@khanacademy/perseus 53.0.0 → 53.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,10 +6,10 @@
6
6
  * It's particularly well suited for embedding our ProcessingJS programs,
7
7
  * but could also be used for embedding viz's hosted elsewhere.
8
8
  */
9
+ import { type PerseusIFrameWidgetOptions, getIFramePublicWidgetOptions } from "@khanacademy/perseus-core";
9
10
  import * as React from "react";
10
11
  import type { WidgetProps, Widget } from "../../types";
11
12
  import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
12
- import type { PerseusIFrameWidgetOptions } from "@khanacademy/perseus-core";
13
13
  import type { PerseusIFrameUserInput, UserInputStatus } from "@khanacademy/perseus-score";
14
14
  type RenderProps = PerseusIFrameWidgetOptions & {
15
15
  status: UserInputStatus;
@@ -39,5 +39,6 @@ declare const _default: {
39
39
  displayName: string;
40
40
  widget: typeof Iframe;
41
41
  hidden: true;
42
+ getPublicWidgetOptions: typeof getIFramePublicWidgetOptions;
42
43
  };
43
44
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { getInteractiveGraphPublicWidgetOptions } from "@khanacademy/perseus-core";
1
2
  import * as React from "react";
2
3
  import { PerseusI18nContext } from "../components/i18n-context";
3
4
  import type { StatefulMafsGraphType } from "./interactive-graphs/stateful-mafs-graph";
@@ -254,11 +255,11 @@ declare class InteractiveGraph extends React.Component<Props, State> {
254
255
  static getAngleEquationString(props: Props): string;
255
256
  static getUserInputFromProps(props: Props): PerseusGraphType;
256
257
  }
257
- export declare function shouldUseMafs(mafsFlags: Record<string, boolean> | undefined | boolean, graph: PerseusGraphType): boolean;
258
258
  declare const _default: {
259
259
  name: string;
260
260
  displayName: string;
261
261
  widget: typeof InteractiveGraph;
262
262
  staticTransform: <T>(value: T) => T;
263
+ getPublicWidgetOptions: typeof getInteractiveGraphPublicWidgetOptions;
263
264
  };
264
265
  export default _default;
@@ -1,3 +1,4 @@
1
- import type { Dispatch, InteractiveGraphElementSuite, PolygonGraphState } from "../types";
2
- export declare function renderPolygonGraph(state: PolygonGraphState, dispatch: Dispatch): InteractiveGraphElementSuite;
1
+ import { type I18nContextType } from "../../../components/i18n-context";
2
+ import type { Dispatch, InteractiveGraphElementSuite, InteractiveGraphProps, PolygonGraphState } from "../types";
3
+ export declare function renderPolygonGraph(state: PolygonGraphState, dispatch: Dispatch, i18n: I18nContextType, markings: InteractiveGraphProps["markings"]): InteractiveGraphElementSuite;
3
4
  export declare const hasFocusVisible: (element: Element | null | undefined) => boolean;
@@ -1 +1 @@
1
- export declare function srFormatNumber(a: number, locale: string): string;
1
+ export declare function srFormatNumber(a: number, locale: string, maximumFractionDigits?: number): string;
@@ -1,7 +1,8 @@
1
+ import { vec } from "mafs";
1
2
  import type { PerseusStrings } from "../../../strings";
2
3
  import type { PairOfPoints } from "../types";
3
4
  import type { Coord } from "@khanacademy/perseus";
4
- import type { Interval, vec } from "mafs";
5
+ import type { Interval } from "mafs";
5
6
  /**
6
7
  * Given a ray and a rectangular box, find the point where the ray intersects
7
8
  * the edge of the box. Assumes the `initialPoint` is inside the box.
@@ -18,4 +19,18 @@ export declare function getCoordQuadrant(coord: Coord): GraphLocations;
18
19
  export declare function getQuadraticVertexString(vertex: Coord, strings: PerseusStrings): string;
19
20
  export declare function getQuadraticPointString(pointNumber: any, coord: Coord, strings: PerseusStrings, locale: string): string;
20
21
  export declare function getQuadraticXIntercepts(a: number, b: number, c: number): number[];
22
+ /**
23
+ * Given a list of points, return the angle made by the point at index i
24
+ * with the points at indices i - 1 and i + 1.
25
+ */
26
+ export declare function getAngleFromPoints(points: Coord[], i: number): number | null;
27
+ export declare function getSideLengthsFromPoints(points: Coord[], i: number, isPolygonOpen?: boolean): Array<{
28
+ pointIndex: number;
29
+ sideLength: number;
30
+ }>;
31
+ /**
32
+ * Determine whether to determine the string with the
33
+ * exact side length or the approximate side length.
34
+ */
35
+ export declare function getPolygonSideString(sideLength: number, pointIndex: number, strings: PerseusStrings, locale: string): string;
21
36
  export {};
@@ -1,12 +1,10 @@
1
1
  import * as React from "react";
2
2
  import type { InteractiveGraphAction } from "./reducer/interactive-graph-action";
3
3
  import type { InteractiveGraphState, InteractiveGraphProps } from "./types";
4
- import type { APIOptions } from "../../types";
5
4
  import type { vec } from "mafs";
6
5
  import "mafs/core.css";
7
6
  import "./mafs-styles.css";
8
7
  export type MafsGraphProps = {
9
- flags?: APIOptions["flags"];
10
8
  box: [number, number];
11
9
  backgroundImage?: InteractiveGraphProps["backgroundImage"];
12
10
  lockedFigures?: InteractiveGraphProps["lockedFigures"];
@@ -1,10 +1,8 @@
1
1
  import * as React from "react";
2
2
  import type { InteractiveGraphProps } from "./types";
3
- import type { APIOptions } from "../../types";
4
3
  import type { PerseusGraphType } from "@khanacademy/perseus-core";
5
4
  import type { PerseusInteractiveGraphUserInput } from "@khanacademy/perseus-score";
6
5
  export type StatefulMafsGraphProps = {
7
- flags?: APIOptions["flags"];
8
6
  box: [number, number];
9
7
  backgroundImage?: InteractiveGraphProps["backgroundImage"];
10
8
  graph: PerseusGraphType;
@@ -1,4 +1,4 @@
1
- import { type PerseusMatrixWidgetAnswers } from "@khanacademy/perseus-core";
1
+ import { getMatrixPublicWidgetOptions, type PerseusMatrixWidgetAnswers } from "@khanacademy/perseus-core";
2
2
  import * as React from "react";
3
3
  import { PerseusI18nContext } from "../../components/i18n-context";
4
4
  import type { FocusPath, Widget, WidgetProps } from "../../types";
@@ -60,5 +60,6 @@ declare const _default: {
60
60
  transform: (arg1: any) => any;
61
61
  staticTransform: (arg1: any) => any;
62
62
  isLintable: true;
63
+ getPublicWidgetOptions: typeof getMatrixPublicWidgetOptions;
63
64
  };
64
65
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { getPlotterPublicWidgetOptions } from "@khanacademy/perseus-core";
1
2
  import * as React from "react";
2
3
  import { PerseusI18nContext } from "../../components/i18n-context";
3
4
  import type { Widget, WidgetProps } from "../../types";
@@ -75,5 +76,6 @@ declare const _default: {
75
76
  hidden: true;
76
77
  widget: typeof Plotter;
77
78
  staticTransform: <T>(value: T) => T;
79
+ getPublicWidgetOptions: typeof getPlotterPublicWidgetOptions;
78
80
  };
79
81
  export default _default;
@@ -1,4 +1,4 @@
1
- import { type PerseusRadioWidgetOptions } from "@khanacademy/perseus-core";
1
+ import { type PerseusRadioWidgetOptions, getRadioPublicWidgetOptions } from "@khanacademy/perseus-core";
2
2
  import Radio from "./radio-component";
3
3
  import type { RenderProps } from "./radio-component";
4
4
  import type { PerseusStrings } from "../../strings";
@@ -12,5 +12,6 @@ declare const _default: {
12
12
  version: import("@khanacademy/perseus-core").Version | undefined;
13
13
  propUpgrades: import("@khanacademy/perseus-core").WidgetOptionsUpgradeMap | undefined;
14
14
  isLintable: true;
15
+ getPublicWidgetOptions: typeof getRadioPublicWidgetOptions;
15
16
  };
16
17
  export default _default;
@@ -1,3 +1,4 @@
1
+ import { getTablePublicWidgetOptions } from "@khanacademy/perseus-core";
1
2
  import * as React from "react";
2
3
  import { PerseusI18nContext } from "../../components/i18n-context";
3
4
  import type { ChangeableProps } from "../../mixins/changeable";
@@ -45,5 +46,6 @@ declare const _default: {
45
46
  transform: (arg1: any) => any;
46
47
  hidden: true;
47
48
  isLintable: true;
49
+ getPublicWidgetOptions: typeof getTablePublicWidgetOptions;
48
50
  };
49
51
  export default _default;
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": "53.0.0",
6
+ "version": "53.1.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -41,39 +41,39 @@
41
41
  "test": "bash -c 'yarn --silent --cwd \"../..\" test ${@:0} $($([[ ${@: -1} = -* ]] || [[ ${@: -1} = bash ]]) && echo $PWD)'"
42
42
  },
43
43
  "dependencies": {
44
- "@khanacademy/kas": "^0.4.13",
45
- "@khanacademy/keypad-context": "^1.0.16",
46
- "@khanacademy/kmath": "^0.3.2",
47
- "@khanacademy/math-input": "^22.2.3",
48
- "@khanacademy/perseus-core": "3.4.0",
49
- "@khanacademy/perseus-linter": "^1.2.15",
50
- "@khanacademy/perseus-score": "^2.1.0",
51
- "@khanacademy/pure-markdown": "^0.3.24",
52
- "@khanacademy/simple-markdown": "^0.13.17",
44
+ "@khanacademy/kas": "^0.4.14",
45
+ "@khanacademy/keypad-context": "^1.0.17",
46
+ "@khanacademy/kmath": "^0.3.3",
47
+ "@khanacademy/math-input": "^22.2.4",
48
+ "@khanacademy/perseus-core": "3.5.0",
49
+ "@khanacademy/perseus-linter": "^1.2.16",
50
+ "@khanacademy/perseus-score": "^2.2.0",
51
+ "@khanacademy/pure-markdown": "^0.3.25",
52
+ "@khanacademy/simple-markdown": "^0.13.18",
53
53
  "@types/classnames": "2.2.0",
54
54
  "@use-gesture/react": "^10.2.27",
55
55
  "mafs": "0.19.0",
56
56
  "uuid": "^10.0.0"
57
57
  },
58
58
  "devDependencies": {
59
- "@khanacademy/wonder-blocks-banner": "4.0.5",
60
- "@khanacademy/wonder-blocks-button": "7.0.5",
61
- "@khanacademy/wonder-blocks-clickable": "5.0.5",
62
- "@khanacademy/wonder-blocks-core": "11.1.0",
63
- "@khanacademy/wonder-blocks-data": "14.0.6",
64
- "@khanacademy/wonder-blocks-dropdown": "7.0.6",
65
- "@khanacademy/wonder-blocks-form": "6.0.6",
66
- "@khanacademy/wonder-blocks-icon": "5.0.5",
67
- "@khanacademy/wonder-blocks-icon-button": "6.0.5",
68
- "@khanacademy/wonder-blocks-layout": "3.0.5",
69
- "@khanacademy/wonder-blocks-link": "7.0.5",
70
- "@khanacademy/wonder-blocks-pill": "3.0.5",
71
- "@khanacademy/wonder-blocks-popover": "5.0.3",
72
- "@khanacademy/wonder-blocks-progress-spinner": "3.0.5",
73
- "@khanacademy/wonder-blocks-switch": "3.0.3",
74
- "@khanacademy/wonder-blocks-tokens": "3.0.1",
75
- "@khanacademy/wonder-blocks-tooltip": "4.0.3",
76
- "@khanacademy/wonder-blocks-typography": "3.0.5",
59
+ "@khanacademy/wonder-blocks-banner": "4.1.1",
60
+ "@khanacademy/wonder-blocks-button": "7.1.1",
61
+ "@khanacademy/wonder-blocks-clickable": "6.1.1",
62
+ "@khanacademy/wonder-blocks-core": "12.1.1",
63
+ "@khanacademy/wonder-blocks-data": "14.1.1",
64
+ "@khanacademy/wonder-blocks-dropdown": "9.1.1",
65
+ "@khanacademy/wonder-blocks-form": "7.1.1",
66
+ "@khanacademy/wonder-blocks-icon": "5.1.1",
67
+ "@khanacademy/wonder-blocks-icon-button": "6.1.1",
68
+ "@khanacademy/wonder-blocks-layout": "3.1.1",
69
+ "@khanacademy/wonder-blocks-link": "7.1.1",
70
+ "@khanacademy/wonder-blocks-pill": "3.1.1",
71
+ "@khanacademy/wonder-blocks-popover": "5.1.1",
72
+ "@khanacademy/wonder-blocks-progress-spinner": "3.1.1",
73
+ "@khanacademy/wonder-blocks-switch": "3.1.1",
74
+ "@khanacademy/wonder-blocks-tokens": "4.2.1",
75
+ "@khanacademy/wonder-blocks-tooltip": "4.1.1",
76
+ "@khanacademy/wonder-blocks-typography": "3.1.1",
77
77
  "@khanacademy/wonder-stuff-core": "1.5.4",
78
78
  "@phosphor-icons/core": "^2.0.2",
79
79
  "@popperjs/core": "^2.10.2",
@@ -91,24 +91,24 @@
91
91
  "underscore": "^1.4.4"
92
92
  },
93
93
  "peerDependencies": {
94
- "@khanacademy/wonder-blocks-banner": "4.0.5",
95
- "@khanacademy/wonder-blocks-button": "7.0.5",
96
- "@khanacademy/wonder-blocks-clickable": "5.0.5",
97
- "@khanacademy/wonder-blocks-core": "11.1.0",
98
- "@khanacademy/wonder-blocks-data": "14.0.6",
99
- "@khanacademy/wonder-blocks-dropdown": "7.0.6",
100
- "@khanacademy/wonder-blocks-form": "6.0.6",
101
- "@khanacademy/wonder-blocks-icon": "5.0.5",
102
- "@khanacademy/wonder-blocks-icon-button": "6.0.5",
103
- "@khanacademy/wonder-blocks-layout": "3.0.5",
104
- "@khanacademy/wonder-blocks-link": "7.0.5",
105
- "@khanacademy/wonder-blocks-pill": "3.0.5",
106
- "@khanacademy/wonder-blocks-popover": "5.0.3",
107
- "@khanacademy/wonder-blocks-progress-spinner": "3.0.5",
108
- "@khanacademy/wonder-blocks-switch": "3.0.3",
109
- "@khanacademy/wonder-blocks-tokens": "3.0.1",
110
- "@khanacademy/wonder-blocks-tooltip": "4.0.3",
111
- "@khanacademy/wonder-blocks-typography": "3.0.5",
94
+ "@khanacademy/wonder-blocks-banner": "4.1.1",
95
+ "@khanacademy/wonder-blocks-button": "7.1.1",
96
+ "@khanacademy/wonder-blocks-clickable": "6.1.1",
97
+ "@khanacademy/wonder-blocks-core": "12.1.1",
98
+ "@khanacademy/wonder-blocks-data": "14.1.1",
99
+ "@khanacademy/wonder-blocks-dropdown": "9.1.1",
100
+ "@khanacademy/wonder-blocks-form": "7.1.1",
101
+ "@khanacademy/wonder-blocks-icon": "5.1.1",
102
+ "@khanacademy/wonder-blocks-icon-button": "6.1.1",
103
+ "@khanacademy/wonder-blocks-layout": "3.1.1",
104
+ "@khanacademy/wonder-blocks-link": "7.1.1",
105
+ "@khanacademy/wonder-blocks-pill": "3.1.1",
106
+ "@khanacademy/wonder-blocks-popover": "5.1.1",
107
+ "@khanacademy/wonder-blocks-progress-spinner": "3.1.1",
108
+ "@khanacademy/wonder-blocks-switch": "3.1.1",
109
+ "@khanacademy/wonder-blocks-tokens": "4.2.1",
110
+ "@khanacademy/wonder-blocks-tooltip": "4.1.1",
111
+ "@khanacademy/wonder-blocks-typography": "3.1.1",
112
112
  "@khanacademy/wonder-stuff-core": "1.5.4",
113
113
  "@phosphor-icons/core": "^2.0.2",
114
114
  "@popperjs/core": "^2.10.2",
@@ -1,4 +0,0 @@
1
- export declare const mafsSupportedGraphTypes: readonly ["angle", "segment", "linear", "linear-system", "ray", "polygon", "point", "circle", "quadratic", "sinusoid", "unlimited-point", "unlimited-polygon"];
2
- type MafsSupportedGraphType = (typeof mafsSupportedGraphTypes)[number];
3
- export declare const trueForAllMafsSupportedGraphTypes: Record<MafsSupportedGraphType, true>;
4
- export {};