@stoplight/elements-core 7.3.10 → 7.3.11
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/components/MosaicTableOfContents/types.d.ts +0 -1
- package/hoc/withMosaicProvider.spec.d.ts +1 -0
- package/hoc/withQueryClientProvider.spec.d.ts +1 -0
- package/index.d.ts +1 -0
- package/index.esm.js +26 -12
- package/index.js +25 -10
- package/index.mjs +26 -12
- package/package.json +1 -1
|
@@ -10,7 +10,6 @@ export declare type TableOfContentsProps = {
|
|
|
10
10
|
export declare type CustomLinkComponent = React.ComponentType<{
|
|
11
11
|
to: string;
|
|
12
12
|
className?: string;
|
|
13
|
-
hash?: string;
|
|
14
13
|
children: React.ReactNode;
|
|
15
14
|
}>;
|
|
16
15
|
export declare type TableOfContentsItem = TableOfContentsDivider | TableOfContentsGroupItem;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export { ExportButton, ExportButtonProps } from './components/Docs/HttpService/E
|
|
|
4
4
|
export { SidebarLayout } from './components/Layout/SidebarLayout';
|
|
5
5
|
export { Logo } from './components/Logo';
|
|
6
6
|
export { CustomComponentMapping, DefaultSMDComponents, MarkdownComponentsProvider, } from './components/MarkdownViewer/CustomComponents/Provider';
|
|
7
|
+
export { ReactRouterMarkdownLink } from './components/MarkdownViewer/CustomComponents/ReactRouterLink';
|
|
7
8
|
export { TableOfContents } from './components/MosaicTableOfContents';
|
|
8
9
|
export { CustomLinkComponent, TableOfContentsItem, TableOfContentsNode, TableOfContentsNodeGroup, } from './components/MosaicTableOfContents/types';
|
|
9
10
|
export { findFirstNode } from './components/MosaicTableOfContents/utils';
|
package/index.esm.js
CHANGED
|
@@ -6,7 +6,7 @@ import _, { isObject, isPlainObject, isArray, throttle, filter, capitalize, flat
|
|
|
6
6
|
import { parse } from '@stoplight/markdown';
|
|
7
7
|
import { NodeType, HttpParamStyles } from '@stoplight/types';
|
|
8
8
|
import { parse as parse$1 } from '@stoplight/yaml';
|
|
9
|
-
import { isArray as isArray$1, Flex, Box, Popover, Button, Panel, CopyButton, Menu, Text, Input, Icon, Select, Image, Link, useThemeIsDark, Tooltip, VStack, InvertTheme, Badge, Tabs, TabList, Tab, TabPanels, TabPanel, Heading as Heading$1, HStack, useClipboard, Provider as Provider$1 } from '@stoplight/mosaic';
|
|
9
|
+
import { isArray as isArray$1, Flex, Box, Popover, Button, Panel, CopyButton, Menu, Text, Input, Icon, Select, Image, Link, useThemeIsDark, Tooltip, VStack, InvertTheme, Badge, Tabs, TabList, Tab, TabPanels, TabPanel, Heading as Heading$1, HStack, useClipboard, useMosaicContext, Provider as Provider$1 } from '@stoplight/mosaic';
|
|
10
10
|
import { withErrorBoundary } from '@stoplight/react-error-boundary';
|
|
11
11
|
import { MarkdownViewer as MarkdownViewer$1, DefaultSMDComponents, MarkdownViewerProvider } from '@stoplight/markdown-viewer';
|
|
12
12
|
export { DefaultSMDComponents } from '@stoplight/markdown-viewer';
|
|
@@ -24,8 +24,8 @@ import * as Sampler from '@stoplight/json-schema-sampler';
|
|
|
24
24
|
import formatXml from 'xml-formatter';
|
|
25
25
|
import { Link as Link$1, useLocation, BrowserRouter, MemoryRouter, HashRouter, Route } from 'react-router-dom';
|
|
26
26
|
import { JsonSchemaViewer, Validations } from '@stoplight/json-schema-viewer';
|
|
27
|
-
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
28
27
|
import { HashLink } from 'react-router-hash-link';
|
|
28
|
+
import { QueryClient, useQueryClient, QueryClientProvider } from 'react-query';
|
|
29
29
|
import $RefParser from '@stoplight/json-schema-ref-parser';
|
|
30
30
|
import * as PropTypes from 'prop-types';
|
|
31
31
|
import * as ReactDOM from 'react-dom';
|
|
@@ -2338,6 +2338,15 @@ const MarkdownComponentsProvider = ({ value, children }) => {
|
|
|
2338
2338
|
return React.createElement(MarkdownViewerProvider, { components: Object.assign({ code: CodeComponent }, value) }, children);
|
|
2339
2339
|
};
|
|
2340
2340
|
|
|
2341
|
+
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
2342
|
+
const ReactRouterMarkdownLink = ({ title, href, children }) => {
|
|
2343
|
+
const isExternal = href !== undefined && externalRegex.test(href);
|
|
2344
|
+
if (isExternal) {
|
|
2345
|
+
return (React__default.createElement("a", { target: "_blank", rel: "noreferrer noopener", href: href, title: title }, children));
|
|
2346
|
+
}
|
|
2347
|
+
return (React__default.createElement(HashLink, { to: href, title: title }, children));
|
|
2348
|
+
};
|
|
2349
|
+
|
|
2341
2350
|
const NODE_TYPE_TITLE_ICON = {
|
|
2342
2351
|
http_service: faCloud,
|
|
2343
2352
|
};
|
|
@@ -2529,6 +2538,14 @@ function withPersistenceBoundary(WrappedComponent) {
|
|
|
2529
2538
|
|
|
2530
2539
|
function withMosaicProvider(WrappedComponent) {
|
|
2531
2540
|
const WithMosaicProvider = (props) => {
|
|
2541
|
+
try {
|
|
2542
|
+
const mosaicContext = useMosaicContext();
|
|
2543
|
+
if (mosaicContext === null || mosaicContext === void 0 ? void 0 : mosaicContext.providerId) {
|
|
2544
|
+
return React__default.createElement(WrappedComponent, Object.assign({}, props));
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
catch (_a) {
|
|
2548
|
+
}
|
|
2532
2549
|
return (React__default.createElement(Provider$1, { style: { height: '100%' } },
|
|
2533
2550
|
React__default.createElement(WrappedComponent, Object.assign({}, props))));
|
|
2534
2551
|
};
|
|
@@ -2546,6 +2563,12 @@ const queryClient = new QueryClient({
|
|
|
2546
2563
|
});
|
|
2547
2564
|
function withQueryClientProvider(WrappedComponent) {
|
|
2548
2565
|
const WithQueryClientProvider = (props) => {
|
|
2566
|
+
try {
|
|
2567
|
+
useQueryClient();
|
|
2568
|
+
return React__default.createElement(WrappedComponent, Object.assign({}, props));
|
|
2569
|
+
}
|
|
2570
|
+
catch (_a) {
|
|
2571
|
+
}
|
|
2549
2572
|
return (React__default.createElement(QueryClientProvider, { client: queryClient },
|
|
2550
2573
|
React__default.createElement(WrappedComponent, Object.assign({}, props))));
|
|
2551
2574
|
};
|
|
@@ -2553,15 +2576,6 @@ function withQueryClientProvider(WrappedComponent) {
|
|
|
2553
2576
|
return WithQueryClientProvider;
|
|
2554
2577
|
}
|
|
2555
2578
|
|
|
2556
|
-
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
2557
|
-
const ReactRouterMarkdownLink = ({ title, href, children }) => {
|
|
2558
|
-
const isExternal = href !== undefined && externalRegex.test(href);
|
|
2559
|
-
if (isExternal) {
|
|
2560
|
-
return (React__default.createElement("a", { target: "_blank", rel: "noreferrer noopener", href: href, title: title }, children));
|
|
2561
|
-
}
|
|
2562
|
-
return (React__default.createElement(HashLink, { to: href, title: title }, children));
|
|
2563
|
-
};
|
|
2564
|
-
|
|
2565
2579
|
const RouterComponent = {
|
|
2566
2580
|
history: BrowserRouter,
|
|
2567
2581
|
memory: MemoryRouter,
|
|
@@ -2752,4 +2766,4 @@ const createElementClass = (Component, propDescriptors) => {
|
|
|
2752
2766
|
};
|
|
2753
2767
|
};
|
|
2754
2768
|
|
|
2755
|
-
export { DeprecatedBadge, Docs, ExportButton, HttpMethodColors, InlineRefResolverProvider, Logo, MarkdownComponentsProvider, MockingProvider, NodeTypeColors, NodeTypeIconDefs, NodeTypePrettyName, NonIdealState, ParsedDocs, PersistenceContextProvider, PoweredByLink, SidebarLayout, Styled, TableOfContents, TryIt, TryItWithRequestSamples, createElementClass, createResolvedObject, findFirstNode, isHttpOperation, isHttpService, useBundleRefsIntoDocument, useParsedData, useParsedValue, useRouter, withMosaicProvider, withPersistenceBoundary, withQueryClientProvider, withRouter, withStyles };
|
|
2769
|
+
export { DeprecatedBadge, Docs, ExportButton, HttpMethodColors, InlineRefResolverProvider, Logo, MarkdownComponentsProvider, MockingProvider, NodeTypeColors, NodeTypeIconDefs, NodeTypePrettyName, NonIdealState, ParsedDocs, PersistenceContextProvider, PoweredByLink, ReactRouterMarkdownLink, SidebarLayout, Styled, TableOfContents, TryIt, TryItWithRequestSamples, createElementClass, createResolvedObject, findFirstNode, isHttpOperation, isHttpService, useBundleRefsIntoDocument, useParsedData, useParsedValue, useRouter, withMosaicProvider, withPersistenceBoundary, withQueryClientProvider, withRouter, withStyles };
|
package/index.js
CHANGED
|
@@ -26,8 +26,8 @@ var Sampler = require('@stoplight/json-schema-sampler');
|
|
|
26
26
|
var formatXml = require('xml-formatter');
|
|
27
27
|
var reactRouterDom = require('react-router-dom');
|
|
28
28
|
var jsonSchemaViewer = require('@stoplight/json-schema-viewer');
|
|
29
|
-
var reactQuery = require('react-query');
|
|
30
29
|
var reactRouterHashLink = require('react-router-hash-link');
|
|
30
|
+
var reactQuery = require('react-query');
|
|
31
31
|
var $RefParser = require('@stoplight/json-schema-ref-parser');
|
|
32
32
|
var PropTypes = require('prop-types');
|
|
33
33
|
var ReactDOM = require('react-dom');
|
|
@@ -2372,6 +2372,15 @@ const MarkdownComponentsProvider = ({ value, children }) => {
|
|
|
2372
2372
|
return React__namespace.createElement(markdownViewer.MarkdownViewerProvider, { components: Object.assign({ code: CodeComponent }, value) }, children);
|
|
2373
2373
|
};
|
|
2374
2374
|
|
|
2375
|
+
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
2376
|
+
const ReactRouterMarkdownLink = ({ title, href, children }) => {
|
|
2377
|
+
const isExternal = href !== undefined && externalRegex.test(href);
|
|
2378
|
+
if (isExternal) {
|
|
2379
|
+
return (React__default["default"].createElement("a", { target: "_blank", rel: "noreferrer noopener", href: href, title: title }, children));
|
|
2380
|
+
}
|
|
2381
|
+
return (React__default["default"].createElement(reactRouterHashLink.HashLink, { to: href, title: title }, children));
|
|
2382
|
+
};
|
|
2383
|
+
|
|
2375
2384
|
const NODE_TYPE_TITLE_ICON = {
|
|
2376
2385
|
http_service: freeSolidSvgIcons.faCloud,
|
|
2377
2386
|
};
|
|
@@ -2563,6 +2572,14 @@ function withPersistenceBoundary(WrappedComponent) {
|
|
|
2563
2572
|
|
|
2564
2573
|
function withMosaicProvider(WrappedComponent) {
|
|
2565
2574
|
const WithMosaicProvider = (props) => {
|
|
2575
|
+
try {
|
|
2576
|
+
const mosaicContext = mosaic.useMosaicContext();
|
|
2577
|
+
if (mosaicContext === null || mosaicContext === void 0 ? void 0 : mosaicContext.providerId) {
|
|
2578
|
+
return React__default["default"].createElement(WrappedComponent, Object.assign({}, props));
|
|
2579
|
+
}
|
|
2580
|
+
}
|
|
2581
|
+
catch (_a) {
|
|
2582
|
+
}
|
|
2566
2583
|
return (React__default["default"].createElement(mosaic.Provider, { style: { height: '100%' } },
|
|
2567
2584
|
React__default["default"].createElement(WrappedComponent, Object.assign({}, props))));
|
|
2568
2585
|
};
|
|
@@ -2580,6 +2597,12 @@ const queryClient = new reactQuery.QueryClient({
|
|
|
2580
2597
|
});
|
|
2581
2598
|
function withQueryClientProvider(WrappedComponent) {
|
|
2582
2599
|
const WithQueryClientProvider = (props) => {
|
|
2600
|
+
try {
|
|
2601
|
+
reactQuery.useQueryClient();
|
|
2602
|
+
return React__default["default"].createElement(WrappedComponent, Object.assign({}, props));
|
|
2603
|
+
}
|
|
2604
|
+
catch (_a) {
|
|
2605
|
+
}
|
|
2583
2606
|
return (React__default["default"].createElement(reactQuery.QueryClientProvider, { client: queryClient },
|
|
2584
2607
|
React__default["default"].createElement(WrappedComponent, Object.assign({}, props))));
|
|
2585
2608
|
};
|
|
@@ -2587,15 +2610,6 @@ function withQueryClientProvider(WrappedComponent) {
|
|
|
2587
2610
|
return WithQueryClientProvider;
|
|
2588
2611
|
}
|
|
2589
2612
|
|
|
2590
|
-
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
2591
|
-
const ReactRouterMarkdownLink = ({ title, href, children }) => {
|
|
2592
|
-
const isExternal = href !== undefined && externalRegex.test(href);
|
|
2593
|
-
if (isExternal) {
|
|
2594
|
-
return (React__default["default"].createElement("a", { target: "_blank", rel: "noreferrer noopener", href: href, title: title }, children));
|
|
2595
|
-
}
|
|
2596
|
-
return (React__default["default"].createElement(reactRouterHashLink.HashLink, { to: href, title: title }, children));
|
|
2597
|
-
};
|
|
2598
|
-
|
|
2599
2613
|
const RouterComponent = {
|
|
2600
2614
|
history: reactRouterDom.BrowserRouter,
|
|
2601
2615
|
memory: reactRouterDom.MemoryRouter,
|
|
@@ -2805,6 +2819,7 @@ exports.NonIdealState = NonIdealState;
|
|
|
2805
2819
|
exports.ParsedDocs = ParsedDocs;
|
|
2806
2820
|
exports.PersistenceContextProvider = PersistenceContextProvider;
|
|
2807
2821
|
exports.PoweredByLink = PoweredByLink;
|
|
2822
|
+
exports.ReactRouterMarkdownLink = ReactRouterMarkdownLink;
|
|
2808
2823
|
exports.SidebarLayout = SidebarLayout;
|
|
2809
2824
|
exports.Styled = Styled;
|
|
2810
2825
|
exports.TableOfContents = TableOfContents;
|
package/index.mjs
CHANGED
|
@@ -6,7 +6,7 @@ import _, { isObject, isPlainObject, isArray, throttle, filter, capitalize, flat
|
|
|
6
6
|
import { parse } from '@stoplight/markdown';
|
|
7
7
|
import { NodeType, HttpParamStyles } from '@stoplight/types';
|
|
8
8
|
import { parse as parse$1 } from '@stoplight/yaml';
|
|
9
|
-
import { isArray as isArray$1, Flex, Box, Popover, Button, Panel, CopyButton, Menu, Text, Input, Icon, Select, Image, Link, useThemeIsDark, Tooltip, VStack, InvertTheme, Badge, Tabs, TabList, Tab, TabPanels, TabPanel, Heading as Heading$1, HStack, useClipboard, Provider as Provider$1 } from '@stoplight/mosaic';
|
|
9
|
+
import { isArray as isArray$1, Flex, Box, Popover, Button, Panel, CopyButton, Menu, Text, Input, Icon, Select, Image, Link, useThemeIsDark, Tooltip, VStack, InvertTheme, Badge, Tabs, TabList, Tab, TabPanels, TabPanel, Heading as Heading$1, HStack, useClipboard, useMosaicContext, Provider as Provider$1 } from '@stoplight/mosaic';
|
|
10
10
|
import { withErrorBoundary } from '@stoplight/react-error-boundary';
|
|
11
11
|
import { MarkdownViewer as MarkdownViewer$1, DefaultSMDComponents, MarkdownViewerProvider } from '@stoplight/markdown-viewer';
|
|
12
12
|
export { DefaultSMDComponents } from '@stoplight/markdown-viewer';
|
|
@@ -24,8 +24,8 @@ import * as Sampler from '@stoplight/json-schema-sampler';
|
|
|
24
24
|
import formatXml from 'xml-formatter';
|
|
25
25
|
import { Link as Link$1, useLocation, BrowserRouter, MemoryRouter, HashRouter, Route } from 'react-router-dom';
|
|
26
26
|
import { JsonSchemaViewer, Validations } from '@stoplight/json-schema-viewer';
|
|
27
|
-
import { QueryClient, QueryClientProvider } from 'react-query';
|
|
28
27
|
import { HashLink } from 'react-router-hash-link';
|
|
28
|
+
import { QueryClient, useQueryClient, QueryClientProvider } from 'react-query';
|
|
29
29
|
import $RefParser from '@stoplight/json-schema-ref-parser';
|
|
30
30
|
import * as PropTypes from 'prop-types';
|
|
31
31
|
import * as ReactDOM from 'react-dom';
|
|
@@ -2338,6 +2338,15 @@ const MarkdownComponentsProvider = ({ value, children }) => {
|
|
|
2338
2338
|
return React.createElement(MarkdownViewerProvider, { components: Object.assign({ code: CodeComponent }, value) }, children);
|
|
2339
2339
|
};
|
|
2340
2340
|
|
|
2341
|
+
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
2342
|
+
const ReactRouterMarkdownLink = ({ title, href, children }) => {
|
|
2343
|
+
const isExternal = href !== undefined && externalRegex.test(href);
|
|
2344
|
+
if (isExternal) {
|
|
2345
|
+
return (React__default.createElement("a", { target: "_blank", rel: "noreferrer noopener", href: href, title: title }, children));
|
|
2346
|
+
}
|
|
2347
|
+
return (React__default.createElement(HashLink, { to: href, title: title }, children));
|
|
2348
|
+
};
|
|
2349
|
+
|
|
2341
2350
|
const NODE_TYPE_TITLE_ICON = {
|
|
2342
2351
|
http_service: faCloud,
|
|
2343
2352
|
};
|
|
@@ -2529,6 +2538,14 @@ function withPersistenceBoundary(WrappedComponent) {
|
|
|
2529
2538
|
|
|
2530
2539
|
function withMosaicProvider(WrappedComponent) {
|
|
2531
2540
|
const WithMosaicProvider = (props) => {
|
|
2541
|
+
try {
|
|
2542
|
+
const mosaicContext = useMosaicContext();
|
|
2543
|
+
if (mosaicContext === null || mosaicContext === void 0 ? void 0 : mosaicContext.providerId) {
|
|
2544
|
+
return React__default.createElement(WrappedComponent, Object.assign({}, props));
|
|
2545
|
+
}
|
|
2546
|
+
}
|
|
2547
|
+
catch (_a) {
|
|
2548
|
+
}
|
|
2532
2549
|
return (React__default.createElement(Provider$1, { style: { height: '100%' } },
|
|
2533
2550
|
React__default.createElement(WrappedComponent, Object.assign({}, props))));
|
|
2534
2551
|
};
|
|
@@ -2546,6 +2563,12 @@ const queryClient = new QueryClient({
|
|
|
2546
2563
|
});
|
|
2547
2564
|
function withQueryClientProvider(WrappedComponent) {
|
|
2548
2565
|
const WithQueryClientProvider = (props) => {
|
|
2566
|
+
try {
|
|
2567
|
+
useQueryClient();
|
|
2568
|
+
return React__default.createElement(WrappedComponent, Object.assign({}, props));
|
|
2569
|
+
}
|
|
2570
|
+
catch (_a) {
|
|
2571
|
+
}
|
|
2549
2572
|
return (React__default.createElement(QueryClientProvider, { client: queryClient },
|
|
2550
2573
|
React__default.createElement(WrappedComponent, Object.assign({}, props))));
|
|
2551
2574
|
};
|
|
@@ -2553,15 +2576,6 @@ function withQueryClientProvider(WrappedComponent) {
|
|
|
2553
2576
|
return WithQueryClientProvider;
|
|
2554
2577
|
}
|
|
2555
2578
|
|
|
2556
|
-
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
2557
|
-
const ReactRouterMarkdownLink = ({ title, href, children }) => {
|
|
2558
|
-
const isExternal = href !== undefined && externalRegex.test(href);
|
|
2559
|
-
if (isExternal) {
|
|
2560
|
-
return (React__default.createElement("a", { target: "_blank", rel: "noreferrer noopener", href: href, title: title }, children));
|
|
2561
|
-
}
|
|
2562
|
-
return (React__default.createElement(HashLink, { to: href, title: title }, children));
|
|
2563
|
-
};
|
|
2564
|
-
|
|
2565
2579
|
const RouterComponent = {
|
|
2566
2580
|
history: BrowserRouter,
|
|
2567
2581
|
memory: MemoryRouter,
|
|
@@ -2752,4 +2766,4 @@ const createElementClass = (Component, propDescriptors) => {
|
|
|
2752
2766
|
};
|
|
2753
2767
|
};
|
|
2754
2768
|
|
|
2755
|
-
export { DeprecatedBadge, Docs, ExportButton, HttpMethodColors, InlineRefResolverProvider, Logo, MarkdownComponentsProvider, MockingProvider, NodeTypeColors, NodeTypeIconDefs, NodeTypePrettyName, NonIdealState, ParsedDocs, PersistenceContextProvider, PoweredByLink, SidebarLayout, Styled, TableOfContents, TryIt, TryItWithRequestSamples, createElementClass, createResolvedObject, findFirstNode, isHttpOperation, isHttpService, useBundleRefsIntoDocument, useParsedData, useParsedValue, useRouter, withMosaicProvider, withPersistenceBoundary, withQueryClientProvider, withRouter, withStyles };
|
|
2769
|
+
export { DeprecatedBadge, Docs, ExportButton, HttpMethodColors, InlineRefResolverProvider, Logo, MarkdownComponentsProvider, MockingProvider, NodeTypeColors, NodeTypeIconDefs, NodeTypePrettyName, NonIdealState, ParsedDocs, PersistenceContextProvider, PoweredByLink, ReactRouterMarkdownLink, SidebarLayout, Styled, TableOfContents, TryIt, TryItWithRequestSamples, createElementClass, createResolvedObject, findFirstNode, isHttpOperation, isHttpService, useBundleRefsIntoDocument, useParsedData, useParsedValue, useRouter, withMosaicProvider, withPersistenceBoundary, withQueryClientProvider, withRouter, withStyles };
|