@khanacademy/perseus 50.0.0 → 50.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.
- package/dist/es/index.js +47 -11
- package/dist/es/index.js.map +1 -1
- package/dist/index.js +46 -11
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +10 -0
- package/dist/widgets/categorizer/categorizer.d.ts +2 -0
- package/dist/widgets/categorizer/categorizer.util.d.ts +17 -0
- package/dist/widgets.d.ts +2 -1
- package/package.json +39 -39
package/dist/types.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { PerseusStrings } from "./strings";
|
|
|
3
3
|
import type { SizeClass } from "./util/sizing-utils";
|
|
4
4
|
import type { Rubric, UserInput, UserInputArray, UserInputMap } from "./validation.types";
|
|
5
5
|
import type { WidgetPromptJSON } from "./widget-ai-utils/prompt-types";
|
|
6
|
+
import type getCategorizerPublicWidgetOptions from "./widgets/categorizer/categorizer.util";
|
|
6
7
|
import type { KeypadAPI } from "@khanacademy/math-input";
|
|
7
8
|
import type { Hint, PerseusAnswerArea, PerseusGraphType, PerseusWidget, PerseusWidgetsMap, AnalyticsEventHandlerFn } from "@khanacademy/perseus-core";
|
|
8
9
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
@@ -373,6 +374,10 @@ export type ValidationResult = Extract<PerseusScore, {
|
|
|
373
374
|
type: "invalid";
|
|
374
375
|
}> | null;
|
|
375
376
|
export type WidgetScorerFunction = (userInput: UserInput, rubric: Rubric, string?: PerseusStrings, locale?: string) => PerseusScore;
|
|
377
|
+
/**
|
|
378
|
+
* A union type of all the functions that provide public widget options.
|
|
379
|
+
*/
|
|
380
|
+
export type PublicWidgetOptionsFunction = typeof getCategorizerPublicWidgetOptions;
|
|
376
381
|
export type WidgetExports<T extends React.ComponentType<any> & Widget = React.ComponentType<any>> = Readonly<{
|
|
377
382
|
name: string;
|
|
378
383
|
displayName: string;
|
|
@@ -409,6 +414,11 @@ export type WidgetExports<T extends React.ComponentType<any> & Widget = React.Co
|
|
|
409
414
|
* A function that scores user input (the guess) for the widget.
|
|
410
415
|
*/
|
|
411
416
|
scorer?: WidgetScorerFunction;
|
|
417
|
+
/**
|
|
418
|
+
* A function that provides a public version of the widget options that can
|
|
419
|
+
* be shared with the client.
|
|
420
|
+
*/
|
|
421
|
+
getPublicWidgetOptions?: PublicWidgetOptionsFunction;
|
|
412
422
|
getOneCorrectAnswerFromRubric?: (rubric: Rubric) => string | null | undefined;
|
|
413
423
|
/**
|
|
414
424
|
* A map of major version numbers (as a string, eg "1") to a function that
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import { PerseusI18nContext } from "../../components/i18n-context";
|
|
3
|
+
import getCategorizerPublicWidgetOptions from "./categorizer.util";
|
|
3
4
|
import scoreCategorizer from "./score-categorizer";
|
|
4
5
|
import type { Widget, WidgetProps } from "../../types";
|
|
5
6
|
import type { PerseusCategorizerScoringData, PerseusCategorizerUserInput } from "../../validation.types";
|
|
@@ -44,5 +45,6 @@ declare const _default: {
|
|
|
44
45
|
staticTransform: (editorProps: PerseusCategorizerWidgetOptions) => RenderProps;
|
|
45
46
|
isLintable: true;
|
|
46
47
|
scorer: typeof scoreCategorizer;
|
|
48
|
+
getPublicWidgetOptions: typeof getCategorizerPublicWidgetOptions;
|
|
47
49
|
};
|
|
48
50
|
export default _default;
|
|
@@ -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;
|
package/dist/widgets.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PerseusStrings } from "./strings";
|
|
2
|
-
import type { Alignment, Tracking, Version, WidgetExports, WidgetTransform, WidgetScorerFunction } from "./types";
|
|
2
|
+
import type { Alignment, Tracking, Version, WidgetExports, WidgetTransform, WidgetScorerFunction, PublicWidgetOptionsFunction } from "./types";
|
|
3
3
|
import type { PerseusWidget } from "@khanacademy/perseus-core";
|
|
4
4
|
import type * as React from "react";
|
|
5
5
|
type Editor = any;
|
|
@@ -29,6 +29,7 @@ export declare const replaceDeprecatedEditors: () => void;
|
|
|
29
29
|
export declare const getWidget: (name: string) => React.ComponentType<any> | null | undefined;
|
|
30
30
|
export declare const getWidgetExport: (name: string) => WidgetExports | null;
|
|
31
31
|
export declare const getWidgetScorer: (name: string) => WidgetScorerFunction | null;
|
|
32
|
+
export declare const getPublicWidgetOptionsFunction: (name: string) => PublicWidgetOptionsFunction;
|
|
32
33
|
export declare const getEditor: (name: string) => Editor | null | undefined;
|
|
33
34
|
export declare const getTransform: (name: string) => WidgetTransform | null | undefined;
|
|
34
35
|
export declare const getVersion: (name: string) => Version | undefined;
|
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": "50.
|
|
6
|
+
"version": "50.1.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@khanacademy/kas": "^0.4.10",
|
|
45
45
|
"@khanacademy/keypad-context": "^1.0.13",
|
|
46
46
|
"@khanacademy/kmath": "^0.2.0",
|
|
47
|
-
"@khanacademy/math-input": "^22.
|
|
47
|
+
"@khanacademy/math-input": "^22.2.0",
|
|
48
48
|
"@khanacademy/perseus-core": "3.1.0",
|
|
49
49
|
"@khanacademy/perseus-linter": "^1.2.12",
|
|
50
50
|
"@khanacademy/perseus-score": "^1.0.0",
|
|
@@ -56,24 +56,24 @@
|
|
|
56
56
|
"uuid": "^10.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@khanacademy/wonder-blocks-banner": "4.0.
|
|
60
|
-
"@khanacademy/wonder-blocks-button": "7.0.
|
|
61
|
-
"@khanacademy/wonder-blocks-clickable": "5.0.
|
|
62
|
-
"@khanacademy/wonder-blocks-core": "11.
|
|
63
|
-
"@khanacademy/wonder-blocks-data": "14.0.
|
|
64
|
-
"@khanacademy/wonder-blocks-dropdown": "7.0.
|
|
65
|
-
"@khanacademy/wonder-blocks-form": "6.0.
|
|
66
|
-
"@khanacademy/wonder-blocks-icon": "5.0.
|
|
67
|
-
"@khanacademy/wonder-blocks-icon-button": "6.0.
|
|
68
|
-
"@khanacademy/wonder-blocks-layout": "3.0.
|
|
69
|
-
"@khanacademy/wonder-blocks-link": "7.0.
|
|
70
|
-
"@khanacademy/wonder-blocks-pill": "3.0.
|
|
71
|
-
"@khanacademy/wonder-blocks-popover": "5.0.
|
|
72
|
-
"@khanacademy/wonder-blocks-progress-spinner": "3.0.
|
|
73
|
-
"@khanacademy/wonder-blocks-switch": "3.0.
|
|
74
|
-
"@khanacademy/wonder-blocks-tokens": "3.0.
|
|
75
|
-
"@khanacademy/wonder-blocks-tooltip": "4.0.
|
|
76
|
-
"@khanacademy/wonder-blocks-typography": "3.0.
|
|
59
|
+
"@khanacademy/wonder-blocks-banner": "4.0.3",
|
|
60
|
+
"@khanacademy/wonder-blocks-button": "7.0.3",
|
|
61
|
+
"@khanacademy/wonder-blocks-clickable": "5.0.3",
|
|
62
|
+
"@khanacademy/wonder-blocks-core": "11.0.0",
|
|
63
|
+
"@khanacademy/wonder-blocks-data": "14.0.3",
|
|
64
|
+
"@khanacademy/wonder-blocks-dropdown": "7.0.1",
|
|
65
|
+
"@khanacademy/wonder-blocks-form": "6.0.1",
|
|
66
|
+
"@khanacademy/wonder-blocks-icon": "5.0.3",
|
|
67
|
+
"@khanacademy/wonder-blocks-icon-button": "6.0.3",
|
|
68
|
+
"@khanacademy/wonder-blocks-layout": "3.0.3",
|
|
69
|
+
"@khanacademy/wonder-blocks-link": "7.0.3",
|
|
70
|
+
"@khanacademy/wonder-blocks-pill": "3.0.3",
|
|
71
|
+
"@khanacademy/wonder-blocks-popover": "5.0.1",
|
|
72
|
+
"@khanacademy/wonder-blocks-progress-spinner": "3.0.3",
|
|
73
|
+
"@khanacademy/wonder-blocks-switch": "3.0.1",
|
|
74
|
+
"@khanacademy/wonder-blocks-tokens": "3.0.0",
|
|
75
|
+
"@khanacademy/wonder-blocks-tooltip": "4.0.1",
|
|
76
|
+
"@khanacademy/wonder-blocks-typography": "3.0.3",
|
|
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.
|
|
95
|
-
"@khanacademy/wonder-blocks-button": "7.0.
|
|
96
|
-
"@khanacademy/wonder-blocks-clickable": "5.0.
|
|
97
|
-
"@khanacademy/wonder-blocks-core": "11.
|
|
98
|
-
"@khanacademy/wonder-blocks-data": "14.0.
|
|
99
|
-
"@khanacademy/wonder-blocks-dropdown": "7.0.
|
|
100
|
-
"@khanacademy/wonder-blocks-form": "6.0.
|
|
101
|
-
"@khanacademy/wonder-blocks-icon": "5.0.
|
|
102
|
-
"@khanacademy/wonder-blocks-icon-button": "6.0.
|
|
103
|
-
"@khanacademy/wonder-blocks-layout": "3.0.
|
|
104
|
-
"@khanacademy/wonder-blocks-link": "7.0.
|
|
105
|
-
"@khanacademy/wonder-blocks-pill": "3.0.
|
|
106
|
-
"@khanacademy/wonder-blocks-popover": "5.0.
|
|
107
|
-
"@khanacademy/wonder-blocks-progress-spinner": "3.0.
|
|
108
|
-
"@khanacademy/wonder-blocks-switch": "3.0.
|
|
109
|
-
"@khanacademy/wonder-blocks-tokens": "3.0.
|
|
110
|
-
"@khanacademy/wonder-blocks-tooltip": "4.0.
|
|
111
|
-
"@khanacademy/wonder-blocks-typography": "3.0.
|
|
94
|
+
"@khanacademy/wonder-blocks-banner": "4.0.3",
|
|
95
|
+
"@khanacademy/wonder-blocks-button": "7.0.3",
|
|
96
|
+
"@khanacademy/wonder-blocks-clickable": "5.0.3",
|
|
97
|
+
"@khanacademy/wonder-blocks-core": "11.0.0",
|
|
98
|
+
"@khanacademy/wonder-blocks-data": "14.0.3",
|
|
99
|
+
"@khanacademy/wonder-blocks-dropdown": "7.0.1",
|
|
100
|
+
"@khanacademy/wonder-blocks-form": "6.0.1",
|
|
101
|
+
"@khanacademy/wonder-blocks-icon": "5.0.3",
|
|
102
|
+
"@khanacademy/wonder-blocks-icon-button": "6.0.3",
|
|
103
|
+
"@khanacademy/wonder-blocks-layout": "3.0.3",
|
|
104
|
+
"@khanacademy/wonder-blocks-link": "7.0.3",
|
|
105
|
+
"@khanacademy/wonder-blocks-pill": "3.0.3",
|
|
106
|
+
"@khanacademy/wonder-blocks-popover": "5.0.1",
|
|
107
|
+
"@khanacademy/wonder-blocks-progress-spinner": "3.0.3",
|
|
108
|
+
"@khanacademy/wonder-blocks-switch": "3.0.1",
|
|
109
|
+
"@khanacademy/wonder-blocks-tokens": "3.0.0",
|
|
110
|
+
"@khanacademy/wonder-blocks-tooltip": "4.0.1",
|
|
111
|
+
"@khanacademy/wonder-blocks-typography": "3.0.3",
|
|
112
112
|
"@khanacademy/wonder-stuff-core": "1.5.4",
|
|
113
113
|
"@phosphor-icons/core": "^2.0.2",
|
|
114
114
|
"@popperjs/core": "^2.10.2",
|
|
@@ -124,4 +124,4 @@
|
|
|
124
124
|
"underscore": "^1.4.4"
|
|
125
125
|
},
|
|
126
126
|
"keywords": []
|
|
127
|
-
}
|
|
127
|
+
}
|