@khanacademy/perseus 17.4.0 → 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 +15 -0
- package/dist/es/index.css +1 -1
- package/dist/es/index.js +25 -16
- package/dist/es/index.js.map +1 -1
- package/dist/index.css +1 -1
- package/dist/index.js +25 -16
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/__stories__/article-renderer.stories.tsx +2 -0
- package/src/__tests__/server-item-renderer.test.tsx +15 -18
- package/src/article-renderer.tsx +20 -15
- package/src/server-item-renderer.tsx +23 -20
- package/src/styles/perseus-renderer.less +1 -1
- package/src/styles/variables.less +1 -0
- package/tsconfig-build.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,20 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 17.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#909](https://github.com/Khan/perseus/pull/909) [`6c841f55`](https://github.com/Khan/perseus/commit/6c841f55027c87bfc8339816dac582f175a84193) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Reworked onFocusChange logic to solve a bug on initial render.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#908](https://github.com/Khan/perseus/pull/908) [`29563723`](https://github.com/Khan/perseus/commit/29563723cf229a9169d0c78a0174a8dbc8029861) Thanks [@benchristel](https://github.com/benchristel)! - Lighten the background color for odd-numbered rows of Markdown tables on
|
|
12
|
+
desktop-sized screens. Previously, the color was `#ededed`; it is now
|
|
13
|
+
`#f7f8fa` (Wonder Blocks offWhite).
|
|
14
|
+
|
|
15
|
+
This change ensures that color-coded math expressions will have accessible
|
|
16
|
+
contrast with the background.
|
|
17
|
+
|
|
3
18
|
## 17.4.0
|
|
4
19
|
|
|
5
20
|
### Minor Changes
|
package/dist/es/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/es/index.js
CHANGED
|
@@ -44202,7 +44202,7 @@ const init = function init(options) {
|
|
|
44202
44202
|
|
|
44203
44203
|
// This file is processed by a Rollup plugin (replace) to inject the production
|
|
44204
44204
|
const libName = "@khanacademy/perseus";
|
|
44205
|
-
const libVersion = "17.
|
|
44205
|
+
const libVersion = "17.5.0";
|
|
44206
44206
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44207
44207
|
|
|
44208
44208
|
const apiVersion = {
|
|
@@ -44258,6 +44258,17 @@ class ArticleRenderer extends React.Component {
|
|
|
44258
44258
|
});
|
|
44259
44259
|
focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
|
|
44260
44260
|
}
|
|
44261
|
+
const {
|
|
44262
|
+
onFocusChange
|
|
44263
|
+
} = this.props.apiOptions;
|
|
44264
|
+
if (onFocusChange) {
|
|
44265
|
+
// Wait for the keypad to mount before getting the height
|
|
44266
|
+
setTimeout(() => {
|
|
44267
|
+
const keypadDomNode = keypadElement == null ? void 0 : keypadElement.getDOMNode();
|
|
44268
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44269
|
+
onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
|
|
44270
|
+
}, 0);
|
|
44271
|
+
}
|
|
44261
44272
|
if (keypadElement && isMobile) {
|
|
44262
44273
|
if (didFocusInput) {
|
|
44263
44274
|
keypadElement.activate();
|
|
@@ -44265,11 +44276,6 @@ class ArticleRenderer extends React.Component {
|
|
|
44265
44276
|
keypadElement.dismiss();
|
|
44266
44277
|
}
|
|
44267
44278
|
}
|
|
44268
|
-
if (this.props.apiOptions.onFocusChange != null) {
|
|
44269
|
-
const keypadDomNode = keypadElement == null ? void 0 : keypadElement.getDOMNode();
|
|
44270
|
-
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44271
|
-
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
|
|
44272
|
-
}
|
|
44273
44279
|
};
|
|
44274
44280
|
this._onRendererBlur = blurPath => {
|
|
44275
44281
|
const blurringFocusPath = this._currentFocus;
|
|
@@ -44835,6 +44841,19 @@ class ServerItemRenderer extends React.Component {
|
|
|
44835
44841
|
const didFocusInput = this._currentFocus && inputPaths.some(inputPath => {
|
|
44836
44842
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
44837
44843
|
});
|
|
44844
|
+
if (onFocusChange != null) {
|
|
44845
|
+
// Wait for the keypad to mount before getting the height
|
|
44846
|
+
setTimeout(() => {
|
|
44847
|
+
// First, calculate the current keypad height
|
|
44848
|
+
const keypadDomNode = keypadElement == null ? void 0 : keypadElement.getDOMNode();
|
|
44849
|
+
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44850
|
+
|
|
44851
|
+
// Then call the callback
|
|
44852
|
+
onFocusChange(this._currentFocus, prevFocus, keypadHeight,
|
|
44853
|
+
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44854
|
+
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44855
|
+
}, 0);
|
|
44856
|
+
}
|
|
44838
44857
|
if (keypadElement && isMobile) {
|
|
44839
44858
|
if (didFocusInput) {
|
|
44840
44859
|
keypadElement.activate();
|
|
@@ -44842,16 +44861,6 @@ class ServerItemRenderer extends React.Component {
|
|
|
44842
44861
|
keypadElement.dismiss();
|
|
44843
44862
|
}
|
|
44844
44863
|
}
|
|
44845
|
-
if (onFocusChange != null) {
|
|
44846
|
-
// First, calculate the current keypad height
|
|
44847
|
-
const keypadDomNode = keypadElement == null ? void 0 : keypadElement.getDOMNode();
|
|
44848
|
-
const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
|
|
44849
|
-
|
|
44850
|
-
// Then call the callback
|
|
44851
|
-
onFocusChange(this._currentFocus, prevFocus, keypadHeight,
|
|
44852
|
-
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44853
|
-
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44854
|
-
}
|
|
44855
44864
|
}
|
|
44856
44865
|
_onRendererBlur(blurPath) {
|
|
44857
44866
|
const blurringFocusPath = this._currentFocus;
|