@khanacademy/perseus 17.3.2 → 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 CHANGED
@@ -1,5 +1,21 @@
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
+
13
+ ## 17.3.3
14
+
15
+ ### Patch Changes
16
+
17
+ - [#876](https://github.com/Khan/perseus/pull/876) [`fdc00c90`](https://github.com/Khan/perseus/commit/fdc00c90a19d3e241b3a5cdc2b1df5d761b24af3) Thanks [@jeremywiebe](https://github.com/jeremywiebe)! - Adjust CSS to ensure all `code` and `pre` blocks rendered by Perseus have a monospace font and common styling
18
+
3
19
  ## 17.3.2
4
20
 
5
21
  ### Patch Changes
package/dist/es/index.css CHANGED
@@ -1490,6 +1490,18 @@ body.mobile ul.inequalities-one-line-radios > li {
1490
1490
  clear: both;
1491
1491
  }
1492
1492
  /* Fall back colors? Eg educator, talks & interviews */
1493
+ .framework-perseus code {
1494
+ font-family: Courier, monospace;
1495
+ }
1496
+ .framework-perseus pre {
1497
+ background-color: #f0f1f2;
1498
+ border-radius: 4px;
1499
+ color: #21242c;
1500
+ font-size: 18px;
1501
+ padding: 16px;
1502
+ white-space: pre;
1503
+ overflow: auto;
1504
+ }
1493
1505
  .framework-perseus.perseus-article:not(.perseus-mobile) .perseus-widget-container:not(.perseus-widget__definition) {
1494
1506
  font-size: 14px;
1495
1507
  line-height: 19.6px;
@@ -1634,17 +1646,7 @@ body.mobile ul.inequalities-one-line-radios > li {
1634
1646
  line-height: 1.5;
1635
1647
  margin: 0;
1636
1648
  }
1637
- .framework-perseus.perseus-article:not(.perseus-mobile) code {
1638
- font-family: Courier, monospace;
1639
- }
1640
1649
  .framework-perseus.perseus-article:not(.perseus-mobile) pre {
1641
- background-color: #f0f1f2;
1642
- border-radius: 4px;
1643
- color: #21242c;
1644
- font-size: 18px;
1645
- padding: 16px;
1646
- white-space: pre;
1647
- overflow: auto;
1648
1650
  margin: 0 -16px 32px -16px;
1649
1651
  }
1650
1652
  .framework-perseus:not(.perseus-article):not(.perseus-mobile) .perseus-radio-option-content .perseus-renderer > .paragraph {
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.3.2";
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;