@redocly/theme 0.1.16 → 0.1.21
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/Button/Button.d.ts +4 -3
- package/Button/Button.js +28 -1
- package/Footer/CustomFooter.d.ts +7 -0
- package/Footer/CustomFooter.js +31 -0
- package/Footer/CustomFooterNavItem.d.ts +7 -0
- package/Footer/CustomFooterNavItem.js +25 -0
- package/Footer/Footer.d.ts +6 -2
- package/Footer/Footer.js +1 -1
- package/Footer/FooterColumn.d.ts +2 -2
- package/Footer/FooterColumn.js +3 -2
- package/Footer/FooterColumns.d.ts +6 -4
- package/Footer/FooterColumns.js +3 -3
- package/Footer/FooterCopyright.d.ts +6 -4
- package/JsonViewer/JsonViewer.js +1 -2
- package/JsonViewer/index.d.ts +0 -1
- package/JsonViewer/index.js +0 -1
- package/Markdown/Admonition.js +1 -1
- package/Markdown/CodeSample/CodeSample.js +15 -5
- package/Markdown/CodeSample/index.d.ts +0 -1
- package/Markdown/CodeSample/index.js +0 -1
- package/Navbar/Navbar.d.ts +2 -1
- package/Navbar/Navbar.js +9 -2
- package/Navbar/NavbarDropdown.d.ts +8 -0
- package/Navbar/NavbarDropdown.js +21 -0
- package/Navbar/NavbarItem.d.ts +3 -36
- package/Navbar/NavbarItem.js +22 -13
- package/Navbar/NavbarMenu.d.ts +2 -1
- package/Navbar/NavbarMenu.js +1 -1
- package/PageNavigation/NextPageLink.js +8 -5
- package/PageNavigation/PreviousPageLink.js +8 -5
- package/Search/SidebarSearch.d.ts +2 -0
- package/Search/SidebarSearch.js +15 -0
- package/Sidebar/MenuGroup.js +2 -2
- package/Sidebar/SidebarLayout.js +5 -0
- package/TableOfContent/TableOfContent.js +8 -1
- package/Typography/CompactTypography.d.ts +11 -0
- package/Typography/CompactTypography.js +18 -0
- package/Typography/Emphasis.d.ts +3 -0
- package/Typography/Emphasis.js +15 -0
- package/Typography/H1.d.ts +3 -0
- package/Typography/H1.js +16 -0
- package/Typography/H2.d.ts +3 -0
- package/Typography/H2.js +16 -0
- package/Typography/H3.d.ts +3 -0
- package/Typography/H3.js +16 -0
- package/Typography/SectionHeader.d.ts +1 -0
- package/Typography/SectionHeader.js +13 -0
- package/Typography/Typography.d.ts +8 -0
- package/Typography/Typography.js +22 -0
- package/Typography/index.d.ts +7 -0
- package/{Headings → Typography}/index.js +7 -1
- package/globalStyle.js +1 -1
- package/{ui → icons/AlertIcon}/AlertIcon.d.ts +2 -2
- package/{ui → icons/AlertIcon}/AlertIcon.js +1 -1
- package/icons/AlertIcon/index.d.ts +2 -0
- package/icons/AlertIcon/index.js +5 -0
- package/icons/ArrowIcon/ArrowIcon.d.ts +7 -0
- package/{ui/Arrow.js → icons/ArrowIcon/ArrowIcon.js} +3 -3
- package/icons/ArrowIcon/index.d.ts +2 -0
- package/icons/ArrowIcon/index.js +5 -0
- package/icons/index.d.ts +2 -0
- package/icons/index.js +2 -0
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/mocks/constants/index.d.ts +2 -0
- package/mocks/constants/index.js +5 -0
- package/mocks/hooks/index.d.ts +6 -0
- package/mocks/hooks/index.js +16 -0
- package/package.json +1 -1
- package/settings.yaml +9 -0
- package/src/Button/Button.tsx +19 -1
- package/src/Footer/CustomFooter.tsx +45 -0
- package/src/Footer/CustomFooterNavItem.tsx +40 -0
- package/src/Footer/Footer.tsx +6 -2
- package/src/Footer/FooterColumn.tsx +4 -4
- package/src/Footer/FooterColumns.tsx +9 -9
- package/src/Footer/FooterCopyright.tsx +6 -6
- package/src/JsonViewer/JsonViewer.tsx +106 -2
- package/src/JsonViewer/index.ts +0 -1
- package/src/Markdown/Admonition.tsx +1 -1
- package/src/Markdown/CodeSample/CodeSample.tsx +160 -6
- package/src/Markdown/CodeSample/index.ts +0 -1
- package/src/Navbar/Navbar.tsx +13 -3
- package/src/Navbar/NavbarDropdown.tsx +44 -0
- package/src/Navbar/NavbarItem.tsx +44 -51
- package/src/Navbar/NavbarMenu.tsx +6 -3
- package/src/PageNavigation/NextPageLink.tsx +9 -3
- package/src/PageNavigation/PreviousPageLink.tsx +9 -3
- package/src/Search/SidebarSearch.tsx +13 -0
- package/src/Sidebar/MenuGroup.tsx +2 -2
- package/src/Sidebar/SidebarLayout.tsx +5 -0
- package/src/TableOfContent/TableOfContent.tsx +7 -1
- package/src/Typography/CompactTypography.ts +9 -0
- package/src/Typography/Emphasis.ts +7 -0
- package/src/Typography/H1.ts +12 -0
- package/src/Typography/H2.ts +12 -0
- package/src/Typography/H3.ts +11 -0
- package/src/Typography/SectionHeader.ts +11 -0
- package/src/Typography/Typography.ts +21 -0
- package/src/Typography/index.ts +7 -0
- package/src/globalStyle.ts +1 -0
- package/src/{ui → icons/AlertIcon}/AlertIcon.tsx +3 -3
- package/src/icons/AlertIcon/index.ts +2 -0
- package/src/{ui/Arrow.tsx → icons/ArrowIcon/ArrowIcon.tsx} +5 -5
- package/src/icons/ArrowIcon/index.ts +2 -0
- package/src/icons/index.ts +2 -0
- package/src/index.ts +1 -1
- package/src/mocks/constants/index.ts +2 -0
- package/src/mocks/hooks/index.ts +17 -0
- package/src/types/portal/index.d.ts +0 -1
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +1 -1
- package/src/types/portal/src/server/{utils → content}/content-provider.d.ts +9 -9
- package/src/types/portal/src/server/{version-store.d.ts → content/versions-config.d.ts} +7 -7
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +14 -11
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +16 -19
- package/src/types/portal/src/server/plugins/types.d.ts +23 -15
- package/src/types/portal/src/server/store.d.ts +32 -33
- package/src/types/portal/src/server/utils/fs.d.ts +2 -1
- package/src/types/portal/src/server/utils/index.d.ts +0 -1
- package/src/types/portal/src/server/utils/paths.d.ts +3 -3
- package/src/types/portal/src/server/utils/reporter/formatter.d.ts +2 -1
- package/src/types/portal/src/server/utils/reporter/reporter.d.ts +2 -1
- package/src/types/portal/src/shared/constants.d.ts +2 -0
- package/src/types/portal/src/shared/models/active-item.d.ts +3 -0
- package/src/types/portal/src/shared/models/config.d.ts +28 -0
- package/src/types/portal/src/shared/models/index.d.ts +6 -0
- package/src/types/portal/src/shared/models/json-index.d.ts +5 -0
- package/src/types/portal/src/shared/models/operation-parameter.d.ts +6 -0
- package/src/types/portal/src/shared/models/search-data.d.ts +5 -0
- package/src/types/portal/src/shared/models/search-document.d.ts +11 -0
- package/src/types/portal/src/shared/types.d.ts +8 -2
- package/src/types/portal/src/shared/urls.d.ts +2 -0
- package/src/types/portal/src/shared/utils.d.ts +8 -2
- package/src/ui/Jumbotron.tsx +1 -1
- package/src/ui/index.tsx +0 -4
- package/src/utils/ClipboardService.ts +19 -0
- package/ui/Jumbotron.js +1 -1
- package/ui/index.d.ts +0 -4
- package/ui/index.js +0 -4
- package/utils/ClipboardService.d.ts +1 -0
- package/utils/ClipboardService.js +19 -0
- package/Headings/Headings.d.ts +0 -3
- package/Headings/Headings.js +0 -16
- package/Headings/index.d.ts +0 -1
- package/JsonViewer/styled.d.ts +0 -1
- package/JsonViewer/styled.js +0 -10
- package/Markdown/CodeSample/styled.d.ts +0 -4
- package/Markdown/CodeSample/styled.js +0 -85
- package/src/Headings/Headings.ts +0 -23
- package/src/Headings/index.ts +0 -1
- package/src/JsonViewer/styled.ts +0 -103
- package/src/Markdown/CodeSample/styled.ts +0 -209
- package/src/types/portal/src/client/app/media-css.d.ts +0 -7
- package/src/types/portal/src/client/styling/default.d.ts +0 -601
- package/src/types/portal/src/client/styling/index.d.ts +0 -10
- package/src/types/portal/src/client/styling/resolve.d.ts +0 -1
- package/src/ui/Button.tsx +0 -19
- package/src/ui/Typography.tsx +0 -90
- package/ui/Arrow.d.ts +0 -7
- package/ui/Button.d.ts +0 -7
- package/ui/Button.js +0 -30
- package/ui/Typography.d.ts +0 -41
- package/ui/Typography.js +0 -59
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { ResolvedNavLinkItem } from '@theme/types/portal';
|
|
4
4
|
import { usePageData } from '@portal/hooks/usePageData';
|
|
5
|
-
import {
|
|
5
|
+
import { useThemeSettings } from '@portal/hooks/';
|
|
6
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants/';
|
|
7
|
+
import { Button } from '@theme/Button/Button';
|
|
6
8
|
|
|
7
9
|
interface NextPageType {
|
|
8
10
|
nextPage?: ResolvedNavLinkItem | null;
|
|
@@ -10,13 +12,17 @@ interface NextPageType {
|
|
|
10
12
|
|
|
11
13
|
export function NextPageLink(): JSX.Element {
|
|
12
14
|
const { nextPage }: NextPageType = usePageData() || {};
|
|
13
|
-
|
|
15
|
+
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
|
+
|
|
17
|
+
if (!nextPage || themeSettings?.navigation?.hide) {
|
|
14
18
|
return <div> </div>;
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
const label = themeSettings?.navigation?.nextPageLink?.label || `Next to ${nextPage.label}`;
|
|
22
|
+
|
|
17
23
|
return (
|
|
18
24
|
<Button variant="outlined" size="large" to={nextPage.link}>
|
|
19
|
-
|
|
25
|
+
{label}
|
|
20
26
|
</Button>
|
|
21
27
|
);
|
|
22
28
|
}
|
|
@@ -2,7 +2,9 @@ import React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { ResolvedNavLinkItem } from '@theme/types/portal';
|
|
4
4
|
import { usePageData } from '@portal/hooks/usePageData';
|
|
5
|
-
import {
|
|
5
|
+
import { useThemeSettings } from '@portal/hooks';
|
|
6
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
7
|
+
import { Button } from '@theme/Button/Button';
|
|
6
8
|
|
|
7
9
|
interface PreviousPageType {
|
|
8
10
|
prevPage?: ResolvedNavLinkItem | null;
|
|
@@ -10,13 +12,17 @@ interface PreviousPageType {
|
|
|
10
12
|
|
|
11
13
|
export function PreviousPageLink(): JSX.Element {
|
|
12
14
|
const { prevPage }: PreviousPageType = usePageData() || {};
|
|
13
|
-
|
|
15
|
+
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
16
|
+
|
|
17
|
+
if (!prevPage || themeSettings?.navigation?.hide) {
|
|
14
18
|
return <div> </div>;
|
|
15
19
|
}
|
|
16
20
|
|
|
21
|
+
const label = themeSettings?.navigation?.nextPageLink?.label || `Back to ${prevPage.label}`;
|
|
22
|
+
|
|
17
23
|
return (
|
|
18
24
|
<Button variant="outlined" size="large" to={prevPage.link}>
|
|
19
|
-
|
|
25
|
+
{label}
|
|
20
26
|
</Button>
|
|
21
27
|
);
|
|
22
28
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { Search } from '@theme/Search/Search';
|
|
4
|
+
import { Popover } from '@theme/Search/Popover';
|
|
5
|
+
|
|
6
|
+
export const SidebarSearch = styled(Search)`
|
|
7
|
+
--search-input-text-color: var(--sidebar-item-active-color);
|
|
8
|
+
|
|
9
|
+
${Popover} {
|
|
10
|
+
right: unset;
|
|
11
|
+
top: 100%;
|
|
12
|
+
}
|
|
13
|
+
`;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
import {
|
|
4
|
+
import { ArrowIcon } from '@theme/icons/ArrowIcon/ArrowIcon';
|
|
5
5
|
import { ItemState } from '@theme/Sidebar/types/ItemState';
|
|
6
6
|
import { MenuLinkItem } from '@theme/Sidebar/MenuLinkItem';
|
|
7
7
|
import { MenuItemLabel } from '@theme/Sidebar/MenuItemLabel';
|
|
@@ -50,6 +50,6 @@ const MenuGroupLabel = styled(MenuItemLabel)<{ isAlwaysExpanded?: boolean }>`
|
|
|
50
50
|
cursor: ${(props) => (props.isAlwaysExpanded ? 'default' : 'pointer')};
|
|
51
51
|
`;
|
|
52
52
|
|
|
53
|
-
const MenuGroupArrow = styled(
|
|
53
|
+
const MenuGroupArrow = styled(ArrowIcon)`
|
|
54
54
|
margin-right: calc(var(--sidebar-spacing-unit) / 2);
|
|
55
55
|
`;
|
|
@@ -5,6 +5,9 @@ import { Sidebar } from '@theme/Sidebar/Sidebar';
|
|
|
5
5
|
import { useMobileMenu } from '@theme/hooks/useMobileMenu';
|
|
6
6
|
import { MobileSidebarButton } from '@theme/Sidebar/MobileSidebarButton';
|
|
7
7
|
import { MenuContainer } from '@theme/Sidebar/MenuContainer';
|
|
8
|
+
import { useThemeSettings } from '@portal/hooks/';
|
|
9
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants/';
|
|
10
|
+
import { SidebarSearch } from '@theme/Search/SidebarSearch';
|
|
8
11
|
|
|
9
12
|
interface SidebarLayoutProps {
|
|
10
13
|
versions: React.ReactNode;
|
|
@@ -14,11 +17,13 @@ interface SidebarLayoutProps {
|
|
|
14
17
|
export function SidebarLayout({ versions, menu }: SidebarLayoutProps): JSX.Element {
|
|
15
18
|
const [isOpen, setIsOpen] = useMobileMenu();
|
|
16
19
|
const toggleMenu = () => setIsOpen(!isOpen);
|
|
20
|
+
const { hide, placement } = useThemeSettings(DEFAULT_THEME_NAME).search || {};
|
|
17
21
|
|
|
18
22
|
return (
|
|
19
23
|
<Wrapper data-component-name="Sidebar/SidebarLayout">
|
|
20
24
|
<MobileSidebarButton opened={isOpen} onClick={toggleMenu} />
|
|
21
25
|
|
|
26
|
+
{!hide && placement === 'sidebar' ? <SidebarSearch /> : null}
|
|
22
27
|
<Sidebar animate={true} opened={isOpen}>
|
|
23
28
|
{versions}
|
|
24
29
|
<MenuContainer>{menu}</MenuContainer>
|
|
@@ -2,8 +2,10 @@ import React, { useRef } from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { useFullHeight } from '@theme/hooks/useFullHeight';
|
|
5
|
+
import { useThemeSettings } from '@portal/hooks';
|
|
5
6
|
import { useActiveHeading } from '@theme/hooks/useActiveHeading';
|
|
6
7
|
import { MdHeading } from '@theme/types/portal';
|
|
8
|
+
import { DEFAULT_THEME_NAME } from '@portal/constants';
|
|
7
9
|
|
|
8
10
|
interface TableOfContentProps {
|
|
9
11
|
headings?: Array<MdHeading | null> | null | undefined;
|
|
@@ -17,7 +19,11 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
17
19
|
const sidebar = useRef<HTMLDivElement | null>(null);
|
|
18
20
|
useFullHeight(sidebar);
|
|
19
21
|
const activeHeadingId = useActiveHeading(contentWrapper);
|
|
22
|
+
const { themeSettings } = useThemeSettings(DEFAULT_THEME_NAME);
|
|
20
23
|
|
|
24
|
+
if (themeSettings?.toc?.hide) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
21
27
|
if (headings && headings.length === 1 && (!headings[0] || headings[0].depth === 1)) {
|
|
22
28
|
return null;
|
|
23
29
|
}
|
|
@@ -30,7 +36,7 @@ export function TableOfContent(props: TableOfContentProps): JSX.Element | null {
|
|
|
30
36
|
{headings && (
|
|
31
37
|
<TableOfContentMenu data-component-name="TableOfContent/TableOfContent">
|
|
32
38
|
<TableOfContentItems ref={sidebar}>
|
|
33
|
-
<TocHeader>On this page</TocHeader>
|
|
39
|
+
<TocHeader>{themeSettings?.toc?.header?.label || 'On this page'}</TocHeader>
|
|
34
40
|
{headings.map((heading: MdHeading | null, idx: number) => {
|
|
35
41
|
// TODO: not sure about !heading
|
|
36
42
|
if (!heading) {
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { Typography } from '@theme/Typography/Typography';
|
|
4
|
+
|
|
5
|
+
export const CompactTypography = styled(Typography).attrs(() => ({
|
|
6
|
+
mt: '0em',
|
|
7
|
+
mb: '0em',
|
|
8
|
+
'data-component-name': 'Typography/CompactTypography',
|
|
9
|
+
}))``;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { typography } from '@theme/utils';
|
|
4
|
+
|
|
5
|
+
export const H1 = styled.h1.attrs(() => ({
|
|
6
|
+
'data-component-name': 'Headings/H1',
|
|
7
|
+
}))`
|
|
8
|
+
color: var(--color-content);
|
|
9
|
+
margin: 0 0 25px;
|
|
10
|
+
|
|
11
|
+
${typography('h1', 'h')};
|
|
12
|
+
`;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
import { typography } from '@theme/utils';
|
|
4
|
+
|
|
5
|
+
export const H2 = styled.h2.attrs(() => ({
|
|
6
|
+
'data-component-name': 'Headings/H2',
|
|
7
|
+
}))`
|
|
8
|
+
color: var(--color-content);
|
|
9
|
+
margin: 0 0 20px;
|
|
10
|
+
|
|
11
|
+
${typography('h2', 'h')};
|
|
12
|
+
`;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const SectionHeader = styled.h2`
|
|
4
|
+
color: var(--h-color);
|
|
5
|
+
font-size: 1.75em;
|
|
6
|
+
font-weight: var(--font-weight-regular);
|
|
7
|
+
text-align: center;
|
|
8
|
+
margin: 2.65em 0;
|
|
9
|
+
padding: 0 20px;
|
|
10
|
+
font-family: var(--h-font-family);
|
|
11
|
+
`;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import styled from 'styled-components';
|
|
2
|
+
import { color, typography as typographySystem, TypographyProps } from 'styled-system';
|
|
3
|
+
|
|
4
|
+
export const Typography = styled.p.attrs(() => ({
|
|
5
|
+
'data-component-name': 'Typography/Typography',
|
|
6
|
+
}))<
|
|
7
|
+
TypographyProps & {
|
|
8
|
+
color?: string;
|
|
9
|
+
mt?: string;
|
|
10
|
+
mb?: string;
|
|
11
|
+
}
|
|
12
|
+
>`
|
|
13
|
+
font-size: var(--font-size-base);
|
|
14
|
+
font-family: var(--font-family-base);
|
|
15
|
+
line-height: var(--line-height-base);
|
|
16
|
+
color: var(--color-content);
|
|
17
|
+
${color};
|
|
18
|
+
margin-top: ${({ mt }) => mt || '1em'};
|
|
19
|
+
margin-bottom: ${({ mb }) => mb || '1em'};
|
|
20
|
+
${typographySystem}
|
|
21
|
+
`;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from '@theme/Typography/H1';
|
|
2
|
+
export * from '@theme/Typography/H2';
|
|
3
|
+
export * from '@theme/Typography/H3';
|
|
4
|
+
export * from '@theme/Typography/Emphasis';
|
|
5
|
+
export * from '@theme/Typography/SectionHeader';
|
|
6
|
+
export * from '@theme/Typography/Typography';
|
|
7
|
+
export * from '@theme/Typography/CompactTypography';
|
package/src/globalStyle.ts
CHANGED
|
@@ -735,6 +735,7 @@ const navbar = css`
|
|
|
735
735
|
--navbar-height: 60px; // @presenter Spacing
|
|
736
736
|
--navbar-text-color: #fff; // @presenter Color
|
|
737
737
|
--navbar-background-color: var(--color-primary-500); // @presenter Color
|
|
738
|
+
--navbar-drowpdown-shadow: 4px 4px 15px -2px rgba(0, 0, 0, 0.5);
|
|
738
739
|
|
|
739
740
|
/**
|
|
740
741
|
* @tokens Navbar Item
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
interface
|
|
4
|
+
export interface AlertIconProps {
|
|
5
5
|
type: 'warning' | 'success' | 'danger' | 'attention' | 'info';
|
|
6
6
|
className?: string;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
function Icon({ type, className }:
|
|
9
|
+
function Icon({ type, className }: AlertIconProps) {
|
|
10
10
|
switch (type) {
|
|
11
11
|
case 'warning':
|
|
12
12
|
return (
|
|
@@ -96,7 +96,7 @@ function Icon({ type, className }: IconProps) {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
export const AlertIcon = styled(Icon).attrs(() => ({
|
|
99
|
-
'data-component-name': '
|
|
99
|
+
'data-component-name': 'icons/AlertIcon/AlertIcon',
|
|
100
100
|
}))`
|
|
101
101
|
position: absolute;
|
|
102
102
|
left: var(--admonition-padding-horizontal);
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
|
-
export interface
|
|
5
|
-
direction?:
|
|
4
|
+
export interface ArrowIconProps {
|
|
5
|
+
direction?: 'up' | 'right' | 'left' | 'down';
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
function directionToTransform({ direction }:
|
|
8
|
+
function directionToTransform({ direction }: ArrowIconProps) {
|
|
9
9
|
switch (direction) {
|
|
10
10
|
case 'up':
|
|
11
11
|
return 180;
|
|
@@ -19,14 +19,14 @@ function directionToTransform({ direction }: ArrowProps) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
const Icon = ({ className }: { className?: string }) => (
|
|
22
|
-
<span data-component-name="
|
|
22
|
+
<span data-component-name="icons/ArrowIcon/ArrowIcon">
|
|
23
23
|
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 7 5" className={className}>
|
|
24
24
|
<path d="M3.5 2.51L5.806.205a.7.7 0 01.99.99l-2.8 2.8a.698.698 0 01-.99 0l-2.8-2.8a.7.7 0 11.99-.99L3.5 2.51z" />
|
|
25
25
|
</svg>
|
|
26
26
|
</span>
|
|
27
27
|
);
|
|
28
28
|
|
|
29
|
-
export const
|
|
29
|
+
export const ArrowIcon = styled(Icon)`
|
|
30
30
|
width: var(--sidebar-chevron-size);
|
|
31
31
|
height: var(--sidebar-chevron-size);
|
|
32
32
|
fill: var(--sidebar-chevron-color);
|
package/src/icons/index.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface RawTheme {
|
|
2
|
+
name: string;
|
|
3
|
+
settings?: any;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export function useThemeSettings(name: string): RawTheme['settings'] {
|
|
7
|
+
return {
|
|
8
|
+
name,
|
|
9
|
+
settings: {
|
|
10
|
+
toc: { header: 'header', hide: false },
|
|
11
|
+
navigation: {
|
|
12
|
+
nextPageLink: { label: 'next page' },
|
|
13
|
+
previousPageLink: { label: 'prev page' },
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import * as chokidar from 'chokidar';
|
|
3
3
|
import * as fs from 'fs';
|
|
4
|
-
import { VersionStore } from '../version-store.js';
|
|
5
4
|
import { PathVersionInfo } from '../plugins/types.js';
|
|
5
|
+
import { VersionsConfig } from './versions-config.js';
|
|
6
6
|
declare type WatchCb = (event: 'add' | 'change' | 'unlink', path: string, stats?: fs.Stats) => Promise<void>;
|
|
7
7
|
export interface ContentRecord {
|
|
8
8
|
content: string;
|
|
@@ -16,15 +16,15 @@ export interface ParsedContentRecord<T = unknown> extends ContentRecord {
|
|
|
16
16
|
export interface ContentProvider {
|
|
17
17
|
cwd: string;
|
|
18
18
|
filesList: Set<string>;
|
|
19
|
-
versions:
|
|
19
|
+
versions: VersionsConfig;
|
|
20
20
|
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
21
21
|
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
22
22
|
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
23
23
|
content: string;
|
|
24
|
-
data:
|
|
24
|
+
data: Record<string, any>;
|
|
25
25
|
}>;
|
|
26
26
|
loadContent(relativePath: string, parse: 'yaml' | 'frontmatter' | undefined): ParsedContentRecord;
|
|
27
|
-
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo;
|
|
27
|
+
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo | undefined;
|
|
28
28
|
has(relativePath: string): boolean;
|
|
29
29
|
}
|
|
30
30
|
export declare class FsContentProvider implements ContentProvider {
|
|
@@ -32,20 +32,20 @@ export declare class FsContentProvider implements ContentProvider {
|
|
|
32
32
|
cwd: string;
|
|
33
33
|
private initialContentLoaded;
|
|
34
34
|
filesList: Set<string>;
|
|
35
|
-
versions:
|
|
35
|
+
versions: VersionsConfig;
|
|
36
36
|
constructor(cwd: string, initialCache?: Map<string, ContentRecord>);
|
|
37
37
|
private emit;
|
|
38
38
|
has(relativePath: string): boolean;
|
|
39
|
-
getVersionInfoByFsPath(relativePath: string): PathVersionInfo;
|
|
39
|
+
getVersionInfoByFsPath(relativePath: string): PathVersionInfo | undefined;
|
|
40
40
|
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
41
|
-
loadContent(relativePath: string, parse: 'yaml'): ParsedContentRecord<
|
|
41
|
+
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
42
42
|
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
43
43
|
content: string;
|
|
44
|
-
data:
|
|
44
|
+
data: Record<string, any>;
|
|
45
45
|
}>;
|
|
46
46
|
watch(test: RegExp, cb: WatchCb): void;
|
|
47
47
|
stop(): Promise<void>;
|
|
48
48
|
start(): void;
|
|
49
|
-
ready(): Promise<chokidar.FSWatcher>;
|
|
49
|
+
ready(): Promise<chokidar.FSWatcher | undefined>;
|
|
50
50
|
}
|
|
51
51
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Version } from '
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
export declare class
|
|
1
|
+
import type { Version } from '../../shared/types';
|
|
2
|
+
import { PathVersionInfo } from '../plugins/types';
|
|
3
|
+
import type { ContentProvider } from './content-provider';
|
|
4
|
+
export declare class VersionsConfig {
|
|
5
5
|
contentProvider: ContentProvider;
|
|
6
6
|
private config;
|
|
7
7
|
constructor(contentProvider: ContentProvider);
|
|
@@ -29,7 +29,7 @@ export declare class VersionStore {
|
|
|
29
29
|
* @param allFilePaths
|
|
30
30
|
*/
|
|
31
31
|
resolveConfig(allFilePaths: Set<string>): void;
|
|
32
|
-
getPageVersions(pagePath: string, suffix?: string): Version[];
|
|
33
|
-
getDefaultByPath(path: string): string;
|
|
34
|
-
getVersionInfoByFsPath(path: string): PathVersionInfo |
|
|
32
|
+
getPageVersions(pagePath: string, suffix?: string): Version[] | undefined;
|
|
33
|
+
getDefaultByPath(path: string): string | null | undefined;
|
|
34
|
+
getVersionInfoByFsPath(path: string): PathVersionInfo | undefined;
|
|
35
35
|
}
|
|
@@ -1,23 +1,26 @@
|
|
|
1
|
-
import { Config,
|
|
2
|
-
import type { ContentProvider, ContentRecord } from '../../
|
|
1
|
+
import { Config, Node, RenderableTreeNode } from '@markdoc/markdoc/dist/src/types';
|
|
2
|
+
import type { ContentProvider, ContentRecord } from '../../content/content-provider.js';
|
|
3
|
+
import { PluginDefaultOptions } from '../types.js';
|
|
3
4
|
import type { RouteDetails } from '../types.js';
|
|
4
|
-
export declare type MarkdownOptions = {
|
|
5
|
-
contentDir: string;
|
|
6
|
-
outdir: string;
|
|
7
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
8
|
-
getRouteBySlug: (slug: string) => RouteDetails;
|
|
9
|
-
contentProvider: ContentProvider;
|
|
10
|
-
};
|
|
11
5
|
export interface MdHeading {
|
|
12
6
|
id: string;
|
|
13
7
|
value: string;
|
|
14
8
|
depth: number;
|
|
15
9
|
}
|
|
10
|
+
export declare type MarkdownOptions = {
|
|
11
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
12
|
+
getRouteBySlug?: (slug: string) => RouteDetails | undefined;
|
|
13
|
+
contentProvider: ContentProvider;
|
|
14
|
+
};
|
|
15
|
+
export interface MdPartialsContext {
|
|
16
|
+
partials: Record<string, Node>;
|
|
17
|
+
}
|
|
18
|
+
export declare type MdRenderContext = ContentRecord & PluginDefaultOptions & MdPartialsContext;
|
|
19
|
+
export declare type MdCompilationContext = MdRenderContext & MarkdownOptions;
|
|
16
20
|
export interface MdCompilationResult {
|
|
17
|
-
result:
|
|
21
|
+
result: RenderableTreeNode;
|
|
18
22
|
headings: MdHeading[];
|
|
19
23
|
}
|
|
20
|
-
export declare type MdCompilationContext = ContentRecord & MarkdownOptions;
|
|
21
24
|
export interface ExtendedMarkdocConfig extends Config {
|
|
22
25
|
currentProcessedPage?: string;
|
|
23
26
|
}
|
|
@@ -1,23 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { ResolvedConfigLinks } from '../../../shared/types.js';
|
|
2
|
+
import { PortalConfig, RawTheme } from '../../../shared/models/config.js';
|
|
3
|
+
import { Redirect } from '../types';
|
|
4
|
+
export interface GlobalData {
|
|
5
|
+
nav?: ResolvedConfigLinks;
|
|
6
|
+
logo?: PortalConfig['logo'];
|
|
7
|
+
footer?: ResolvedConfigLinks;
|
|
8
|
+
themeSettings?: PortalConfig['themes'];
|
|
7
9
|
}
|
|
8
|
-
export interface
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
columns?: FooterColumn[];
|
|
16
|
-
}
|
|
17
|
-
export interface FooterColumn {
|
|
18
|
-
group: string;
|
|
19
|
-
label?: string;
|
|
20
|
-
items: ResolvedNavItem[];
|
|
10
|
+
export interface GlobalConfig {
|
|
11
|
+
themes: RawTheme[];
|
|
12
|
+
scripts?: string;
|
|
13
|
+
stylesheets?: string;
|
|
14
|
+
redirects: Record<string, Redirect>;
|
|
15
|
+
fileName: string;
|
|
16
|
+
[k: string]: unknown;
|
|
21
17
|
}
|
|
18
|
+
export declare type RbacConfig = Record<string, string[]>;
|
|
22
19
|
export declare type CustomEntryPropertyType = Record<string, string | boolean>;
|
|
23
20
|
export declare type ScriptOrStylesheetConfig = string | CustomEntryPropertyType;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PageProps, ResolvedNavItem } from '../../shared/types.js';
|
|
2
2
|
import type { Template } from '../store';
|
|
3
|
-
import type { ContentProvider } from '../
|
|
3
|
+
import type { ContentProvider } from '../content/content-provider.js';
|
|
4
|
+
import { SearchData, SearchDocument } from '../../shared/models';
|
|
5
|
+
import type { GlobalData, GlobalConfig, RbacConfig } from './portal-config/types.js';
|
|
4
6
|
export declare type DataLoaderContext = {
|
|
5
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
6
|
-
getRouteBySlug: (relativePath: string) => RouteDetails;
|
|
7
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
8
|
+
getRouteBySlug: (relativePath: string) => RouteDetails | undefined;
|
|
7
9
|
};
|
|
8
10
|
export declare type DataLoader<T = any> = (contentProvider: ContentProvider, context: DataLoaderContext) => Promise<T>;
|
|
9
11
|
export interface RouteDetails {
|
|
@@ -16,6 +18,11 @@ export interface RouteDetails {
|
|
|
16
18
|
};
|
|
17
19
|
getNavText?: () => Promise<string>;
|
|
18
20
|
getSidebar?(): ResolvedNavItem[];
|
|
21
|
+
getSearchDocuments?(): Promise<SearchDocument[]>;
|
|
22
|
+
}
|
|
23
|
+
export interface Redirect {
|
|
24
|
+
to: string;
|
|
25
|
+
type: number;
|
|
19
26
|
}
|
|
20
27
|
export interface PathVersionInfo {
|
|
21
28
|
version: string;
|
|
@@ -23,23 +30,22 @@ export interface PathVersionInfo {
|
|
|
23
30
|
versionFolderId: string;
|
|
24
31
|
}
|
|
25
32
|
export interface ProcessContentActions {
|
|
33
|
+
createSharedData(id: string, data: unknown): string;
|
|
34
|
+
addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
|
|
26
35
|
addRoute: (route: RouteDetails) => void;
|
|
27
36
|
createTemplate: (template: Template) => Template;
|
|
28
|
-
|
|
29
|
-
addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
|
|
37
|
+
setRbacConfig: (rbacConfig: RbacConfig) => void;
|
|
30
38
|
}
|
|
31
39
|
export interface AfterRoutesCreatedActions {
|
|
32
|
-
createSharedData(id: string, data:
|
|
40
|
+
createSharedData(id: string, data: unknown): string;
|
|
33
41
|
addRouteSharedData(routeSlug: string, dataKey: string, dataId: string): void;
|
|
34
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
35
|
-
getRouteBySlug: (relativePath: string) => RouteDetails;
|
|
42
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
43
|
+
getRouteBySlug: (relativePath: string) => RouteDetails | undefined;
|
|
36
44
|
getAllRoutes: () => RouteDetails[];
|
|
37
|
-
setGlobalData: (data:
|
|
38
|
-
setGlobalConfig: (data:
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
type: number;
|
|
42
|
-
}) => void;
|
|
45
|
+
setGlobalData: (data: GlobalData) => void;
|
|
46
|
+
setGlobalConfig: (data: Partial<GlobalConfig>) => void;
|
|
47
|
+
setSearchData: (data: SearchData) => void;
|
|
48
|
+
addRedirect: (from: string, to: Redirect) => void;
|
|
43
49
|
contentDir: string;
|
|
44
50
|
}
|
|
45
51
|
export interface PluginInstance {
|
|
@@ -47,9 +53,11 @@ export interface PluginInstance {
|
|
|
47
53
|
processContent?: (content: ContentProvider, actions: ProcessContentActions) => Promise<void>;
|
|
48
54
|
afterRoutesCreated?: (content: ContentProvider, actions: AfterRoutesCreatedActions) => Promise<void>;
|
|
49
55
|
}
|
|
50
|
-
export interface
|
|
56
|
+
export interface PluginDefaultOptions {
|
|
51
57
|
contentDir: string;
|
|
52
58
|
outdir: string;
|
|
59
|
+
}
|
|
60
|
+
export interface PluginOptions extends PluginDefaultOptions {
|
|
53
61
|
[k: string]: unknown;
|
|
54
62
|
}
|
|
55
63
|
export declare type Plugin = (opts: PluginOptions) => PluginInstance;
|