@stoplight/elements 7.3.9 → 7.4.0
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 +7 -4
- package/index.js +19 -11
- package/index.mjs +7 -4
- package/package.json +4 -5
- package/styles.min.css +1 -1
- package/web-components.min.js +1 -1
package/index.esm.js
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
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 flow from 'lodash/flow.js';
|
|
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
|
|
8
|
+
import defaults from 'lodash/defaults.js';
|
|
9
9
|
import cn from 'classnames';
|
|
10
10
|
import { safeStringify } from '@stoplight/yaml';
|
|
11
11
|
import { saveAs } from 'file-saver';
|
|
12
12
|
import { transformOas2Service, transformOas2Operation } from '@stoplight/http-spec/oas2';
|
|
13
13
|
import { transformOas3Service, transformOas3Operation } from '@stoplight/http-spec/oas3';
|
|
14
14
|
import { encodePointerFragment, pointerToPath } from '@stoplight/json';
|
|
15
|
+
import get from 'lodash/get.js';
|
|
16
|
+
import isObject from 'lodash/isObject.js';
|
|
17
|
+
import last from 'lodash/last.js';
|
|
15
18
|
|
|
16
19
|
const computeTagGroups = (serviceNode) => {
|
|
17
20
|
const groupsByTagId = {};
|
|
@@ -182,7 +185,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
182
185
|
React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
183
186
|
React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
|
|
184
187
|
React.createElement(PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
|
|
185
|
-
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,
|
|
188
|
+
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, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
186
189
|
};
|
|
187
190
|
|
|
188
191
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -514,6 +517,6 @@ const APIImpl = props => {
|
|
|
514
517
|
}
|
|
515
518
|
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 }))));
|
|
516
519
|
};
|
|
517
|
-
const API =
|
|
520
|
+
const API = flow(withRouter, withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(APIImpl);
|
|
518
521
|
|
|
519
522
|
export { API };
|
package/index.js
CHANGED
|
@@ -4,18 +4,21 @@ 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 flow = require('lodash/flow.js');
|
|
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
|
|
12
|
+
var defaults = require('lodash/defaults.js');
|
|
13
13
|
var cn = require('classnames');
|
|
14
14
|
var yaml = require('@stoplight/yaml');
|
|
15
15
|
var fileSaver = require('file-saver');
|
|
16
16
|
var oas2 = require('@stoplight/http-spec/oas2');
|
|
17
17
|
var oas3 = require('@stoplight/http-spec/oas3');
|
|
18
18
|
var json = require('@stoplight/json');
|
|
19
|
+
var get = require('lodash/get.js');
|
|
20
|
+
var isObject = require('lodash/isObject.js');
|
|
21
|
+
var last = require('lodash/last.js');
|
|
19
22
|
|
|
20
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
21
24
|
|
|
@@ -37,8 +40,13 @@ function _interopNamespace(e) {
|
|
|
37
40
|
return Object.freeze(n);
|
|
38
41
|
}
|
|
39
42
|
|
|
43
|
+
var flow__default = /*#__PURE__*/_interopDefaultLegacy(flow);
|
|
40
44
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
45
|
+
var defaults__default = /*#__PURE__*/_interopDefaultLegacy(defaults);
|
|
41
46
|
var cn__default = /*#__PURE__*/_interopDefaultLegacy(cn);
|
|
47
|
+
var get__default = /*#__PURE__*/_interopDefaultLegacy(get);
|
|
48
|
+
var isObject__default = /*#__PURE__*/_interopDefaultLegacy(isObject);
|
|
49
|
+
var last__default = /*#__PURE__*/_interopDefaultLegacy(last);
|
|
42
50
|
|
|
43
51
|
const computeTagGroups = (serviceNode) => {
|
|
44
52
|
const groupsByTagId = {};
|
|
@@ -87,7 +95,7 @@ const defaultComputerAPITreeConfig = {
|
|
|
87
95
|
hideInternal: false,
|
|
88
96
|
};
|
|
89
97
|
const computeAPITree = (serviceNode, config = {}) => {
|
|
90
|
-
const mergedConfig =
|
|
98
|
+
const mergedConfig = defaults__default["default"](config, defaultComputerAPITreeConfig);
|
|
91
99
|
const tree = [];
|
|
92
100
|
tree.push({
|
|
93
101
|
id: '/',
|
|
@@ -209,7 +217,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
209
217
|
React__namespace.createElement(mosaic.Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
210
218
|
React__namespace.createElement(elementsCore.TableOfContents, { tree: tree, activeId: pathname, Link: reactRouterDom.Link, onLinkClick: handleTocClick })),
|
|
211
219
|
React__namespace.createElement(elementsCore.PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
|
|
212
|
-
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,
|
|
220
|
+
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, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
213
221
|
};
|
|
214
222
|
|
|
215
223
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -368,13 +376,13 @@ const oas3SourceMap = [
|
|
|
368
376
|
},
|
|
369
377
|
];
|
|
370
378
|
|
|
371
|
-
const isOas2 = (parsed) =>
|
|
379
|
+
const isOas2 = (parsed) => isObject__default["default"](parsed) &&
|
|
372
380
|
'swagger' in parsed &&
|
|
373
381
|
Number.parseInt(String(parsed.swagger)) === 2;
|
|
374
|
-
const isOas3 = (parsed) =>
|
|
382
|
+
const isOas3 = (parsed) => isObject__default["default"](parsed) &&
|
|
375
383
|
'openapi' in parsed &&
|
|
376
384
|
Number.parseFloat(String(parsed.openapi)) >= 3;
|
|
377
|
-
const isOas31 = (parsed) =>
|
|
385
|
+
const isOas31 = (parsed) => isObject__default["default"](parsed) &&
|
|
378
386
|
'openapi' in parsed &&
|
|
379
387
|
Number.parseFloat(String(parsed.openapi)) === 3.1;
|
|
380
388
|
const OAS_MODEL_REGEXP = /((definitions|components)\/?(schemas)?)\//;
|
|
@@ -406,7 +414,7 @@ function computeServiceNode(document, map, transformService, transformOperation)
|
|
|
406
414
|
function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
407
415
|
var _a;
|
|
408
416
|
const nodes = [];
|
|
409
|
-
if (!
|
|
417
|
+
if (!isObject__default["default"](data))
|
|
410
418
|
return nodes;
|
|
411
419
|
for (const key of Object.keys(data)) {
|
|
412
420
|
const sanitizedKey = json.encodePointerFragment(key);
|
|
@@ -435,13 +443,13 @@ function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
|
435
443
|
});
|
|
436
444
|
}
|
|
437
445
|
else if (match.type === NodeTypes.Model) {
|
|
438
|
-
const schemaDocument =
|
|
446
|
+
const schemaDocument = get__default["default"](document, jsonPath);
|
|
439
447
|
const parsedUri = uri.replace(OAS_MODEL_REGEXP, 'schemas/');
|
|
440
448
|
nodes.push({
|
|
441
449
|
type: types.NodeType.Model,
|
|
442
450
|
uri: parsedUri,
|
|
443
451
|
data: schemaDocument,
|
|
444
|
-
name: schemaDocument.title ||
|
|
452
|
+
name: schemaDocument.title || last__default["default"](uri.split('/')) || '',
|
|
445
453
|
tags: schemaDocument['x-tags'] || [],
|
|
446
454
|
});
|
|
447
455
|
}
|
|
@@ -541,6 +549,6 @@ const APIImpl = props => {
|
|
|
541
549
|
}
|
|
542
550
|
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 }))));
|
|
543
551
|
};
|
|
544
|
-
const API =
|
|
552
|
+
const API = flow__default["default"](elementsCore.withRouter, elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(APIImpl);
|
|
545
553
|
|
|
546
554
|
exports.API = API;
|
package/index.mjs
CHANGED
|
@@ -1,17 +1,20 @@
|
|
|
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 flow from 'lodash/flow.js';
|
|
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
|
|
8
|
+
import defaults from 'lodash/defaults.js';
|
|
9
9
|
import cn from 'classnames';
|
|
10
10
|
import { safeStringify } from '@stoplight/yaml';
|
|
11
11
|
import { saveAs } from 'file-saver';
|
|
12
12
|
import { transformOas2Service, transformOas2Operation } from '@stoplight/http-spec/oas2';
|
|
13
13
|
import { transformOas3Service, transformOas3Operation } from '@stoplight/http-spec/oas3';
|
|
14
14
|
import { encodePointerFragment, pointerToPath } from '@stoplight/json';
|
|
15
|
+
import get from 'lodash/get.js';
|
|
16
|
+
import isObject from 'lodash/isObject.js';
|
|
17
|
+
import last from 'lodash/last.js';
|
|
15
18
|
|
|
16
19
|
const computeTagGroups = (serviceNode) => {
|
|
17
20
|
const groupsByTagId = {};
|
|
@@ -182,7 +185,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
182
185
|
React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
183
186
|
React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
|
|
184
187
|
React.createElement(PoweredByLink, { source: serviceNode.name, pathname: pathname, packageType: "elements" })));
|
|
185
|
-
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,
|
|
188
|
+
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, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
|
|
186
189
|
};
|
|
187
190
|
|
|
188
191
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -514,6 +517,6 @@ const APIImpl = props => {
|
|
|
514
517
|
}
|
|
515
518
|
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 }))));
|
|
516
519
|
};
|
|
517
|
-
const API =
|
|
520
|
+
const API = flow(withRouter, withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(APIImpl);
|
|
518
521
|
|
|
519
522
|
export { API };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.4.0",
|
|
4
4
|
"description": "UI components for composing beautiful developer documentation.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "./index.js",
|
|
@@ -26,14 +26,13 @@
|
|
|
26
26
|
"react-dom": ">=16.8"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@fortawesome/fontawesome-svg-core": "^1.2.31",
|
|
30
29
|
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
|
31
|
-
"@
|
|
32
|
-
"@stoplight/elements-core": "~7.3.8",
|
|
30
|
+
"@stoplight/elements-core": "~7.4.0",
|
|
33
31
|
"@stoplight/http-spec": "^4.2.2",
|
|
34
32
|
"@stoplight/json": "^3.10.0",
|
|
35
|
-
"@stoplight/mosaic": "^1.
|
|
33
|
+
"@stoplight/mosaic": "^1.12.4",
|
|
36
34
|
"@stoplight/types": "^12.0.0",
|
|
35
|
+
"@stoplight/yaml": "^4.2.2",
|
|
37
36
|
"classnames": "^2.2.6",
|
|
38
37
|
"file-saver": "^2.0.5",
|
|
39
38
|
"lodash": "^4.17.19",
|