@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
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
|
+
|
|
18
|
+
## 17.4.0
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- [#902](https://github.com/Khan/perseus/pull/902) [`c9db8185`](https://github.com/Khan/perseus/commit/c9db818510e2e0fd142c23298890dcad89a7549a) Thanks [@SonicScrewdriver](https://github.com/SonicScrewdriver)! - Updated OnFocusChange method to return the keypadHeight rather than the DOMNode
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#887](https://github.com/Khan/perseus/pull/887) [`d09fdb98`](https://github.com/Khan/perseus/commit/d09fdb98963f23dbeb2009518513db671e0f09bb) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Export `PerseusItem` type which represents an exercise question
|
|
27
|
+
|
|
3
28
|
## 17.3.3
|
|
4
29
|
|
|
5
30
|
### Patch 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,8 +44258,16 @@ class ArticleRenderer extends React.Component {
|
|
|
44258
44258
|
});
|
|
44259
44259
|
focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
|
|
44260
44260
|
}
|
|
44261
|
-
|
|
44262
|
-
|
|
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);
|
|
44263
44271
|
}
|
|
44264
44272
|
if (keypadElement && isMobile) {
|
|
44265
44273
|
if (didFocusInput) {
|
|
@@ -44834,9 +44842,17 @@ class ServerItemRenderer extends React.Component {
|
|
|
44834
44842
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
44835
44843
|
});
|
|
44836
44844
|
if (onFocusChange != null) {
|
|
44837
|
-
|
|
44838
|
-
|
|
44839
|
-
|
|
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);
|
|
44840
44856
|
}
|
|
44841
44857
|
if (keypadElement && isMobile) {
|
|
44842
44858
|
if (didFocusInput) {
|