@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/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
|
@@ -2994,6 +2994,17 @@ const ExpressionWithDependencies = /*#__PURE__*/React__namespace.forwardRef((pro
|
|
|
2994
2994
|
analytics: deps.analytics
|
|
2995
2995
|
}, props));
|
|
2996
2996
|
});
|
|
2997
|
+
|
|
2998
|
+
// HACK: Propogate "static" methods onto our wrapper component.
|
|
2999
|
+
// In the future we should adjust client apps to not depend on these static
|
|
3000
|
+
// methods and instead adjust Peresus to provide these facilities through
|
|
3001
|
+
// instance methods on our Renderers.
|
|
3002
|
+
// @ts-expect-error - TS2339 - Property 'validate' does not exist on type
|
|
3003
|
+
ExpressionWithDependencies.validate = Expression.validate;
|
|
3004
|
+
// @ts-expect-error - TS2339 - Property 'validate' does not exist on type
|
|
3005
|
+
ExpressionWithDependencies.getUserInputFromProps = Expression.getUserInputFromProps;
|
|
3006
|
+
// @ts-expect-error - TS2339 - Property 'validate' does not exist on type
|
|
3007
|
+
ExpressionWithDependencies.getOneCorrectAnswerFromRubric = Expression.getOneCorrectAnswerFromRubric;
|
|
2997
3008
|
var Expression$1 = {
|
|
2998
3009
|
name: "expression",
|
|
2999
3010
|
displayName: "Expression / Equation",
|
|
@@ -19305,9 +19316,9 @@ class Renderer extends React__namespace.Component {
|
|
|
19305
19316
|
|
|
19306
19317
|
// @ts-expect-error - TS2564 - Property 'widgetIds' has no initializer and is not definitely assigned in the constructor.
|
|
19307
19318
|
|
|
19308
|
-
constructor(_props
|
|
19319
|
+
constructor(_props) {
|
|
19309
19320
|
var _this;
|
|
19310
|
-
super(_props
|
|
19321
|
+
super(_props);
|
|
19311
19322
|
_this = this;
|
|
19312
19323
|
_defineProperty(this, "_currentFocus", void 0);
|
|
19313
19324
|
_defineProperty(this, "_foundTextNodes", void 0);
|
|
@@ -44492,7 +44503,6 @@ class HintsRenderer extends React__namespace.Component {
|
|
|
44492
44503
|
// false in hints.
|
|
44493
44504
|
return {
|
|
44494
44505
|
...ApiOptions.defaults,
|
|
44495
|
-
// @ts-expect-error - TS2339 - Property 'apiOptions' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44496
44506
|
...this.props.apiOptions,
|
|
44497
44507
|
readOnly: false
|
|
44498
44508
|
};
|
|
@@ -44579,13 +44589,9 @@ class HintsRenderer extends React__namespace.Component {
|
|
|
44579
44589
|
totalHints: this.props.hints.length,
|
|
44580
44590
|
ref: "hintRenderer" + i,
|
|
44581
44591
|
key: "hintRenderer" + i,
|
|
44582
|
-
apiOptions: apiOptions
|
|
44583
|
-
// @ts-expect-error - TS2339 - Property 'findExternalWidgets' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44584
|
-
,
|
|
44592
|
+
apiOptions: apiOptions,
|
|
44585
44593
|
findExternalWidgets: this.props.findExternalWidgets,
|
|
44586
|
-
linterContext: PerseusLinter__namespace.pushContextStack(
|
|
44587
|
-
// @ts-expect-error - TS2339 - Property 'linterContext' does not exist on type 'Readonly<{ className?: string | undefined; hints: readonly any[]; hintsVisible?: number | undefined; }> & Readonly<{ children?: ReactNode; }>'.
|
|
44588
|
-
this.props.linterContext, "hints[" + i + "]")
|
|
44594
|
+
linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints[" + i + "]")
|
|
44589
44595
|
});
|
|
44590
44596
|
if (isFinalHelpPage) {
|
|
44591
44597
|
hints.push(renderer);
|
|
@@ -44849,9 +44855,7 @@ class ItemRenderer extends React__namespace.Component {
|
|
|
44849
44855
|
}, /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
|
|
44850
44856
|
ref: node => this.hintsRenderer = node,
|
|
44851
44857
|
hints: this.props.item.hints,
|
|
44852
|
-
hintsVisible: this.state.hintsVisible
|
|
44853
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
44854
|
-
,
|
|
44858
|
+
hintsVisible: this.state.hintsVisible,
|
|
44855
44859
|
apiOptions: apiOptions,
|
|
44856
44860
|
linterContext: PerseusLinter__namespace.pushContextStack(this.props.linterContext, "hints")
|
|
44857
44861
|
})),
|
|
@@ -45390,9 +45394,7 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
45390
45394
|
}));
|
|
45391
45395
|
const hintsRenderer = /*#__PURE__*/React__namespace.createElement(HintsRenderer, {
|
|
45392
45396
|
hints: this.props.item.hints,
|
|
45393
|
-
hintsVisible: this.props.hintsVisible
|
|
45394
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
45395
|
-
,
|
|
45397
|
+
hintsVisible: this.props.hintsVisible,
|
|
45396
45398
|
apiOptions: apiOptions,
|
|
45397
45399
|
ref: elem => this.hintsRenderer = elem
|
|
45398
45400
|
});
|
|
@@ -46566,7 +46568,6 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46566
46568
|
// _annotateRendererArray() needs this
|
|
46567
46569
|
ref: null,
|
|
46568
46570
|
makeRenderer: () => /*#__PURE__*/React__namespace.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46569
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46570
46571
|
findExternalWidgets: findExternalWidgets,
|
|
46571
46572
|
hints: [hint]
|
|
46572
46573
|
}))
|
|
@@ -46732,7 +46733,6 @@ class MultiRenderer extends React__namespace.Component {
|
|
|
46732
46733
|
const hintRendererDatas = rendererDatas;
|
|
46733
46734
|
renderers = [...renderers];
|
|
46734
46735
|
renderers.firstN = n => /*#__PURE__*/React__namespace.createElement(HintsRenderer, _extends({}, this._getRendererProps(), {
|
|
46735
|
-
// @ts-expect-error - TS2769 - No overload matches this call.
|
|
46736
46736
|
findExternalWidgets: hintRendererDatas[0] ? hintRendererDatas[0].findExternalWidgets : undefined,
|
|
46737
46737
|
hints: hintRendererDatas.map(d => d.hint),
|
|
46738
46738
|
hintsVisible: n
|