@khanacademy/perseus 69.3.0 → 70.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/components/image-loader.d.ts +4 -28
- package/dist/components/with-dependencies.d.ts +9 -0
- package/dist/es/index.js +10 -8
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +10 -8
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/util/url-utils.d.ts +1 -1
- package/dist/widgets/expression/expression.d.ts +1 -0
- package/dist/widgets/python-program/python-program.d.ts +3 -14
- package/dist/widgets/video/video.d.ts +3 -14
- package/package.json +24 -24
package/dist/types.d.ts
CHANGED
|
@@ -96,6 +96,12 @@ type TrackInteractionArgs = {
|
|
|
96
96
|
id: string;
|
|
97
97
|
correct?: boolean;
|
|
98
98
|
} & Partial<TrackingGradedGroupExtraArguments> & Partial<TrackingSequenceExtraArguments>;
|
|
99
|
+
type GenerateUrlContext = "image_loader:image_url" | "python_program:program_url" | "video:video_url";
|
|
100
|
+
export type GenerateUrlArgs = {
|
|
101
|
+
url: string;
|
|
102
|
+
context: GenerateUrlContext;
|
|
103
|
+
};
|
|
104
|
+
export type GenerateUrlFn = (args: GenerateUrlArgs) => string;
|
|
99
105
|
/**
|
|
100
106
|
* APIOptions provides different ways to customize the behaviour of Perseus.
|
|
101
107
|
*
|
|
@@ -277,6 +283,9 @@ export type PerseusDependencies = {
|
|
|
277
283
|
svgImageJiptLabels: JiptLabelStore;
|
|
278
284
|
rendererTranslationComponents: JiptTranslationComponents;
|
|
279
285
|
TeX: React.ComponentType<TeXProps>;
|
|
286
|
+
/**
|
|
287
|
+
* @deprecated Use `PerseusDependenciesV2.generateUrl` instead.
|
|
288
|
+
*/
|
|
280
289
|
staticUrl: StaticUrlFn;
|
|
281
290
|
InitialRequestUrl: InitialRequestUrlInterface;
|
|
282
291
|
Log: ILogger;
|
|
@@ -295,6 +304,13 @@ export interface PerseusDependenciesV2 {
|
|
|
295
304
|
analytics: {
|
|
296
305
|
onAnalyticsEvent: AnalyticsEventHandlerFn;
|
|
297
306
|
};
|
|
307
|
+
/**
|
|
308
|
+
* A function that takes a URL or partial url and may modify it to return
|
|
309
|
+
* the full URL. This may be used to request a resource from a different
|
|
310
|
+
* app to where the widget is rendered, like when embedding a video
|
|
311
|
+
* cross-domain.
|
|
312
|
+
*/
|
|
313
|
+
generateUrl: (args: GenerateUrlArgs) => string;
|
|
298
314
|
useVideo(id: string, kind: VideoKind): Result<{
|
|
299
315
|
video: VideoData | null | undefined;
|
|
300
316
|
}>;
|
package/dist/util/url-utils.d.ts
CHANGED
|
@@ -129,6 +129,7 @@ export declare class Expression extends React.Component<Props> implements Widget
|
|
|
129
129
|
analytics?: {
|
|
130
130
|
onAnalyticsEvent: import("@khanacademy/perseus-core").AnalyticsEventHandlerFn;
|
|
131
131
|
} | undefined;
|
|
132
|
+
generateUrl?: ((args: import("../..").GenerateUrlArgs) => string) | undefined;
|
|
132
133
|
useVideo?: ((id: string, kind: import("../..").VideoKind) => import("@khanacademy/wonder-blocks-data").Result<{
|
|
133
134
|
video: import("../..").VideoData | null | undefined;
|
|
134
135
|
}>) | undefined;
|
|
@@ -1,24 +1,13 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type
|
|
3
|
-
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
2
|
+
import { type PerseusDependenciesV2 } from "../../types";
|
|
4
3
|
type Props = {
|
|
5
4
|
programID: string;
|
|
6
5
|
height: number;
|
|
6
|
+
dependencies: PerseusDependenciesV2;
|
|
7
7
|
};
|
|
8
|
-
type DefaultProps = {
|
|
9
|
-
height: Props["height"];
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* This renders the program in an iframe.
|
|
13
|
-
*/
|
|
14
|
-
declare class PythonProgram extends React.Component<Props> implements Widget {
|
|
15
|
-
static defaultProps: DefaultProps;
|
|
16
|
-
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
17
|
-
render(): React.ReactNode;
|
|
18
|
-
}
|
|
19
8
|
declare const _default: {
|
|
20
9
|
name: string;
|
|
21
10
|
displayName: string;
|
|
22
|
-
widget:
|
|
11
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
23
12
|
};
|
|
24
13
|
export default _default;
|
|
@@ -2,26 +2,15 @@
|
|
|
2
2
|
* This is a video widget for embedding videos in articles.
|
|
3
3
|
*/
|
|
4
4
|
import * as React from "react";
|
|
5
|
-
import {
|
|
6
|
-
import type { Widget, WidgetProps } from "../../types";
|
|
7
|
-
import type { UnsupportedWidgetPromptJSON } from "../../widget-ai-utils/unsupported-widget";
|
|
5
|
+
import { type PerseusDependenciesV2, type WidgetProps } from "../../types";
|
|
8
6
|
import type { PerseusVideoWidgetOptions } from "@khanacademy/perseus-core";
|
|
9
7
|
type Props = WidgetProps<PerseusVideoWidgetOptions> & {
|
|
10
8
|
alignment: string;
|
|
9
|
+
dependencies: PerseusDependenciesV2;
|
|
11
10
|
};
|
|
12
|
-
/**
|
|
13
|
-
* Video renderer.
|
|
14
|
-
*/
|
|
15
|
-
declare class Video extends React.Component<Props> implements Widget {
|
|
16
|
-
static contextType: React.Context<import("../../components/i18n-context").I18nContextType>;
|
|
17
|
-
context: React.ContextType<typeof PerseusI18nContext>;
|
|
18
|
-
isWidget: true;
|
|
19
|
-
getPromptJSON(): UnsupportedWidgetPromptJSON;
|
|
20
|
-
render(): React.ReactNode;
|
|
21
|
-
}
|
|
22
11
|
declare const _default: {
|
|
23
12
|
name: string;
|
|
24
13
|
displayName: string;
|
|
25
|
-
widget:
|
|
14
|
+
widget: React.ForwardRefExoticComponent<Omit<Props, "dependencies"> & React.RefAttributes<any>>;
|
|
26
15
|
};
|
|
27
16
|
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": "
|
|
6
|
+
"version": "70.0.0",
|
|
7
7
|
"publishConfig": {
|
|
8
8
|
"access": "public"
|
|
9
9
|
},
|
|
@@ -45,33 +45,33 @@
|
|
|
45
45
|
"@khanacademy/keypad-context": "3.2.8",
|
|
46
46
|
"@khanacademy/kmath": "2.2.8",
|
|
47
47
|
"@khanacademy/math-input": "26.2.8",
|
|
48
|
-
"@khanacademy/perseus-core": "19.3.0",
|
|
49
48
|
"@khanacademy/perseus-linter": "4.3.8",
|
|
49
|
+
"@khanacademy/perseus-core": "19.3.0",
|
|
50
50
|
"@khanacademy/perseus-score": "7.7.8",
|
|
51
51
|
"@khanacademy/perseus-utils": "2.1.0",
|
|
52
52
|
"@khanacademy/pure-markdown": "2.2.0",
|
|
53
53
|
"@khanacademy/simple-markdown": "2.1.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@khanacademy/wonder-blocks-banner": "4.
|
|
57
|
-
"@khanacademy/wonder-blocks-button": "11.2.
|
|
58
|
-
"@khanacademy/wonder-blocks-clickable": "
|
|
56
|
+
"@khanacademy/wonder-blocks-banner": "4.5.1",
|
|
57
|
+
"@khanacademy/wonder-blocks-button": "11.2.3",
|
|
58
|
+
"@khanacademy/wonder-blocks-clickable": "8.0.0",
|
|
59
59
|
"@khanacademy/wonder-blocks-core": "12.4.0",
|
|
60
60
|
"@khanacademy/wonder-blocks-data": "14.1.6",
|
|
61
|
-
"@khanacademy/wonder-blocks-dropdown": "10.
|
|
62
|
-
"@khanacademy/wonder-blocks-form": "7.3.
|
|
63
|
-
"@khanacademy/wonder-blocks-icon-button": "10.5.
|
|
61
|
+
"@khanacademy/wonder-blocks-dropdown": "10.4.2",
|
|
62
|
+
"@khanacademy/wonder-blocks-form": "7.3.9",
|
|
63
|
+
"@khanacademy/wonder-blocks-icon-button": "10.5.2",
|
|
64
64
|
"@khanacademy/wonder-blocks-icon": "5.2.20",
|
|
65
65
|
"@khanacademy/wonder-blocks-labeled-field": "4.0.6",
|
|
66
66
|
"@khanacademy/wonder-blocks-layout": "3.1.37",
|
|
67
|
-
"@khanacademy/wonder-blocks-link": "
|
|
68
|
-
"@khanacademy/wonder-blocks-modal": "8.4.
|
|
69
|
-
"@khanacademy/wonder-blocks-pill": "3.1.
|
|
70
|
-
"@khanacademy/wonder-blocks-popover": "6.1.
|
|
67
|
+
"@khanacademy/wonder-blocks-link": "10.0.0",
|
|
68
|
+
"@khanacademy/wonder-blocks-modal": "8.4.4",
|
|
69
|
+
"@khanacademy/wonder-blocks-pill": "3.1.42",
|
|
70
|
+
"@khanacademy/wonder-blocks-popover": "6.1.34",
|
|
71
71
|
"@khanacademy/wonder-blocks-progress-spinner": "3.1.37",
|
|
72
72
|
"@khanacademy/wonder-blocks-switch": "3.3.19",
|
|
73
73
|
"@khanacademy/wonder-blocks-tokens": "14.0.0",
|
|
74
|
-
"@khanacademy/wonder-blocks-tooltip": "4.1.
|
|
74
|
+
"@khanacademy/wonder-blocks-tooltip": "4.1.48",
|
|
75
75
|
"@khanacademy/wonder-blocks-typography": "4.2.22",
|
|
76
76
|
"@khanacademy/wonder-stuff-core": "1.5.5",
|
|
77
77
|
"@phosphor-icons/core": "2.0.2",
|
|
@@ -91,25 +91,25 @@
|
|
|
91
91
|
"raphael": "1.5.4"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@khanacademy/wonder-blocks-banner": "^4.
|
|
95
|
-
"@khanacademy/wonder-blocks-button": "^11.2.
|
|
96
|
-
"@khanacademy/wonder-blocks-clickable": "^
|
|
94
|
+
"@khanacademy/wonder-blocks-banner": "^4.5.1",
|
|
95
|
+
"@khanacademy/wonder-blocks-button": "^11.2.3",
|
|
96
|
+
"@khanacademy/wonder-blocks-clickable": "^8.0.0",
|
|
97
97
|
"@khanacademy/wonder-blocks-core": "^12.4.0",
|
|
98
98
|
"@khanacademy/wonder-blocks-data": "^14.1.6",
|
|
99
|
-
"@khanacademy/wonder-blocks-dropdown": "^10.
|
|
100
|
-
"@khanacademy/wonder-blocks-form": "^7.3.
|
|
99
|
+
"@khanacademy/wonder-blocks-dropdown": "^10.4.2",
|
|
100
|
+
"@khanacademy/wonder-blocks-form": "^7.3.9",
|
|
101
101
|
"@khanacademy/wonder-blocks-icon": "^5.2.20",
|
|
102
|
-
"@khanacademy/wonder-blocks-icon-button": "^10.5.
|
|
102
|
+
"@khanacademy/wonder-blocks-icon-button": "^10.5.2",
|
|
103
103
|
"@khanacademy/wonder-blocks-labeled-field": "^4.0.6",
|
|
104
104
|
"@khanacademy/wonder-blocks-layout": "^3.1.37",
|
|
105
|
-
"@khanacademy/wonder-blocks-link": "^
|
|
106
|
-
"@khanacademy/wonder-blocks-modal": "^8.4.
|
|
107
|
-
"@khanacademy/wonder-blocks-pill": "^3.1.
|
|
108
|
-
"@khanacademy/wonder-blocks-popover": "^6.1.
|
|
105
|
+
"@khanacademy/wonder-blocks-link": "^10.0.0",
|
|
106
|
+
"@khanacademy/wonder-blocks-modal": "^8.4.4",
|
|
107
|
+
"@khanacademy/wonder-blocks-pill": "^3.1.42",
|
|
108
|
+
"@khanacademy/wonder-blocks-popover": "^6.1.34",
|
|
109
109
|
"@khanacademy/wonder-blocks-progress-spinner": "^3.1.37",
|
|
110
110
|
"@khanacademy/wonder-blocks-switch": "^3.3.19",
|
|
111
111
|
"@khanacademy/wonder-blocks-tokens": "^14.0.0",
|
|
112
|
-
"@khanacademy/wonder-blocks-tooltip": "^4.1.
|
|
112
|
+
"@khanacademy/wonder-blocks-tooltip": "^4.1.48",
|
|
113
113
|
"@khanacademy/wonder-blocks-typography": "^4.2.22",
|
|
114
114
|
"@khanacademy/wonder-stuff-core": "^1.5.5",
|
|
115
115
|
"@phosphor-icons/core": "^2.0.2",
|