@redocly/theme 0.4.16 → 0.5.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/ApiOnboarding/AppCustomAttributes.d.ts +5 -0
- package/lib/ApiOnboarding/AppCustomAttributes.js +8 -0
- package/lib/ColorModeSwitcher/ColorModeSwitcher.js +23 -10
- package/lib/EditPageButton/EditPageButton.d.ts +1 -1
- package/lib/EditPageButton/EditPageButton.js +5 -1
- package/lib/Footer/Footer.js +2 -2
- package/lib/Footer/FooterColumn.js +1 -1
- package/lib/LastUpdated/LastUpdated.js +30 -7
- package/lib/Markdown/Admonition.js +3 -0
- package/lib/Markdown/CodeSample/CodeSample.js +14 -14
- package/lib/Markdown/MarkdownLayout.d.ts +1 -1
- package/lib/Markdown/MarkdownLayout.js +5 -1
- package/lib/Navbar/Navbar.js +2 -2
- package/lib/Navbar/NavbarItem.js +1 -1
- package/lib/PageNavigation/NextPageLink.js +30 -7
- package/lib/PageNavigation/PageNavigation.js +8 -3
- package/lib/PageNavigation/PreviousPageLink.js +4 -4
- package/lib/Sidebar/MenuLink.d.ts +3 -4
- package/lib/Sidebar/MenuLink.js +2 -6
- package/lib/Sidebar/SidebarLayout.js +2 -2
- package/lib/Sidebar/types/MenuStyle.js +0 -1
- package/lib/TableOfContent/TableOfContent.d.ts +0 -1
- package/lib/TableOfContent/TableOfContent.js +5 -7
- package/lib/config.d.ts +385 -0
- package/lib/config.js +113 -0
- package/lib/globalStyle.js +3 -5
- package/lib/hooks/index.d.ts +1 -0
- package/lib/hooks/index.js +1 -0
- package/lib/hooks/useActiveHeading.js +1 -1
- package/lib/hooks/useActiveSectionId.js +1 -1
- package/lib/hooks/useThemeConfig.d.ts +1 -0
- package/lib/hooks/useThemeConfig.js +6 -0
- package/lib/icons/ColorModeIcon/ColorModeIcon.js +3 -3
- package/lib/index.d.ts +2 -0
- package/lib/index.js +2 -0
- package/lib/mocks/Link.js +12 -2
- package/lib/mocks/hooks/index.d.ts +2 -5
- package/lib/mocks/hooks/index.js +22 -6
- package/lib/mocks/types.d.ts +0 -11
- package/lib/mocks/types.js +1 -0
- package/lib/types/config.d.ts +5 -0
- package/lib/types/config.js +3 -0
- package/lib/ui/index.d.ts +0 -1
- package/lib/ui/index.js +0 -1
- package/lib/utils/args-typecheck.js +1 -1
- package/package.json +30 -34
- package/src/ApiOnboarding/AppCustomAttributes.tsx +6 -0
- package/src/ColorModeSwitcher/ColorModeSwitcher.tsx +29 -12
- package/src/EditPageButton/EditPageButton.tsx +6 -2
- package/src/Footer/Footer.tsx +2 -2
- package/src/Footer/FooterColumn.tsx +7 -1
- package/src/LastUpdated/LastUpdated.tsx +8 -6
- package/src/Markdown/Admonition.tsx +3 -0
- package/src/Markdown/CodeSample/CodeSample.tsx +15 -16
- package/src/Markdown/MarkdownLayout.tsx +9 -3
- package/src/Navbar/Navbar.tsx +2 -2
- package/src/Navbar/NavbarItem.tsx +1 -1
- package/src/PageNavigation/NextPageLink.tsx +8 -5
- package/src/PageNavigation/PageNavigation.tsx +7 -3
- package/src/PageNavigation/PreviousPageLink.tsx +7 -4
- package/src/Sidebar/MenuLink.tsx +3 -8
- package/src/Sidebar/SidebarLayout.tsx +2 -2
- package/src/Sidebar/types/MenuStyle.ts +0 -1
- package/src/TableOfContent/TableOfContent.tsx +5 -7
- package/src/config.ts +130 -0
- package/src/globalStyle.ts +3 -5
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useActiveHeading.ts +3 -1
- package/src/hooks/useActiveSectionId.ts +1 -1
- package/src/hooks/useThemeConfig.ts +1 -0
- package/src/icons/ColorModeIcon/ColorModeIcon.tsx +3 -3
- package/src/index.ts +3 -0
- package/src/mocks/Link.tsx +8 -2
- package/src/mocks/hooks/index.ts +22 -9
- package/src/mocks/types.ts +2 -11
- package/{settings.yaml → src/settings.yaml} +0 -0
- package/src/types/config.ts +5 -0
- package/src/types/portal/src/shared/constants.d.ts +0 -1
- package/src/types/portal/src/shared/types/nav.d.ts +3 -0
- package/src/ui/index.tsx +0 -1
- package/src/utils/args-typecheck.ts +1 -1
- package/lib/hooks/useDefaultThemeSettings.d.ts +0 -2
- package/lib/hooks/useDefaultThemeSettings.js +0 -10
- package/lib/ui/UniversalLink.d.ts +0 -17
- package/lib/ui/UniversalLink.js +0 -79
- package/src/hooks/useDefaultThemeSettings.ts +0 -7
- package/src/ui/UniversalLink.tsx +0 -97
package/src/ui/UniversalLink.tsx
DELETED
|
@@ -1,97 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useLocation } from 'react-router-dom';
|
|
3
|
-
import styled from 'styled-components';
|
|
4
|
-
|
|
5
|
-
import type { LinkProps } from 'react-router-dom';
|
|
6
|
-
|
|
7
|
-
import { isUrl } from '@theme/utils/isUrl';
|
|
8
|
-
import { Link } from '@portal/Link';
|
|
9
|
-
|
|
10
|
-
const StyledExternalLink = styled.a`
|
|
11
|
-
&.external-url {
|
|
12
|
-
position: relative;
|
|
13
|
-
|
|
14
|
-
:after {
|
|
15
|
-
content: '';
|
|
16
|
-
display: inline-block;
|
|
17
|
-
position: absolute;
|
|
18
|
-
background: var(--text-color);
|
|
19
|
-
mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' version='1.1' x='0' y='0' viewBox='0 0 100 125' enable-background='new 0 0 100 100' xml:space='preserve'%3E%3Cpath d='M-408.2-318.5 98.6 4.8c0-0.1 0-0.2-0.1-0.3 0-0.1-0.1-0.2-0.1-0.3 0-0.1 0-0.1-0.1-0.2 0 0 0-0.1 0-0.1 0-0.1-0.1-0.2-0.2-0.3 0-0.1-0.1-0.2-0.2-0.3 -0.1-0.1-0.1-0.2-0.2-0.3C97.7 2.9 97.6 2.8 97.5 2.7c-0.1-0.1-0.2-0.2-0.3-0.3 -0.1-0.1-0.1-0.1-0.2-0.2 -0.1-0.1-0.2-0.2-0.3-0.2 -0.1-0.1-0.2-0.1-0.2-0.2 -0.1-0.1-0.2-0.1-0.3-0.2 -0.1 0-0.2-0.1-0.3-0.1 0 0-0.1 0-0.1-0.1 -0.1 0-0.2 0-0.2-0.1 -0.1 0-0.2-0.1-0.3-0.1 -0.1 0-0.2-0.1-0.4-0.1 -0.1 0-0.2 0-0.3 0 -0.1 0-0.3 0-0.4 0 -0.1 0-0.1 0-0.2 0L63.8 1.3c-2.5 0-4.6 2.1-4.6 4.6 0 2.5 2.1 4.6 4.6 4.5l19.3-0.1 -29.8 30.2c-1.1 1.1-1.5 2.7-1.2 4.1 0.2 0.9 0.6 1.7 1.3 2.4 0.9 0.9 2.1 1.3 3.2 1.3 1.2 0 2.3-0.5 3.2-1.4l0 0 29.8-30.2 0.1 19.3c0 2.5 2.1 4.6 4.6 4.5 1.3 0 2.4-0.5 3.2-1.4 0.8-0.8 1.3-2 1.3-3.2L98.7 5.7c0-0.1 0-0.1 0-0.2 0-0.1 0-0.2 0-0.4C98.6 5 98.6 4.9 98.6 4.8zM6.5 83.3c0 5.7 4.6 10.4 10.4 10.4l55.6 0.1c5.7 0 10.4-4.6 10.4-10.4l-0.1-40.8h6.1v40.8c0 9-7.3 16.3-16.3 16.3l-56.4-0.1c-8.6 0-15.6-7-15.6-15.6L0.6 27.8c0-9 7.3-16.3 16.3-16.3l41.1-0.1v6.1L17 17.5c-5.7 0-10.4 4.6-10.4 10.4L6.5 83.3z'/%3E%3C/svg%3E");
|
|
20
|
-
mask-repeat: no-repeat;
|
|
21
|
-
width: 10px;
|
|
22
|
-
height: 10px;
|
|
23
|
-
top: 50%;
|
|
24
|
-
right: -15px;
|
|
25
|
-
transform: translateY(-50%);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
// TODO: We're using our own Link component so probably filtering is not necessary here.
|
|
31
|
-
// filter out unnecessary props
|
|
32
|
-
const propsList = [
|
|
33
|
-
'color',
|
|
34
|
-
'size',
|
|
35
|
-
'variant',
|
|
36
|
-
'bgColor',
|
|
37
|
-
'bgImage',
|
|
38
|
-
'disableArrow',
|
|
39
|
-
'withIcon',
|
|
40
|
-
'maxWidth',
|
|
41
|
-
'inversed',
|
|
42
|
-
'transparent',
|
|
43
|
-
'large',
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
export const withPropsFilter =
|
|
47
|
-
(filterList: string[]) => (WrappedComponent: React.FunctionComponent) =>
|
|
48
|
-
function WithPropsFilter(props: React.PropsWithChildren<object>): JSX.Element {
|
|
49
|
-
const filteredProps = Object.fromEntries(
|
|
50
|
-
Object.entries(props).filter(([key]) => !filterList.includes(key)),
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
return <WrappedComponent {...filteredProps} />;
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export interface PortalLinkProps<TState> extends LinkProps<TState> {
|
|
57
|
-
activeClassName?: string;
|
|
58
|
-
activeStyle?: object;
|
|
59
|
-
onClick?: (event: React.MouseEvent<HTMLAnchorElement>) => void;
|
|
60
|
-
partiallyActive?: boolean;
|
|
61
|
-
replace?: boolean;
|
|
62
|
-
state?: TState;
|
|
63
|
-
to: string;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export interface UniversalLinkProps extends Partial<PortalLinkProps<object>> {
|
|
67
|
-
external?: boolean;
|
|
68
|
-
ref?: any;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export const UniversalLink = withPropsFilter(propsList)((props: UniversalLinkProps) => {
|
|
72
|
-
return (typeof props.to === 'string' && (isUrl(props.to) || props.to.startsWith('mailto:'))) ||
|
|
73
|
-
props.external ? (
|
|
74
|
-
<StyledExternalLink
|
|
75
|
-
style={props.style}
|
|
76
|
-
href={props.to}
|
|
77
|
-
target={props.target || (props.external && '_blank') || '_self'}
|
|
78
|
-
className={`${props.external ? 'external-url' : ''} ${props.className}`}
|
|
79
|
-
rel={props.rel}
|
|
80
|
-
data-cy={`universalLink-${
|
|
81
|
-
typeof props.children === 'string' ? props.children : 'with-nested-jsx'
|
|
82
|
-
}`}
|
|
83
|
-
>
|
|
84
|
-
{props.children}
|
|
85
|
-
</StyledExternalLink>
|
|
86
|
-
) : props.to == null ? (
|
|
87
|
-
<a onClick={props.onClick} className={props.className} style={props.style}>
|
|
88
|
-
{props.children}
|
|
89
|
-
</a>
|
|
90
|
-
) : (
|
|
91
|
-
<Link
|
|
92
|
-
{...props}
|
|
93
|
-
to={props.to}
|
|
94
|
-
state={{ previousPath: useLocation()?.pathname, ...props.state }}
|
|
95
|
-
/>
|
|
96
|
-
);
|
|
97
|
-
});
|