@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/dist/hint-renderer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
|
-
import type { APIOptions
|
|
2
|
+
import type { APIOptions } from "./types";
|
|
3
|
+
import type { LinterContextProps } from "@khanacademy/perseus-linter";
|
|
3
4
|
type Props = {
|
|
4
5
|
apiOptions: APIOptions;
|
|
5
6
|
className?: string;
|
package/dist/hints-renderer.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as React from "react";
|
|
2
2
|
import type Renderer from "./renderer";
|
|
3
3
|
import type { APIOptionsWithDefaults } from "./types";
|
|
4
|
-
type
|
|
4
|
+
import type { PropsFor } from "@khanacademy/wonder-blocks-core";
|
|
5
|
+
type Props = PropsFor<typeof Renderer> & {
|
|
5
6
|
className?: string;
|
|
6
7
|
hints: ReadonlyArray<any>;
|
|
7
8
|
hintsVisible?: number;
|
package/dist/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/index.d.ts
CHANGED
|
@@ -86,7 +86,7 @@ export { default as WIDGET_PROP_DENYLIST } from "./mixins/widget-prop-denylist";
|
|
|
86
86
|
export type { PerseusOptions } from "./init";
|
|
87
87
|
export type { ILogger, LogErrorOptions, ErrorKind } from "./logging/log";
|
|
88
88
|
export type { ServerItemRenderer as ServerItemRendererComponent } from "./server-item-renderer";
|
|
89
|
-
export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer,
|
|
89
|
+
export type { Alignment, APIOptions, APIOptionsWithDefaults, ChangeHandler, DeviceType, DomInsertCheckFn, EditorMode, FocusPath, Hint, ImageDict, ImageUploader, JiptLabelStore, JiptRenderer, PerseusDependencies, PerseusScore, Version, VideoData, VideoKind, WidgetDict, WidgetExports, WidgetInfo, } from "./types";
|
|
90
90
|
export type { ParsedValue } from "./util";
|
|
91
91
|
export type { MathFormat, InputNumberWidget, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusRadioWidgetOptions, PerseusExpressionWidgetOptions, PerseusRenderer, } from "./perseus-types";
|
|
92
92
|
export type { Coord } from "./interactive2/types";
|
package/dist/index.js
CHANGED
|
@@ -183,11 +183,26 @@ const getDependencies = () => {
|
|
|
183
183
|
}
|
|
184
184
|
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"));
|
|
185
185
|
};
|
|
186
|
+
const DependenciesContext = /*#__PURE__*/React__namespace.createContext({
|
|
187
|
+
analytics: {
|
|
188
|
+
onAnalyticsEvent: async () => {}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* useDependencies provides easy access to the current Perseus dependencies.
|
|
194
|
+
*/
|
|
195
|
+
const useDependencies = () => {
|
|
196
|
+
const deps = React__namespace.useContext(DependenciesContext);
|
|
197
|
+
return deps;
|
|
198
|
+
};
|
|
186
199
|
|
|
187
200
|
var dependencies = /*#__PURE__*/Object.freeze({
|
|
188
201
|
__proto__: null,
|
|
189
202
|
setDependencies: setDependencies,
|
|
190
|
-
getDependencies: getDependencies
|
|
203
|
+
getDependencies: getDependencies,
|
|
204
|
+
DependenciesContext: DependenciesContext,
|
|
205
|
+
useDependencies: useDependencies
|
|
191
206
|
});
|
|
192
207
|
|
|
193
208
|
const prettyBig = {
|
|
@@ -2489,14 +2504,6 @@ const KhanAnswerTypes = {
|
|
|
2489
2504
|
}
|
|
2490
2505
|
};
|
|
2491
2506
|
|
|
2492
|
-
const sendExpressionEvaluatedEvent = result => {
|
|
2493
|
-
getDependencies().analytics({
|
|
2494
|
-
type: "perseus:expression-evaluated",
|
|
2495
|
-
payload: {
|
|
2496
|
-
result
|
|
2497
|
-
}
|
|
2498
|
-
});
|
|
2499
|
-
};
|
|
2500
2507
|
const ERROR_MESSAGE = i18n__namespace._("Sorry, I don't understand that!");
|
|
2501
2508
|
const insertBraces = value => {
|
|
2502
2509
|
// HACK(alex): Make sure that all LaTeX super/subscripts are wrapped
|
|
@@ -2519,6 +2526,13 @@ const insertBraces = value => {
|
|
|
2519
2526
|
// TODO(alex): Properly hack MathQuill to always use explicit braces.
|
|
2520
2527
|
return value.replace(/([_^])([^{])/g, "$1{$2}");
|
|
2521
2528
|
};
|
|
2529
|
+
const deriveKeypadVersion = apiOptions => {
|
|
2530
|
+
// We can derive which version of the keypad is in use. This is
|
|
2531
|
+
// a bit tricky, but this code will be relatively short-lived
|
|
2532
|
+
// as we coalesce onto the new, v2 Keypad, at which point we
|
|
2533
|
+
// can remove this `virtualKeypadVersion` field entirely.
|
|
2534
|
+
return apiOptions.nativeKeypadProxy != null ? "REACT_NATIVE_KEYPAD" : apiOptions.customKeypad === true ? apiOptions.useV2Keypad === true ? "MATH_INPUT_KEYPAD_V2" : "MATH_INPUT_KEYPAD_V1" : "PERSEUS_MATH_INPUT";
|
|
2535
|
+
};
|
|
2522
2536
|
// The new, MathQuill input expression widget
|
|
2523
2537
|
class Expression extends React__namespace.Component {
|
|
2524
2538
|
constructor() {
|
|
@@ -2575,7 +2589,9 @@ class Expression extends React__namespace.Component {
|
|
|
2575
2589
|
});
|
|
2576
2590
|
_defineProperty(this, "simpleValidate", (rubric, onInputError) => {
|
|
2577
2591
|
onInputError = onInputError || function () {};
|
|
2578
|
-
|
|
2592
|
+
const result = Expression.validate(this.getUserInput(), rubric, onInputError);
|
|
2593
|
+
this.sendExpressionEvaluatedEvent(result.type === "invalid" ? "invalid" : result.earned === result.total ? "correct" : "incorrect");
|
|
2594
|
+
return result;
|
|
2579
2595
|
});
|
|
2580
2596
|
_defineProperty(this, "getUserInput", () => {
|
|
2581
2597
|
return Expression.getUserInputFromProps(this.props);
|
|
@@ -2733,8 +2749,6 @@ class Expression extends React__namespace.Component {
|
|
|
2733
2749
|
// we did, whether it's considered correct, incorrect, or ungraded
|
|
2734
2750
|
if (!matchingAnswerForm) {
|
|
2735
2751
|
if (firstUngradedResult) {
|
|
2736
|
-
sendExpressionEvaluatedEvent("invalid");
|
|
2737
|
-
|
|
2738
2752
|
// While we didn't directly match with any answer form, we
|
|
2739
2753
|
// did at some point get an "ungraded" validation result,
|
|
2740
2754
|
// which might indicate e.g. a mismatch in variable casing.
|
|
@@ -2748,8 +2762,6 @@ class Expression extends React__namespace.Component {
|
|
|
2748
2762
|
};
|
|
2749
2763
|
}
|
|
2750
2764
|
if (allEmpty) {
|
|
2751
|
-
sendExpressionEvaluatedEvent("invalid");
|
|
2752
|
-
|
|
2753
2765
|
// If everything graded as empty, it's invalid.
|
|
2754
2766
|
return {
|
|
2755
2767
|
type: "invalid",
|
|
@@ -2758,7 +2770,6 @@ class Expression extends React__namespace.Component {
|
|
|
2758
2770
|
}
|
|
2759
2771
|
// We fell through all the possibilities and we're not empty,
|
|
2760
2772
|
// so the answer is considered incorrect.
|
|
2761
|
-
sendExpressionEvaluatedEvent("incorrect");
|
|
2762
2773
|
return {
|
|
2763
2774
|
type: "points",
|
|
2764
2775
|
earned: 0,
|
|
@@ -2771,7 +2782,6 @@ class Expression extends React__namespace.Component {
|
|
|
2771
2782
|
const apiResult = onInputError(null,
|
|
2772
2783
|
// Reserved for some widget identifier
|
|
2773
2784
|
userInput, matchMessage);
|
|
2774
|
-
sendExpressionEvaluatedEvent("invalid");
|
|
2775
2785
|
return {
|
|
2776
2786
|
type: "invalid",
|
|
2777
2787
|
message: apiResult === false ? null : matchMessage
|
|
@@ -2783,7 +2793,6 @@ class Expression extends React__namespace.Component {
|
|
|
2783
2793
|
// TODO(eater): Seems silly to translate result to this
|
|
2784
2794
|
// invalid/points thing and immediately translate it back in
|
|
2785
2795
|
// ItemRenderer.scoreInput()
|
|
2786
|
-
sendExpressionEvaluatedEvent(matchingAnswerForm.considered === "correct" ? "correct" : "incorrect");
|
|
2787
2796
|
return {
|
|
2788
2797
|
type: "points",
|
|
2789
2798
|
earned: matchingAnswerForm.considered === "correct" ? 1 : 0,
|
|
@@ -2809,6 +2818,15 @@ class Expression extends React__namespace.Component {
|
|
|
2809
2818
|
// @ts-expect-error - TS2339 - Property 'insert' does not exist on type 'ReactInstance'.
|
|
2810
2819
|
this.refs.input.insert(keyPressed);
|
|
2811
2820
|
}
|
|
2821
|
+
sendExpressionEvaluatedEvent(result) {
|
|
2822
|
+
this.props.analytics.onAnalyticsEvent({
|
|
2823
|
+
type: "perseus:expression-evaluated",
|
|
2824
|
+
payload: {
|
|
2825
|
+
result,
|
|
2826
|
+
virtualKeypadVersion: deriveKeypadVersion(this.props.apiOptions)
|
|
2827
|
+
}
|
|
2828
|
+
});
|
|
2829
|
+
}
|
|
2812
2830
|
render() {
|
|
2813
2831
|
if (this.props.apiOptions.customKeypad) {
|
|
2814
2832
|
return /*#__PURE__*/React__namespace.createElement(mathInput.KeypadInput
|
|
@@ -2969,11 +2987,18 @@ const propUpgrades$2 = {
|
|
|
2969
2987
|
}]
|
|
2970
2988
|
})
|
|
2971
2989
|
};
|
|
2990
|
+
const ExpressionWithDependencies = /*#__PURE__*/React__namespace.forwardRef((props, ref) => {
|
|
2991
|
+
const deps = useDependencies();
|
|
2992
|
+
return /*#__PURE__*/React__namespace.createElement(Expression, _extends({
|
|
2993
|
+
ref: ref,
|
|
2994
|
+
analytics: deps.analytics
|
|
2995
|
+
}, props));
|
|
2996
|
+
});
|
|
2972
2997
|
var Expression$1 = {
|
|
2973
2998
|
name: "expression",
|
|
2974
2999
|
displayName: "Expression / Equation",
|
|
2975
3000
|
defaultAlignment: "inline-block",
|
|
2976
|
-
widget:
|
|
3001
|
+
widget: ExpressionWithDependencies,
|
|
2977
3002
|
transform: widgetOptions => {
|
|
2978
3003
|
const {
|
|
2979
3004
|
times,
|
|
@@ -19280,9 +19305,9 @@ class Renderer extends React__namespace.Component {
|
|
|
19280
19305
|
|
|
19281
19306
|
// @ts-expect-error - TS2564 - Property 'widgetIds' has no initializer and is not definitely assigned in the constructor.
|
|
19282
19307
|
|
|
19283
|
-
constructor(_props
|
|
19308
|
+
constructor(_props) {
|
|
19284
19309
|
var _this;
|
|
19285
|
-
super(_props
|
|
19310
|
+
super(_props);
|
|
19286
19311
|
_this = this;
|
|
19287
19312
|
_defineProperty(this, "_currentFocus", void 0);
|
|
19288
19313
|
_defineProperty(this, "_foundTextNodes", void 0);
|
|
@@ -44299,7 +44324,9 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44299
44324
|
// TODO(alex): Add mobile api functions and pass them down here
|
|
44300
44325
|
const sections = this._sections().map((section, i) => {
|
|
44301
44326
|
const refForSection = "section-".concat(i);
|
|
44302
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
44327
|
+
return /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
|
|
44328
|
+
value: this.props.dependencies
|
|
44329
|
+
}, /*#__PURE__*/React__namespace.createElement("div", {
|
|
44303
44330
|
key: i,
|
|
44304
44331
|
className: "clearfix"
|
|
44305
44332
|
}, /*#__PURE__*/React__namespace.createElement(Renderer, _extends({}, section, {
|
|
@@ -44318,7 +44345,7 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44318
44345
|
},
|
|
44319
44346
|
linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "article"),
|
|
44320
44347
|
legacyPerseusLint: this.props.legacyPerseusLint
|
|
44321
|
-
})));
|
|
44348
|
+
}))));
|
|
44322
44349
|
});
|
|
44323
44350
|
return /*#__PURE__*/React__namespace.createElement("div", {
|
|
44324
44351
|
className: classes
|
|
@@ -44465,7 +44492,6 @@ class HintsRenderer extends React__namespace.Component {
|
|
|
44465
44492
|
// false in hints.
|
|
44466
44493
|
return {
|
|
44467
44494
|
...ApiOptions.defaults,
|
|
44468
|
-
// @ts-expect-error - TS2339 - Property 'apiOptions' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44469
44495
|
...this.props.apiOptions,
|
|
44470
44496
|
readOnly: false
|
|
44471
44497
|
};
|
|
@@ -44552,13 +44578,9 @@ class HintsRenderer extends React__namespace.Component {
|
|
|
44552
44578
|
totalHints: this.props.hints.length,
|
|
44553
44579
|
ref: "hintRenderer" + i,
|
|
44554
44580
|
key: "hintRenderer" + i,
|
|
44555
|
-
apiOptions: apiOptions
|
|
44556
|
-
// @ts-expect-error - TS2339 - Property 'findExternalWidgets' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44557
|
-
,
|
|
44581
|
+
apiOptions: apiOptions,
|
|
44558
44582
|
findExternalWidgets: this.props.findExternalWidgets,
|
|
44559
|
-
linterContext: PerseusLinter__namespace.pushContextStack(
|
|
44560
|
-
// @ts-expect-error - TS2339 - Property 'linterContext' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44561
|
-
this.props.linterContext, "hints[" + i + "]")
|
|
44583
|
+
linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints[" + i + "]")
|
|
44562
44584
|
});
|
|
44563
44585
|
if (isFinalHelpPage) {
|
|
44564
44586
|
hints.push(renderer);
|
|
@@ -44784,7 +44806,9 @@ class ItemRenderer extends React__namespace.Component {
|
|
|
44784
44806
|
// that have completely different places in the DOM, we have to do this
|
|
44785
44807
|
// strangeness instead of relying on React's normal render() method.
|
|
44786
44808
|
// TODO(alpert): Figure out how to clean this up somehow
|
|
44787
|
-
render( /*#__PURE__*/React__namespace.createElement(
|
|
44809
|
+
render( /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
|
|
44810
|
+
value: this.props.dependencies
|
|
44811
|
+
}, /*#__PURE__*/React__namespace.createElement(Renderer, _extends({
|
|
44788
44812
|
ref: node => {
|
|
44789
44813
|
if (!node) {
|
|
44790
44814
|
return;
|
|
@@ -44812,18 +44836,18 @@ class ItemRenderer extends React__namespace.Component {
|
|
|
44812
44836
|
linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "question")
|
|
44813
44837
|
}, this.props.item.question, {
|
|
44814
44838
|
legacyPerseusLint: this.props.legacyPerseusLint
|
|
44815
|
-
})),
|
|
44839
|
+
}))),
|
|
44816
44840
|
// @ts-expect-error - TS2345 - Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'.
|
|
44817
44841
|
workArea);
|
|
44818
|
-
render( /*#__PURE__*/React__namespace.createElement(
|
|
44842
|
+
render( /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
|
|
44843
|
+
value: this.props.dependencies
|
|
44844
|
+
}, /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
|
|
44819
44845
|
ref: node => this.hintsRenderer = node,
|
|
44820
44846
|
hints: this.props.item.hints,
|
|
44821
|
-
hintsVisible: this.state.hintsVisible
|
|
44822
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
44823
|
-
,
|
|
44847
|
+
hintsVisible: this.state.hintsVisible,
|
|
44824
44848
|
apiOptions: apiOptions,
|
|
44825
44849
|
linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints")
|
|
44826
|
-
}),
|
|
44850
|
+
})),
|
|
44827
44851
|
// @ts-expect-error - TS2345 - Argument of type 'Element' is not assignable to parameter of type 'HTMLElement'.
|
|
44828
44852
|
hintsArea);
|
|
44829
44853
|
const answerArea = this.props.item.answerArea || {};
|
|
@@ -45040,7 +45064,9 @@ class ItemRenderer extends React__namespace.Component {
|
|
|
45040
45064
|
this.questionRenderer.deselectIncorrectSelectedChoices();
|
|
45041
45065
|
}
|
|
45042
45066
|
render() {
|
|
45043
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
45067
|
+
return /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
|
|
45068
|
+
value: this.props.dependencies
|
|
45069
|
+
}, /*#__PURE__*/React__namespace.createElement("div", null));
|
|
45044
45070
|
}
|
|
45045
45071
|
}
|
|
45046
45072
|
_defineProperty(ItemRenderer, "defaultProps", {
|
|
@@ -45357,20 +45383,20 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
45357
45383
|
}));
|
|
45358
45384
|
const hintsRenderer = /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
|
|
45359
45385
|
hints: this.props.item.hints,
|
|
45360
|
-
hintsVisible: this.props.hintsVisible
|
|
45361
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
45362
|
-
,
|
|
45386
|
+
hintsVisible: this.props.hintsVisible,
|
|
45363
45387
|
apiOptions: apiOptions,
|
|
45364
45388
|
ref: elem => this.hintsRenderer = elem
|
|
45365
45389
|
});
|
|
45366
|
-
return /*#__PURE__*/React__namespace.createElement(
|
|
45390
|
+
return /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
|
|
45391
|
+
value: this.props.dependencies
|
|
45392
|
+
}, /*#__PURE__*/React__namespace.createElement("div", null, /*#__PURE__*/React__namespace.createElement("div", null, questionRenderer), /*#__PURE__*/React__namespace.createElement("div", {
|
|
45367
45393
|
className:
|
|
45368
45394
|
// Avoid adding any horizontal padding when applying the
|
|
45369
45395
|
// mobile hint styles, which are flush to the left.
|
|
45370
45396
|
// NOTE(charlie): We may still want to apply this
|
|
45371
45397
|
// padding for desktop exercises.
|
|
45372
45398
|
apiOptions.isMobile ? undefined : aphrodite.css(styles$3.hintsContainer)
|
|
45373
|
-
}, hintsRenderer));
|
|
45399
|
+
}, hintsRenderer)));
|
|
45374
45400
|
}
|
|
45375
45401
|
}
|
|
45376
45402
|
_defineProperty(ServerItemRenderer, "defaultProps", {
|
|
@@ -46531,7 +46557,6 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46531
46557
|
// _annotateRendererArray() needs this
|
|
46532
46558
|
ref: null,
|
|
46533
46559
|
makeRenderer: () => /*#__PURE__*/React__namespace.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46534
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46535
46560
|
findExternalWidgets: findExternalWidgets,
|
|
46536
46561
|
hints: [hint]
|
|
46537
46562
|
}))
|
|
@@ -46697,7 +46722,6 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46697
46722
|
const hintRendererDatas = rendererDatas;
|
|
46698
46723
|
renderers = [...renderers];
|
|
46699
46724
|
renderers.firstN = n => /*#__PURE__*/React__namespace.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46700
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46701
46725
|
findExternalWidgets: hintRendererDatas[0] ? hintRendererDatas[0].findExternalWidgets : undefined,
|
|
46702
46726
|
hints: hintRendererDatas.map(d => d.hint),
|
|
46703
46727
|
hintsVisible: n
|
|
@@ -46727,9 +46751,11 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46727
46751
|
|
|
46728
46752
|
// Pass the renderer tree to the `children` function, which will
|
|
46729
46753
|
// determine the actual content of this component.
|
|
46730
|
-
return
|
|
46754
|
+
return /*#__PURE__*/React__namespace.createElement(DependenciesContext.Provider, {
|
|
46755
|
+
value: this.props.dependencies
|
|
46756
|
+
}, this.props.children({
|
|
46731
46757
|
renderers: this._getRenderers()
|
|
46732
|
-
});
|
|
46758
|
+
}));
|
|
46733
46759
|
}
|
|
46734
46760
|
}
|
|
46735
46761
|
const styles = aphrodite.StyleSheet.create({
|