@khanacademy/perseus 17.3.3 → 17.4.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 +10 -0
- package/dist/es/index.js +16 -9
- package/dist/es/index.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +16 -9
- 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/__tests__/server-item-renderer.test.tsx +23 -7
- package/src/article-renderer.tsx +15 -9
- package/src/index.ts +5 -4
- package/src/server-item-renderer.tsx +18 -9
- 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,15 @@
|
|
|
1
1
|
# @khanacademy/perseus
|
|
2
2
|
|
|
3
|
+
## 17.4.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#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
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#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
|
|
12
|
+
|
|
3
13
|
## 17.3.3
|
|
4
14
|
|
|
5
15
|
### Patch Changes
|
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.4.0";
|
|
44206
44206
|
addLibraryVersionToPerseusDebug(libName, libVersion);
|
|
44207
44207
|
|
|
44208
44208
|
const apiVersion = {
|
|
@@ -44258,9 +44258,6 @@ class ArticleRenderer extends React.Component {
|
|
|
44258
44258
|
});
|
|
44259
44259
|
focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
|
|
44260
44260
|
}
|
|
44261
|
-
if (this.props.apiOptions.onFocusChange != null) {
|
|
44262
|
-
this.props.apiOptions.onFocusChange(this._currentFocus, prevFocusPath, didFocusInput ? keypadElement == null ? void 0 : keypadElement.getDOMNode() : null, didFocusInput ? focusedInput : null);
|
|
44263
|
-
}
|
|
44264
44261
|
if (keypadElement && isMobile) {
|
|
44265
44262
|
if (didFocusInput) {
|
|
44266
44263
|
keypadElement.activate();
|
|
@@ -44268,6 +44265,11 @@ class ArticleRenderer extends React.Component {
|
|
|
44268
44265
|
keypadElement.dismiss();
|
|
44269
44266
|
}
|
|
44270
44267
|
}
|
|
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
|
+
}
|
|
44271
44273
|
};
|
|
44272
44274
|
this._onRendererBlur = blurPath => {
|
|
44273
44275
|
const blurringFocusPath = this._currentFocus;
|
|
@@ -44833,11 +44835,6 @@ class ServerItemRenderer extends React.Component {
|
|
|
44833
44835
|
const didFocusInput = this._currentFocus && inputPaths.some(inputPath => {
|
|
44834
44836
|
return Util.inputPathsEqual(inputPath, this._currentFocus);
|
|
44835
44837
|
});
|
|
44836
|
-
if (onFocusChange != null) {
|
|
44837
|
-
onFocusChange(this._currentFocus, prevFocus, didFocusInput ? keypadElement == null ? void 0 : keypadElement.getDOMNode() : null,
|
|
44838
|
-
// @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
|
|
44839
|
-
didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
|
|
44840
|
-
}
|
|
44841
44838
|
if (keypadElement && isMobile) {
|
|
44842
44839
|
if (didFocusInput) {
|
|
44843
44840
|
keypadElement.activate();
|
|
@@ -44845,6 +44842,16 @@ class ServerItemRenderer extends React.Component {
|
|
|
44845
44842
|
keypadElement.dismiss();
|
|
44846
44843
|
}
|
|
44847
44844
|
}
|
|
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
|
+
}
|
|
44848
44855
|
}
|
|
44849
44856
|
_onRendererBlur(blurPath) {
|
|
44850
44857
|
const blurringFocusPath = this._currentFocus;
|