@stoplight/elements 7.3.8 → 7.3.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/index.esm.js +4 -4
- package/index.js +4 -4
- package/index.mjs +4 -4
- package/package.json +3 -3
- package/styles.min.css +1 -1
- package/web-components.min.js +1 -1
package/index.esm.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isHttpOperation, isHttpService, Logo, TableOfContents, PoweredByLink, SidebarLayout, ParsedDocs, HttpMethodColors, DeprecatedBadge, TryItWithRequestSamples, Docs, withRouter, withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider, useParsedValue, useBundleRefsIntoDocument, NonIdealState, InlineRefResolverProvider } from '@stoplight/elements-core';
|
|
2
2
|
import { Flex, Heading, Box, Icon, Tabs, TabList, Tab, TabPanels, TabPanel } from '@stoplight/mosaic';
|
|
3
|
-
import {
|
|
3
|
+
import { defaults, isObject, get, last, flow } from 'lodash';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useQuery } from 'react-query';
|
|
6
6
|
import { NodeType } from '@stoplight/types';
|
|
7
7
|
import { useLocation, Redirect, Link } from 'react-router-dom';
|
|
8
|
-
import { defaults, isObject, get, last } from 'lodash';
|
|
9
8
|
import cn from 'classnames';
|
|
10
9
|
import { safeStringify } from '@stoplight/yaml';
|
|
11
10
|
import { saveAs } from 'file-saver';
|
|
@@ -160,6 +159,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
160
159
|
const { pathname } = location;
|
|
161
160
|
const isRootPath = !pathname || pathname === '/';
|
|
162
161
|
const node = isRootPath ? serviceNode : serviceNode.children.find(child => child.uri === pathname);
|
|
162
|
+
const layoutOptions = React.useMemo(() => ({ hideTryIt: hideTryIt, hideExport: hideExport || (node === null || node === void 0 ? void 0 : node.type) !== NodeType.HttpService }), [hideTryIt, hideExport, node]);
|
|
163
163
|
if (!node) {
|
|
164
164
|
const firstSlug = findFirstNodeSlug(tree);
|
|
165
165
|
if (firstSlug) {
|
|
@@ -181,7 +181,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
181
181
|
React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
182
182
|
React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
|
|
183
183
|
React.createElement(PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
|
|
184
|
-
return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions:
|
|
184
|
+
return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: layoutOptions, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -513,6 +513,6 @@ const APIImpl = props => {
|
|
|
513
513
|
}
|
|
514
514
|
return (React.createElement(InlineRefResolverProvider, { document: parsedDocument }, layout === 'stacked' ? (React.createElement(APIWithStackedLayout, { serviceNode: serviceNode, hideTryIt: hideTryIt, hideExport: hideExport, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy })) : (React.createElement(APIWithSidebarLayout, { logo: logo, serviceNode: serviceNode, hideTryIt: hideTryIt, hideSchemas: hideSchemas, hideInternal: hideInternal, hideExport: hideExport, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
515
515
|
};
|
|
516
|
-
const API =
|
|
516
|
+
const API = flow(withRouter, withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(APIImpl);
|
|
517
517
|
|
|
518
518
|
export { API };
|
package/index.js
CHANGED
|
@@ -4,12 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var elementsCore = require('@stoplight/elements-core');
|
|
6
6
|
var mosaic = require('@stoplight/mosaic');
|
|
7
|
-
var
|
|
7
|
+
var lodash = require('lodash');
|
|
8
8
|
var React = require('react');
|
|
9
9
|
var reactQuery = require('react-query');
|
|
10
10
|
var types = require('@stoplight/types');
|
|
11
11
|
var reactRouterDom = require('react-router-dom');
|
|
12
|
-
var lodash = require('lodash');
|
|
13
12
|
var cn = require('classnames');
|
|
14
13
|
var yaml = require('@stoplight/yaml');
|
|
15
14
|
var fileSaver = require('file-saver');
|
|
@@ -187,6 +186,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
187
186
|
const { pathname } = location;
|
|
188
187
|
const isRootPath = !pathname || pathname === '/';
|
|
189
188
|
const node = isRootPath ? serviceNode : serviceNode.children.find(child => child.uri === pathname);
|
|
189
|
+
const layoutOptions = React__namespace.useMemo(() => ({ hideTryIt: hideTryIt, hideExport: hideExport || (node === null || node === void 0 ? void 0 : node.type) !== types.NodeType.HttpService }), [hideTryIt, hideExport, node]);
|
|
190
190
|
if (!node) {
|
|
191
191
|
const firstSlug = findFirstNodeSlug(tree);
|
|
192
192
|
if (firstSlug) {
|
|
@@ -208,7 +208,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
208
208
|
React__namespace.createElement(mosaic.Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
209
209
|
React__namespace.createElement(elementsCore.TableOfContents, { tree: tree, activeId: pathname, Link: reactRouterDom.Link, onLinkClick: handleTocClick })),
|
|
210
210
|
React__namespace.createElement(elementsCore.PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
|
|
211
|
-
return (React__namespace.createElement(elementsCore.SidebarLayout, { ref: container, sidebar: sidebar }, node && (React__namespace.createElement(elementsCore.ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions:
|
|
211
|
+
return (React__namespace.createElement(elementsCore.SidebarLayout, { ref: container, sidebar: sidebar }, node && (React__namespace.createElement(elementsCore.ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: layoutOptions, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
212
212
|
};
|
|
213
213
|
|
|
214
214
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -540,6 +540,6 @@ const APIImpl = props => {
|
|
|
540
540
|
}
|
|
541
541
|
return (React__namespace.createElement(elementsCore.InlineRefResolverProvider, { document: parsedDocument }, layout === 'stacked' ? (React__namespace.createElement(APIWithStackedLayout, { serviceNode: serviceNode, hideTryIt: hideTryIt, hideExport: hideExport, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy })) : (React__namespace.createElement(APIWithSidebarLayout, { logo: logo, serviceNode: serviceNode, hideTryIt: hideTryIt, hideSchemas: hideSchemas, hideInternal: hideInternal, hideExport: hideExport, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
542
542
|
};
|
|
543
|
-
const API =
|
|
543
|
+
const API = lodash.flow(elementsCore.withRouter, elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(APIImpl);
|
|
544
544
|
|
|
545
545
|
exports.API = API;
|
package/index.mjs
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { isHttpOperation, isHttpService, Logo, TableOfContents, PoweredByLink, SidebarLayout, ParsedDocs, HttpMethodColors, DeprecatedBadge, TryItWithRequestSamples, Docs, withRouter, withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider, useParsedValue, useBundleRefsIntoDocument, NonIdealState, InlineRefResolverProvider } from '@stoplight/elements-core';
|
|
2
2
|
import { Flex, Heading, Box, Icon, Tabs, TabList, Tab, TabPanels, TabPanel } from '@stoplight/mosaic';
|
|
3
|
-
import {
|
|
3
|
+
import { defaults, isObject, get, last, flow } from 'lodash';
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import { useQuery } from 'react-query';
|
|
6
6
|
import { NodeType } from '@stoplight/types';
|
|
7
7
|
import { useLocation, Redirect, Link } from 'react-router-dom';
|
|
8
|
-
import { defaults, isObject, get, last } from 'lodash';
|
|
9
8
|
import cn from 'classnames';
|
|
10
9
|
import { safeStringify } from '@stoplight/yaml';
|
|
11
10
|
import { saveAs } from 'file-saver';
|
|
@@ -160,6 +159,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
160
159
|
const { pathname } = location;
|
|
161
160
|
const isRootPath = !pathname || pathname === '/';
|
|
162
161
|
const node = isRootPath ? serviceNode : serviceNode.children.find(child => child.uri === pathname);
|
|
162
|
+
const layoutOptions = React.useMemo(() => ({ hideTryIt: hideTryIt, hideExport: hideExport || (node === null || node === void 0 ? void 0 : node.type) !== NodeType.HttpService }), [hideTryIt, hideExport, node]);
|
|
163
163
|
if (!node) {
|
|
164
164
|
const firstSlug = findFirstNodeSlug(tree);
|
|
165
165
|
if (firstSlug) {
|
|
@@ -181,7 +181,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
181
181
|
React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
182
182
|
React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
|
|
183
183
|
React.createElement(PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
|
|
184
|
-
return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions:
|
|
184
|
+
return (React.createElement(SidebarLayout, { ref: container, sidebar: sidebar }, node && (React.createElement(ParsedDocs, { key: pathname, uri: pathname, node: node, nodeTitle: node.name, layoutOptions: layoutOptions, location: location, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
185
185
|
};
|
|
186
186
|
|
|
187
187
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -513,6 +513,6 @@ const APIImpl = props => {
|
|
|
513
513
|
}
|
|
514
514
|
return (React.createElement(InlineRefResolverProvider, { document: parsedDocument }, layout === 'stacked' ? (React.createElement(APIWithStackedLayout, { serviceNode: serviceNode, hideTryIt: hideTryIt, hideExport: hideExport, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy })) : (React.createElement(APIWithSidebarLayout, { logo: logo, serviceNode: serviceNode, hideTryIt: hideTryIt, hideSchemas: hideSchemas, hideInternal: hideInternal, hideExport: hideExport, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
515
515
|
};
|
|
516
|
-
const API =
|
|
516
|
+
const API = flow(withRouter, withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(APIImpl);
|
|
517
517
|
|
|
518
518
|
export { API };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements",
|
|
3
|
-
"version": "7.3.
|
|
3
|
+
"version": "7.3.12",
|
|
4
4
|
"description": "UI components for composing beautiful developer documentation.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "./index.js",
|
|
@@ -29,10 +29,10 @@
|
|
|
29
29
|
"@fortawesome/fontawesome-svg-core": "^1.2.31",
|
|
30
30
|
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
|
31
31
|
"@fortawesome/react-fontawesome": "^0.1.11",
|
|
32
|
-
"@stoplight/elements-core": "~7.3.
|
|
32
|
+
"@stoplight/elements-core": "~7.3.11",
|
|
33
33
|
"@stoplight/http-spec": "^4.2.2",
|
|
34
34
|
"@stoplight/json": "^3.10.0",
|
|
35
|
-
"@stoplight/mosaic": "^1.
|
|
35
|
+
"@stoplight/mosaic": "^1.12.4",
|
|
36
36
|
"@stoplight/types": "^12.0.0",
|
|
37
37
|
"classnames": "^2.2.6",
|
|
38
38
|
"file-saver": "^2.0.5",
|