@khanacademy/perseus 8.0.0 → 10.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/CHANGELOG.md +33 -0
- package/dist/article-renderer.d.ts +2 -1
- package/dist/components/info-tip.d.ts +2 -1
- package/dist/components/input-with-examples.d.ts +1 -1
- package/dist/components/sortable.d.ts +1 -1
- package/dist/dependencies.d.ts +7 -1
- package/dist/es/index.css +3 -5
- package/dist/es/index.js +72 -45
- package/dist/es/index.js.map +1 -1
- package/dist/hint-renderer.d.ts +2 -1
- package/dist/hints-renderer.d.ts +2 -1
- package/dist/index.css +3 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +72 -46
- package/dist/index.js.map +1 -1
- package/dist/interaction-tracker.d.ts +3 -3
- package/dist/item-renderer.d.ts +3 -1
- package/dist/multi-items/multi-renderer.d.ts +4 -2
- package/dist/perseus-api.d.ts +1 -1
- package/dist/renderer.d.ts +4 -9
- package/dist/server-item-renderer.d.ts +3 -1
- package/dist/types.d.ts +30 -15
- package/dist/widget-container.d.ts +2 -1
- package/dist/widgets/expression.d.ts +409 -12
- package/dist/widgets/graded-group.d.ts +2 -2
- package/dist/widgets/grapher.d.ts +2 -1
- package/dist/widgets/passage-ref.d.ts +2 -1
- package/dist/widgets/sequence.d.ts +2 -2
- package/package.json +3 -3
- package/src/__stories__/article-renderer.stories.tsx +35 -2
- package/src/__testdata__/article-renderer.testdata.ts +71 -0
- package/src/__tests__/item-renderer.test.tsx +12 -1
- package/src/__tests__/renderer.test.tsx +0 -2
- package/src/__tests__/server-item-renderer.test.tsx +11 -5
- package/src/article-renderer.tsx +38 -30
- package/src/components/info-tip.tsx +3 -4
- package/src/components/input-with-examples.tsx +1 -1
- package/src/components/sortable.tsx +1 -1
- package/src/dependencies.ts +16 -1
- package/src/hint-renderer.tsx +2 -1
- package/src/hints-renderer.tsx +2 -9
- package/src/index.ts +0 -1
- package/src/interaction-tracker.ts +3 -3
- package/src/item-renderer.tsx +57 -44
- package/src/multi-items/__tests__/multi-renderer.test.tsx +6 -1
- package/src/multi-items/multi-renderer.tsx +18 -11
- package/src/renderer.tsx +4 -4
- package/src/server-item-renderer.tsx +21 -17
- package/src/types.ts +50 -21
- package/src/widget-container.tsx +2 -1
- package/src/widgets/__stories__/definition.stories.tsx +8 -1
- package/src/widgets/__stories__/expression.stories.tsx +2 -2
- package/src/widgets/__tests__/{expression.test.ts → expression.test.tsx} +73 -8
- package/src/widgets/__tests__/renderQuestion.tsx +29 -29
- package/src/widgets/expression.tsx +77 -48
- package/src/widgets/graded-group.tsx +11 -2
- package/src/widgets/grapher.tsx +4 -12
- package/src/widgets/passage-ref.tsx +1 -1
- package/src/widgets/sequence.tsx +10 -2
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,38 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 10.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- 9eb50ae1: Removed `LinterContextProps` type. Moved to `@khanacademy/perseus-linter` in a previous release, but wasn't deleted from this package.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- aea86eec: Convert all usages of JSX.LibraryManagedAttributes to WB Core's PropsFor type
|
|
12
|
+
- Updated dependencies [7b11736e]
|
|
13
|
+
- @khanacademy/math-input@10.0.1
|
|
14
|
+
|
|
15
|
+
## 9.0.0
|
|
16
|
+
|
|
17
|
+
### Major Changes
|
|
18
|
+
|
|
19
|
+
- dd800c22: Rename analytics prop from onEvent to onAnalyticsEvent
|
|
20
|
+
- 2b99fbda: Remove 'analytics' key from PerseusDependencies
|
|
21
|
+
|
|
22
|
+
### Minor Changes
|
|
23
|
+
|
|
24
|
+
- ec50a510: Switch `virtualKeypadVersion` on `perseus:expression-evaluated` event to be non-optional
|
|
25
|
+
- 673f61b3: Introduce `dependencies` on ArticleRenderer, ItemRenderer, MultiRenderer, and ServerItemRenderer.
|
|
26
|
+
|
|
27
|
+
### Patch Changes
|
|
28
|
+
|
|
29
|
+
- 2c69b0dc: Fix APIOptions `trackInteraction` type for better Flow type generation
|
|
30
|
+
- Updated dependencies [dd800c22]
|
|
31
|
+
- Updated dependencies [5352d512]
|
|
32
|
+
- Updated dependencies [673f61b3]
|
|
33
|
+
- @khanacademy/math-input@10.0.0
|
|
34
|
+
- @khanacademy/perseus-core@0.2.0
|
|
35
|
+
|
|
3
36
|
## 8.0.0
|
|
4
37
|
|
|
5
38
|
### Major Changes
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as React from "react";
|
|
6
6
|
import type { KeypadProps } from "./mixins/provide-keypad";
|
|
7
7
|
import type { PerseusRenderer } from "./perseus-types";
|
|
8
|
-
import type { APIOptions } from "./types";
|
|
8
|
+
import type { APIOptions, PerseusDependenciesV2 } from "./types";
|
|
9
9
|
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
10
10
|
type Props = {
|
|
11
11
|
apiOptions: APIOptions;
|
|
@@ -16,6 +16,7 @@ type Props = {
|
|
|
16
16
|
useNewStyles: boolean;
|
|
17
17
|
linterContext: LinterContextProps;
|
|
18
18
|
legacyPerseusLint?: ReadonlyArray<string>;
|
|
19
|
+
dependencies: PerseusDependenciesV2;
|
|
19
20
|
} & KeypadProps;
|
|
20
21
|
type DefaultProps = {
|
|
21
22
|
apiOptions: Props["apiOptions"];
|
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import * as React from "react";
|
|
8
8
|
import ReactComponentsInfoTip from "./info-tip/info-tip";
|
|
9
|
-
type
|
|
9
|
+
import type { PropsFor } from "@khanacademy/wonder-blocks-core";
|
|
10
|
+
type Props = PropsFor<typeof ReactComponentsInfoTip>;
|
|
10
11
|
type State = {
|
|
11
12
|
didMount: boolean;
|
|
12
13
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { LinterContextProps } from "
|
|
2
|
+
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
3
3
|
import type { StyleType } from "@khanacademy/wonder-blocks-core";
|
|
4
4
|
type Props = {
|
|
5
5
|
type: "math" | "text" | "tex";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { LinterContextProps } from "../types";
|
|
3
2
|
import type { Position } from "../util";
|
|
3
|
+
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
4
4
|
export declare enum Layout {
|
|
5
5
|
HORIZONTAL = "horizontal",
|
|
6
6
|
VERTICAL = "vertical"
|
package/dist/dependencies.d.ts
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import type { PerseusDependencies, PerseusDependenciesV2 } from "./types";
|
|
2
3
|
export declare const setDependencies: (dependencies: PerseusDependencies) => void;
|
|
3
4
|
export declare const getDependencies: () => PerseusDependencies;
|
|
5
|
+
export declare const DependenciesContext: React.Context<PerseusDependenciesV2>;
|
|
6
|
+
/**
|
|
7
|
+
* useDependencies provides easy access to the current Perseus dependencies.
|
|
8
|
+
*/
|
|
9
|
+
export declare const useDependencies: () => PerseusDependenciesV2;
|
package/dist/es/index.css
CHANGED
|
@@ -3679,7 +3679,7 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
|
|
|
3679
3679
|
outline: none !important;
|
|
3680
3680
|
}
|
|
3681
3681
|
.keypad-input .mq-editable-field .mq-root-block {
|
|
3682
|
-
overflow-x:
|
|
3682
|
+
overflow-x: auto;
|
|
3683
3683
|
}
|
|
3684
3684
|
.keypad-input .mq-editable-field .mq-cursor:not(:only-child),
|
|
3685
3685
|
.keypad-input .mq-editable-field .mq-root-block.mq-hasCursor > .mq-cursor:only-child {
|
|
@@ -3698,12 +3698,11 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
|
|
|
3698
3698
|
margin-left: -1px !important;
|
|
3699
3699
|
margin-right: -1px !important;
|
|
3700
3700
|
opacity: 1 !important;
|
|
3701
|
-
transition: opacity
|
|
3701
|
+
transition: opacity 300ms ease !important;
|
|
3702
3702
|
visibility: visible !important;
|
|
3703
3703
|
}
|
|
3704
3704
|
.keypad-input .mq-editable-field .mq-cursor.mq-blink {
|
|
3705
3705
|
opacity: 0 !important;
|
|
3706
|
-
transition: opacity 500ms ease-in !important;
|
|
3707
3706
|
visibility: visible !important;
|
|
3708
3707
|
}
|
|
3709
3708
|
.keypad-input .mq-editable-field .mq-non-leaf .mq-cursor:only-child {
|
|
@@ -3712,12 +3711,11 @@ body.mobile .framework-perseus table.perseus-widget-table-of-values.non-markdown
|
|
|
3712
3711
|
border-radius: 1px;
|
|
3713
3712
|
opacity: 1 !important;
|
|
3714
3713
|
padding: 0 4px 0 4px;
|
|
3715
|
-
transition: border-color
|
|
3714
|
+
transition: border-color 300ms ease !important;
|
|
3716
3715
|
}
|
|
3717
3716
|
.keypad-input .mq-editable-field .mq-non-leaf .mq-cursor:only-child.mq-blink {
|
|
3718
3717
|
border-color: #1865f2 !important;
|
|
3719
3718
|
opacity: 1 !important;
|
|
3720
|
-
transition: border-color 500ms ease-in !important;
|
|
3721
3719
|
}
|
|
3722
3720
|
.keypad-input .mq-empty {
|
|
3723
3721
|
background: transparent !important;
|
package/dist/es/index.js
CHANGED
|
@@ -113,11 +113,26 @@ const getDependencies = () => {
|
|
|
113
113
|
}
|
|
114
114
|
throw new Error(["Perseus has not been provided required dependencies.", "setDependencies(dependencies) must be called first.", "Make sure Perseus is being imported from javascript/perseus/perseus.js."].join("\n"));
|
|
115
115
|
};
|
|
116
|
+
const DependenciesContext = /*#__PURE__*/React.createContext({
|
|
117
|
+
analytics: {
|
|
118
|
+
onAnalyticsEvent: async () => {}
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* useDependencies provides easy access to the current Perseus dependencies.
|
|
124
|
+
*/
|
|
125
|
+
const useDependencies = () => {
|
|
126
|
+
const deps = React.useContext(DependenciesContext);
|
|
127
|
+
return deps;
|
|
128
|
+
};
|
|
116
129
|
|
|
117
130
|
var dependencies = /*#__PURE__*/Object.freeze({
|
|
118
131
|
__proto__: null,
|
|
119
132
|
setDependencies: setDependencies,
|
|
120
|
-
getDependencies: getDependencies
|
|
133
|
+
getDependencies: getDependencies,
|
|
134
|
+
DependenciesContext: DependenciesContext,
|
|
135
|
+
useDependencies: useDependencies
|
|
121
136
|
});
|
|
122
137
|
|
|
123
138
|
/* eslint-disable @khanacademy/ts-no-error-suppressions */
|
|
@@ -2430,14 +2445,6 @@ const KhanAnswerTypes = {
|
|
|
2430
2445
|
}
|
|
2431
2446
|
};
|
|
2432
2447
|
|
|
2433
|
-
const sendExpressionEvaluatedEvent = result => {
|
|
2434
|
-
getDependencies().analytics({
|
|
2435
|
-
type: "perseus:expression-evaluated",
|
|
2436
|
-
payload: {
|
|
2437
|
-
result
|
|
2438
|
-
}
|
|
2439
|
-
});
|
|
2440
|
-
};
|
|
2441
2448
|
const ERROR_MESSAGE = i18n._("Sorry, I don't understand that!");
|
|
2442
2449
|
const insertBraces = value => {
|
|
2443
2450
|
// HACK(alex): Make sure that all LaTeX super/subscripts are wrapped
|
|
@@ -2460,6 +2467,13 @@ const insertBraces = value => {
|
|
|
2460
2467
|
// TODO(alex): Properly hack MathQuill to always use explicit braces.
|
|
2461
2468
|
return value.replace(/([_^])([^{])/g, "$1{$2}");
|
|
2462
2469
|
};
|
|
2470
|
+
const deriveKeypadVersion = apiOptions => {
|
|
2471
|
+
// We can derive which version of the keypad is in use. This is
|
|
2472
|
+
// a bit tricky, but this code will be relatively short-lived
|
|
2473
|
+
// as we coalesce onto the new, v2 Keypad, at which point we
|
|
2474
|
+
// can remove this `virtualKeypadVersion` field entirely.
|
|
2475
|
+
return apiOptions.nativeKeypadProxy != null ? "REACT_NATIVE_KEYPAD" : apiOptions.customKeypad === true ? apiOptions.useV2Keypad === true ? "MATH_INPUT_KEYPAD_V2" : "MATH_INPUT_KEYPAD_V1" : "PERSEUS_MATH_INPUT";
|
|
2476
|
+
};
|
|
2463
2477
|
// The new, MathQuill input expression widget
|
|
2464
2478
|
class Expression extends React.Component {
|
|
2465
2479
|
constructor(..._args) {
|
|
@@ -2514,7 +2528,9 @@ class Expression extends React.Component {
|
|
|
2514
2528
|
};
|
|
2515
2529
|
this.simpleValidate = (rubric, onInputError) => {
|
|
2516
2530
|
onInputError = onInputError || function () {};
|
|
2517
|
-
|
|
2531
|
+
const result = Expression.validate(this.getUserInput(), rubric, onInputError);
|
|
2532
|
+
this.sendExpressionEvaluatedEvent(result.type === "invalid" ? "invalid" : result.earned === result.total ? "correct" : "incorrect");
|
|
2533
|
+
return result;
|
|
2518
2534
|
};
|
|
2519
2535
|
this.getUserInput = () => {
|
|
2520
2536
|
return Expression.getUserInputFromProps(this.props);
|
|
@@ -2670,8 +2686,6 @@ class Expression extends React.Component {
|
|
|
2670
2686
|
// we did, whether it's considered correct, incorrect, or ungraded
|
|
2671
2687
|
if (!matchingAnswerForm) {
|
|
2672
2688
|
if (firstUngradedResult) {
|
|
2673
|
-
sendExpressionEvaluatedEvent("invalid");
|
|
2674
|
-
|
|
2675
2689
|
// While we didn't directly match with any answer form, we
|
|
2676
2690
|
// did at some point get an "ungraded" validation result,
|
|
2677
2691
|
// which might indicate e.g. a mismatch in variable casing.
|
|
@@ -2685,8 +2699,6 @@ class Expression extends React.Component {
|
|
|
2685
2699
|
};
|
|
2686
2700
|
}
|
|
2687
2701
|
if (allEmpty) {
|
|
2688
|
-
sendExpressionEvaluatedEvent("invalid");
|
|
2689
|
-
|
|
2690
2702
|
// If everything graded as empty, it's invalid.
|
|
2691
2703
|
return {
|
|
2692
2704
|
type: "invalid",
|
|
@@ -2695,7 +2707,6 @@ class Expression extends React.Component {
|
|
|
2695
2707
|
}
|
|
2696
2708
|
// We fell through all the possibilities and we're not empty,
|
|
2697
2709
|
// so the answer is considered incorrect.
|
|
2698
|
-
sendExpressionEvaluatedEvent("incorrect");
|
|
2699
2710
|
return {
|
|
2700
2711
|
type: "points",
|
|
2701
2712
|
earned: 0,
|
|
@@ -2708,7 +2719,6 @@ class Expression extends React.Component {
|
|
|
2708
2719
|
const apiResult = onInputError(null,
|
|
2709
2720
|
// Reserved for some widget identifier
|
|
2710
2721
|
userInput, matchMessage);
|
|
2711
|
-
sendExpressionEvaluatedEvent("invalid");
|
|
2712
2722
|
return {
|
|
2713
2723
|
type: "invalid",
|
|
2714
2724
|
message: apiResult === false ? null : matchMessage
|
|
@@ -2720,7 +2730,6 @@ class Expression extends React.Component {
|
|
|
2720
2730
|
// TODO(eater): Seems silly to translate result to this
|
|
2721
2731
|
// invalid/points thing and immediately translate it back in
|
|
2722
2732
|
// ItemRenderer.scoreInput()
|
|
2723
|
-
sendExpressionEvaluatedEvent(matchingAnswerForm.considered === "correct" ? "correct" : "incorrect");
|
|
2724
2733
|
return {
|
|
2725
2734
|
type: "points",
|
|
2726
2735
|
earned: matchingAnswerForm.considered === "correct" ? 1 : 0,
|
|
@@ -2746,6 +2755,15 @@ class Expression extends React.Component {
|
|
|
2746
2755
|
// @ts-expect-error - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
|
|
2747
2756
|
this.refs.input.insert(keyPressed);
|
|
2748
2757
|
}
|
|
2758
|
+
sendExpressionEvaluatedEvent(result) {
|
|
2759
|
+
this.props.analytics.onAnalyticsEvent({
|
|
2760
|
+
type: "perseus:expression-evaluated",
|
|
2761
|
+
payload: {
|
|
2762
|
+
result,
|
|
2763
|
+
virtualKeypadVersion: deriveKeypadVersion(this.props.apiOptions)
|
|
2764
|
+
}
|
|
2765
|
+
});
|
|
2766
|
+
}
|
|
2749
2767
|
render() {
|
|
2750
2768
|
if (this.props.apiOptions.customKeypad) {
|
|
2751
2769
|
return /*#__PURE__*/React.createElement(KeypadInput
|
|
@@ -2906,11 +2924,18 @@ const propUpgrades$2 = {
|
|
|
2906
2924
|
}]
|
|
2907
2925
|
})
|
|
2908
2926
|
};
|
|
2927
|
+
const ExpressionWithDependencies = /*#__PURE__*/React.forwardRef((props, ref) => {
|
|
2928
|
+
const deps = useDependencies();
|
|
2929
|
+
return /*#__PURE__*/React.createElement(Expression, _extends({
|
|
2930
|
+
ref: ref,
|
|
2931
|
+
analytics: deps.analytics
|
|
2932
|
+
}, props));
|
|
2933
|
+
});
|
|
2909
2934
|
var Expression$1 = {
|
|
2910
2935
|
name: "expression",
|
|
2911
2936
|
displayName: "Expression / Equation",
|
|
2912
2937
|
defaultAlignment: "inline-block",
|
|
2913
|
-
widget:
|
|
2938
|
+
widget: ExpressionWithDependencies,
|
|
2914
2939
|
transform: widgetOptions => {
|
|
2915
2940
|
const {
|
|
2916
2941
|
times,
|
|
@@ -19195,8 +19220,8 @@ class Renderer extends React.Component {
|
|
|
19195
19220
|
|
|
19196
19221
|
// @ts-expect-error - TS2564 - Property 'widgetIds' has no initializer and is not definitely assigned in the constructor.
|
|
19197
19222
|
|
|
19198
|
-
constructor(_props
|
|
19199
|
-
super(_props
|
|
19223
|
+
constructor(_props) {
|
|
19224
|
+
super(_props);
|
|
19200
19225
|
this._currentFocus = void 0;
|
|
19201
19226
|
this._foundTextNodes = void 0;
|
|
19202
19227
|
this._interactionTrackers = void 0;
|
|
@@ -44033,7 +44058,9 @@ class ArticleRenderer extends React.Component {
|
|
|
44033
44058
|
// TODO(alex): Add mobile api functions and pass them down here
|
|
44034
44059
|
const sections = this._sections().map((section, i) => {
|
|
44035
44060
|
const refForSection = `section-${i}`;
|
|
44036
|
-
return /*#__PURE__*/React.createElement(
|
|
44061
|
+
return /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
|
|
44062
|
+
value: this.props.dependencies
|
|
44063
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
44037
44064
|
key: i,
|
|
44038
44065
|
className: "clearfix"
|
|
44039
44066
|
}, /*#__PURE__*/React.createElement(Renderer, _extends({}, section, {
|
|
@@ -44051,7 +44078,7 @@ class ArticleRenderer extends React.Component {
|
|
|
44051
44078
|
}),
|
|
44052
44079
|
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "article"),
|
|
44053
44080
|
legacyPerseusLint: this.props.legacyPerseusLint
|
|
44054
|
-
})));
|
|
44081
|
+
}))));
|
|
44055
44082
|
});
|
|
44056
44083
|
return /*#__PURE__*/React.createElement("div", {
|
|
44057
44084
|
className: classes
|
|
@@ -44281,13 +44308,9 @@ class HintsRenderer extends React.Component {
|
|
|
44281
44308
|
totalHints: this.props.hints.length,
|
|
44282
44309
|
ref: "hintRenderer" + i,
|
|
44283
44310
|
key: "hintRenderer" + i,
|
|
44284
|
-
apiOptions: apiOptions
|
|
44285
|
-
// @ts-expect-error - TS2339 - Property 'findExternalWidgets' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44286
|
-
,
|
|
44311
|
+
apiOptions: apiOptions,
|
|
44287
44312
|
findExternalWidgets: this.props.findExternalWidgets,
|
|
44288
|
-
linterContext: PerseusLinter.pushContextStack(
|
|
44289
|
-
// @ts-expect-error - TS2339 - Property 'linterContext' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44290
|
-
this.props.linterContext, "hints[" + i + "]")
|
|
44313
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints[" + i + "]")
|
|
44291
44314
|
});
|
|
44292
44315
|
if (isFinalHelpPage) {
|
|
44293
44316
|
hints.push(renderer);
|
|
@@ -44508,7 +44531,9 @@ class ItemRenderer extends React.Component {
|
|
|
44508
44531
|
// that have completely different places in the DOM, we have to do this
|
|
44509
44532
|
// strangeness instead of relying on React's normal render() method.
|
|
44510
44533
|
// TODO(alpert): Figure out how to clean this up somehow
|
|
44511
|
-
render( /*#__PURE__*/React.createElement(
|
|
44534
|
+
render( /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
|
|
44535
|
+
value: this.props.dependencies
|
|
44536
|
+
}, /*#__PURE__*/React.createElement(Renderer, _extends({
|
|
44512
44537
|
ref: node => {
|
|
44513
44538
|
if (!node) {
|
|
44514
44539
|
return;
|
|
@@ -44536,18 +44561,18 @@ class ItemRenderer extends React.Component {
|
|
|
44536
44561
|
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "question")
|
|
44537
44562
|
}, this.props.item.question, {
|
|
44538
44563
|
legacyPerseusLint: this.props.legacyPerseusLint
|
|
44539
|
-
})),
|
|
44564
|
+
}))),
|
|
44540
44565
|
// @ts-expect-error - TS2345 - Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'.
|
|
44541
44566
|
workArea);
|
|
44542
|
-
render( /*#__PURE__*/React.createElement(
|
|
44567
|
+
render( /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
|
|
44568
|
+
value: this.props.dependencies
|
|
44569
|
+
}, /*#__PURE__*/React.createElement(HintsRenderer, {
|
|
44543
44570
|
ref: node => this.hintsRenderer = node,
|
|
44544
44571
|
hints: this.props.item.hints,
|
|
44545
|
-
hintsVisible: this.state.hintsVisible
|
|
44546
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
44547
|
-
,
|
|
44572
|
+
hintsVisible: this.state.hintsVisible,
|
|
44548
44573
|
apiOptions: apiOptions,
|
|
44549
44574
|
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints")
|
|
44550
|
-
}),
|
|
44575
|
+
})),
|
|
44551
44576
|
// @ts-expect-error - TS2345 - Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'.
|
|
44552
44577
|
hintsArea);
|
|
44553
44578
|
const answerArea = this.props.item.answerArea || {};
|
|
@@ -44764,7 +44789,9 @@ class ItemRenderer extends React.Component {
|
|
|
44764
44789
|
this.questionRenderer.deselectIncorrectSelectedChoices();
|
|
44765
44790
|
}
|
|
44766
44791
|
render() {
|
|
44767
|
-
return /*#__PURE__*/React.createElement(
|
|
44792
|
+
return /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
|
|
44793
|
+
value: this.props.dependencies
|
|
44794
|
+
}, /*#__PURE__*/React.createElement("div", null));
|
|
44768
44795
|
}
|
|
44769
44796
|
}
|
|
44770
44797
|
ItemRenderer.defaultProps = {
|
|
@@ -45078,20 +45105,20 @@ class ServerItemRenderer extends React.Component {
|
|
|
45078
45105
|
}));
|
|
45079
45106
|
const hintsRenderer = /*#__PURE__*/React.createElement(HintsRenderer, {
|
|
45080
45107
|
hints: this.props.item.hints,
|
|
45081
|
-
hintsVisible: this.props.hintsVisible
|
|
45082
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
45083
|
-
,
|
|
45108
|
+
hintsVisible: this.props.hintsVisible,
|
|
45084
45109
|
apiOptions: apiOptions,
|
|
45085
45110
|
ref: elem => this.hintsRenderer = elem
|
|
45086
45111
|
});
|
|
45087
|
-
return /*#__PURE__*/React.createElement(
|
|
45112
|
+
return /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
|
|
45113
|
+
value: this.props.dependencies
|
|
45114
|
+
}, /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", null, questionRenderer), /*#__PURE__*/React.createElement("div", {
|
|
45088
45115
|
className:
|
|
45089
45116
|
// Avoid adding any horizontal padding when applying the
|
|
45090
45117
|
// mobile hint styles, which are flush to the left.
|
|
45091
45118
|
// NOTE(charlie): We may still want to apply this
|
|
45092
45119
|
// padding for desktop exercises.
|
|
45093
45120
|
apiOptions.isMobile ? undefined : css(styles$3.hintsContainer)
|
|
45094
|
-
}, hintsRenderer));
|
|
45121
|
+
}, hintsRenderer)));
|
|
45095
45122
|
}
|
|
45096
45123
|
}
|
|
45097
45124
|
ServerItemRenderer.defaultProps = {
|
|
@@ -46296,7 +46323,6 @@ class MultiRenderer extends React.Component {
|
|
|
46296
46323
|
// _annotateRendererArray() needs this
|
|
46297
46324
|
ref: null,
|
|
46298
46325
|
makeRenderer: () => /*#__PURE__*/React.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46299
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46300
46326
|
findExternalWidgets: findExternalWidgets,
|
|
46301
46327
|
hints: [hint]
|
|
46302
46328
|
}))
|
|
@@ -46462,7 +46488,6 @@ class MultiRenderer extends React.Component {
|
|
|
46462
46488
|
const hintRendererDatas = rendererDatas;
|
|
46463
46489
|
renderers = [...renderers];
|
|
46464
46490
|
renderers.firstN = n => /*#__PURE__*/React.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46465
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46466
46491
|
findExternalWidgets: hintRendererDatas[0] ? hintRendererDatas[0].findExternalWidgets : undefined,
|
|
46467
46492
|
hints: hintRendererDatas.map(d => d.hint),
|
|
46468
46493
|
hintsVisible: n
|
|
@@ -46492,9 +46517,11 @@ class MultiRenderer extends React.Component {
|
|
|
46492
46517
|
|
|
46493
46518
|
// Pass the renderer tree to the `children` function, which will
|
|
46494
46519
|
// determine the actual content of this component.
|
|
46495
|
-
return
|
|
46520
|
+
return /*#__PURE__*/React.createElement(DependenciesContext.Provider, {
|
|
46521
|
+
value: this.props.dependencies
|
|
46522
|
+
}, this.props.children({
|
|
46496
46523
|
renderers: this._getRenderers()
|
|
46497
|
-
});
|
|
46524
|
+
}));
|
|
46498
46525
|
}
|
|
46499
46526
|
}
|
|
46500
46527
|
const styles = StyleSheet.create({
|