@khanacademy/perseus 78.4.1 → 79.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/types.d.ts CHANGED
@@ -84,7 +84,6 @@ export type ChangeHandler = (arg1: {
84
84
  markers?: Array<LabelImageMarkerPublicData | PerseusLabelImageMarker>;
85
85
  }, callback?: () => void, silent?: boolean) => unknown;
86
86
  export type ImageUploader = (file: File, callback: (url: string) => unknown) => unknown;
87
- export type Path = ReadonlyArray<string>;
88
87
  type TrackInteractionArgs = {
89
88
  type: string;
90
89
  id: string;
@@ -9,26 +9,20 @@ import type React from "react";
9
9
  */
10
10
  export type InputNumberPromptJSON = {
11
11
  type: "input-number";
12
- /** The configuration of the widget, set by the content creator. */
13
- options: {
14
- /**
15
- * Indicates how answers in unsimplified form are scored.
16
- *
17
- * - "optional" means the answer can be unsimplified.
18
- * - "required" means an unsimplified answer is considered invalid,
19
- * and the learner can try again without penalty.
20
- * - "enforced" means unsimplified answers are counted as incorrect.
21
- */
22
- simplify: string;
23
- /** The expected numeric form, e.g. "rational", "decimal" */
24
- answerType: string;
25
- };
12
+ /**
13
+ * Accessible label for the input field, set by the content creator.
14
+ * Shown to learners using screen readers to describe what value should
15
+ * be entered.
16
+ */
17
+ label: string;
26
18
  /**
27
19
  * The current state of the widget user interface. Usually represents a
28
20
  * learner's attempt to answer a question.
29
21
  */
30
22
  userInput: {
31
- /** The text input by the user */
23
+ /**
24
+ * The text currently entered in the input field by the learner.
25
+ */
32
26
  value: string;
33
27
  };
34
28
  };
@@ -1,32 +1,18 @@
1
- import * as React from "react";
2
- import type { PerseusDependenciesV2, WidgetProps } from "../../types";
3
- import type { PerseusInputNumberWidgetOptions, PerseusInputNumberUserInput } from "@khanacademy/perseus-core";
4
- type ExternalProps = WidgetProps<PerseusInputNumberWidgetOptions, PerseusInputNumberUserInput>;
5
- type Props = ExternalProps & {
6
- apiOptions: NonNullable<ExternalProps["apiOptions"]>;
7
- linterContext: NonNullable<ExternalProps["linterContext"]>;
8
- rightAlign: NonNullable<ExternalProps["rightAlign"]>;
9
- size: NonNullable<ExternalProps["size"]>;
10
- answerType: NonNullable<ExternalProps["answerType"]>;
11
- dependencies: PerseusDependenciesV2;
12
- };
13
- declare function getOneCorrectAnswerFromRubric(rubric: any): string | undefined;
1
+ import type { PerseusInputNumberUserInput } from "@khanacademy/perseus-core";
14
2
  /**
15
3
  * @deprecated and likely a very broken API
16
4
  * [LEMS-3185] do not trust serializedState
17
5
  */
18
6
  declare function getUserInputFromSerializedState(serializedState: any): PerseusInputNumberUserInput;
19
- declare function getStartUserInput(): PerseusInputNumberUserInput;
20
- declare function getCorrectUserInput(options: PerseusInputNumberWidgetOptions): PerseusInputNumberUserInput;
21
7
  declare const _default: {
22
8
  name: string;
23
9
  displayName: string;
24
10
  hidden: true;
25
- widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
11
+ widget: typeof import("../numeric-input/numeric-input.class").NumericInput;
26
12
  isLintable: true;
27
- getOneCorrectAnswerFromRubric: typeof getOneCorrectAnswerFromRubric;
28
- getStartUserInput: typeof getStartUserInput;
29
- getCorrectUserInput: typeof getCorrectUserInput;
13
+ getOneCorrectAnswerFromRubric: (rubric: import("@khanacademy/perseus-core").PerseusNumericInputRubric) => string | null | undefined;
14
+ getStartUserInput: () => import("@khanacademy/perseus-core").PerseusNumericInputUserInput;
15
+ getCorrectUserInput: (options: import("@khanacademy/perseus-core").PerseusNumericInputWidgetOptions) => import("@khanacademy/perseus-core").PerseusNumericInputUserInput;
30
16
  getUserInputFromSerializedState: typeof getUserInputFromSerializedState;
31
17
  };
32
18
  export default _default;
@@ -10,5 +10,19 @@ interface GridProps {
10
10
  width: number;
11
11
  height: number;
12
12
  }
13
+ /**
14
+ * Renders the Cartesian grid lines (not the axis lines). This is intended to
15
+ * be clipped to the graph's exact bounds so grid lines never spill past the
16
+ * edge. The axis lines are rendered separately by `<Axes>`.
17
+ */
13
18
  export declare const Grid: (props: GridProps) => React.JSX.Element | null;
19
+ /**
20
+ * Renders the Cartesian axis lines (not the grid lines). When an axis sits on
21
+ * the graph's edge, the outer half of its stroke would be clipped away by the
22
+ * graph bounds, making the axis look half its intended width. To avoid that,
23
+ * this is clipped to the graph bounds expanded outward (by half the stroke
24
+ * width) only on the sides where an axis sits on the edge — see how this is
25
+ * clipped in mafs-graph.tsx.
26
+ */
27
+ export declare const Axes: (props: GridProps) => React.JSX.Element | null;
14
28
  export {};
@@ -1,4 +1,12 @@
1
1
  import * as React from "react";
2
- export declare function ClipToGraphBounds({ children }: {
2
+ type Insets = {
3
+ top?: number;
4
+ right?: number;
5
+ bottom?: number;
6
+ left?: number;
7
+ };
8
+ export declare function ClipToGraphBounds({ children, expand, }: {
3
9
  children: React.ReactNode;
10
+ expand?: Insets;
4
11
  }): React.JSX.Element;
12
+ export {};
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Core Perseus API (includes renderers and widgets)",
4
4
  "author": "Khan Academy",
5
5
  "license": "MIT",
6
- "version": "78.4.1",
6
+ "version": "79.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -43,12 +43,12 @@
43
43
  "tiny-invariant": "1.3.1",
44
44
  "uuid": "^10.0.0",
45
45
  "@khanacademy/kas": "2.2.3",
46
- "@khanacademy/keypad-context": "3.2.67",
47
- "@khanacademy/kmath": "2.4.26",
48
- "@khanacademy/math-input": "26.4.40",
49
- "@khanacademy/perseus-core": "29.0.0",
50
- "@khanacademy/perseus-linter": "5.1.7",
51
- "@khanacademy/perseus-score": "8.11.10",
46
+ "@khanacademy/keypad-context": "3.2.68",
47
+ "@khanacademy/kmath": "2.4.27",
48
+ "@khanacademy/math-input": "26.4.41",
49
+ "@khanacademy/perseus-core": "30.0.0",
50
+ "@khanacademy/perseus-linter": "5.1.8",
51
+ "@khanacademy/perseus-score": "8.12.0",
52
52
  "@khanacademy/perseus-utils": "2.1.5",
53
53
  "@khanacademy/pure-markdown": "2.3.0",
54
54
  "@khanacademy/simple-markdown": "2.2.3"