@concord-consortium/lara-interactive-api 1.9.3-pre.5 → 1.9.3-pre.6
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 +3 -4
- package/index-bundle.d.ts +3 -4
- package/index.js +6 -7
- package/package.json +1 -1
package/hooks.d.ts
CHANGED
|
@@ -23,10 +23,9 @@ export interface IUseReportItemOptions<InteractiveState, AuthoredState> {
|
|
|
23
23
|
export declare const useReportItem: <InteractiveState, AuthoredState>({ metadata, handler }: IUseReportItemOptions<InteractiveState, AuthoredState>) => void;
|
|
24
24
|
export declare const DefaultAccessibilitySettings: IAccessibilitySettings;
|
|
25
25
|
export interface IUseAccessibilityProps {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
26
|
+
updateHtmlFontSize?: boolean;
|
|
27
|
+
addBodyClass?: boolean;
|
|
28
|
+
fontFamilySelector?: string;
|
|
30
29
|
}
|
|
31
30
|
export declare const useAccessibility: (props?: IUseAccessibilityProps | undefined) => IAccessibilitySettings;
|
|
32
31
|
export {};
|
package/index-bundle.d.ts
CHANGED
|
@@ -675,10 +675,9 @@ interface IUseReportItemOptions<InteractiveState, AuthoredState> {
|
|
|
675
675
|
declare const useReportItem: <InteractiveState, AuthoredState>({ metadata, handler }: IUseReportItemOptions<InteractiveState, AuthoredState>) => void;
|
|
676
676
|
declare const DefaultAccessibilitySettings: IAccessibilitySettings;
|
|
677
677
|
interface IUseAccessibilityProps {
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
};
|
|
678
|
+
updateHtmlFontSize?: boolean;
|
|
679
|
+
addBodyClass?: boolean;
|
|
680
|
+
fontFamilySelector?: string;
|
|
682
681
|
}
|
|
683
682
|
declare const useAccessibility: (props?: IUseAccessibilityProps | undefined) => IAccessibilitySettings;
|
|
684
683
|
|
package/index.js
CHANGED
|
@@ -5589,9 +5589,9 @@ exports.DefaultAccessibilitySettings = {
|
|
|
5589
5589
|
fontFamilyForType: (0, accessibility_1.getFamilyForFontType)("normal"),
|
|
5590
5590
|
};
|
|
5591
5591
|
var useAccessibility = function (props) {
|
|
5592
|
-
var
|
|
5592
|
+
var _a = props || {}, updateHtmlFontSize = _a.updateHtmlFontSize, addBodyClass = _a.addBodyClass, fontFamilySelector = _a.fontFamilySelector;
|
|
5593
5593
|
var initMessage = (0, exports.useInitMessage)();
|
|
5594
|
-
var
|
|
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/, "-"); };
|
|
5596
5596
|
(0, react_1.useEffect)(function () {
|
|
5597
5597
|
var _a;
|
|
@@ -5599,14 +5599,13 @@ var useAccessibility = function (props) {
|
|
|
5599
5599
|
var _accessibility = initMessage.accessibility || exports.DefaultAccessibilitySettings;
|
|
5600
5600
|
var fontSize = _accessibility.fontSize, fontSizeInPx = _accessibility.fontSizeInPx, fontType = _accessibility.fontType, fontFamilyForType = _accessibility.fontFamilyForType;
|
|
5601
5601
|
setAccessibility(_accessibility);
|
|
5602
|
-
if (
|
|
5603
|
-
var fontFamilySelector = updateDOM.fontFamilySelector;
|
|
5602
|
+
if (updateHtmlFontSize || addBodyClass || fontFamilySelector) {
|
|
5604
5603
|
var html = document.getElementsByTagName("html").item(0);
|
|
5605
5604
|
var body = document.getElementsByTagName("body").item(0);
|
|
5606
|
-
if (html) {
|
|
5605
|
+
if (updateHtmlFontSize && html) {
|
|
5607
5606
|
html.style.fontSize = fontSizeInPx + "px";
|
|
5608
5607
|
}
|
|
5609
|
-
if (body) {
|
|
5608
|
+
if (addBodyClass && body) {
|
|
5610
5609
|
body.classList.add("font-size-" + normalizeClass(fontSize));
|
|
5611
5610
|
body.classList.add("font-type-" + normalizeClass(fontType));
|
|
5612
5611
|
}
|
|
@@ -5617,7 +5616,7 @@ var useAccessibility = function (props) {
|
|
|
5617
5616
|
}
|
|
5618
5617
|
}
|
|
5619
5618
|
}
|
|
5620
|
-
}, [initMessage,
|
|
5619
|
+
}, [initMessage, updateHtmlFontSize, addBodyClass, fontFamilySelector]);
|
|
5621
5620
|
return accessibility;
|
|
5622
5621
|
};
|
|
5623
5622
|
exports.useAccessibility = useAccessibility;
|