@khanacademy/perseus 17.4.0 → 17.6.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,26 @@
1
1
  # @khanacademy/perseus
2
2
 
3
+ ## 17.6.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#907](https://github.com/Khan/perseus/pull/907) [`83884550`](https://github.com/Khan/perseus/commit/83884550df8b394e9afa6e95947c987614e2d242) Thanks [@nishasy](https://github.com/nishasy)! - Display names have been updated to better match type names
8
+
9
+ ## 17.5.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#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.
14
+
15
+ ### Patch Changes
16
+
17
+ - [#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
18
+ desktop-sized screens. Previously, the color was `#ededed`; it is now
19
+ `#f7f8fa` (Wonder Blocks offWhite).
20
+
21
+ This change ensures that color-coded math expressions will have accessible
22
+ contrast with the background.
23
+
3
24
  ## 17.4.0
4
25
 
5
26
  ### 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: #ededed;
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
@@ -21405,7 +21405,7 @@ const propTransform$4 = widgetOptions => {
21405
21405
  };
21406
21406
  var InputNumber$1 = {
21407
21407
  name: "input-number",
21408
- displayName: "Number text box (old)",
21408
+ displayName: "Input number (deprecated - use numeric input instead)",
21409
21409
  defaultAlignment: "inline-block",
21410
21410
  hidden: true,
21411
21411
  widget: InputNumber,
@@ -21818,7 +21818,7 @@ const propsTransform = function propsTransform(widgetOptions) {
21818
21818
  };
21819
21819
  var NumericInput$1 = {
21820
21820
  name: "numeric-input",
21821
- displayName: "Number text box",
21821
+ displayName: "Numeric input",
21822
21822
  defaultAlignment: "inline-block",
21823
21823
  accessible: true,
21824
21824
  widget: NumericInput,
@@ -23802,7 +23802,7 @@ const propUpgrades$1 = {
23802
23802
  };
23803
23803
  var Radio = {
23804
23804
  name: "radio",
23805
- displayName: "Multiple choice",
23805
+ displayName: "Radio / Multiple choice",
23806
23806
  accessible: true,
23807
23807
  widget: Radio$1,
23808
23808
  transform: transform,
@@ -26661,7 +26661,7 @@ _.extend(Iframe, {
26661
26661
  });
26662
26662
  var Iframe$1 = {
26663
26663
  name: "iframe",
26664
- displayName: "Iframe",
26664
+ displayName: "Iframe (deprecated)",
26665
26665
  widget: Iframe,
26666
26666
  // Let's not expose it to all content creators yet
26667
26667
  hidden: true
@@ -32295,7 +32295,7 @@ const transformProps = function transformProps(editorProps) {
32295
32295
  };
32296
32296
  var LightsPuzzle$1 = {
32297
32297
  name: "lights-puzzle",
32298
- displayName: "Lights Puzzle",
32298
+ displayName: "Lights puzzle (deprecated)",
32299
32299
  hidden: true,
32300
32300
  widget: LightsPuzzle,
32301
32301
  transform: transformProps
@@ -33238,7 +33238,7 @@ const styles$d = StyleSheet.create({
33238
33238
  });
33239
33239
  var Matcher$1 = {
33240
33240
  name: "matcher",
33241
- displayName: "Two column matcher",
33241
+ displayName: "Matcher (two column)",
33242
33242
  widget: Matcher,
33243
33243
  isLintable: true
33244
33244
  };
@@ -39303,7 +39303,7 @@ ReactionDiagramWidget.defaultProps = {
39303
39303
  };
39304
39304
  var ReactionDiagram = {
39305
39305
  name: "reaction-diagram",
39306
- displayName: "Chemical reaction",
39306
+ displayName: "Chemical reaction diagram (deprecated)",
39307
39307
  hidden: true,
39308
39308
  widget: ReactionDiagramWidget
39309
39309
  };
@@ -39397,7 +39397,7 @@ const traverseChildWidgets = function traverseChildWidgets(props, traverseRender
39397
39397
  };
39398
39398
  var Sequence$1 = {
39399
39399
  name: "sequence",
39400
- displayName: "Graded Sequence",
39400
+ displayName: "Graded sequence (deprecated)",
39401
39401
  widget: Sequence,
39402
39402
  traverseChildWidgets: traverseChildWidgets,
39403
39403
  tracking: "all",
@@ -40106,7 +40106,7 @@ const propTransform$1 = editorProps => {
40106
40106
  };
40107
40107
  var Simulator$1 = {
40108
40108
  name: "simulator",
40109
- displayName: "Simulator",
40109
+ displayName: "Simulator (deprecated)",
40110
40110
  widget: Simulator,
40111
40111
  transform: propTransform$1,
40112
40112
  hidden: true
@@ -40526,7 +40526,7 @@ const propTransform = editorProps => {
40526
40526
  };
40527
40527
  var Table$1 = {
40528
40528
  name: "table",
40529
- displayName: "Table of values",
40529
+ displayName: "Table (deprecated - use markdown table instead)",
40530
40530
  accessible: true,
40531
40531
  widget: Table,
40532
40532
  transform: propTransform,
@@ -42937,7 +42937,8 @@ Transformer.defaultProps = _.defaults({
42937
42937
  }, defaultTransformerProps);
42938
42938
  var Transformer$1 = {
42939
42939
  name: "transformer",
42940
- displayName: "Transformer",
42940
+ displayName: "Transformer (deprecated)",
42941
+ hidden: true,
42941
42942
  widget: Transformer
42942
42943
  };
42943
42944
 
@@ -43984,7 +43985,7 @@ const primUnits = function primUnits(expr) {
43984
43985
  };
43985
43986
  var Unit = {
43986
43987
  name: "unit-input",
43987
- displayName: "Unit",
43988
+ displayName: "Unit input",
43988
43989
  defaultAlignment: "inline-block",
43989
43990
  widget: OldUnitInput,
43990
43991
  transform: x => lens(x).del(["value"]).freeze(),
@@ -44202,7 +44203,7 @@ const init = function init(options) {
44202
44203
 
44203
44204
  // This file is processed by a Rollup plugin (replace) to inject the production
44204
44205
  const libName = "@khanacademy/perseus";
44205
- const libVersion = "17.4.0";
44206
+ const libVersion = "17.6.0";
44206
44207
  addLibraryVersionToPerseusDebug(libName, libVersion);
44207
44208
 
44208
44209
  const apiVersion = {
@@ -44258,6 +44259,17 @@ class ArticleRenderer extends React.Component {
44258
44259
  });
44259
44260
  focusedInput = this.sectionRenderers[sectionIndex].getDOMNodeForPath(focusPath);
44260
44261
  }
44262
+ const {
44263
+ onFocusChange
44264
+ } = this.props.apiOptions;
44265
+ if (onFocusChange) {
44266
+ // Wait for the keypad to mount before getting the height
44267
+ setTimeout(() => {
44268
+ const keypadDomNode = keypadElement == null ? void 0 : keypadElement.getDOMNode();
44269
+ const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44270
+ onFocusChange(this._currentFocus, prevFocusPath, keypadHeight, didFocusInput ? focusedInput : null);
44271
+ }, 0);
44272
+ }
44261
44273
  if (keypadElement && isMobile) {
44262
44274
  if (didFocusInput) {
44263
44275
  keypadElement.activate();
@@ -44265,11 +44277,6 @@ class ArticleRenderer extends React.Component {
44265
44277
  keypadElement.dismiss();
44266
44278
  }
44267
44279
  }
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
44280
  };
44274
44281
  this._onRendererBlur = blurPath => {
44275
44282
  const blurringFocusPath = this._currentFocus;
@@ -44835,6 +44842,19 @@ class ServerItemRenderer extends React.Component {
44835
44842
  const didFocusInput = this._currentFocus && inputPaths.some(inputPath => {
44836
44843
  return Util.inputPathsEqual(inputPath, this._currentFocus);
44837
44844
  });
44845
+ if (onFocusChange != null) {
44846
+ // Wait for the keypad to mount before getting the height
44847
+ setTimeout(() => {
44848
+ // First, calculate the current keypad height
44849
+ const keypadDomNode = keypadElement == null ? void 0 : keypadElement.getDOMNode();
44850
+ const keypadHeight = keypadDomNode && didFocusInput ? keypadDomNode.getBoundingClientRect().height : 0;
44851
+
44852
+ // Then call the callback
44853
+ onFocusChange(this._currentFocus, prevFocus, keypadHeight,
44854
+ // @ts-expect-error [FEI-5003] - TS2345 - Argument of type 'false | Element | Text | null | undefined' is not assignable to parameter of type 'HTMLElement | undefined'.
44855
+ didFocusInput && this.questionRenderer.getDOMNodeForPath(newFocus));
44856
+ }, 0);
44857
+ }
44838
44858
  if (keypadElement && isMobile) {
44839
44859
  if (didFocusInput) {
44840
44860
  keypadElement.activate();
@@ -44842,16 +44862,6 @@ class ServerItemRenderer extends React.Component {
44842
44862
  keypadElement.dismiss();
44843
44863
  }
44844
44864
  }
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
44865
  }
44856
44866
  _onRendererBlur(blurPath) {
44857
44867
  const blurringFocusPath = this._currentFocus;