@redocly/theme 0.44.0 → 0.44.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/lib/components/CodeBlock/CodeBlockControls.js +3 -3
- package/lib/components/Image/Image.js +1 -1
- package/lib/components/SidebarActions/SidebarActions.js +6 -3
- package/lib/core/utils/dom.d.ts +1 -1
- package/package.json +3 -3
- package/src/components/CodeBlock/CodeBlockControls.tsx +1 -1
- package/src/components/Image/Image.tsx +7 -1
- package/src/components/SidebarActions/SidebarActions.tsx +5 -3
- package/src/core/utils/dom.ts +1 -1
- package/src/core/utils/with-load-progress.ts +1 -1
|
@@ -39,9 +39,9 @@ function CodeBlockControls({ children, className, title, controls, tabs, }) {
|
|
|
39
39
|
select ? (react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "select-all", icon: controlsType === 'icon' ? react_1.default.createElement(SelectIcon_1.SelectIcon, null) : undefined, onClick: select === null || select === void 0 ? void 0 : select.onClick }, controlsType !== 'icon' && (select === null || select === void 0 ? void 0 : select.label) ? select.label : 'Select all')) : null,
|
|
40
40
|
deselect ? (react_1.default.createElement(ControlButton, { variant: "text", size: "small", "data-testid": "clear-all", icon: controlsType === 'icon' ? react_1.default.createElement(DeselectIcon_1.DeselectIcon, null) : undefined, onClick: deselect === null || deselect === void 0 ? void 0 : deselect.onClick }, controlsType !== 'icon' && (deselect === null || deselect === void 0 ? void 0 : deselect.label) ? deselect.label : 'Clear all')) : null,
|
|
41
41
|
copy && !((_e = codeSnippet === null || codeSnippet === void 0 ? void 0 : codeSnippet.copy) === null || _e === void 0 ? void 0 : _e.hide) ? (react_1.default.createElement(CopyButton_1.CopyButton, { data: copy.data, "data-source": copy.dataSource, "data-hash": copy.dataHash, type: controlsType, toasterPlacement: copy.toasterPlacement, toasterDuration: copy.toasterDuration, buttonText: copy.label, onCopyClick: () => {
|
|
42
|
-
var _a;
|
|
43
|
-
copy === null || copy === void 0 ? void 0 : copy.onClick;
|
|
44
|
-
(
|
|
42
|
+
var _a, _b;
|
|
43
|
+
(_a = copy === null || copy === void 0 ? void 0 : copy.onClick) === null || _a === void 0 ? void 0 : _a.call(copy);
|
|
44
|
+
(_b = telemetry === null || telemetry === void 0 ? void 0 : telemetry.send) === null || _b === void 0 ? void 0 : _b.call(telemetry, 'code_snippet_copied', {});
|
|
45
45
|
} })) : null))) : null;
|
|
46
46
|
return children || controls ? (react_1.default.createElement(ContainerWrapper, { "data-component-name": "CodeBlock/CodeBlockControls", className: className }, children ? children : defaultControls)) : null;
|
|
47
47
|
}
|
|
@@ -12,7 +12,7 @@ function Image(props) {
|
|
|
12
12
|
const parsedSourceSetMap = react_1.default.useMemo(() => {
|
|
13
13
|
return srcSet ? (0, utils_1.parseSrcSet)(srcSet) : new Map();
|
|
14
14
|
}, [srcSet]);
|
|
15
|
-
return (react_1.default.createElement(react_1.default.Fragment, null, src ? (react_1.default.createElement("img", { src: src, alt: alt, className: className })) : (Array.from(parsedSourceSetMap).map(([key, value]) => (react_1.default.createElement(ColorModeAwareImage, { key: key, colorMode: key, src: value, alt: alt }))))));
|
|
15
|
+
return (react_1.default.createElement(react_1.default.Fragment, null, src ? (react_1.default.createElement("img", { src: src, alt: alt, className: className })) : (Array.from(parsedSourceSetMap).map(([key, value]) => (react_1.default.createElement(ColorModeAwareImage, { key: key, colorMode: key, src: value, alt: alt, className: className }))))));
|
|
16
16
|
}
|
|
17
17
|
exports.Image = Image;
|
|
18
18
|
const ColorModeAwareImage = styled_components_1.default.img `
|
|
@@ -21,9 +21,12 @@ const SidebarActions = ({ layout, hideCollapseSidebarButton = false, collapsedSi
|
|
|
21
21
|
!hideCollapseSidebarButton && (react_1.default.createElement(Button_1.Button, { onClick: () => {
|
|
22
22
|
var _a, _b;
|
|
23
23
|
onChangeCollapseSidebarClick();
|
|
24
|
-
collapsedSidebar
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
if (collapsedSidebar) {
|
|
25
|
+
(_a = telemetry.send) === null || _a === void 0 ? void 0 : _a.call(telemetry, 'sidebar_item_expanded', {});
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
(_b = telemetry.send) === null || _b === void 0 ? void 0 : _b.call(telemetry, 'sidebar_item_collapsed', {});
|
|
29
|
+
}
|
|
27
30
|
}, title: collapsedSidebar
|
|
28
31
|
? translate('sidebar.actions.show', 'Show sidebar')
|
|
29
32
|
: translate('sidebar.actions.hide', 'Hide sidebar'), size: "small", variant: "outlined", icon: collapsedSidebar ? react_1.default.createElement(SidePanelOpenIcon_1.SidePanelOpenIcon, null) : react_1.default.createElement(SidePanelCloseIcon_1.SidePanelCloseIcon, null) })),
|
package/lib/core/utils/dom.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const IS_BROWSER: boolean;
|
|
2
|
-
export declare function onDocumentReady(fn:
|
|
2
|
+
export declare function onDocumentReady(fn: () => unknown): void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@redocly/theme",
|
|
3
|
-
"version": "0.44.
|
|
3
|
+
"version": "0.44.1",
|
|
4
4
|
"description": "Shared UI components lib",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"theme",
|
|
@@ -62,8 +62,8 @@
|
|
|
62
62
|
"@types/styled-components": "5.1.34",
|
|
63
63
|
"@types/styled-system": "5.1.22",
|
|
64
64
|
"@types/nprogress": "0.2.3",
|
|
65
|
-
"@typescript-eslint/eslint-plugin": "
|
|
66
|
-
"@typescript-eslint/parser": "
|
|
65
|
+
"@typescript-eslint/eslint-plugin": "8.6.0",
|
|
66
|
+
"@typescript-eslint/parser": "8.6.0",
|
|
67
67
|
"chromatic": "6.17.2",
|
|
68
68
|
"concurrently": "7.6.0",
|
|
69
69
|
"jest": "29.5.0",
|
|
@@ -23,7 +23,13 @@ export function Image(props: ImageProps): JSX.Element {
|
|
|
23
23
|
<img src={src} alt={alt} className={className} />
|
|
24
24
|
) : (
|
|
25
25
|
Array.from(parsedSourceSetMap).map(([key, value]) => (
|
|
26
|
-
<ColorModeAwareImage
|
|
26
|
+
<ColorModeAwareImage
|
|
27
|
+
key={key}
|
|
28
|
+
colorMode={key}
|
|
29
|
+
src={value}
|
|
30
|
+
alt={alt}
|
|
31
|
+
className={className}
|
|
32
|
+
/>
|
|
27
33
|
))
|
|
28
34
|
)}
|
|
29
35
|
</>
|
|
@@ -47,9 +47,11 @@ export const SidebarActions = ({
|
|
|
47
47
|
<Button
|
|
48
48
|
onClick={() => {
|
|
49
49
|
onChangeCollapseSidebarClick();
|
|
50
|
-
collapsedSidebar
|
|
51
|
-
|
|
52
|
-
|
|
50
|
+
if (collapsedSidebar) {
|
|
51
|
+
telemetry.send?.('sidebar_item_expanded', {});
|
|
52
|
+
} else {
|
|
53
|
+
telemetry.send?.('sidebar_item_collapsed', {});
|
|
54
|
+
}
|
|
53
55
|
}}
|
|
54
56
|
title={
|
|
55
57
|
collapsedSidebar
|
package/src/core/utils/dom.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export const IS_BROWSER = typeof window !== 'undefined' && 'HTMLElement' in window;
|
|
2
2
|
|
|
3
|
-
export function onDocumentReady(fn:
|
|
3
|
+
export function onDocumentReady(fn: () => unknown) {
|
|
4
4
|
if (document.readyState === 'loading') {
|
|
5
5
|
document.addEventListener('DOMContentLoaded', fn as EventListener);
|
|
6
6
|
} else {
|
|
@@ -6,7 +6,7 @@ nprogress.configure({
|
|
|
6
6
|
});
|
|
7
7
|
|
|
8
8
|
// Only the last caller should be able to call nprogress.done()
|
|
9
|
-
let lastCalledBy:
|
|
9
|
+
let lastCalledBy: symbol;
|
|
10
10
|
|
|
11
11
|
export async function withLoadProgress<T>(loadTarget: Promise<T>): Promise<T> {
|
|
12
12
|
const callIdentifier = Symbol();
|