@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.
Files changed (60) hide show
  1. package/Footer/CustomFooter.d.ts +7 -0
  2. package/Footer/CustomFooter.js +31 -0
  3. package/Footer/CustomFooterNavItem.d.ts +7 -0
  4. package/Footer/CustomFooterNavItem.js +25 -0
  5. package/Footer/Footer.d.ts +6 -2
  6. package/Footer/Footer.js +1 -1
  7. package/Footer/FooterColumn.d.ts +2 -2
  8. package/Footer/FooterColumn.js +3 -2
  9. package/Footer/FooterColumns.d.ts +6 -4
  10. package/Footer/FooterColumns.js +3 -3
  11. package/Footer/FooterCopyright.d.ts +6 -4
  12. package/Navbar/Navbar.d.ts +2 -1
  13. package/Navbar/Navbar.js +2 -1
  14. package/Navbar/NavbarDropdown.d.ts +8 -0
  15. package/Navbar/NavbarDropdown.js +21 -0
  16. package/Navbar/NavbarItem.d.ts +3 -36
  17. package/Navbar/NavbarItem.js +22 -13
  18. package/Navbar/NavbarMenu.d.ts +2 -1
  19. package/Navbar/NavbarMenu.js +1 -1
  20. package/globalStyle.js +1 -1
  21. package/package.json +1 -1
  22. package/src/Footer/CustomFooter.tsx +45 -0
  23. package/src/Footer/CustomFooterNavItem.tsx +40 -0
  24. package/src/Footer/Footer.tsx +6 -2
  25. package/src/Footer/FooterColumn.tsx +4 -4
  26. package/src/Footer/FooterColumns.tsx +9 -9
  27. package/src/Footer/FooterCopyright.tsx +6 -6
  28. package/src/Navbar/Navbar.tsx +5 -2
  29. package/src/Navbar/NavbarDropdown.tsx +44 -0
  30. package/src/Navbar/NavbarItem.tsx +44 -51
  31. package/src/Navbar/NavbarMenu.tsx +6 -3
  32. package/src/globalStyle.ts +1 -0
  33. package/src/types/portal/index.d.ts +0 -1
  34. package/src/types/portal/src/client/app/Sidebar/types.d.ts +1 -1
  35. package/src/types/portal/src/server/{utils → content}/content-provider.d.ts +9 -9
  36. package/src/types/portal/src/server/{version-store.d.ts → content/versions-config.d.ts} +7 -7
  37. package/src/types/portal/src/server/plugins/markdown/types.d.ts +14 -11
  38. package/src/types/portal/src/server/plugins/portal-config/types.d.ts +16 -19
  39. package/src/types/portal/src/server/plugins/types.d.ts +23 -15
  40. package/src/types/portal/src/server/store.d.ts +32 -33
  41. package/src/types/portal/src/server/utils/fs.d.ts +2 -1
  42. package/src/types/portal/src/server/utils/index.d.ts +0 -1
  43. package/src/types/portal/src/server/utils/paths.d.ts +3 -3
  44. package/src/types/portal/src/server/utils/reporter/formatter.d.ts +2 -1
  45. package/src/types/portal/src/server/utils/reporter/reporter.d.ts +2 -1
  46. package/src/types/portal/src/shared/constants.d.ts +2 -0
  47. package/src/types/portal/src/shared/models/active-item.d.ts +3 -0
  48. package/src/types/portal/src/shared/models/config.d.ts +28 -0
  49. package/src/types/portal/src/shared/models/index.d.ts +6 -0
  50. package/src/types/portal/src/shared/models/json-index.d.ts +5 -0
  51. package/src/types/portal/src/shared/models/operation-parameter.d.ts +6 -0
  52. package/src/types/portal/src/shared/models/search-data.d.ts +5 -0
  53. package/src/types/portal/src/shared/models/search-document.d.ts +11 -0
  54. package/src/types/portal/src/shared/types.d.ts +8 -2
  55. package/src/types/portal/src/shared/urls.d.ts +2 -0
  56. package/src/types/portal/src/shared/utils.d.ts +8 -2
  57. package/src/types/portal/src/client/app/media-css.d.ts +0 -7
  58. package/src/types/portal/src/client/styling/default.d.ts +0 -601
  59. package/src/types/portal/src/client/styling/index.d.ts +0 -10
  60. 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
