@concord-consortium/lara-interactive-api 1.9.1 → 1.9.2-pre.1

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,5 +24,6 @@ export declare const useReportItem: <InteractiveState, AuthoredState>({ metadata
24
24
  export declare const DefaultAccessibilitySettings: IAccessibilitySettings;
25
25
  export declare const useAccessibility: (props?: {
26
26
  updateHtmlFontSize?: boolean | undefined;
27
+ addBodyClass?: boolean | undefined;
27
28
  } | undefined) => IAccessibilitySettings;
28
29
  export {};
package/index-bundle.d.ts CHANGED
@@ -652,6 +652,7 @@ declare const useReportItem: <InteractiveState, AuthoredState>({ metadata, handl
652
652
  declare const DefaultAccessibilitySettings: IAccessibilitySettings;
653
653
  declare const useAccessibility: (props?: {
654
654
  updateHtmlFontSize?: boolean | undefined;
655
+ addBodyClass?: boolean | undefined;
655
656
  } | undefined) => IAccessibilitySettings;
656
657
 
657
658
  declare type ManagedStateEvent = "interactiveStateUpdated" | "globalInteractiveStateUpdated" | "authoredStateUpdated" | "initInteractive";
package/index.js CHANGED
@@ -5067,13 +5067,13 @@ exports.DefaultAccessibilitySettings = {
5067
5067
  fontSizeInPx: 16
5068
5068
  };
5069
5069
  var useAccessibility = function (props) {
5070
- var updateHtmlFontSize = (props || {}).updateHtmlFontSize;
5070
+ var _a = props || {}, updateHtmlFontSize = _a.updateHtmlFontSize, addBodyClass = _a.addBodyClass;
5071
5071
  var initMessage = (0, exports.useInitMessage)();
5072
- var _a = (0, react_1.useState)(exports.DefaultAccessibilitySettings), accessibility = _a[0], setAccessibility = _a[1];
5072
+ var _b = (0, react_1.useState)(exports.DefaultAccessibilitySettings), accessibility = _b[0], setAccessibility = _b[1];
5073
5073
  (0, react_1.useEffect)(function () {
5074
5074
  if (initMessage && initMessage.mode === "runtime") {
5075
5075
  var _accessibility = initMessage.accessibility || exports.DefaultAccessibilitySettings;
5076
- var fontSizeInPx = _accessibility.fontSizeInPx;
5076
+ var fontSize = _accessibility.fontSize, fontSizeInPx = _accessibility.fontSizeInPx;
5077
5077
  setAccessibility(_accessibility);
5078
5078
  if (updateHtmlFontSize && (fontSizeInPx !== exports.DefaultAccessibilitySettings.fontSizeInPx)) {
5079
5079
  var html = document.getElementsByTagName("html").item(0);
@@ -5081,6 +5081,12 @@ var useAccessibility = function (props) {
5081
5081
  html.style.fontSize = fontSizeInPx + "px";
5082
5082
  }
5083
5083
  }
5084
+ if (addBodyClass) {
5085
+ var body = document.getElementsByTagName("body").item(0);
5086
+ if (body) {
5087
+ body.classList.add("font-size-" + fontSize.toLowerCase().replace(/\s/, "-"));
5088
+ }
5089
+ }
5084
5090
  }
5085
5091
  }, [initMessage, updateHtmlFontSize]);
5086
5092
  return accessibility;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@concord-consortium/lara-interactive-api",
3
- "version": "1.9.1",
3
+ "version": "1.9.2-pre.1",
4
4
  "description": "LARA Interactive API client and types",
5
5
  "main": "./index.js",
6
6
  "types": "./index-bundle.d.ts",