@khanacademy/perseus 49.2.2 → 50.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/article-renderer.d.ts +2 -6
- package/dist/components/graph.d.ts +1 -1
- package/dist/components/graphie.d.ts +1 -1
- package/dist/components/highlighting/ui/highlight-set-renderer.d.ts +1 -4
- package/dist/components/highlighting/ui/highlighting-ui.d.ts +1 -4
- package/dist/components/i18n-context.d.ts +1 -1
- package/dist/components/input-with-examples.d.ts +1 -4
- package/dist/components/math-input.d.ts +2 -6
- package/dist/components/number-input.d.ts +2 -5
- package/dist/components/svg-image.d.ts +1 -1
- package/dist/es/index.js +529 -1346
- package/dist/es/index.js.map +1 -1
- package/dist/es/strings.js +19 -1
- package/dist/es/strings.js.map +1 -1
- package/dist/hint-renderer.d.ts +1 -4
- package/dist/hints-renderer.d.ts +2 -5
- package/dist/index.d.ts +5 -7
- package/dist/index.js +588 -1407
- package/dist/index.js.map +1 -1
- package/dist/renderer-util.d.ts +1 -1
- package/dist/renderer.d.ts +2 -5
- package/dist/server-item-renderer.d.ts +3 -7
- package/dist/strings.d.ts +8 -0
- package/dist/strings.js +19 -0
- package/dist/strings.js.map +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/util/extract-perseus-data.d.ts +1 -1
- package/dist/util/parse-perseus-json/index.d.ts +33 -4
- package/dist/util/parse-perseus-json/perseus-parsers/categorizer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/cs-program-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/definition-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/dropdown-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/explanation-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/expression-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/graded-group-set-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/graded-group-widget.d.ts +3 -3
- package/dist/util/parse-perseus-json/perseus-parsers/grapher-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/group-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/hint.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/iframe-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/image-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/images-map.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/input-number-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/interaction-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/interactive-graph-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/label-image-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/matcher-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/matrix-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/measurer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/molecule-renderer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/number-line-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/numeric-input-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/orderer-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/passage-ref-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/passage-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-article.d.ts +3 -0
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-image-background.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-item.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/perseus-renderer.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/phet-simulation-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/plotter-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/python-program-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/radio-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/sorter-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/table-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/versioned-widget-options.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/video-widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/widget.d.ts +1 -1
- package/dist/util/parse-perseus-json/perseus-parsers/widgets-map.d.ts +1 -1
- package/dist/util/test-utils.d.ts +1 -1
- package/dist/util.d.ts +1 -1
- package/dist/validation.types.d.ts +9 -3
- package/dist/widget-ai-utils/grapher/grapher-ai-utils.d.ts +1 -1
- package/dist/widget-ai-utils/interactive-graph/interactive-graph-ai-utils.d.ts +1 -1
- package/dist/widget-ai-utils/mock-widget/prompt-utils.d.ts +13 -0
- package/dist/widget-ai-utils/prompt-types.d.ts +2 -1
- package/dist/widget-container.d.ts +1 -1
- package/dist/widget-type-utils.d.ts +1 -1
- package/dist/widgets/categorizer/categorizer.d.ts +2 -5
- package/dist/widgets/cs-program/cs-program.d.ts +1 -1
- package/dist/widgets/definition/definition.d.ts +2 -5
- package/dist/widgets/deprecated-standin/deprecated-standin.d.ts +1 -4
- package/dist/widgets/dropdown/dropdown.d.ts +2 -5
- package/dist/widgets/explanation/explanation.d.ts +2 -5
- package/dist/widgets/expression/expression.d.ts +5 -8
- package/dist/widgets/graded-group/graded-group-answer-bar.d.ts +1 -4
- package/dist/widgets/graded-group/graded-group.d.ts +2 -5
- package/dist/widgets/graded-group-set/graded-group-set.d.ts +1 -1
- package/dist/widgets/grapher/grapher.d.ts +2 -2
- package/dist/widgets/group/group.d.ts +2 -5
- package/dist/widgets/iframe/iframe.d.ts +1 -1
- package/dist/widgets/image/image.d.ts +2 -5
- package/dist/widgets/input-number/input-number.d.ts +2 -6
- package/dist/widgets/interaction/interaction.d.ts +1 -1
- package/dist/widgets/interactive-graph.d.ts +4 -6
- package/dist/widgets/interactive-graphs/backgrounds/grid.d.ts +2 -2
- package/dist/widgets/interactive-graphs/backgrounds/legacy-grid.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graph-locked-labels-layer.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graph-locked-layer.d.ts +1 -1
- package/dist/widgets/interactive-graphs/graphs/circle.d.ts +2 -0
- package/dist/widgets/interactive-graphs/graphs/components/angle-indicators.d.ts +1 -1
- package/dist/widgets/interactive-graphs/interactive-graph-question-builder.d.ts +2 -2
- package/dist/widgets/interactive-graphs/locked-figures/locked-ellipse.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-function.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-label.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-line.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-point.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-polygon.d.ts +1 -1
- package/dist/widgets/interactive-graphs/locked-figures/locked-vector.d.ts +1 -1
- package/dist/widgets/interactive-graphs/mafs-state-to-interactive-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/initialize-graph-state.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/interactive-graph-state.d.ts +1 -1
- package/dist/widgets/interactive-graphs/reducer/use-graph-config.d.ts +2 -1
- package/dist/widgets/interactive-graphs/stateful-mafs-graph.d.ts +1 -1
- package/dist/widgets/interactive-graphs/types.d.ts +1 -1
- package/dist/widgets/interactive-graphs/utils.d.ts +1 -1
- package/dist/widgets/label-image/label-image.d.ts +2 -5
- package/dist/widgets/label-image/marker.d.ts +1 -4
- package/dist/widgets/matcher/matcher.d.ts +2 -5
- package/dist/widgets/matrix/matrix.d.ts +2 -5
- package/dist/widgets/measurer/measurer.d.ts +1 -1
- package/dist/widgets/mock-widgets/index.d.ts +2 -0
- package/dist/widgets/mock-widgets/mock-asset-loading-widget.d.ts +17 -0
- package/dist/widgets/mock-widgets/mock-widget.d.ts +47 -0
- package/dist/widgets/mock-widgets/score-mock-widget.d.ts +5 -0
- package/dist/widgets/molecule/molecule.d.ts +1 -1
- package/dist/widgets/number-line/number-line.d.ts +1 -4
- package/dist/widgets/numeric-input/numeric-input.d.ts +2 -6
- package/dist/widgets/orderer/orderer.d.ts +1 -1
- package/dist/widgets/passage/passage.d.ts +2 -5
- package/dist/widgets/passage-ref/passage-ref.d.ts +2 -5
- package/dist/widgets/passage-ref-target/passage-ref-target.d.ts +2 -5
- package/dist/widgets/phet-simulation/phet-simulation.d.ts +2 -5
- package/dist/widgets/plotter/plotter.d.ts +2 -5
- package/dist/widgets/radio/base-radio.d.ts +1 -1
- package/dist/widgets/radio/radio-component.d.ts +2 -5
- package/dist/widgets/radio/radio.d.ts +1 -1
- package/dist/widgets/sorter/sorter.d.ts +1 -1
- package/dist/widgets/table/table.d.ts +2 -5
- package/dist/widgets/video/video.d.ts +2 -5
- package/dist/widgets.d.ts +1 -1
- package/package.json +44 -43
- package/dist/interactive2/objective_.d.ts +0 -34
- package/dist/perseus-types.d.ts +0 -980
- package/dist/util/answer-types.d.ts +0 -69
- package/dist/util/math.d.ts +0 -29
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import type { PerseusStrings } from "../strings";
|
|
2
|
-
type Guess = any;
|
|
3
|
-
type Predicate = (guess: number, maxError: number) => boolean;
|
|
4
|
-
export type Score = {
|
|
5
|
-
empty: boolean;
|
|
6
|
-
correct: boolean;
|
|
7
|
-
message: string | null | undefined;
|
|
8
|
-
suppressAlmostThere?: boolean | null | undefined;
|
|
9
|
-
guess: Guess;
|
|
10
|
-
ungraded?: boolean;
|
|
11
|
-
};
|
|
12
|
-
/**
|
|
13
|
-
* Answer types
|
|
14
|
-
*
|
|
15
|
-
* Utility for creating answerable questions displayed in exercises
|
|
16
|
-
*
|
|
17
|
-
* Different answer types produce different kinds of input displays, and do
|
|
18
|
-
* different kinds of checking on the solutions.
|
|
19
|
-
*
|
|
20
|
-
* Each of the objects contain two functions, setup and createValidator.
|
|
21
|
-
*
|
|
22
|
-
* The setup function takes a solutionarea and solution, and performs setup
|
|
23
|
-
* within the solutionarea, and then returns an object which contains:
|
|
24
|
-
*
|
|
25
|
-
* answer: a function which, when called, will retrieve the current answer from
|
|
26
|
-
* the solutionarea, which can then be validated using the validator
|
|
27
|
-
* function
|
|
28
|
-
* validator: a function returned from the createValidator function (defined
|
|
29
|
-
* below)
|
|
30
|
-
* solution: the correct answer to the problem
|
|
31
|
-
* showGuess: a function which, when given a guess, shows the guess within the
|
|
32
|
-
* provided solutionarea
|
|
33
|
-
* showGuessCustom: a function which displays parts of a guess that are not
|
|
34
|
-
* within the solutionarea; currently only used for custom
|
|
35
|
-
* answers
|
|
36
|
-
*
|
|
37
|
-
* The createValidator function only takes a solution, and it returns a
|
|
38
|
-
* function which can be used to validate an answer.
|
|
39
|
-
*
|
|
40
|
-
* The resulting validator function returns:
|
|
41
|
-
* - true: if the answer is fully correct
|
|
42
|
-
* - false: if the answer is incorrect
|
|
43
|
-
* - "" (the empty string): if no answer has been provided (e.g. the answer box
|
|
44
|
-
* is left unfilled)
|
|
45
|
-
* - a string: if there is some slight error
|
|
46
|
-
*
|
|
47
|
-
* In most cases, setup and createValidator don't really need the solution DOM
|
|
48
|
-
* element so we have setupFunctional and createValidatorFunctional for them
|
|
49
|
-
* which take only $solution.text() and $solution.data(). This makes it easier
|
|
50
|
-
* to reuse specific answer types.
|
|
51
|
-
*
|
|
52
|
-
* TODO(alpert): Think of a less-absurd name for createValidatorFunctional.
|
|
53
|
-
*
|
|
54
|
-
*/
|
|
55
|
-
declare const KhanAnswerTypes: {
|
|
56
|
-
readonly predicate: {
|
|
57
|
-
readonly defaultForms: "integer, proper, improper, mixed, decimal";
|
|
58
|
-
readonly createValidatorFunctional: (predicate: Predicate, options: any, strings: PerseusStrings) => (arg1: Guess) => Score;
|
|
59
|
-
};
|
|
60
|
-
readonly number: {
|
|
61
|
-
readonly convertToPredicate: (correctAnswer: string, options: any) => [predicate: Predicate, options: any];
|
|
62
|
-
readonly createValidatorFunctional: (correctAnswer: string, options: any, strings: PerseusStrings) => (arg1: Guess) => Score;
|
|
63
|
-
};
|
|
64
|
-
readonly expression: {
|
|
65
|
-
readonly parseSolution: (solutionString: string, options: any) => any;
|
|
66
|
-
readonly createValidatorFunctional: (solution: any, options: any, strings: PerseusStrings) => (arg1: Guess) => Score;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
export default KhanAnswerTypes;
|
package/dist/util/math.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import type { MathFormat } from "../perseus-types";
|
|
2
|
-
declare const KhanMath: {
|
|
3
|
-
readonly cleanMath: (expr: string) => string;
|
|
4
|
-
readonly bound: (num: number) => number;
|
|
5
|
-
readonly factorial: (x: number) => number;
|
|
6
|
-
readonly getGCD: (a: number, b: number) => number;
|
|
7
|
-
readonly getLCM: (a: number, b: number) => number;
|
|
8
|
-
readonly primes: readonly [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97];
|
|
9
|
-
readonly isPrime: (n: number) => boolean;
|
|
10
|
-
readonly getPrimeFactorization: (number: number) => ReadonlyArray<number>;
|
|
11
|
-
readonly roundToNearest: (increment: number, num: number) => number;
|
|
12
|
-
readonly roundTo: (precision: number, num: number) => number;
|
|
13
|
-
/**
|
|
14
|
-
* Return a string of num rounded to a fixed precision decimal places,
|
|
15
|
-
* with an approx symbol if num had to be rounded, and trailing 0s
|
|
16
|
-
*/
|
|
17
|
-
readonly toFixedApprox: (num: number, precision: number) => string;
|
|
18
|
-
/**
|
|
19
|
-
* Return a string of num rounded to precision decimal places, with an
|
|
20
|
-
* approx symbol if num had to be rounded, but no trailing 0s if it was
|
|
21
|
-
* not rounded.
|
|
22
|
-
*/
|
|
23
|
-
readonly roundToApprox: (num: number, precision: number) => string;
|
|
24
|
-
readonly toFraction: (decimal: number, tolerance?: number) => [number, number];
|
|
25
|
-
readonly getNumericFormat: (text: string) => MathFormat | null | undefined;
|
|
26
|
-
readonly toNumericString: (number: number, format?: MathFormat) => string;
|
|
27
|
-
};
|
|
28
|
-
export declare function sum(array: number[]): number;
|
|
29
|
-
export default KhanMath;
|