@redocly/theme 0.1.17 → 0.1.20
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/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/Navbar/Navbar.d.ts +2 -1
- package/Navbar/Navbar.js +2 -1
- 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/globalStyle.js +1 -1
- package/package.json +1 -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/Navbar/Navbar.tsx +5 -2
- package/src/Navbar/NavbarDropdown.tsx +44 -0
- package/src/Navbar/NavbarItem.tsx +44 -51
- package/src/Navbar/NavbarMenu.tsx +6 -3
- package/src/globalStyle.ts +1 -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/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
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import styled from 'styled-components';
|
|
3
|
+
|
|
4
|
+
import type { ResolvedNavLinkItem } from '@theme/types/portal';
|
|
5
|
+
import { Link } from '@portal/Link';
|
|
6
|
+
|
|
7
|
+
interface NavbarDropdownProps {
|
|
8
|
+
items: ResolvedNavLinkItem[];
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export function NavbarDropdown({ items }: NavbarDropdownProps): JSX.Element {
|
|
12
|
+
return (
|
|
13
|
+
<DropdownWrapper data-component-name="Navbar/NavbarDropdown">
|
|
14
|
+
{items.map((item, index) => (
|
|
15
|
+
<div key={`${item.label}_${index}`}>
|
|
16
|
+
<Link to={item.link}>{item.label}</Link>
|
|
17
|
+
</div>
|
|
18
|
+
))}
|
|
19
|
+
</DropdownWrapper>
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const DropdownWrapper = styled.div`
|
|
24
|
+
display: none;
|
|
25
|
+
position: absolute;
|
|
26
|
+
background: var(--navbar-item-active-background-color);
|
|
27
|
+
border-radius: var(--navbar-item-border-radius);
|
|
28
|
+
padding: 10px 15px;
|
|
29
|
+
width: max-content;
|
|
30
|
+
line-height: 1rem;
|
|
31
|
+
box-shadow: var(--navbar-dropdown-shadow);
|
|
32
|
+
& > div {
|
|
33
|
+
text-align: left;
|
|
34
|
+
padding: 10px 0px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
a {
|
|
37
|
+
color: var(--navbar-text-color);
|
|
38
|
+
text-decoration: none;
|
|
39
|
+
}
|
|
40
|
+
:hover {
|
|
41
|
+
text-decoration: underline;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
`;
|
|
@@ -2,67 +2,60 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
import { useLocation } from 'react-router-dom';
|
|
4
4
|
|
|
5
|
+
import type {
|
|
6
|
+
ResolvedNavItem,
|
|
7
|
+
ResolvedNavLinkItem,
|
|
8
|
+
ResolvedNavGroupItem,
|
|
9
|
+
} from '@theme/types/portal';
|
|
5
10
|
import { Link } from '@portal/Link';
|
|
6
11
|
import { withPathPrefix } from '@portal/utils';
|
|
12
|
+
import { NavbarDropdown, DropdownWrapper } from '@theme/Navbar/NavbarDropdown';
|
|
7
13
|
|
|
8
|
-
|
|
9
|
-
|
|
14
|
+
interface NavbarItemProps {
|
|
15
|
+
navItem: ResolvedNavItem;
|
|
10
16
|
}
|
|
11
17
|
|
|
12
|
-
export
|
|
13
|
-
|
|
14
|
-
link: string;
|
|
15
|
-
label: string;
|
|
16
|
-
items?: ResolvedNavItem[];
|
|
17
|
-
external?: boolean;
|
|
18
|
-
version?: string;
|
|
19
|
-
default?: string;
|
|
20
|
-
httpVerb?: string; // TODO: make a separate type of item
|
|
21
|
-
separatorLine?: boolean;
|
|
22
|
-
active?: boolean;
|
|
23
|
-
};
|
|
18
|
+
export function NavbarItem({ navItem }: NavbarItemProps): JSX.Element | null {
|
|
19
|
+
const { pathname } = useLocation();
|
|
24
20
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
21
|
+
if ((navItem as ResolvedNavLinkItem).link) {
|
|
22
|
+
const item = navItem as ResolvedNavLinkItem;
|
|
23
|
+
const isActive = pathname === withPathPrefix(item.link);
|
|
24
|
+
return (
|
|
25
|
+
<NavMenuItem active={isActive} data-component-name="Navbar/NavbarItem">
|
|
26
|
+
<NavLink to={item.link} active={isActive}>
|
|
27
|
+
<NavLabel>{item.label}</NavLabel>
|
|
28
|
+
</NavLink>
|
|
29
|
+
</NavMenuItem>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
36
32
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
};
|
|
33
|
+
if ((navItem as ResolvedNavGroupItem).items) {
|
|
34
|
+
const item = navItem as ResolvedNavGroupItem;
|
|
35
|
+
return (
|
|
36
|
+
<NavMenuItemWithDropdownWrapper>
|
|
37
|
+
<NavMenuItem active={false} data-component-name="Navbar/NavbarItem">
|
|
38
|
+
<NavLabel>{item.label}</NavLabel>
|
|
39
|
+
</NavMenuItem>
|
|
40
|
+
<NavbarDropdown items={item.items as ResolvedNavLinkItem[]} />
|
|
41
|
+
</NavMenuItemWithDropdownWrapper>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
49
44
|
|
|
50
|
-
|
|
51
|
-
navItem: ResolvedNavLinkItem;
|
|
45
|
+
return null;
|
|
52
46
|
}
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
48
|
+
const NavMenuItemWithDropdownWrapper = styled.div`
|
|
49
|
+
display: inline-block;
|
|
50
|
+
position: relative;
|
|
51
|
+
border-radius: var(--navbar-item-border-radius);
|
|
52
|
+
&:hover {
|
|
53
|
+
background: var(--navbar-item-active-background-color);
|
|
54
|
+
${DropdownWrapper} {
|
|
55
|
+
display: block;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
`;
|
|
66
59
|
|
|
67
60
|
const NavMenuItem = styled.li<{ active?: boolean }>`
|
|
68
61
|
display: inline-block;
|
|
@@ -2,16 +2,19 @@ import React from 'react';
|
|
|
2
2
|
import styled from 'styled-components';
|
|
3
3
|
|
|
4
4
|
import { NavbarItem } from '@theme/Navbar/NavbarItem';
|
|
5
|
+
import type { ResolvedConfigLinks, ResolvedNavItem } from '@theme/types/portal';
|
|
5
6
|
|
|
6
|
-
export function NavbarMenu({ menuItems }: { menuItems:
|
|
7
|
+
export function NavbarMenu({ menuItems }: { menuItems: ResolvedConfigLinks }): JSX.Element | null {
|
|
7
8
|
if (!menuItems?.length) {
|
|
8
9
|
return null;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
return (
|
|
12
13
|
<NavItemsContainer data-component-name="Navbar/NavbarMenu">
|
|
13
|
-
{menuItems.map((navItem, index) => {
|
|
14
|
-
return
|
|
14
|
+
{(menuItems as ResolvedNavItem[]).map((navItem, index) => {
|
|
15
|
+
return (
|
|
16
|
+
<NavbarItem key={`${navItem.label}_${index}`} data-cy={navItem.label} navItem={navItem} />
|
|
17
|
+
);
|
|
15
18
|
})}
|
|
16
19
|
</NavItemsContainer>
|
|
17
20
|
);
|
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,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;
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Plugin } from 'esbuild';
|
|
2
|
+
import { JSONIndex, SearchDocument, SearchData } from '../shared/models';
|
|
3
|
+
import type { RouteDetails, Redirect } from './plugins/types.js';
|
|
4
|
+
import type { GlobalData, GlobalConfig, RbacConfig } from './plugins/portal-config/types';
|
|
2
5
|
export declare class Template {
|
|
3
|
-
|
|
6
|
+
pathOrThemePath: string;
|
|
4
7
|
id: string;
|
|
5
8
|
hash: string;
|
|
6
|
-
constructor(
|
|
9
|
+
constructor(pathOrThemePath: string, id: string);
|
|
7
10
|
}
|
|
8
11
|
export declare class Store {
|
|
9
12
|
contentDir: string;
|
|
@@ -12,42 +15,38 @@ export declare class Store {
|
|
|
12
15
|
routesBySlug: Map<string, RouteDetails>;
|
|
13
16
|
routesByFsPath: Map<string, RouteDetails>;
|
|
14
17
|
routesSharedData: Map<string, Record<string, string>>;
|
|
15
|
-
|
|
18
|
+
searchDocuments: SearchDocument[];
|
|
19
|
+
searchIndex: JSONIndex;
|
|
20
|
+
sharedData: Map<string, unknown>;
|
|
16
21
|
templates: Map<string, Template>;
|
|
17
|
-
esbuildPlugins:
|
|
22
|
+
esbuildPlugins: Plugin[];
|
|
18
23
|
listeners: Map<string, Set<Function>>;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
stylesheets: string;
|
|
24
|
-
redirects: Record<string, {
|
|
25
|
-
to: string;
|
|
26
|
-
type: number;
|
|
27
|
-
}>;
|
|
28
|
-
[k: string]: unknown;
|
|
29
|
-
};
|
|
24
|
+
rbacConfig: RbacConfig;
|
|
25
|
+
globalData: GlobalData;
|
|
26
|
+
cliOptions: Record<string, string>;
|
|
27
|
+
globalConfig: GlobalConfig;
|
|
30
28
|
constructor(contentDir: string, outdir?: string, renderMode?: 'thread_worker' | 'main');
|
|
31
|
-
on(type: 'routes-updated', cb: () => void
|
|
32
|
-
on(type: 'template-updated', cb: (
|
|
33
|
-
on(type: '
|
|
34
|
-
on(type: '
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
29
|
+
on(type: 'routes-updated', cb: () => void): void;
|
|
30
|
+
on(type: 'template-updated', cb: () => void): void;
|
|
31
|
+
on(type: 'build-updated', cb: () => void): void;
|
|
32
|
+
on(type: 'shared-data-updated', cb: (id: string, data: unknown) => void): void;
|
|
33
|
+
on(type: 'search-data-updated', cb: (data: SearchData) => void): void;
|
|
34
|
+
on(type: 'global-data-updated', cb: (pathname: string, data: Record<string, unknown>) => void): void;
|
|
35
|
+
runListeners<T extends Array<unknown>>(type: 'template-updated' | 'global-data-updated' | 'shared-data-updated' | 'search-data-updated' | 'routes-updated' | 'build-updated', ...args: T): void;
|
|
36
|
+
addEsbuildPlugin(plugin: Plugin): void;
|
|
37
|
+
setGlobalData(data: GlobalData): void;
|
|
38
|
+
setSearchData(data: SearchData): void;
|
|
39
|
+
setCliOptions(data: Record<string, string>): void;
|
|
40
|
+
setGlobalConfig(data: Partial<GlobalConfig>): void;
|
|
41
|
+
setRbacConfig(rbacConfig: RbacConfig): void;
|
|
42
|
+
addRedirect(from: string, to: Redirect): void;
|
|
43
|
+
createSharedData: (id: string, data: unknown) => string;
|
|
45
44
|
addRouteSharedData: (routeSlug: string, dataKey: string, dataId: string) => void;
|
|
46
45
|
addRoute: (route: RouteDetails) => void;
|
|
47
|
-
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
48
|
-
getRouteBySlug: (slug: string) => RouteDetails;
|
|
46
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails | undefined;
|
|
47
|
+
getRouteBySlug: (slug: string) => RouteDetails | undefined;
|
|
49
48
|
getAllRoutes: () => RouteDetails[];
|
|
50
|
-
getTemplate: (id: string) => Template;
|
|
49
|
+
getTemplate: (id: string) => Template | undefined;
|
|
51
50
|
createTemplate: (template: Template) => Template;
|
|
52
51
|
clear: () => void;
|
|
53
52
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
export declare function readFileAsStringSync(filePath: string): string;
|
|
1
|
+
export declare function readFileAsStringSync(filePath: string): string | null | undefined;
|
|
2
2
|
export declare function readFileNames(dir: string): string[];
|
|
3
3
|
export declare function copyStaticFile(absolutePath: string, outdir: string): string;
|
|
4
|
+
export declare function ensureDir(path: string): string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ContentProvider } from '
|
|
1
|
+
import type { ContentProvider } from '../content/content-provider.js';
|
|
2
2
|
export declare function getDataFromRelativePath(relativePath: string): {
|
|
3
|
-
pathVersion: string;
|
|
3
|
+
pathVersion: string | null;
|
|
4
4
|
basePath: string;
|
|
5
5
|
};
|
|
6
6
|
export declare function generatePagePathname(currentVersion?: string | null, defaultVersion?: string | null, ...combineParts: string[]): string;
|
|
@@ -10,4 +10,4 @@ export declare function fromCurrentDir(moduleUrl: string, path: string): string;
|
|
|
10
10
|
export declare function excludeVersion<T extends string[] | string>(arg: T): {
|
|
11
11
|
version?: string;
|
|
12
12
|
data: T;
|
|
13
|
-
}
|
|
13
|
+
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Reporter } from './reporter';
|
|
1
2
|
declare const formatter: {
|
|
2
3
|
success(message: string, ...args: any[]): string;
|
|
3
4
|
info(message: string, ...args: any[]): string;
|
|
@@ -5,7 +6,7 @@ declare const formatter: {
|
|
|
5
6
|
error(message: string, ...args: any[]): string;
|
|
6
7
|
verbose(message: string, ...args: any[]): string;
|
|
7
8
|
formatMs(ms: number): string;
|
|
8
|
-
withTime(message:
|
|
9
|
+
withTime(message: string, reporter: Reporter): string;
|
|
9
10
|
format(pattern: string, ...args: any[]): string;
|
|
10
11
|
};
|
|
11
12
|
export default formatter;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const reporter: {
|
|
2
2
|
now(): number;
|
|
3
3
|
startTiming(): void;
|
|
4
|
-
getTimeSpan(): number;
|
|
4
|
+
getTimeSpan(): number | undefined;
|
|
5
5
|
success(message: string, ...args: any[]): void;
|
|
6
6
|
successTime(message: string, ...args: any[]): void;
|
|
7
7
|
info(message: string, ...args: any[]): void;
|
|
@@ -15,3 +15,4 @@ export declare const reporter: {
|
|
|
15
15
|
panicOnBuild(message: string, ...args: any[]): void;
|
|
16
16
|
flushErrors(): void;
|
|
17
17
|
};
|
|
18
|
+
export declare type Reporter = typeof reporter;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export declare const RUNTIME_RESOURCES_DIR = "runtime";
|
|
2
2
|
export declare const REDOC_OVERVIEW_ITEM_ID = "overview";
|
|
3
3
|
export declare const PORTAL_CUSTOM_THEMES_FOLDER = "@theme";
|
|
4
|
+
export declare const CUSTOM_MARKDOC_OPTIONS_PATH = "markdoc";
|
|
5
|
+
export declare const CUSTOM_MARKDOC_TAGS_PATH = "tags";
|
|
4
6
|
export declare const USER_THEME_ALIAS = "@theme";
|
|
5
7
|
export declare const PUBLIC_STATIC_FOLDER = "/static";
|
|
6
8
|
export declare enum FsErrors {
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { RawNavItem, LogoConfig, ResolvedNavItem } from '../types';
|
|
2
|
+
export interface PortalConfig extends Record<string, any> {
|
|
3
|
+
nav?: RawNavItem[];
|
|
4
|
+
logo?: LogoConfig;
|
|
5
|
+
themes?: RawTheme[];
|
|
6
|
+
footer?: FooterConfig;
|
|
7
|
+
}
|
|
8
|
+
export interface RawTheme {
|
|
9
|
+
name: string;
|
|
10
|
+
settings?: any;
|
|
11
|
+
}
|
|
12
|
+
export interface ResolvedTheme extends RawTheme {
|
|
13
|
+
stylesFile?: string;
|
|
14
|
+
markdoc: {
|
|
15
|
+
nodesFiles: string[];
|
|
16
|
+
tagsFiles: string[];
|
|
17
|
+
componentsFile?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface FooterConfig {
|
|
21
|
+
copyrightText?: string;
|
|
22
|
+
columns?: FooterColumn[];
|
|
23
|
+
}
|
|
24
|
+
export interface FooterColumn {
|
|
25
|
+
group: string;
|
|
26
|
+
label?: string;
|
|
27
|
+
items: ResolvedNavItem[];
|
|
28
|
+
}
|