@khanacademy/perseus 85.2.0 → 86.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.
@@ -4,8 +4,6 @@ declare const Interactive2: {
4
4
  readonly addMovablePoint: (graphie: any, options: any) => any;
5
5
  readonly MovableLine: (graphie: any, movable: any, options: any) => void;
6
6
  readonly addMovableLine: (graphie: any, options: any) => any;
7
- readonly MovablePolygon: (graphie: any, movable: any, options: any) => void;
8
- readonly addMovablePolygon: (graphie: any, options: any) => any;
9
7
  readonly addMovablePointV2: (widget: any, extraProps: any) => any;
10
8
  };
11
9
  export default Interactive2;
@@ -129,7 +129,7 @@ declare const _default: React.ForwardRefExoticComponent<Omit<Pick<SharedRenderer
129
129
  isMobile?: boolean;
130
130
  isMobileApp?: boolean;
131
131
  hintProgressColor?: string;
132
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras", boolean>;
132
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
133
133
  }> | undefined;
134
134
  linterContext?: PerseusLinter.LinterContextProps | undefined;
135
135
  onRendered?: ((isRendered: boolean) => void) | undefined;
@@ -9,8 +9,9 @@ type Props = {
9
9
  * `json`, but it is the article. Trust me.
10
10
  */
11
11
  json: PerseusArticle;
12
+ seed?: number;
12
13
  apiOptions?: APIOptions;
13
14
  linterContext?: LinterContextProps;
14
15
  };
15
- export declare const ArticleRendererWithDebugUI: ({ title, json, apiOptions, linterContext, }: Props) => React.ReactElement;
16
+ export declare const ArticleRendererWithDebugUI: ({ title, json, seed, apiOptions, linterContext, }: Props) => React.ReactElement;
16
17
  export {};
@@ -8,6 +8,7 @@ export declare function getFeatureFlags(overrides?: Partial<typeof DEFAULT_FEATU
8
8
  "perseus-renderer-upgrade": boolean;
9
9
  "desmos-calculator": boolean;
10
10
  "article-extras": boolean;
11
+ "dnd-widget-fitb": boolean;
11
12
  "perseus-test-flag-1": boolean;
12
13
  "perseus-test-flag-2": boolean;
13
14
  };
@@ -35,7 +35,7 @@ export declare const useItemRenderer: (item: PerseusItem, apiOptions?: APIOption
35
35
  }>) => void;
36
36
  isMobileApp?: boolean;
37
37
  hintProgressColor?: string;
38
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras", boolean>;
38
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
39
39
  };
40
40
  toggleMobile: (isMobile: boolean) => void;
41
41
  toggleRtl: (isRtl: boolean) => void;
