@concord-consortium/lara-interactive-api 1.9.3-pre.2 → 1.9.3-pre.3

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/hooks.d.ts CHANGED
@@ -24,7 +24,7 @@ export declare const useReportItem: <InteractiveState, AuthoredState>({ metadata
24
24
  export declare const DefaultAccessibilitySettings: IAccessibilitySettings;
25
25
  export interface IUseAccessibilityProps {
26
26
  updateHtmlFontSize?: boolean;
27
- updateHtmlFontFamily?: boolean;
27
+ updateBodyFontFamily?: boolean;
28
28
  addBodyClass?: boolean;
29
29
  }
30
30
  export declare const useAccessibility: (props?: IUseAccessibilityProps | undefined) => IAccessibilitySettings;
package/index-bundle.d.ts CHANGED
@@ -676,7 +676,7 @@ declare const useReportItem: <InteractiveState, AuthoredState>({ metadata, handl
676
676
  declare const DefaultAccessibilitySettings: IAccessibilitySettings;
677
677
  interface IUseAccessibilityProps {
678
678
  updateHtmlFontSize?: boolean;
679
- updateHtmlFontFamily?: boolean;
679
+ updateBodyFontFamily?: boolean;
680
680
  addBodyClass?: boolean;
681
681
  }
682
682
  declare const useAccessibility: (props?: IUseAccessibilityProps | undefined) => IAccessibilitySettings;
package/index.js CHANGED
@@ -5589,7 +5589,7 @@ exports.DefaultAccessibilitySettings = {
5589
5589
  fontFamilyForType: (0, accessibility_1.getFamilyForFontType)("normal"),
5590
5590
  };
5591
5591
  var useAccessibility = function (props) {
5592
- var _a = props || {}, updateHtmlFontSize = _a.updateHtmlFontSize, updateHtmlFontFamily = _a.updateHtmlFontFamily, addBodyClass = _a.addBodyClass;
5592
+ var _a = props || {}, updateHtmlFontSize = _a.updateHtmlFontSize, updateBodyFontFamily = _a.updateBodyFontFamily, addBodyClass = _a.addBodyClass;
5593
5593
  var initMessage = (0, exports.useInitMessage)();
5594
5594
  var _b = (0, react_1.useState)(exports.DefaultAccessibilitySettings), accessibility = _b[0], setAccessibility = _b[1];
5595
5595
  var normalizeClass = function (text) { return text.toLowerCase().replace(/\s/, "-"); };
@@ -5598,23 +5598,17 @@ var useAccessibility = function (props) {
5598
5598
  var _accessibility = initMessage.accessibility || exports.DefaultAccessibilitySettings;
5599
5599
  var fontSize = _accessibility.fontSize, fontSizeInPx = _accessibility.fontSizeInPx, fontType = _accessibility.fontType, fontFamilyForType = _accessibility.fontFamilyForType;
5600
5600
  setAccessibility(_accessibility);
5601
- if (updateHtmlFontSize || updateHtmlFontFamily) {
5602
- var html = document.getElementsByTagName("html").item(0);
5603
- if (html) {
5604
- if (updateHtmlFontSize && (fontSizeInPx !== exports.DefaultAccessibilitySettings.fontSizeInPx)) {
5605
- html.style.fontSize = fontSizeInPx + "px";
5606
- }
5607
- if (updateHtmlFontFamily && (fontType !== exports.DefaultAccessibilitySettings.fontType)) {
5608
- html.style.fontFamily = fontFamilyForType;
5609
- }
5610
- }
5601
+ var html = document.getElementsByTagName("html").item(0);
5602
+ var body = document.getElementsByTagName("body").item(0);
5603
+ if (updateHtmlFontSize && (fontSize !== exports.DefaultAccessibilitySettings.fontSize) && html) {
5604
+ html.style.fontSize = fontSizeInPx + "px";
5611
5605
  }
5612
- if (addBodyClass) {
5613
- var body = document.getElementsByTagName("body").item(0);
5614
- if (body) {
5615
- body.classList.add("font-size-" + normalizeClass(fontSize));
5616
- body.classList.add("font-type-" + normalizeClass(fontType));
5617
- }
5606
+ if (updateBodyFontFamily && (fontType !== exports.DefaultAccessibilitySettings.fontType) && body) {
5607
+ body.style.fontFamily = fontFamilyForType;
5608
+ }
5609
+ if (addBodyClass && body) {
5610
+ body.classList.add("font-size-" + normalizeClass(fontSize));
5611
+ body.classList.add("font-type-" + normalizeClass(fontType));
5618
5612
  }
5619
5613
  }
5620
5614
  }, [initMessage, updateHtmlFontSize]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concord-consortium/lara-interactive-api",
3
- "version": "1.9.3-pre.2",
3
+ "version": "1.9.3-pre.3",
4
4
  "description": "LARA Interactive API client and types",
5
5
  "main": "./index.js",
6
6
  "types": "./index-bundle.d.ts",