@redocly/theme 0.1.9 → 0.1.12
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/index.d.ts +1 -1
- package/Button/index.js +1 -1
- package/CodeBlock/index.d.ts +1 -1
- package/CodeBlock/index.js +1 -1
- package/CopyButton/index.d.ts +2 -2
- package/CopyButton/index.js +2 -2
- package/Footer/Footer.d.ts +2 -2
- package/Footer/Footer.js +1 -1
- package/Footer/FooterColumn.js +6 -6
- package/Footer/FooterColumns.d.ts +3 -3
- package/Footer/FooterCopyright.d.ts +3 -3
- package/Footer/FooterCopyright.js +1 -1
- package/Footer/index.d.ts +4 -4
- package/Footer/index.js +4 -4
- package/Headings/index.d.ts +1 -1
- package/Headings/index.js +1 -1
- package/JsonViewer/index.d.ts +2 -2
- package/JsonViewer/index.js +2 -2
- package/Layout/index.d.ts +2 -2
- package/Layout/index.js +2 -2
- package/Markdown/Admonition.js +4 -4
- package/Markdown/CodeSample/index.d.ts +3 -3
- package/Markdown/CodeSample/index.js +3 -3
- package/Markdown/Heading.js +1 -1
- package/Markdown/MarkdownLayout.d.ts +2 -2
- package/Markdown/StyledMarkdown.js +2 -2
- package/Markdown/Tabs/index.d.ts +2 -2
- package/Markdown/Tabs/index.js +2 -2
- package/Markdown/index.d.ts +9 -9
- package/Markdown/index.js +9 -9
- package/Navbar/Navbar.d.ts +0 -1
- package/Navbar/Navbar.js +1 -1
- package/Navbar/NavbarItem.js +1 -1
- package/Navbar/NavbarMenu.js +1 -1
- package/Navbar/index.d.ts +3 -0
- package/Navbar/index.js +19 -0
- package/NavbarLogo/NavbarLogo.d.ts +6 -0
- package/{Logo/Logo.js → NavbarLogo/NavbarLogo.js} +8 -5
- package/NavbarLogo/index.d.ts +1 -0
- package/{Logo → NavbarLogo}/index.js +1 -1
- package/OperationBadge/index.d.ts +1 -1
- package/OperationBadge/index.js +1 -1
- package/PageNavigation/index.d.ts +3 -0
- package/PageNavigation/index.js +19 -0
- package/Panel/index.d.ts +8 -8
- package/Panel/index.js +8 -8
- package/REAMDE.md +1 -0
- package/SamplesPanelControls/index.d.ts +1 -1
- package/SamplesPanelControls/index.js +1 -1
- package/Search/Autocomplete.js +1 -1
- package/Search/ClearIcon.js +2 -2
- package/Search/Input.js +1 -1
- package/Search/Parameters.js +2 -2
- package/Search/Popover.js +1 -1
- package/Search/SearchIcon.js +2 -2
- package/Search/SearchItem.js +2 -2
- package/Search/index.d.ts +9 -9
- package/Search/index.js +9 -9
- package/Search/utils.js +1 -1
- package/Sidebar/ApiCallItem.js +1 -1
- package/Sidebar/BackButton.js +1 -1
- package/Sidebar/DrilldownMenuItem.js +3 -3
- package/Sidebar/Menu.js +1 -1
- package/Sidebar/MenuItemLabel.js +2 -2
- package/Sidebar/MenuLink.js +1 -1
- package/Sidebar/MobileSidebarButton.js +1 -1
- package/Sidebar/Sidebar.js +1 -1
- package/Sidebar/index.d.ts +19 -19
- package/Sidebar/index.js +19 -19
- package/Sidebar/types/index.d.ts +5 -5
- package/Sidebar/types/index.js +5 -5
- package/SidebarLogo/index.d.ts +1 -1
- package/SidebarLogo/index.js +1 -1
- package/SourceCode/index.d.ts +1 -1
- package/SourceCode/index.js +1 -1
- package/TableOfContent/TableOfContent.js +7 -8
- package/TableOfContent/index.d.ts +1 -1
- package/TableOfContent/index.js +1 -1
- package/Tooltip/index.d.ts +1 -1
- package/Tooltip/index.js +1 -1
- package/globalStyle.d.ts +1 -0
- package/globalStyle.js +25 -3
- package/hooks/index.d.ts +7 -7
- package/hooks/index.js +7 -7
- package/hooks/useActiveSectionId.d.ts +2 -2
- package/hooks/useActiveSectionId.js +1 -0
- package/icons/ShelfIcon/index.d.ts +2 -2
- package/icons/ShelfIcon/index.js +1 -1
- package/icons/index.d.ts +1 -1
- package/icons/index.js +1 -1
- package/mocks/Link.js +4 -1
- package/mocks/hooks/usePageData.js +4 -1
- package/package.json +1 -1
- package/src/Button/index.ts +1 -1
- package/src/CodeBlock/index.ts +1 -1
- package/src/CopyButton/index.ts +2 -2
- package/src/Footer/Footer.tsx +5 -8
- package/src/Footer/FooterColumn.tsx +7 -7
- package/src/Footer/FooterColumns.tsx +3 -1
- package/src/Footer/FooterCopyright.tsx +5 -3
- package/src/Footer/index.ts +4 -4
- package/src/Headings/index.ts +1 -1
- package/src/JsonViewer/index.ts +2 -2
- package/src/Layout/index.ts +2 -2
- package/src/Markdown/Admonition.tsx +15 -15
- package/src/Markdown/CodeSample/index.ts +3 -3
- package/src/Markdown/Heading.tsx +4 -1
- package/src/Markdown/MarkdownLayout.tsx +2 -2
- package/src/Markdown/StyledMarkdown.tsx +27 -27
- package/src/Markdown/Tabs/index.ts +2 -2
- package/src/Markdown/index.ts +9 -9
- package/src/Navbar/Navbar.tsx +2 -3
- package/src/Navbar/NavbarItem.tsx +1 -1
- package/src/Navbar/NavbarMenu.tsx +1 -1
- package/src/Navbar/index.ts +3 -0
- package/src/NavbarLogo/NavbarLogo.tsx +24 -0
- package/src/NavbarLogo/index.ts +1 -0
- package/src/OperationBadge/index.ts +1 -1
- package/src/PageNavigation/index.ts +3 -0
- package/src/Panel/index.ts +8 -8
- package/src/SamplesPanelControls/index.ts +1 -1
- package/src/Search/Autocomplete.tsx +1 -1
- package/src/Search/ClearIcon.tsx +12 -13
- package/src/Search/Input.tsx +7 -7
- package/src/Search/Parameters.tsx +2 -2
- package/src/Search/Popover.tsx +2 -2
- package/src/Search/SearchIcon.tsx +12 -13
- package/src/Search/SearchItem.tsx +2 -2
- package/src/Search/index.ts +9 -9
- package/src/Search/utils.tsx +1 -1
- package/src/Sidebar/ApiCallItem.tsx +1 -2
- package/src/Sidebar/BackButton.tsx +2 -2
- package/src/Sidebar/DrilldownMenuItem.tsx +4 -4
- package/src/Sidebar/Menu.tsx +1 -1
- package/src/Sidebar/MenuItemLabel.tsx +4 -4
- package/src/Sidebar/MenuLink.tsx +1 -1
- package/src/Sidebar/MobileSidebarButton.tsx +2 -2
- package/src/Sidebar/Sidebar.tsx +1 -1
- package/src/Sidebar/index.ts +19 -19
- package/src/Sidebar/types/index.ts +5 -5
- package/src/SidebarLogo/index.ts +1 -1
- package/src/SourceCode/index.ts +1 -1
- package/src/TableOfContent/TableOfContent.tsx +12 -10
- package/src/TableOfContent/index.ts +1 -1
- package/src/Tooltip/index.ts +1 -1
- package/src/globalStyle.ts +793 -441
- package/src/hooks/index.ts +7 -7
- package/src/hooks/useActiveSectionId.ts +3 -3
- package/src/icons/ShelfIcon/index.ts +2 -2
- package/src/icons/index.ts +1 -1
- package/src/mocks/Link.tsx +5 -2
- package/src/mocks/hooks/usePageData.ts +4 -1
- package/src/types/portal/index.d.ts +0 -1
- package/src/types/portal/src/client/app/Sidebar/types.d.ts +32 -41
- package/src/types/portal/src/client/app/media-css.d.ts +4 -4
- package/src/types/portal/src/client/styling/default.d.ts +585 -391
- package/src/types/portal/src/client/styling/index.d.ts +2 -6
- package/src/types/portal/src/server/constants.d.ts +5 -9
- package/src/types/portal/src/server/plugins/markdown/types.d.ts +14 -19
- package/src/types/portal/src/server/plugins/portal-config/types.d.ts +12 -12
- package/src/types/portal/src/server/plugins/types.d.ts +55 -0
- package/src/types/portal/src/server/store.d.ts +49 -97
- package/src/types/portal/src/server/utils/async.d.ts +1 -5
- package/src/types/portal/src/server/utils/content-provider.d.ts +51 -0
- package/src/types/portal/src/server/utils/index.d.ts +1 -1
- package/src/types/portal/src/server/utils/paths.d.ts +10 -13
- package/src/types/portal/src/server/utils/reporter/formatter.d.ts +8 -8
- package/src/types/portal/src/server/utils/reporter/reporter.d.ts +15 -15
- package/src/types/portal/src/server/version-store.d.ts +35 -0
- package/src/types/portal/src/shared/constants.d.ts +6 -6
- package/src/types/portal/src/shared/types.d.ts +97 -58
- package/src/types/portal/src/shared/urls.d.ts +2 -1
- package/src/ui/AlertIcon.tsx +8 -7
- package/src/ui/Background.tsx +3 -3
- package/src/ui/Dropdown.tsx +4 -4
- package/src/ui/Jumbotron.tsx +3 -3
- package/src/ui/Tiles/TileHeader.ts +1 -1
- package/src/ui/Tiles/TileText.tsx +2 -2
- package/src/ui/Tiles/index.ts +4 -4
- package/src/ui/Typography.tsx +27 -27
- package/src/ui/UniversalLink.tsx +3 -8
- package/src/utils/isUrl.ts +4 -4
- package/ui/AlertIcon.d.ts +3 -2
- package/ui/AlertIcon.js +2 -2
- package/ui/Background.js +1 -1
- package/ui/Dropdown.js +3 -3
- package/ui/Jumbotron.js +3 -3
- package/ui/Tiles/TileHeader.js +1 -1
- package/ui/Tiles/TileText.js +1 -1
- package/ui/Tiles/index.d.ts +4 -4
- package/ui/Tiles/index.js +4 -4
- package/ui/Typography.js +23 -23
- package/ui/UniversalLink.js +1 -5
- package/utils/isUrl.d.ts +2 -2
- package/utils/isUrl.js +4 -4
- package/Logo/Logo.d.ts +0 -5
- package/Logo/index.d.ts +0 -1
- package/src/Button/Button.stories.tsx +0 -74
- package/src/Button/__tests__/Button.test.tsx +0 -42
- package/src/Button/__tests__/__snapshots__/Button.test.tsx.snap +0 -274
- package/src/CodeBlock/__tests__/CodeBlock.test.tsx +0 -12
- package/src/CodeBlock/__tests__/__snapshots__/CodeBlock.test.tsx.snap +0 -140
- package/src/CopyButton/CopyButton.stories.tsx +0 -18
- package/src/CopyButton/__tests__/CopyButton.test.tsx +0 -35
- package/src/CopyButton/__tests__/CopyButtonWrapper.test.tsx +0 -17
- package/src/CopyButton/__tests__/__snapshots__/CopyButton.test.tsx.snap +0 -55
- package/src/CopyButton/__tests__/__snapshots__/CopyButtonWrapper.test.tsx.snap +0 -46
- package/src/Headings/Headings.stories.tsx +0 -36
- package/src/Headings/__tests__/Headings.test.tsx +0 -24
- package/src/Headings/__tests__/__snapshots__/Headings.test.tsx.snap +0 -57
- package/src/Introduction.stories.mdx +0 -7
- package/src/JsonViewer/JsonViewer.stories.tsx +0 -57
- package/src/JsonViewer/__tests__/JsonViewer.test.tsx +0 -83
- package/src/JsonViewer/__tests__/__snapshots__/JsonViewer.test.tsx.snap +0 -2728
- package/src/Logo/Logo.tsx +0 -17
- package/src/Logo/index.ts +0 -1
- package/src/Navbar/Navbar.stories.tsx +0 -28
- package/src/OperationBadge/OperationBadge.stories.tsx +0 -35
- package/src/OperationBadge/__tests__/OperationBadge.test.tsx +0 -59
- package/src/OperationBadge/__tests__/__snapshots__/OperationBadge.test.tsx.snap +0 -651
- package/src/Panel/CodePanel.stories.tsx +0 -26
- package/src/Panel/ContentPanel.stories.tsx +0 -26
- package/src/Panel/Panel.stories.tsx +0 -56
- package/src/Panel/__tests__/CodePanel.test.tsx +0 -26
- package/src/Panel/__tests__/ContentPanel.test.tsx +0 -26
- package/src/Panel/__tests__/Panel.test.tsx +0 -53
- package/src/Panel/__tests__/__snapshots__/CodePanel.test.tsx.snap +0 -258
- package/src/Panel/__tests__/__snapshots__/ContentPanel.test.tsx.snap +0 -278
- package/src/Panel/__tests__/__snapshots__/Panel.test.tsx.snap +0 -398
- package/src/SamplesPanelControls/SamplesControlButton.stories.tsx +0 -18
- package/src/SamplesPanelControls/__tests__/SamplesPanelControls.test.tsx +0 -36
- package/src/SamplesPanelControls/__tests__/__snapshots__/SamplesPanelControls.test.tsx.snap +0 -228
- package/src/SidebarLogo/SidebarLogo.stories.tsx +0 -21
- package/src/SidebarLogo/__tests__/SidebarLogo.test.tsx +0 -32
- package/src/SidebarLogo/__tests__/__snapshots__/SidebarLogo.test.tsx.snap +0 -62
- package/src/SourceCode/SourceCode.stories.tsx +0 -29
- package/src/SourceCode/__tests__/SourceCode.test.tsx +0 -48
- package/src/SourceCode/__tests__/__snapshots__/SourceCode.test.tsx.snap +0 -786
- package/src/TableOfContent/TableOfContent.stories.tsx +0 -39
- package/src/Tooltip/Tooltip.stories.tsx +0 -27
- package/src/Tooltip/__tests__/Tooltip.test.tsx +0 -41
- package/src/Tooltip/__tests__/__snapshots__/Tooltip.test.tsx.snap +0 -83
- package/src/icons/ShelfIcon/ShelfIcon.stories.tsx +0 -36
- package/src/icons/ShelfIcon/__tests__/ShelfIcon.test.tsx +0 -54
- package/src/icons/ShelfIcon/__tests__/__snapshots__/ShelfIcon.test.tsx.snap +0 -235
- package/src/types/portal/src/server/plugins/nav-utils.d.ts +0 -19
- package/src/types/portal/src/server/plugins/sidebars/index.d.ts +0 -16
- package/src/types/portal/src/server/plugins/versions/index.d.ts +0 -15
- package/src/types/portal/src/server/plugins/versions/types.d.ts +0 -23
- package/src/types/portal/src/server/plugins/versions/utils.d.ts +0 -10
- package/src/types/portal/src/server/utils/watcher.d.ts +0 -16
- package/src/utils/__tests__/ClipboardService.test.ts +0 -24
- package/src/utils/__tests__/__snapshots__/highlight.test.ts.snap +0 -5
- package/src/utils/__tests__/__snapshots__/jsonToHtml.test.ts.snap +0 -5
- package/src/utils/__tests__/css-variables.test.ts +0 -20
- package/src/utils/__tests__/highlight.test.ts +0 -51
- package/src/utils/__tests__/jsonToHtml.test.ts +0 -40
- package/src/utils/__tests__/media-css.test.ts +0 -20
- package/src/utils/__tests__/theme-helpers.test.ts +0 -25
|
@@ -2,13 +2,9 @@ import type { MediaQueries } from './../app/media-css';
|
|
|
2
2
|
import { defaultTheme } from './default.js';
|
|
3
3
|
export declare const theme: AppTheme;
|
|
4
4
|
declare type InferDeep<T extends object> = {
|
|
5
|
-
|
|
6
|
-
? ReturnType<T[k]>
|
|
7
|
-
: T[k] extends object
|
|
8
|
-
? InferDeep<T[k]>
|
|
9
|
-
: T[k];
|
|
5
|
+
[k in keyof T]: T[k] extends (...args: any) => any ? ReturnType<T[k]> : T[k] extends object ? InferDeep<T[k]> : T[k];
|
|
10
6
|
};
|
|
11
7
|
export declare type AppTheme = InferDeep<typeof defaultTheme> & {
|
|
12
|
-
|
|
8
|
+
mediaQueries: MediaQueries;
|
|
13
9
|
};
|
|
14
10
|
export {};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
export declare enum cliCommandNames {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
}
|
|
5
|
-
export declare const VERSION_SEPARATOR = '@';
|
|
6
|
-
export declare const DEFAULT_VERSION_NAME = 'default';
|
|
7
|
-
export declare enum PageType {
|
|
8
|
-
MARKDOWN = 'Markdown',
|
|
9
|
-
REFERENCE_DOCS = 'ReferenceDocs',
|
|
10
|
-
REACT = 'React',
|
|
2
|
+
BUILD = "build",
|
|
3
|
+
DEVELOP = "develop"
|
|
11
4
|
}
|
|
5
|
+
export declare const VERSION_SEPARATOR = "@";
|
|
6
|
+
export declare const DEFAULT_VERSION_NAME = "default";
|
|
7
|
+
export declare const VERSIONED_FOLDER_REGEXP_MATCH: RegExp;
|
|
@@ -1,28 +1,23 @@
|
|
|
1
1
|
import { Config, RenderNodes } from '@markdoc/markdoc/dist/src/types';
|
|
2
|
-
import type {
|
|
3
|
-
import type {
|
|
2
|
+
import type { ContentProvider, ContentRecord } from '../../utils/content-provider.js';
|
|
3
|
+
import type { RouteDetails } from '../types.js';
|
|
4
4
|
export declare type MarkdownOptions = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
outdir: string;
|
|
5
|
+
contentDir: string;
|
|
6
|
+
outdir: string;
|
|
7
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
8
|
+
getRouteBySlug: (slug: string) => RouteDetails;
|
|
9
|
+
contentProvider: ContentProvider;
|
|
11
10
|
};
|
|
12
11
|
export interface MdHeading {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
id: string;
|
|
13
|
+
value: string;
|
|
14
|
+
depth: number;
|
|
16
15
|
}
|
|
17
16
|
export interface MdCompilationResult {
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
result: RenderNodes;
|
|
18
|
+
headings: MdHeading[];
|
|
20
19
|
}
|
|
21
|
-
export declare type MdCompilationContext =
|
|
22
|
-
absolutePath: string;
|
|
23
|
-
content: string;
|
|
24
|
-
contentHash: string;
|
|
25
|
-
} & MarkdownOptions;
|
|
20
|
+
export declare type MdCompilationContext = ContentRecord & MarkdownOptions;
|
|
26
21
|
export interface ExtendedMarkdocConfig extends Config {
|
|
27
|
-
|
|
22
|
+
currentProcessedPage?: string;
|
|
28
23
|
}
|
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
import { LogoConfig, RawNavItem, ResolvedNavItem } from '../../../shared/types.js';
|
|
2
2
|
export interface PortalConfig extends Record<string, any> {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
nav?: RawNavItem[];
|
|
4
|
+
logo?: LogoConfig;
|
|
5
|
+
themes?: CustomTheme[];
|
|
6
|
+
footer?: FooterConfig;
|
|
7
7
|
}
|
|
8
8
|
export interface CustomTheme {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
9
|
+
name: string;
|
|
10
|
+
settings?: any;
|
|
11
|
+
themeStyles?: string;
|
|
12
12
|
}
|
|
13
13
|
export interface FooterConfig {
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
copyrightText?: string;
|
|
15
|
+
columns?: FooterColumn[];
|
|
16
16
|
}
|
|
17
17
|
export interface FooterColumn {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
group: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
items: ResolvedNavItem[];
|
|
21
21
|
}
|
|
22
22
|
export declare type CustomEntryPropertyType = Record<string, string | boolean>;
|
|
23
23
|
export declare type ScriptOrStylesheetConfig = string | CustomEntryPropertyType;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { PageProps, ResolvedNavItem } from '../../shared/types.js';
|
|
2
|
+
import type { Template } from '../store';
|
|
3
|
+
import type { ContentProvider } from '../utils/content-provider.js';
|
|
4
|
+
export declare type DataLoaderContext = {
|
|
5
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
6
|
+
getRouteBySlug: (relativePath: string) => RouteDetails;
|
|
7
|
+
};
|
|
8
|
+
export declare type DataLoader<T = any> = (contentProvider: ContentProvider, context: DataLoaderContext) => Promise<T>;
|
|
9
|
+
export interface RouteDetails {
|
|
10
|
+
slug: string;
|
|
11
|
+
fsPath: string;
|
|
12
|
+
templateId: string;
|
|
13
|
+
dataLoaders: {
|
|
14
|
+
props: DataLoader<PageProps>;
|
|
15
|
+
[k: string]: DataLoader;
|
|
16
|
+
};
|
|
17
|
+
getNavText?: () => Promise<string>;
|
|
18
|
+
getSidebar?(): ResolvedNavItem[];
|
|
19
|
+
}
|
|
20
|
+
export interface PathVersionInfo {
|
|
21
|
+
version: string;
|
|
22
|
+
isDefault: boolean;
|
|
23
|
+
versionFolderId: string;
|
|
24
|
+
}
|
|
25
|
+
export interface ProcessContentActions {
|
|
26
|
+
addRoute: (route: RouteDetails) => void;
|
|
27
|
+
createTemplate: (template: Template) => Template;
|
|
28
|
+
createSharedData(id: string, data: any): string;
|
|
29
|
+
addRouteSharedData(slug: string, dataKey: string, dataId: string): void;
|
|
30
|
+
}
|
|
31
|
+
export interface AfterRoutesCreatedActions {
|
|
32
|
+
createSharedData(id: string, data: any): string;
|
|
33
|
+
addRouteSharedData(routeSlug: string, dataKey: string, dataId: string): void;
|
|
34
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
35
|
+
getRouteBySlug: (relativePath: string) => RouteDetails;
|
|
36
|
+
getAllRoutes: () => RouteDetails[];
|
|
37
|
+
setGlobalData: (data: Record<string, unknown>) => void;
|
|
38
|
+
setGlobalConfig: (data: Record<string, unknown>) => void;
|
|
39
|
+
addRedirect: (from: string, to: {
|
|
40
|
+
to: string;
|
|
41
|
+
type: number;
|
|
42
|
+
}) => void;
|
|
43
|
+
contentDir: string;
|
|
44
|
+
}
|
|
45
|
+
export interface PluginInstance {
|
|
46
|
+
watch?: RegExp;
|
|
47
|
+
processContent?: (content: ContentProvider, actions: ProcessContentActions) => Promise<void>;
|
|
48
|
+
afterRoutesCreated?: (content: ContentProvider, actions: AfterRoutesCreatedActions) => Promise<void>;
|
|
49
|
+
}
|
|
50
|
+
export interface PluginOptions {
|
|
51
|
+
contentDir: string;
|
|
52
|
+
outdir: string;
|
|
53
|
+
[k: string]: unknown;
|
|
54
|
+
}
|
|
55
|
+
export declare type Plugin = (opts: PluginOptions) => PluginInstance;
|
|
@@ -1,101 +1,53 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { PageType } from './constants.js';
|
|
3
|
-
import type { Version, VersionsConfigType } from './plugins/versions/types.js';
|
|
4
|
-
import type { ResolvedNavItem } from '../shared/types.js';
|
|
5
|
-
export interface PageProps {
|
|
6
|
-
id: string;
|
|
7
|
-
seo: {
|
|
8
|
-
title: string;
|
|
9
|
-
};
|
|
10
|
-
versions?: Version[];
|
|
11
|
-
[k: string]: unknown;
|
|
12
|
-
}
|
|
13
|
-
export interface Page {
|
|
14
|
-
type: PageType;
|
|
15
|
-
basePath: string;
|
|
16
|
-
relativePath: string;
|
|
17
|
-
id: string;
|
|
18
|
-
pathname: string;
|
|
19
|
-
absolutePath: string;
|
|
20
|
-
hash: string;
|
|
21
|
-
sidebarId: string | null;
|
|
22
|
-
version: string;
|
|
23
|
-
versions: Version[] | null;
|
|
24
|
-
dataDependencies?: string[];
|
|
25
|
-
getPageProps(): Promise<PageProps>;
|
|
26
|
-
getSidebarLabel(): Promise<string>;
|
|
27
|
-
getTemplateId(): string;
|
|
28
|
-
getSidebar?(): ResolvedNavItem[];
|
|
29
|
-
getSidebarPages?(): Page[];
|
|
30
|
-
clone(version: string, versionsConfig: Map<string, VersionsConfigType>): Page;
|
|
31
|
-
}
|
|
1
|
+
import type { RouteDetails } from './plugins/types.js';
|
|
32
2
|
export declare class Template {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
3
|
+
absolutePath: string;
|
|
4
|
+
id: string;
|
|
5
|
+
hash: string;
|
|
6
|
+
constructor(absolutePath: string, id: string);
|
|
37
7
|
}
|
|
38
8
|
export declare class Store {
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
setVersionsConfig(id: string, data: VersionsConfigType): void;
|
|
84
|
-
setGlobalData(data: Record<string, unknown>): void;
|
|
85
|
-
setCliOptions(data: Record<string, unknown>): void;
|
|
86
|
-
setGlobalConfig(data: Record<string, unknown>): void;
|
|
87
|
-
setAllAbsolutePaths(paths: any): void;
|
|
88
|
-
setVersionConfigUpdated(): void;
|
|
89
|
-
getPageByPathname(pathname: string): Page;
|
|
90
|
-
getSidebarById(id: string): Sidebar;
|
|
91
|
-
getPageByFsPath(absolutePath: string): Page;
|
|
92
|
-
createSidebar(sidebar: Sidebar): void;
|
|
93
|
-
removeSidebar(id: string): void;
|
|
94
|
-
createSharedData(id: string, data: any): string;
|
|
95
|
-
createPage(page: Page): Promise<void>;
|
|
96
|
-
deletePage(pathname: string): void;
|
|
97
|
-
getTemplate(id: string): Template;
|
|
98
|
-
createTemplate(template: Template): void;
|
|
99
|
-
private verifyVersionsLink;
|
|
100
|
-
private assignPagesSidebars;
|
|
9
|
+
contentDir: string;
|
|
10
|
+
outdir: string;
|
|
11
|
+
renderMode: 'thread_worker' | 'main';
|
|
12
|
+
routesBySlug: Map<string, RouteDetails>;
|
|
13
|
+
routesByFsPath: Map<string, RouteDetails>;
|
|
14
|
+
routesSharedData: Map<string, Record<string, string>>;
|
|
15
|
+
sharedData: Map<string, any>;
|
|
16
|
+
templates: Map<string, Template>;
|
|
17
|
+
esbuildPlugins: any[];
|
|
18
|
+
listeners: Map<string, Set<Function>>;
|
|
19
|
+
globalData: Record<string, unknown>;
|
|
20
|
+
cliOptions: Record<string, unknown>;
|
|
21
|
+
globalConfig: {
|
|
22
|
+
scripts: string;
|
|
23
|
+
stylesheets: string;
|
|
24
|
+
redirects: Record<string, {
|
|
25
|
+
to: string;
|
|
26
|
+
type: number;
|
|
27
|
+
}>;
|
|
28
|
+
[k: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
constructor(contentDir: string, outdir?: string, renderMode?: 'thread_worker' | 'main');
|
|
31
|
+
on(type: 'routes-updated', cb: () => void | any): void;
|
|
32
|
+
on(type: 'template-updated', cb: (template: Template) => void | any): void;
|
|
33
|
+
on(type: 'shared-data-updated', cb: (id: string, data: any) => void): any;
|
|
34
|
+
on(type: 'global-data-updated', cb: (pathname: string, data: Record<string, unknown>) => void | any): void;
|
|
35
|
+
runListeners<T extends Array<unknown>>(type: 'template-updated' | 'global-data-updated' | 'shared-data-updated' | 'routes-updated', ...args: T): void;
|
|
36
|
+
addEsbuildPlugin(plugin: any): void;
|
|
37
|
+
setGlobalData(data: Record<string, unknown>): void;
|
|
38
|
+
setCliOptions(data: Record<string, unknown>): void;
|
|
39
|
+
setGlobalConfig(data: Record<string, unknown>): void;
|
|
40
|
+
addRedirect(from: string, to: {
|
|
41
|
+
to: string;
|
|
42
|
+
type: number;
|
|
43
|
+
}): void;
|
|
44
|
+
createSharedData: (id: string, data: any) => string;
|
|
45
|
+
addRouteSharedData: (routeSlug: string, dataKey: string, dataId: string) => void;
|
|
46
|
+
addRoute: (route: RouteDetails) => void;
|
|
47
|
+
getRouteByFsPath: (relativePath: string) => RouteDetails;
|
|
48
|
+
getRouteBySlug: (slug: string) => RouteDetails;
|
|
49
|
+
getAllRoutes: () => RouteDetails[];
|
|
50
|
+
getTemplate: (id: string) => Template;
|
|
51
|
+
createTemplate: (template: Template) => Template;
|
|
52
|
+
clear: () => void;
|
|
101
53
|
}
|
|
@@ -1,5 +1 @@
|
|
|
1
|
-
export declare function promiseMapLimit<T, P>(
|
|
2
|
-
array: T[],
|
|
3
|
-
poolLimit: number,
|
|
4
|
-
iteratorFn: (arg: T, array: T[]) => Promise<P>,
|
|
5
|
-
): Promise<P[]>;
|
|
1
|
+
export declare function promiseMapLimit<T, P>(array: T[], poolLimit: number, iteratorFn: (arg: T, array: T[]) => Promise<P>): Promise<P[]>;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import * as chokidar from 'chokidar';
|
|
3
|
+
import * as fs from 'fs';
|
|
4
|
+
import { VersionStore } from '../version-store.js';
|
|
5
|
+
import { PathVersionInfo } from '../plugins/types.js';
|
|
6
|
+
declare type WatchCb = (event: 'add' | 'change' | 'unlink', path: string, stats?: fs.Stats) => Promise<void>;
|
|
7
|
+
export interface ContentRecord {
|
|
8
|
+
content: string;
|
|
9
|
+
contentHash: string;
|
|
10
|
+
relativePath: string;
|
|
11
|
+
parsed?: any;
|
|
12
|
+
}
|
|
13
|
+
export interface ParsedContentRecord<T = unknown> extends ContentRecord {
|
|
14
|
+
parsed: T;
|
|
15
|
+
}
|
|
16
|
+
export interface ContentProvider {
|
|
17
|
+
cwd: string;
|
|
18
|
+
filesList: Set<string>;
|
|
19
|
+
versions: VersionStore;
|
|
20
|
+
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
21
|
+
loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
|
|
22
|
+
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
23
|
+
content: string;
|
|
24
|
+
data: unknown;
|
|
25
|
+
}>;
|
|
26
|
+
loadContent(relativePath: string, parse: 'yaml' | 'frontmatter' | undefined): ParsedContentRecord;
|
|
27
|
+
getVersionInfoByFsPath: (relativePath: string) => PathVersionInfo;
|
|
28
|
+
has(relativePath: string): boolean;
|
|
29
|
+
}
|
|
30
|
+
export declare class FsContentProvider implements ContentProvider {
|
|
31
|
+
#private;
|
|
32
|
+
cwd: string;
|
|
33
|
+
private initialContentLoaded;
|
|
34
|
+
filesList: Set<string>;
|
|
35
|
+
versions: VersionStore;
|
|
36
|
+
constructor(cwd: string, initialCache?: Map<string, ContentRecord>);
|
|
37
|
+
private emit;
|
|
38
|
+
has(relativePath: string): boolean;
|
|
39
|
+
getVersionInfoByFsPath(relativePath: string): PathVersionInfo;
|
|
40
|
+
loadContent(relativePath: string, parse?: undefined): ContentRecord;
|
|
41
|
+
loadContent(relativePath: string, parse: 'yaml'): ParsedContentRecord<unknown>;
|
|
42
|
+
loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
|
|
43
|
+
content: string;
|
|
44
|
+
data: unknown;
|
|
45
|
+
}>;
|
|
46
|
+
watch(test: RegExp, cb: WatchCb): void;
|
|
47
|
+
stop(): Promise<void>;
|
|
48
|
+
start(): void;
|
|
49
|
+
ready(): Promise<chokidar.FSWatcher>;
|
|
50
|
+
}
|
|
51
|
+
export {};
|
|
@@ -1,16 +1,13 @@
|
|
|
1
|
+
import { ContentProvider } from './index.js';
|
|
1
2
|
export declare function getDataFromRelativePath(relativePath: string): {
|
|
2
|
-
|
|
3
|
-
|
|
3
|
+
pathVersion: string;
|
|
4
|
+
basePath: string;
|
|
4
5
|
};
|
|
5
|
-
export declare function generatePagePathname(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
...combineParts: string[]
|
|
9
|
-
): string;
|
|
6
|
+
export declare function generatePagePathname(currentVersion?: string | null, defaultVersion?: string | null, ...combineParts: string[]): string;
|
|
7
|
+
export declare function slugFromRelativePath(relativePath: string, contentProvider: ContentProvider): string;
|
|
8
|
+
export declare function slug(str: string): string;
|
|
10
9
|
export declare function fromCurrentDir(moduleUrl: string, path: string): string;
|
|
11
|
-
export declare function excludeVersion<T extends string[] | string>(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
data: T;
|
|
16
|
-
};
|
|
10
|
+
export declare function excludeVersion<T extends string[] | string>(arg: T): {
|
|
11
|
+
version?: string;
|
|
12
|
+
data: T;
|
|
13
|
+
} | undefined;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
declare const formatter: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
success(message: string, ...args: any[]): string;
|
|
3
|
+
info(message: string, ...args: any[]): string;
|
|
4
|
+
warn(message: string, ...args: any[]): string;
|
|
5
|
+
error(message: string, ...args: any[]): string;
|
|
6
|
+
verbose(message: string, ...args: any[]): string;
|
|
7
|
+
formatMs(ms: number): string;
|
|
8
|
+
withTime(message: any, reporter: any): string;
|
|
9
|
+
format(pattern: string, ...args: any[]): string;
|
|
10
10
|
};
|
|
11
11
|
export default formatter;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
export declare const reporter: {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
now(): number;
|
|
3
|
+
startTiming(): void;
|
|
4
|
+
getTimeSpan(): number;
|
|
5
|
+
success(message: string, ...args: any[]): void;
|
|
6
|
+
successTime(message: string, ...args: any[]): void;
|
|
7
|
+
info(message: string, ...args: any[]): void;
|
|
8
|
+
infoTime(message: string, ...args: any[]): void;
|
|
9
|
+
warn(message: string, ...args: any[]): void;
|
|
10
|
+
warnTime(message: string, ...args: any[]): void;
|
|
11
|
+
error(message: string, ...args: any[]): void;
|
|
12
|
+
verbose(message: string, ...args: any[]): void;
|
|
13
|
+
verboseTime(message: string, ...args: any[]): void;
|
|
14
|
+
panic(message: string, ...args: any[]): never;
|
|
15
|
+
panicOnBuild(message: string, ...args: any[]): void;
|
|
16
|
+
flushErrors(): void;
|
|
17
17
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Version } from '../shared/types';
|
|
2
|
+
import { ContentProvider } from './utils/index.js';
|
|
3
|
+
import { PathVersionInfo } from './plugins/types';
|
|
4
|
+
export declare class VersionStore {
|
|
5
|
+
contentProvider: ContentProvider;
|
|
6
|
+
private config;
|
|
7
|
+
constructor(contentProvider: ContentProvider);
|
|
8
|
+
private parsePath;
|
|
9
|
+
/**
|
|
10
|
+
* Goes through config and makes sure each folder has a default version set
|
|
11
|
+
* By default, versions are sorted alphabetically and last one becomes default
|
|
12
|
+
*/
|
|
13
|
+
private setDefaultVersions;
|
|
14
|
+
/**
|
|
15
|
+
* Checks for nested versions and files in the root of versioned folder
|
|
16
|
+
* @param allFiles relative paths of all files
|
|
17
|
+
*/
|
|
18
|
+
private validateVersionsStructure;
|
|
19
|
+
/**
|
|
20
|
+
* Read config and store it in the state and mark folder with hasVersionsConfig = true
|
|
21
|
+
* to prevent versions list from being deducted automatically.
|
|
22
|
+
* This means that if file strucutre has 3 versions, but config only specifies 2, the list will only have 2
|
|
23
|
+
* @param versionsFilePath path to versions.yaml
|
|
24
|
+
*/
|
|
25
|
+
private parseVersionsFile;
|
|
26
|
+
/**
|
|
27
|
+
* Reads and validates versions config.
|
|
28
|
+
* TODO: takes ~200-400ms on tests/starter. Consider partial updates instead of rebuilding if this is becoming a bottleneck
|
|
29
|
+
* @param allFilePaths
|
|
30
|
+
*/
|
|
31
|
+
resolveConfig(allFilePaths: Set<string>): void;
|
|
32
|
+
getPageVersions(pagePath: string, suffix?: string): Version[];
|
|
33
|
+
getDefaultByPath(path: string): string;
|
|
34
|
+
getVersionInfoByFsPath(path: string): PathVersionInfo | null;
|
|
35
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const RUNTIME_RESOURCES_DIR =
|
|
2
|
-
export declare const REDOC_OVERVIEW_ITEM_ID =
|
|
3
|
-
export declare const PORTAL_CUSTOM_THEMES_FOLDER =
|
|
4
|
-
export declare const USER_THEME_ALIAS =
|
|
5
|
-
export declare const PUBLIC_STATIC_FOLDER =
|
|
1
|
+
export declare const RUNTIME_RESOURCES_DIR = "runtime";
|
|
2
|
+
export declare const REDOC_OVERVIEW_ITEM_ID = "overview";
|
|
3
|
+
export declare const PORTAL_CUSTOM_THEMES_FOLDER = "@theme";
|
|
4
|
+
export declare const USER_THEME_ALIAS = "@theme";
|
|
5
|
+
export declare const PUBLIC_STATIC_FOLDER = "/static";
|
|
6
6
|
export declare enum FsErrors {
|
|
7
|
-
|
|
7
|
+
NotExist = "ENOENT"
|
|
8
8
|
}
|