@khanacademy/perseus 17.3.3 → 17.5.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 +25 -0
- package/dist/es/index.css +1 -1
- package/dist/es/index.js +22 -6
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +22 -6
- package/dist/index.js.map +1 -1
- package/dist/perseus-api.d.ts +2 -2
- package/dist/server-item-renderer.d.ts +1 -1
- package/dist/types.d.ts +4 -8
- package/dist/widgets/expression.d.ts +12 -12
- package/dist/widgets/label-image.d.ts +2 -2
- package/package.json +1 -1
- package/src/__stories__/article-renderer.stories.tsx +2 -0
- package/src/__tests__/server-item-renderer.test.tsx +38 -25
- package/src/article-renderer.tsx +18 -7
- package/src/index.ts +5 -4
- package/src/server-item-renderer.tsx +20 -8
- package/src/styles/perseus-renderer.less +1 -1
- package/src/styles/variables.less +1 -0
- package/src/types.ts +8 -8
- package/src/widgets/__stories__/expression.stories.tsx +2 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/dist/index.css
CHANGED
|
@@ -2508,7 +2508,7 @@ img.zoom-img {
|
|
|
2508
2508
|
padding-bottom: 2px;
|
|
2509
2509
|
}
|
|
2510
2510
|
.framework-perseus:not(.perseus-mobile) table tr:nth-child(odd) td {
|
|
2511
|
-
background-color: #
|
|
2511
|
+
background-color: #f7f8fa;
|
|
2512
2512
|
}
|
|
2513
2513
|
.framework-perseus:not(.perseus-mobile) .perseus-titled-table {
|
|
2514
2514
|
display: inline-block;
|
package/dist/index.d.ts
CHANGED
|
@@ -81,7 +81,7 @@ export type { ILogger, LogErrorOptions, ErrorKind } from "./logging/log";
|
|
|
81
81
|
export type { ServerItemRenderer as ServerItemRendererComponent } from "./server-item-renderer";
|
|
82
82
|
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";
|
|
83
83
|
export type { ParsedValue } from "./util";
|
|
84
|
-
export type { MathFormat,
|
|
84
|
+
export type { InputNumberWidget, MathFormat, PerseusAnswerArea, PerseusExpressionWidgetOptions, PerseusImageBackground, PerseusInteractiveGraphWidgetOptions, PerseusItem, PerseusPlotterWidgetOptions, PerseusRadioWidgetOptions, PerseusRenderer, } from "./perseus-types";
|
|
85
85
|
export type { Coord } from "./interactive2/types";
|
|
86
86
|
export type { MarkerType } from "./widgets/label-image/types";
|
|
87
87
|
/**
|
package/dist/index.js
CHANGED
|
@@ -44337,7 +44337,7 @@ const init = function (options) {
|
|
|
44337
44337
|
|
|
44338
44338
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44339
44339
|
const libName = "@khanacademy/perseus";
|
|
44340
|
-
const libVersion = "17.
|
|
44340
|
+
const libVersion = "17.5.0";
|
|
44341
44341
|
perseusCore.addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44342
44342
|
|
|
44343
44343
|
const apiVersion = {
|
|
@@ -44404,8 +44404,16 @@ class ArticleRenderer extends React__namespace.Component {
|
|
|
44404
44404
|
});
|
|
44405
44405
|
focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
|
|
44406
44406
|
}
|
|
44407
|
-
|
|
44408
|
-
|
|
44407
|
+
const {
|
|
44408
|
+
onFocusChange
|
|
44409
|
+
} = this.props.apiOptions;
|
|
44410
|
+
if (onFocusChange) {
|
|
44411
|
+
// Wait for the keypad to mount before getting the height
|
|
44412
|
+
setTimeout(() => {
|
|
44413
|
+
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44414
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44415
|
+
onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
|
|
44416
|
+
}, 0);
|
|
44409
44417
|
}
|
|
44410
44418
|
if (keypadElement && isMobile) {
|
|
44411
44419
|
if (didFocusInput) {
|
|
@@ -44952,9 +44960,17 @@ class ServerItemRenderer extends React__namespace.Component {
|
|
|
44952
44960
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
44953
44961
|
});
|
|
44954
44962
|
if (onFocusChange != null) {
|
|
44955
|
-
|
|
44956
|
-
|
|
44957
|
-
|
|
44963
|
+
// Wait for the keypad to mount before getting the height
|
|
44964
|
+
setTimeout(() => {
|
|
44965
|
+
// First, calculate the current keypad height
|
|
44966
|
+
const keypadDomNode = keypadElement?.getDOMNode();
|
|
44967
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44968
|
+
|
|
44969
|
+
// Then call the callback
|
|
44970
|
+
onFocusChange(this._currentFocus, prevFocus, keypadHeight,
|
|
44971
|
+
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44972
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44973
|
+
}, 0);
|
|
44958
44974
|
}
|
|
44959
44975
|
if (keypadElement && isMobile) {
|
|
44960
44976
|
if (didFocusInput) {
|