mirror of
https://github.com/Redocly/redoc.git
synced 2025-01-31 01:54:08 +03:00
feat: export TypeScript typings
This commit is contained in:
parent
e06f6e83de
commit
9115be8378
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -24,7 +24,8 @@ node_modules
|
||||||
lib/
|
lib/
|
||||||
stats.json
|
stats.json
|
||||||
cypress/
|
cypress/
|
||||||
bundles
|
bundles/
|
||||||
|
typings/
|
||||||
cli/index.js
|
cli/index.js
|
||||||
|
|
||||||
/benchmark/revisions
|
/benchmark/revisions
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
*
|
*
|
||||||
!bundles/*
|
!bundles/*
|
||||||
|
!typings/*
|
||||||
!package.json
|
!package.json
|
||||||
!README.md
|
!README.md
|
||||||
!LICENSE
|
!LICENSE
|
|
@ -23,6 +23,7 @@
|
||||||
"React.js"
|
"React.js"
|
||||||
],
|
],
|
||||||
"main": "bundles/redoc.lib.js",
|
"main": "bundles/redoc.lib.js",
|
||||||
|
"types": "typings/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"start": "webpack-dev-server --mode=development --env.playground --hot --config demo/webpack.config.ts",
|
"start": "webpack-dev-server --mode=development --env.playground --hot --config demo/webpack.config.ts",
|
||||||
"start:prod": "webpack-dev-server --env.playground --mode=production --config demo/webpack.config.ts",
|
"start:prod": "webpack-dev-server --env.playground --mode=production --config demo/webpack.config.ts",
|
||||||
|
@ -37,6 +38,7 @@
|
||||||
"bundle:standalone": "webpack --env.standalone --mode=production",
|
"bundle:standalone": "webpack --env.standalone --mode=production",
|
||||||
"bundle:lib": "webpack --mode=production",
|
"bundle:lib": "webpack --mode=production",
|
||||||
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
"bundle": "npm run bundle:clean && npm run bundle:lib && npm run bundle:standalone",
|
||||||
|
"declarations": "rimraf typings && tsc --emitDeclarationOnly -p tsconfig.lib.json",
|
||||||
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
|
"stats": "webpack --env.standalone --json --profile --mode=production > stats.json",
|
||||||
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
|
"prettier": "prettier --write \"src/**/*.{ts,tsx}\"",
|
||||||
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 1",
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
|
import * as React from 'react';
|
||||||
import Dropdown from 'react-dropdown';
|
import Dropdown from 'react-dropdown';
|
||||||
|
|
||||||
import styled, { StyledComponentClass, withProps } from '../styled-components';
|
import styled, {
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
withProps,
|
||||||
|
} from '../styled-components';
|
||||||
|
|
||||||
export interface DropdownOption {
|
export interface DropdownOption {
|
||||||
label: string;
|
label: string;
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
import { transparentize } from 'polished';
|
import { transparentize } from 'polished';
|
||||||
import styled, { withProps } from '../styled-components';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import styled, {
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
withProps,
|
||||||
|
} from '../styled-components';
|
||||||
import { deprecatedCss } from './mixins';
|
import { deprecatedCss } from './mixins';
|
||||||
|
|
||||||
export const PropertiesTableCaption = styled.caption`
|
export const PropertiesTableCaption = styled.caption`
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
import { transparentize } from 'polished';
|
import { transparentize } from 'polished';
|
||||||
import styled from '../styled-components';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../styled-components';
|
||||||
import { PropertyNameCell } from './fields-layout';
|
import { PropertyNameCell } from './fields-layout';
|
||||||
|
|
||||||
export const ClickablePropertyNameCell = PropertyNameCell.extend`
|
export const ClickablePropertyNameCell = PropertyNameCell.extend`
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import styled, { css } from '../styled-components';
|
import * as React from 'react';
|
||||||
|
import { InterpolationFunction, Styles, ThemeProps } from 'styled-components';
|
||||||
|
|
||||||
|
import styled, { css, ResolvedThemeInterface, StyledComponentClass } from '../styled-components';
|
||||||
|
|
||||||
const headerFontSize = {
|
const headerFontSize = {
|
||||||
1: '1.85714em',
|
1: '1.85714em',
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
import styled, { css } from '../styled-components';
|
import * as React from 'react';
|
||||||
|
import { InterpolationFunction, Styles, ThemeProps } from 'styled-components';
|
||||||
|
|
||||||
|
import styled, { css, ResolvedThemeInterface, StyledComponentClass } from '../styled-components';
|
||||||
|
|
||||||
// tslint:disable-next-line
|
// tslint:disable-next-line
|
||||||
export const linkifyMixin = className => css`
|
export const linkifyMixin = className => css`
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import { css } from '../styled-components';
|
import { InterpolationFunction, Styles, ThemeProps } from 'styled-components';
|
||||||
|
|
||||||
|
import { css, StyledComponentClass } from '../styled-components';
|
||||||
|
|
||||||
export const deprecatedCss = css`
|
export const deprecatedCss = css`
|
||||||
text-decoration: line-through;
|
text-decoration: line-through;
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import styled, { media } from '../styled-components';
|
import * as React from 'react';
|
||||||
|
import styled, { media, ResolvedThemeInterface, StyledComponentClass } from '../styled-components';
|
||||||
|
|
||||||
export const MiddlePanel = styled.div`
|
export const MiddlePanel = styled.div`
|
||||||
width: calc(100% - ${props => props.theme.rightPanel.width});
|
width: calc(100% - ${props => props.theme.rightPanel.width});
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import styled from '../styled-components';
|
import * as React from 'react';
|
||||||
|
|
||||||
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../styled-components';
|
||||||
|
|
||||||
export const SampleControls = styled.div`
|
export const SampleControls = styled.div`
|
||||||
opacity: 0.4;
|
opacity: 0.4;
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import styled, { withProps } from '../styled-components';
|
import * as React from 'react';
|
||||||
|
import styled, {
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
withProps,
|
||||||
|
} from '../styled-components';
|
||||||
|
|
||||||
export const OneOfList = styled.ul`
|
export const OneOfList = styled.ul`
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled, { withProps } from '../styled-components';
|
import styled, {
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
withProps,
|
||||||
|
} from '../styled-components';
|
||||||
|
|
||||||
const directionMap = {
|
const directionMap = {
|
||||||
left: '90deg',
|
left: '90deg',
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Tabs as ReactTabs } from 'react-tabs';
|
import { Tabs as ReactTabs, TabsProps } from 'react-tabs';
|
||||||
import styled from '../styled-components';
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../styled-components';
|
||||||
|
|
||||||
export { Tab, TabList, TabPanel } from 'react-tabs';
|
export { Tab, TabList, TabPanel } from 'react-tabs';
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
InfoSpanBoxWrap,
|
InfoSpanBoxWrap,
|
||||||
} from './styled.elements';
|
} from './styled.elements';
|
||||||
|
|
||||||
interface ApiInfoProps {
|
export interface ApiInfoProps {
|
||||||
store: AppStore;
|
store: AppStore;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import styled from '../../styled-components';
|
import { AnchorHTMLAttributes, ClassAttributes, HTMLAttributes } from 'react';
|
||||||
|
|
||||||
import { H1, MiddlePanel } from '../../common-elements';
|
import { H1, MiddlePanel } from '../../common-elements';
|
||||||
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
const delimiterWidth = 15;
|
const delimiterWidth = 15;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '../../styled-components';
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
export const LogoImgEl = styled.img`
|
export const LogoImgEl = styled.img`
|
||||||
max-height: ${props => props.theme.logo.maxHeight};
|
max-height: ${props => props.theme.logo.maxHeight};
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class ContentItems extends React.Component<{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ContentItemProps {
|
export interface ContentItemProps {
|
||||||
item: ContentItemModel;
|
item: ContentItemModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
import styled, { withProps } from '../../styled-components';
|
import { ClassAttributes, HTMLAttributes, HTMLProps } from 'react';
|
||||||
|
|
||||||
|
import styled, {
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
withProps,
|
||||||
|
} from '../../styled-components';
|
||||||
|
|
||||||
export const OperationEndpointWrap = styled.div`
|
export const OperationEndpointWrap = styled.div`
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '../../styled-components';
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
import { SampleControls } from '../../common-elements';
|
import { SampleControls } from '../../common-elements';
|
||||||
import { CopyButtonWrapper } from '../../common-elements/CopyButtonWrapper';
|
import { CopyButtonWrapper } from '../../common-elements/CopyButtonWrapper';
|
||||||
import { jsonToHTML } from '../../utils/jsonToHtml';
|
import { jsonToHTML } from '../../utils/jsonToHtml';
|
||||||
import { jsonStyles } from './style';
|
import { jsonStyles } from './style';
|
||||||
|
|
||||||
interface JsonProps {
|
export interface JsonProps {
|
||||||
data: any;
|
data: any;
|
||||||
className?: string;
|
className?: string;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { css } from '../../styled-components';
|
import { InterpolationFunction, Styles, ThemeProps } from 'styled-components';
|
||||||
|
import { css, ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
export const jsonStyles = css`
|
export const jsonStyles = css`
|
||||||
.redoc-json > .collapser {
|
.redoc-json > .collapser {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled, { keyframes } from '../../styled-components';
|
import styled, {
|
||||||
|
keyframes,
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
} from '../../styled-components';
|
||||||
|
|
||||||
const _Spinner = (props: { className?: string; color: string }) => (
|
const _Spinner = (props: { className?: string; color: string }) => (
|
||||||
<svg className={props.className} version="1.1" width="512" height="512" viewBox="0 0 512 512">
|
<svg className={props.className} version="1.1" width="512" height="512" viewBox="0 0 512 512">
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '../../styled-components';
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
import * as DOMPurify from 'dompurify';
|
import * as DOMPurify from 'dompurify';
|
||||||
import { AppStore, MarkdownRenderer } from '../../services';
|
import { AppStore, MarkdownRenderer } from '../../services';
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
|
import { InterpolationFunction, Styles, ThemeProps } from 'styled-components';
|
||||||
|
|
||||||
import { headerCommonMixin, linkifyMixin } from '../../common-elements';
|
import { headerCommonMixin, linkifyMixin } from '../../common-elements';
|
||||||
import { css } from '../../styled-components';
|
import { css, ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
export const markdownCss = css`
|
export const markdownCss = css`
|
||||||
p {
|
p {
|
||||||
|
|
|
@ -35,7 +35,7 @@ const OperationRow = Row.extend`
|
||||||
}
|
}
|
||||||
`;
|
`;
|
||||||
|
|
||||||
interface OperationProps {
|
export interface OperationProps {
|
||||||
operation: OperationType;
|
operation: OperationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,19 +3,6 @@ import * as React from 'react';
|
||||||
|
|
||||||
import { RedocNormalizedOptions } from '../services/RedocNormalizedOptions';
|
import { RedocNormalizedOptions } from '../services/RedocNormalizedOptions';
|
||||||
|
|
||||||
// TODO: contribute declarations to @types/react once 16.3 is released
|
|
||||||
type ReactProviderComponent<T> = React.ComponentType<{ value: T }>;
|
|
||||||
type ReactConsumerComponent<T> = React.ComponentType<{ children: ((value: T) => React.ReactNode) }>;
|
|
||||||
|
|
||||||
interface ReactContext<T> {
|
|
||||||
Provider: ReactProviderComponent<T>;
|
|
||||||
Consumer: ReactConsumerComponent<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
declare module 'react' {
|
|
||||||
function createContext<T>(defatulValue: T): ReactContext<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export const OptionsContext = React.createContext(new RedocNormalizedOptions({}));
|
export const OptionsContext = React.createContext(new RedocNormalizedOptions({}));
|
||||||
export const OptionsProvider = OptionsContext.Provider;
|
export const OptionsProvider = OptionsContext.Provider;
|
||||||
export const OptionsConsumer = OptionsContext.Consumer;
|
export const OptionsConsumer = OptionsContext.Consumer;
|
||||||
|
|
|
@ -17,7 +17,7 @@ function safePush(obj, prop, item) {
|
||||||
obj[prop].push(item);
|
obj[prop].push(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ParametersProps {
|
export interface ParametersProps {
|
||||||
parameters?: FieldModel[];
|
parameters?: FieldModel[];
|
||||||
body?: RequestBodyModel;
|
body?: RequestBodyModel;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import styled from '../../styled-components';
|
import { ClassAttributes, HTMLAttributes } from 'react';
|
||||||
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
|
||||||
import { StyledDropdown } from '../../common-elements';
|
import { DropdownProps, StyledDropdown } from '../../common-elements';
|
||||||
|
|
||||||
export const MimeLabel = styled.div`
|
export const MimeLabel = styled.div`
|
||||||
border-bottom: 1px solid rgba(255, 255, 255, 0.9);
|
border-bottom: 1px solid rgba(255, 255, 255, 0.9);
|
||||||
|
|
|
@ -32,7 +32,9 @@ export class Redoc extends React.Component<RedocProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { store: { spec, menu, options, search, marker } } = this.props;
|
const {
|
||||||
|
store: { spec, menu, options, search, marker },
|
||||||
|
} = this.props;
|
||||||
const store = this.props.store;
|
const store = this.props.store;
|
||||||
return (
|
return (
|
||||||
<ThemeProvider theme={options.theme}>
|
<ThemeProvider theme={options.theme}>
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
import styled, { media } from '../../styled-components';
|
import { ClassAttributes, HTMLAttributes } from 'react';
|
||||||
export { ClassAttributes } from 'react';
|
|
||||||
|
import styled, {
|
||||||
|
media,
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
} from '../../styled-components';
|
||||||
|
|
||||||
export const RedocWrap = styled.div`
|
export const RedocWrap = styled.div`
|
||||||
font-family: ${props => props.theme.baseFont.family};
|
font-family: ${props => props.theme.baseFont.family};
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import styled from '../../styled-components';
|
|
||||||
|
|
||||||
import { transparentize } from 'polished';
|
import { transparentize } from 'polished';
|
||||||
|
import { ClassAttributes, HTMLAttributes } from 'react';
|
||||||
|
|
||||||
import { UnderlinedHeader } from '../../common-elements';
|
import { UnderlinedHeader } from '../../common-elements';
|
||||||
import { ResponseTitle } from './ResponseTitle';
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
|
import { ResponseTitle, ResponseTitleProps } from './ResponseTitle';
|
||||||
|
|
||||||
export const StyledResponseTitle = styled(ResponseTitle)`
|
export const StyledResponseTitle = styled(ResponseTitle)`
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
|
|
|
@ -24,7 +24,11 @@ export class ObjectSchema extends React.Component<ObjectSchemaProps> {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { schema: { fields = [] }, showTitle, discriminator } = this.props;
|
const {
|
||||||
|
schema: { fields = [] },
|
||||||
|
showTitle,
|
||||||
|
discriminator,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
const needFilter = this.props.skipReadOnly || this.props.skipWriteOnly;
|
const needFilter = this.props.skipReadOnly || this.props.skipWriteOnly;
|
||||||
|
|
||||||
|
|
|
@ -34,7 +34,10 @@ export class OneOfButton extends React.Component<OneOfButtonProps> {
|
||||||
@observer
|
@observer
|
||||||
export class OneOfSchema extends React.Component<SchemaProps> {
|
export class OneOfSchema extends React.Component<SchemaProps> {
|
||||||
render() {
|
render() {
|
||||||
const { schema: { oneOf }, schema } = this.props;
|
const {
|
||||||
|
schema: { oneOf },
|
||||||
|
schema,
|
||||||
|
} = this.props;
|
||||||
|
|
||||||
if (oneOf === undefined) {
|
if (oneOf === undefined) {
|
||||||
return null;
|
return null;
|
||||||
|
|
|
@ -7,7 +7,13 @@ import { MenuItem } from '../SideMenu/MenuItem';
|
||||||
import { MarkerService } from '../../services/MarkerService';
|
import { MarkerService } from '../../services/MarkerService';
|
||||||
import { SearchDocument } from '../../services/SearchWorker.worker';
|
import { SearchDocument } from '../../services/SearchWorker.worker';
|
||||||
|
|
||||||
import { ClearIcon, SearchIcon, SearchInput, SearchResultsBox, SearchWrap } from './elements';
|
import {
|
||||||
|
ClearIcon,
|
||||||
|
SearchIcon,
|
||||||
|
SearchInput,
|
||||||
|
SearchResultsBox,
|
||||||
|
SearchWrap,
|
||||||
|
} from './styled.elements';
|
||||||
|
|
||||||
export interface SearchBoxProps {
|
export interface SearchBoxProps {
|
||||||
search: SearchStore;
|
search: SearchStore;
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import styled from '../../styled-components';
|
|
||||||
|
import styled, { ResolvedThemeInterface, StyledComponentClass } from '../../styled-components';
|
||||||
import { MenuItemLabel } from '../SideMenu/styled.elements';
|
import { MenuItemLabel } from '../SideMenu/styled.elements';
|
||||||
|
|
||||||
export const SearchWrap = styled.div`
|
export const SearchWrap = styled.div`
|
|
@ -1,5 +1,6 @@
|
||||||
import { transparentize } from 'polished';
|
import { transparentize } from 'polished';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
|
|
||||||
import styled from '../../styled-components';
|
import styled from '../../styled-components';
|
||||||
|
|
||||||
import { UnderlinedHeader } from '../../common-elements/headers';
|
import { UnderlinedHeader } from '../../common-elements/headers';
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { IMenuItem, OperationModel } from '../../services';
|
||||||
import { MenuItems } from './MenuItems';
|
import { MenuItems } from './MenuItems';
|
||||||
import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements';
|
import { MenuItemLabel, MenuItemLi, MenuItemTitle, OperationBadge } from './styled.elements';
|
||||||
|
|
||||||
interface MenuItemProps {
|
export interface MenuItemProps {
|
||||||
item: IMenuItem;
|
item: IMenuItem;
|
||||||
onActivate?: (item: IMenuItem) => void;
|
onActivate?: (item: IMenuItem) => void;
|
||||||
withoutChildren?: boolean;
|
withoutChildren?: boolean;
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { IMenuItem } from '../../services';
|
||||||
import { MenuItem } from './MenuItem';
|
import { MenuItem } from './MenuItem';
|
||||||
import { MenuItemUl } from './styled.elements';
|
import { MenuItemUl } from './styled.elements';
|
||||||
|
|
||||||
interface MenuItemsProps {
|
export interface MenuItemsProps {
|
||||||
items: IMenuItem[];
|
items: IMenuItem[];
|
||||||
active?: boolean;
|
active?: boolean;
|
||||||
onActivate?: (item: IMenuItem) => void;
|
onActivate?: (item: IMenuItem) => void;
|
||||||
|
|
4
src/components/SideMenu/index.ts
Normal file
4
src/components/SideMenu/index.ts
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
export * from './MenuItem';
|
||||||
|
export * from './MenuItems';
|
||||||
|
export * from './SideMenu';
|
||||||
|
export * from './styled.elements';
|
|
@ -1,7 +1,14 @@
|
||||||
import * as classnames from 'classnames';
|
import * as classnames from 'classnames';
|
||||||
|
import * as React from 'react';
|
||||||
|
import { InterpolationFunction, Styles, ThemeProps } from 'styled-components';
|
||||||
|
|
||||||
import { deprecatedCss } from '../../common-elements';
|
import { deprecatedCss } from '../../common-elements';
|
||||||
import styled, { css, withProps } from '../../styled-components';
|
import styled, {
|
||||||
|
css,
|
||||||
|
ResolvedThemeInterface,
|
||||||
|
StyledComponentClass,
|
||||||
|
withProps,
|
||||||
|
} from '../../styled-components';
|
||||||
|
|
||||||
export const OperationBadge = withProps<{ type: string }>(styled.span).attrs({
|
export const OperationBadge = withProps<{ type: string }>(styled.span).attrs({
|
||||||
className: props => `operation-type ${props.type}`,
|
className: props => `operation-type ${props.type}`,
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { RedocRawOptions } from '../services/RedocNormalizedOptions';
|
||||||
import { OpenAPISpec } from '../types';
|
import { OpenAPISpec } from '../types';
|
||||||
import { loadAndBundleSpec } from '../utils';
|
import { loadAndBundleSpec } from '../utils';
|
||||||
|
|
||||||
interface StoreProviderProps {
|
export interface StoreProviderProps {
|
||||||
specUrl?: string;
|
specUrl?: string;
|
||||||
spec?: object;
|
spec?: object;
|
||||||
store?: AppStore;
|
store?: AppStore;
|
||||||
|
@ -15,7 +15,7 @@ interface StoreProviderProps {
|
||||||
children: (props: { loading: boolean; store?: AppStore }) => any;
|
children: (props: { loading: boolean; store?: AppStore }) => any;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface StoreProviderState {
|
export interface StoreProviderState {
|
||||||
error?: Error;
|
error?: Error;
|
||||||
loading: boolean;
|
loading: boolean;
|
||||||
store?: AppStore;
|
store?: AppStore;
|
||||||
|
|
|
@ -10,4 +10,6 @@ export * from './JsonViewer';
|
||||||
|
|
||||||
export * from './ErrorBoundary';
|
export * from './ErrorBoundary';
|
||||||
export * from './StoreProvider';
|
export * from './StoreProvider';
|
||||||
// re-export the rest of components
|
export * from './SideMenu/';
|
||||||
|
export * from './StickySidebar/StickyResponsiveSidebar';
|
||||||
|
export * from './SearchBox/SearchBox';
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
export * from './components';
|
export * from './components';
|
||||||
export * from './services';
|
export * from './services';
|
||||||
export * from './utils';
|
export * from './utils';
|
||||||
|
|
||||||
|
export * from './styled-components';
|
||||||
|
export { default as styled } from './styled-components';
|
||||||
|
|
|
@ -8,7 +8,7 @@ function isSameHash(a: string, b: string): boolean {
|
||||||
return a === b || '#' + a === b || a === '#' + b;
|
return a === b || '#' + a === b || a === '#' + b;
|
||||||
}
|
}
|
||||||
|
|
||||||
class IntHistoryService {
|
export class IntHistoryService {
|
||||||
private causedHashChange: boolean = false;
|
private causedHashChange: boolean = false;
|
||||||
private _emiter;
|
private _emiter;
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ export function buildComponentComment(name: string) {
|
||||||
return `<!-- ReDoc-Inject: <${name}> -->`;
|
return `<!-- ReDoc-Inject: <${name}> -->`;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface MarkdownHeading {
|
export interface MarkdownHeading {
|
||||||
id: string;
|
id: string;
|
||||||
name: string;
|
name: string;
|
||||||
items?: MarkdownHeading[];
|
items?: MarkdownHeading[];
|
||||||
|
|
|
@ -2,7 +2,9 @@ import { IS_BROWSER } from '../utils/';
|
||||||
import { IMenuItem } from './MenuStore';
|
import { IMenuItem } from './MenuStore';
|
||||||
import { OperationModel } from './models';
|
import { OperationModel } from './models';
|
||||||
|
|
||||||
let worker;
|
import Worker, { SearchDocument, SearchResult } from './SearchWorker.worker';
|
||||||
|
|
||||||
|
let worker: new () => Worker;
|
||||||
|
|
||||||
if (IS_BROWSER) {
|
if (IS_BROWSER) {
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -60,7 +60,7 @@ export async function load(state: any) {
|
||||||
resolveIndex(lunr.Index.load(state.index));
|
resolveIndex(lunr.Index.load(state.index));
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function search(q: string): Promise<SearchResult[]> {
|
export async function search(q: string): Promise<Array<SearchDocument & SearchResult>> {
|
||||||
if (q.trim().length === 0) {
|
if (q.trim().length === 0) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,8 @@
|
||||||
import { computed, observable } from 'mobx';
|
import { computed, observable } from 'mobx';
|
||||||
import { OpenAPISpec } from '../types';
|
import { OpenAPIExternalDocumentation, OpenAPISpec } from '../types';
|
||||||
|
|
||||||
// import { OpenAPIExternalDocumentation, OpenAPIInfo } from '../types';
|
|
||||||
|
|
||||||
import { MenuBuilder } from './MenuBuilder';
|
import { MenuBuilder } from './MenuBuilder';
|
||||||
|
import { GroupModel, OperationModel } from './models/';
|
||||||
import { ApiInfoModel } from './models/ApiInfo';
|
import { ApiInfoModel } from './models/ApiInfo';
|
||||||
import { SecuritySchemesModel } from './models/SecuritySchemes';
|
import { SecuritySchemesModel } from './models/SecuritySchemes';
|
||||||
import { OpenAPIParser } from './OpenAPIParser';
|
import { OpenAPIParser } from './OpenAPIParser';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { OpenAPISecurityRequirement } from '../../types';
|
||||||
import { SECURITY_SCHEMES_SECTION } from '../../utils/openapi';
|
import { SECURITY_SCHEMES_SECTION } from '../../utils/openapi';
|
||||||
import { OpenAPIParser } from '../OpenAPIParser';
|
import { OpenAPIParser } from '../OpenAPIParser';
|
||||||
|
|
||||||
interface SecurityScheme {
|
export interface SecurityScheme {
|
||||||
id: string;
|
id: string;
|
||||||
sectionId: string;
|
sectionId: string;
|
||||||
type: string;
|
type: string;
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
|
import { ComponentClass, StatelessComponent } from 'react';
|
||||||
import * as styledComponents from 'styled-components';
|
import * as styledComponents from 'styled-components';
|
||||||
|
|
||||||
import { ResolvedThemeInterface } from './theme';
|
import { ResolvedThemeInterface } from './theme';
|
||||||
|
|
||||||
|
export { ResolvedThemeInterface };
|
||||||
|
|
||||||
|
export type InterpolationFunction<P> = styledComponents.InterpolationFunction<P>;
|
||||||
|
|
||||||
export type StyledFunction<T> = styledComponents.ThemedStyledFunction<T, ResolvedThemeInterface>;
|
export type StyledFunction<T> = styledComponents.ThemedStyledFunction<T, ResolvedThemeInterface>;
|
||||||
|
|
||||||
function withProps<T, U extends HTMLElement = HTMLElement>(
|
function withProps<T, U extends HTMLElement = HTMLElement>(
|
||||||
|
|
|
@ -7,7 +7,8 @@
|
||||||
"noUnusedParameters": true,
|
"noUnusedParameters": true,
|
||||||
"strictNullChecks": true,
|
"strictNullChecks": true,
|
||||||
"sourceMap": true,
|
"sourceMap": true,
|
||||||
// "declaration": true,
|
"declaration": true,
|
||||||
|
"declarationDir": "typings",
|
||||||
"noEmitHelpers": true,
|
"noEmitHelpers": true,
|
||||||
"importHelpers": true,
|
"importHelpers": true,
|
||||||
"outDir": "lib",
|
"outDir": "lib",
|
||||||
|
|
7
tsconfig.lib.json
Normal file
7
tsconfig.lib.json
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"extends": "./tsconfig.json",
|
||||||
|
"include": [
|
||||||
|
"./custom.d.ts",
|
||||||
|
"src/index.ts"
|
||||||
|
]
|
||||||
|
}
|
|
@ -17,7 +17,7 @@
|
||||||
"quotemark": [true, "single", "avoid-template", "jsx-double"],
|
"quotemark": [true, "single", "avoid-template", "jsx-double"],
|
||||||
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"],
|
"variable-name": [true, "ban-keywords", "check-format", "allow-leading-underscore", "allow-pascal-case"],
|
||||||
"arrow-parens": [true, "ban-single-arg-parens"],
|
"arrow-parens": [true, "ban-single-arg-parens"],
|
||||||
"no-submodule-imports": [true, "prismjs", "perfect-scrollbar"],
|
"no-submodule-imports": [true, "prismjs", "perfect-scrollbar", "core-js"],
|
||||||
"object-literal-key-quotes": [true, "as-needed"],
|
"object-literal-key-quotes": [true, "as-needed"],
|
||||||
"no-unused-expression": [true, "allow-tagged-template"],
|
"no-unused-expression": [true, "allow-tagged-template"],
|
||||||
"semicolon": [true, "always", "ignore-bound-class-methods"],
|
"semicolon": [true, "always", "ignore-bound-class-methods"],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user