- export enum MenuStyle {
9
- Drilldown = 'drilldown',
14
+ interface NavbarItemProps {
15
+ navItem: ResolvedNavItem;
10
16
  }
11
17
 
12
- export type ResolvedNavLinkItem = {
13
- type: 'link';
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
- export type ResolvedNavGroupItem = {
26
- type: 'group';
27
- link?: string;
28
- label: string;
29
- items: ResolvedNavItem[];
30
- version?: string;
31
- default?: string;
32
- menuStyle?: MenuStyle;
33
- separatorLine?: boolean;
34
- active?: boolean;
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
- export type ResolvedNavItem =
38
- | ResolvedNavLinkItem
39
- | ResolvedNavGroupItem
40
- | {
41
- type: 'separator';
42
- label?: string;
43
- separatorLine?: boolean;
44
- }
45
- | {
46
- type: 'error';
47
- label: string;
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
- interface NavbarItemProps {
51
- navItem: ResolvedNavLinkItem;
45
+ return null;
52
46
  }
53
47
 
54
- export function NavbarItem({ navItem }: NavbarItemProps): JSX.Element {
55
- const { pathname } = useLocation();
56
- const isActive = pathname === withPathPrefix(navItem.link);
57
-
58
- return (
59
- <NavMenuItem active={isActive} data-component-name="Navbar/NavbarItem">
60
- <NavLink to={navItem.link} active={isActive}>
61
- <NavLabel>{navItem.label}</NavLabel>
62
- </NavLink>
63
- </NavMenuItem>
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: any[] }): JSX.Element | null {
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 <NavbarItem key={index} data-cy={navItem.label} navItem={navItem} />;
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
  );
@@ -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,4 +1,3 @@
1
- export * from './src/client/styling';
2
1
  export * from './src/client/app/Sidebar/types';
3
2
  export * from './src/server/plugins/portal-config/types';
4
3
  export * from './src/shared/types';
@@ -27,7 +27,7 @@ export interface ItemState extends SidebarNavItem {
27
27
  items: ItemState[];
28
28
  active: boolean;
29
29
  hasActiveSubItem: boolean;
30
- menuStyle?: MenuStyle | null;
30
+ menuStyle?: MenuStyle;
31
31
  }
32
32
  export declare enum MenuType {
33
33
  Separator = "separator",
@@ -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: VersionStore;
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: unknown;
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: VersionStore;
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<unknown>;
41
+ loadContent<T = unknown>(relativePath: string, parse: 'yaml'): ParsedContentRecord<T>;
42
42
  loadContent(relativePath: string, parse: 'frontmatter'): ParsedContentRecord<{
43
43
  content: string;
44
- data: unknown;
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 '../shared/types';
2
- import { ContentProvider } from './utils/index.js';
3
- import { PathVersionInfo } from './plugins/types';
4
- export declare class VersionStore {
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 | null;
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, RenderNodes } from '@markdoc/markdoc/dist/src/types';
2
- import type { ContentProvider, ContentRecord } from '../../utils/content-provider.js';
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: RenderNodes;
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 { LogoConfig, RawNavItem, ResolvedNavItem } from '../../../shared/types.js';
2
- export interface PortalConfig extends Record<string, any> {
3
- nav?: RawNavItem[];
4
- logo?: LogoConfig;
5
- themes?: CustomTheme[];
6
- footer?: FooterConfig;
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 CustomTheme {
9
- name: string;
10
- settings?: any;
11
- themeStyles?: string;
12
- }
13
- export interface FooterConfig {
14
- copyrightText?: string;
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 '../utils/content-provider.js';
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
- createSharedData(id: string, data: any): string;
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: any): string;
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: Record<string, unknown>) => void;
38
- setGlobalConfig: (data: Record<string, unknown>) => void;
39
- addRedirect: (from: string, to: {
40
- to: string;
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 PluginOptions {
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 type { RouteDetails } from './plugins/types.js';
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
- absolutePath: string;
6
+ pathOrThemePath: string;
4
7
  id: string;
5
8
  hash: string;
6
- constructor(absolutePath: string, id: string);
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
- sharedData: Map<string, any>;
18
+ searchDocuments: SearchDocument[];
19
+ searchIndex: JSONIndex;
20
+ sharedData: Map<string, unknown>;
16
21
  templates: Map<string, Template>;
17
- esbuildPlugins: any[];
22
+ esbuildPlugins: Plugin[];
18
23
  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
- };
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 | 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;
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;
@@ -2,5 +2,4 @@ export * from './async.js';
2
2
  export * from './crypto.js';
3
3
  export * from './fs.js';
4
4
  export * from './reporter/reporter.js';
5
- export * from './content-provider.js';
6
5
  export * from './paths.js';
@@ -1,6 +1,6 @@
1
- import { ContentProvider } from './index.js';
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
- } | undefined;
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: any, reporter: any): string;
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,3 @@
1
+ export declare type ActiveItem<T> = T & {
2
+ active: boolean;
3
+ };
@@ -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
+ }
@@ -0,0 +1,6 @@
1
+ export * from './search-document';
2
+ export * from './active-item';
3
+ export * from './search-data';
4
+ export * from './json-index';
5
+ export * from './operation-parameter';
6
+ export * from './config';
@@ -0,0 +1,5 @@
1
+ import Fuse from 'fuse.js';
2
+ export interface JSONIndex {
3
+ keys: ReadonlyArray<string>;
4
+ records: Fuse.FuseIndexRecords;
5
+ }
@@ -0,0 +1,6 @@
1
+ export interface OperationParameter {
2
+ name: string | string[];
3
+ description: string | string[];
4
+ place: string;
5
+ path?: string[];
6
+ }