@@ -1,6 +1,17 @@
1
+ /**
2
+ * Color constants we use throughout Perseus (originally on KhanUtil).
3
+ *
4
+ * DEPRECATED: This palette is retained only for the interaction editor's
5
+ * color swatches and the measurer widget's graphie rendering. Do not add
6
+ * new uses — use Wonder Blocks semanticColor tokens instead.
7
+ *
8
+ * Note that if the color palette changes substantially, it may also need to be
9
+ * updated in khan-exercises and cherry-picked into graphie-to-png's
10
+ * khan-exercises submodule, as graphie-to-png still relies on the palette
11
+ * provided on KhanUtil.
12
+ */
1
13
  declare const KhanColors: {
2
14
  readonly BLUE: string;
3
- readonly ORANGE: "#FFA500";
4
15
  readonly PINK: "#FF00AF";
5
16
  readonly GREEN: string;
6
17
  readonly PURPLE: "#9D38BD";
@@ -13,67 +24,8 @@ declare const KhanColors: {
13
24
  readonly LIGHT_GREEN: "#9BEDCE";
14
25
  readonly LIGHT_PURPLE: "#DA9BED";
15
26
  readonly LIGHT_RED: "#ED9AAC";
16
- readonly LIGHT_GRAY: "#ED9B9B";
17
- readonly LIGHT_BLACK: "#ED9B9B";
18
- readonly GRAY10: "#D6D6D6";
19
- readonly GRAY20: "#CDCDCD";
20
- readonly GRAY30: "#B3B3B3";
21
- readonly GRAY40: "#9A9A9A";
22
- readonly GRAY50: "#808080";
23
- readonly GRAY60: "#666666";
24
- readonly GRAY70: "#4D4D4D";
25
- readonly GRAY80: "#333333";
26
- readonly GRAY90: "#1A1A1A";
27
- readonly BLUE_A: "#CCFAFF";
28
- readonly BLUE_B: "#80F6FF";
29
- readonly BLUE_C: "#63D9EA";
30
- readonly BLUE_D: "#11ACCD";
31
- readonly BLUE_E: "#0C7F99";
32
- readonly TEAL_A: "#94FFF5";
33
- readonly TEAL_B: "#26EDD5";
34
- readonly TEAL_C: "#01D1C1";
35
- readonly TEAL_D: "#01A995";
36
- readonly TEAL_E: "#208170";
37
- readonly GREEN_A: "#B6FFB0";
38
- readonly GREEN_B: "#8AF281";
39
- readonly GREEN_C: "#74CF70";
40
- readonly GREEN_D: "#1FAB54";
41
- readonly GREEN_E: "#0D923F";
42
- readonly GOLD_A: "#FFD0A9";
43
- readonly GOLD_B: "#FFBB71";
44
- readonly GOLD_C: "#FF9C39";
45
- readonly GOLD_D: "#E07D10";
46
- readonly GOLD_E: "#A75A05";
47
- readonly RED_A: "#FCA9A9";
48
- readonly RED_B: "#FF8482";
49
- readonly RED_C: "#F9685D";
50
- readonly RED_D: "#E84D39";
51
- readonly RED_E: "#BC2612";
52
- readonly MAROON_A: "#FFBDE0";
53
- readonly MAROON_B: "#FF92C6";
54
- readonly MAROON_C: "#ED5FA6";
55
- readonly MAROON_D: "#CA337C";
56
- readonly MAROON_E: "#9E034E";
57
- readonly PURPLE_A: "#DDD7FF";
58
- readonly PURPLE_B: "#C6B9FC";
59
- readonly PURPLE_C: "#AA87FF";
60
- readonly PURPLE_D: "#7854AB";
61
- readonly PURPLE_E: "#543B78";
62
- readonly MINT_A: "#F5F9E8";
63
- readonly MINT_B: "#EDF2DF";
64
- readonly MINT_C: "#E0E5CC";
65
- readonly GRAY_A: "#F6F7F7";
66
- readonly GRAY_B: "#F0F1F2";
67
27
  readonly GRAY_C: "#E3E5E6";
68
- readonly GRAY_D: "#D6D8DA";
69
- readonly GRAY_E: "#BABEC2";
70
- readonly GRAY_F: "#888D93";
71
28
  readonly GRAY_G: "#626569";
72
- readonly GRAY_H: "#3B3E40";
73
- readonly GRAY_I: "#21242C";
74
- readonly KA_BLUE: "#314453";
75
- readonly KA_GREEN: "#71B307";
76
- readonly _BACKGROUND: "#FDFDFD";
77
29
  readonly INTERACTING: string;
78
30
  readonly INTERACTIVE: string;
79
31
  readonly DYNAMIC: string;
@@ -87,4 +39,24 @@ declare const KhanColors: {
87
39
  * @returns a string representing the background color, or a CSS variable for the default background color.
88
40
  */
89
41
  export declare const getBackgroundColor: (elementToInspect: HTMLElement) => string;
42
+ interface RGB {
43
+ r: number;
44
+ g: number;
45
+ b: number;
46
+ }
47
+ /**
48
+ * Resolves a CSS color into its red, green, and blue components.
49
+ * @param color - can be hex, a name like `"black"`, or e.g. `rgb(0, 0, 0)`.
50
+ */
51
+ export declare function resolveColor(color: string): RGB;
52
+ export declare function toClosestMathColor(target: string): string;
53
+ export declare function parseHexColor(hex: string): RGB;
54
+ /**
55
+ * Uses a variant of the "redmean" algorithm to determine how similar two
56
+ * colors are. In contrast to redmean, we skip taking the square root of the
57
+ * result, which means this function gives you a relative difference, not an
58
+ * absolute difference.
59
+ * See: https://en.wikipedia.org/wiki/Color_difference
60
+ */
61
+ export declare function diffColors(a: RGB, b: RGB): number;
90
62
  export default KhanColors;
@@ -2,7 +2,6 @@ import type { MouseHandler } from "./interactive";
2
2
  import type { Interval } from "./interval";
3
3
  import type { Coord } from "../interactive2/types";
4
4
  import type { GraphieLabelElement } from "../types";
5
- export declare function polar(r: number | Coord, th: number): Coord;
6
5
  interface RaphaelElement {
7
6
  type: string;
8
7
  attrs: Record<string, any>;
@@ -29,7 +29,6 @@ export declare class GradedGroup extends React.Component<Props, State> implement
29
29
  rendererRef: React.RefObject<Renderer>;
30
30
  hintRendererRef: React.RefObject<Renderer>;
31
31
  componentDidMount(): void;
32
- shouldComponentUpdate(nextProps: Props, nextState: State): boolean;
33
32
  _handleUserInput(_userInput: UserInputMap, widgetsEmpty: boolean): void;
34
33
  _checkAnswer: () => void;
35
34
  getInputPaths: () => ReadonlyArray<FocusPath>;
@@ -45,7 +45,7 @@ declare const _default: {
45
45
  isMobile?: boolean;
46
46
  isMobileApp?: boolean;
47
47
  hintProgressColor?: string;
48
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras", boolean>;
48
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
49
49
  }> & {
50
50
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
51
51
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
@@ -54,7 +54,7 @@ declare class InteractiveGraph extends React.Component<Props> {
54
54
  isMobile?: boolean;
55
55
  isMobileApp?: boolean;
56
56
  hintProgressColor?: string;
57
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras", boolean>;
57
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
58
58
  }> & {
59
59
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
60
60
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
@@ -66,7 +66,7 @@ declare class MockWidgetComponent extends React.Component<Props> implements Widg
66
66
  isMobile?: boolean;
67
67
  isMobileApp?: boolean;
68
68
  hintProgressColor?: string;
69
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras", boolean>;
69
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
70
70
  }> & {
71
71
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
72
72
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
@@ -45,7 +45,7 @@ declare const _default: {
45
45
  isMobile?: boolean;
46
46
  isMobileApp?: boolean;
47
47
  hintProgressColor?: string;
48
- flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras", boolean>;
48
+ flags?: Record<"perseus-renderer-upgrade" | "desmos-calculator" | "article-extras" | "dnd-widget-fitb", boolean>;
49
49
  }> & {
50
50
  baseElements: NonNullable<import("../..").APIOptions["baseElements"]>;
51
51
  isArticle: NonNullable<import("../..").APIOptions["isArticle"]>;
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": "85.2.0",
6
+ "version": "86.0.0",
7
7
  "publishConfig": {
8
8
  "access": "public"
9
9
  },
@@ -45,12 +45,12 @@
45
45
  "uuid": "^10.0.0",
46
46
  "jquery": "^2.1.1",
47
47
  "@khanacademy/kas": "2.2.6",
48
- "@khanacademy/keypad-context": "3.2.88",
49
- "@khanacademy/kmath": "2.4.47",
50
- "@khanacademy/math-input": "27.0.10",
51
- "@khanacademy/perseus-core": "38.1.0",
52
- "@khanacademy/perseus-linter": "5.2.1",
53
- "@khanacademy/perseus-score": "8.12.20",
48
+ "@khanacademy/keypad-context": "3.2.89",
49
+ "@khanacademy/kmath": "2.4.48",
50
+ "@khanacademy/math-input": "27.0.11",
51
+ "@khanacademy/perseus-core": "38.1.1",
52
+ "@khanacademy/perseus-linter": "5.2.2",
53
+ "@khanacademy/perseus-score": "8.12.21",
54
54
  "@khanacademy/perseus-utils": "2.1.5",
55
55
  "@khanacademy/pure-markdown": "2.3.2",
56
56
  "@khanacademy/simple-markdown": "3.0.1"
@@ -62,7 +62,7 @@
62
62
  "@khanacademy/wonder-blocks-clickable": "8.2.9",
63
63
  "@khanacademy/wonder-blocks-core": "12.4.4",
64
64
  "@khanacademy/wonder-blocks-data": "15.0.3",
65
- "@khanacademy/wonder-blocks-dropdown": "10.11.8",
65
+ "@khanacademy/wonder-blocks-dropdown": "10.12.0",
66
66
  "@khanacademy/wonder-blocks-form": "7.6.10",
67
67
  "@khanacademy/wonder-blocks-icon": "5.3.23",
68
68
  "@khanacademy/wonder-blocks-icon-button": "11.4.5",
@@ -98,7 +98,7 @@
98
98
  "@khanacademy/wonder-blocks-clickable": "^8.2.9",
99
99
  "@khanacademy/wonder-blocks-core": "^12.4.4",
100
100
  "@khanacademy/wonder-blocks-data": "^15.0.3",
101
- "@khanacademy/wonder-blocks-dropdown": "^10.11.8",
101
+ "@khanacademy/wonder-blocks-dropdown": "^10.12.0",
102
102
  "@khanacademy/wonder-blocks-form": "^7.6.10",
103
103
  "@khanacademy/wonder-blocks-icon": "^5.3.23",
104
104
  "@khanacademy/wonder-blocks-icon-button": "^11.4.5",
@@ -127,7 +127,7 @@
127
127
  },
128
128
  "keywords": [],
129
129
  "khan": {
130
- "catalogHash": "bcf5b2d4681b77c1"
130
+ "catalogHash": "08e8d9a41dfc2cab"
131
131
  },
132
132
  "scripts": {}
133
133
  }
@@ -1,40 +0,0 @@
1
- /**
2
- * A library of options to pass to add/draw/remove/constraints
3
- */
4
- import type { Coord } from "./types";
5
- declare const _default: {
6
- add: {
7
- readonly constrain: () => void;
8
- readonly pointsToFront: (state: any) => void;
9
- };
10
- modify: {
11
- readonly draw: () => void;
12
- };
13
- draw: {
14
- readonly basic: (state: any, prevState: any) => void;
15
- readonly labels: (state: any, prevState: any) => void;
16
- readonly highlight: (state: any, prevState: any) => void;
17
- };
18
- remove: {
19
- readonly basic: () => void;
20
- readonly labels: () => void;
21
- };
22
- onMoveStart: {
23
- standard: null;
24
- };
25
- constraints: {
26
- readonly fixed: () => () => boolean;
27
- readonly snap: (snap: any) => (arg1: Coord) => unknown;
28
- readonly bound: (range: any, snap: any, paddingPx: number) => (arg1: Coord, arg2: Coord) => Coord;
29
- };
30
- onMove: {
31
- readonly updatePoints: (coord: Coord, prevCoord: Coord) => void;
32
- };
33
- onMoveEnd: {
34
- standard: null;
35
- };
36
- onClick: {
37
- standard: null;
38
- };
39
- };
40
- export default _default;
@@ -1,2 +0,0 @@
1
- declare const MovablePolygon: (graphie: any, movable: any, options: any) => void;
2
- export default MovablePolygon;