@khanacademy/perseus 9.0.0 → 10.0.1
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 +21 -0
- 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/es/index.css +3 -5
- package/dist/es/index.js +17 -16
- 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 +17 -17
- package/dist/index.js.map +1 -1
- package/dist/item-renderer.d.ts +2 -1
- package/dist/multi-items/multi-renderer.d.ts +2 -1
- package/dist/renderer.d.ts +3 -8
- package/dist/types.d.ts +1 -6
- package/dist/widget-container.d.ts +2 -1
- package/dist/widgets/expression.d.ts +8 -8
- package/dist/widgets/grapher.d.ts +2 -1
- package/dist/widgets/passage-ref.d.ts +2 -1
- package/package.json +2 -2
- package/src/__tests__/mock-asset-loading-widget.tsx +3 -2
- package/src/__tests__/renderer.test.tsx +0 -2
- package/src/__tests__/server-item-renderer.test.tsx +2 -4
- package/src/__tests__/widgets.test.ts +73 -0
- 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/hint-renderer.tsx +2 -1
- package/src/hints-renderer.tsx +2 -9
- package/src/index.ts +0 -1
- package/src/item-renderer.tsx +2 -7
- package/src/multi-items/multi-renderer.tsx +2 -7
- package/src/renderer.tsx +3 -3
- package/src/server-item-renderer.tsx +0 -1
- package/src/types.ts +1 -8
- package/src/widget-container.tsx +2 -1
- package/src/widgets/__tests__/renderQuestion.tsx +3 -11
- package/src/widgets/expression.tsx +15 -7
- package/src/widgets/grapher.tsx +4 -12
- package/src/widgets/passage-ref.tsx +1 -1
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,26 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 10.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 5f33560b: Revert type changes made in #694
|
|
8
|
+
- 0f95281c: Restore static methods on `Expression` widget component
|
|
9
|
+
- Updated dependencies [781551f9]
|
|
10
|
+
- @khanacademy/math-input@10.1.0
|
|
11
|
+
|
|
12
|
+
## 10.0.0
|
|
13
|
+
|
|
14
|
+
### Major Changes
|
|
15
|
+
|
|
16
|
+
- 9eb50ae1: Removed `LinterContextProps` type. Moved to `@khanacademy/perseus-linter` in a previous release, but wasn't deleted from this package.
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- aea86eec: Convert all usages of JSX.LibraryManagedAttributes to WB Core's PropsFor type
|
|
21
|
+
- Updated dependencies [7b11736e]
|
|
22
|
+
- @khanacademy/math-input@10.0.1
|
|
23
|
+
|
|
3
24
|
## 9.0.0
|
|
4
25
|
|
|
5
26
|
### Major Changes
|
|
@@ -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/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
|
@@ -2931,6 +2931,17 @@ const ExpressionWithDependencies = /*#__PURE__*/React.forwardRef((props, ref) =>
|
|
|
2931
2931
|
analytics: deps.analytics
|
|
2932
2932
|
}, props));
|
|
2933
2933
|
});
|
|
2934
|
+
|
|
2935
|
+
// HACK: Propogate "static" methods onto our wrapper component.
|
|
2936
|
+
// In the future we should adjust client apps to not depend on these static
|
|
2937
|
+
// methods and instead adjust Peresus to provide these facilities through
|
|
2938
|
+
// instance methods on our Renderers.
|
|
2939
|
+
// @ts-expect-error - TS2339 - Property 'validate' does not exist on type
|
|
2940
|
+
ExpressionWithDependencies.validate = Expression.validate;
|
|
2941
|
+
// @ts-expect-error - TS2339 - Property 'validate' does not exist on type
|
|
2942
|
+
ExpressionWithDependencies.getUserInputFromProps = Expression.getUserInputFromProps;
|
|
2943
|
+
// @ts-expect-error - TS2339 - Property 'validate' does not exist on type
|
|
2944
|
+
ExpressionWithDependencies.getOneCorrectAnswerFromRubric = Expression.getOneCorrectAnswerFromRubric;
|
|
2934
2945
|
var Expression$1 = {
|
|
2935
2946
|
name: "expression",
|
|
2936
2947
|
displayName: "Expression / Equation",
|
|
@@ -19220,8 +19231,8 @@ class Renderer extends React.Component {
|
|
|
19220
19231
|
|
|
19221
19232
|
// @ts-expect-error - TS2564 - Property 'widgetIds' has no initializer and is not definitely assigned in the constructor.
|
|
19222
19233
|
|
|
19223
|
-
constructor(_props
|
|
19224
|
-
super(_props
|
|
19234
|
+
constructor(_props) {
|
|
19235
|
+
super(_props);
|
|
19225
19236
|
this._currentFocus = void 0;
|
|
19226
19237
|
this._foundTextNodes = void 0;
|
|
19227
19238
|
this._interactionTrackers = void 0;
|
|
@@ -44308,13 +44319,9 @@ class HintsRenderer extends React.Component {
|
|
|
44308
44319
|
totalHints: this.props.hints.length,
|
|
44309
44320
|
ref: "hintRenderer" + i,
|
|
44310
44321
|
key: "hintRenderer" + i,
|
|
44311
|
-
apiOptions: apiOptions
|
|
44312
|
-
// @ts-expect-error - TS2339 - Property 'findExternalWidgets' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44313
|
-
,
|
|
44322
|
+
apiOptions: apiOptions,
|
|
44314
44323
|
findExternalWidgets: this.props.findExternalWidgets,
|
|
44315
|
-
linterContext: PerseusLinter.pushContextStack(
|
|
44316
|
-
// @ts-expect-error - TS2339 - Property 'linterContext' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44317
|
-
this.props.linterContext, "hints[" + i + "]")
|
|
44324
|
+
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints[" + i + "]")
|
|
44318
44325
|
});
|
|
44319
44326
|
if (isFinalHelpPage) {
|
|
44320
44327
|
hints.push(renderer);
|
|
@@ -44573,9 +44580,7 @@ class ItemRenderer extends React.Component {
|
|
|
44573
44580
|
}, /*#__PURE__*/React.createElement(HintsRenderer, {
|
|
44574
44581
|
ref: node => this.hintsRenderer = node,
|
|
44575
44582
|
hints: this.props.item.hints,
|
|
44576
|
-
hintsVisible: this.state.hintsVisible
|
|
44577
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
44578
|
-
,
|
|
44583
|
+
hintsVisible: this.state.hintsVisible,
|
|
44579
44584
|
apiOptions: apiOptions,
|
|
44580
44585
|
linterContext: PerseusLinter.pushContextStack(this.props.linterContext, "hints")
|
|
44581
44586
|
})),
|
|
@@ -45111,9 +45116,7 @@ class ServerItemRenderer extends React.Component {
|
|
|
45111
45116
|
}));
|
|
45112
45117
|
const hintsRenderer = /*#__PURE__*/React.createElement(HintsRenderer, {
|
|
45113
45118
|
hints: this.props.item.hints,
|
|
45114
|
-
hintsVisible: this.props.hintsVisible
|
|
45115
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
45116
|
-
,
|
|
45119
|
+
hintsVisible: this.props.hintsVisible,
|
|
45117
45120
|
apiOptions: apiOptions,
|
|
45118
45121
|
ref: elem => this.hintsRenderer = elem
|
|
45119
45122
|
});
|
|
@@ -46331,7 +46334,6 @@ class MultiRenderer extends React.Component {
|
|
|
46331
46334
|
// _annotateRendererArray() needs this
|
|
46332
46335
|
ref: null,
|
|
46333
46336
|
makeRenderer: () => /*#__PURE__*/React.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46334
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46335
46337
|
findExternalWidgets: findExternalWidgets,
|
|
46336
46338
|
hints: [hint]
|
|
46337
46339
|
}))
|
|
@@ -46497,7 +46499,6 @@ class MultiRenderer extends React.Component {
|
|
|
46497
46499
|
const hintRendererDatas = rendererDatas;
|
|
46498
46500
|
renderers = [...renderers];
|
|
46499
46501
|
renderers.firstN = n => /*#__PURE__*/React.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46500
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46501
46502
|
findExternalWidgets: hintRendererDatas[0] ? hintRendererDatas[0].findExternalWidgets : undefined,
|
|
46502
46503
|
hints: hintRendererDatas.map(d => d.hint),
|
|
46503
46504
|
hintsVisible: n
|