@stoplight/elements 7.3.12 → 7.5.1
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 -10
- package/index.js +20 -18
- package/index.mjs +7 -10
- package/package.json +4 -5
- package/styles.min.css +1 -1
- package/web-components.min.js +1 -1
package/index.esm.js
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
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';
|
|
1
|
+
import { isHttpOperation, isHttpService, Logo, TableOfContents, PoweredByLink, SidebarLayout, ParsedDocs, HttpMethodColors, DeprecatedBadge, TryItWithRequestSamples, Docs, slugify, 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 defaults from 'lodash/defaults.js';
|
|
8
9
|
import cn from 'classnames';
|
|
9
10
|
import { safeStringify } from '@stoplight/yaml';
|
|
10
11
|
import { saveAs } from 'file-saver';
|
|
11
12
|
import { transformOas2Service, transformOas2Operation } from '@stoplight/http-spec/oas2';
|
|
12
13
|
import { transformOas3Service, transformOas3Operation } from '@stoplight/http-spec/oas3';
|
|
13
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';
|
|
14
18
|
|
|
15
19
|
const computeTagGroups = (serviceNode) => {
|
|
16
20
|
const groupsByTagId = {};
|
|
@@ -181,7 +185,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
181
185
|
React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
182
186
|
React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
|
|
183
187
|
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: 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 }))));
|
|
185
189
|
};
|
|
186
190
|
|
|
187
191
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -424,13 +428,6 @@ function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
|
424
428
|
}
|
|
425
429
|
return nodes;
|
|
426
430
|
}
|
|
427
|
-
function slugify(name) {
|
|
428
|
-
return name
|
|
429
|
-
.replace(/\/|{|}|\s/g, '-')
|
|
430
|
-
.replace(/-{2,}/, '-')
|
|
431
|
-
.replace(/^-/, '')
|
|
432
|
-
.replace(/-$/, '');
|
|
433
|
-
}
|
|
434
431
|
function findMapMatch(key, map) {
|
|
435
432
|
var _a;
|
|
436
433
|
if (typeof key === 'number')
|
package/index.js
CHANGED
|
@@ -4,17 +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 defaults = require('lodash/defaults.js');
|
|
12
13
|
var cn = require('classnames');
|
|
13
14
|
var yaml = require('@stoplight/yaml');
|
|
14
15
|
var fileSaver = require('file-saver');
|
|
15
16
|
var oas2 = require('@stoplight/http-spec/oas2');
|
|
16
17
|
var oas3 = require('@stoplight/http-spec/oas3');
|
|
17
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');
|
|
18
22
|
|
|
19
23
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
20
24
|
|
|
@@ -36,8 +40,13 @@ function _interopNamespace(e) {
|
|
|
36
40
|
return Object.freeze(n);
|
|
37
41
|
}
|
|
38
42
|
|
|
43
|
+
var flow__default = /*#__PURE__*/_interopDefaultLegacy(flow);
|
|
39
44
|
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
45
|
+
var defaults__default = /*#__PURE__*/_interopDefaultLegacy(defaults);
|
|
40
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);
|
|
41
50
|
|
|
42
51
|
const computeTagGroups = (serviceNode) => {
|
|
43
52
|
const groupsByTagId = {};
|
|
@@ -86,7 +95,7 @@ const defaultComputerAPITreeConfig = {
|
|
|
86
95
|
hideInternal: false,
|
|
87
96
|
};
|
|
88
97
|
const computeAPITree = (serviceNode, config = {}) => {
|
|
89
|
-
const mergedConfig =
|
|
98
|
+
const mergedConfig = defaults__default["default"](config, defaultComputerAPITreeConfig);
|
|
90
99
|
const tree = [];
|
|
91
100
|
tree.push({
|
|
92
101
|
id: '/',
|
|
@@ -208,7 +217,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
208
217
|
React__namespace.createElement(mosaic.Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
209
218
|
React__namespace.createElement(elementsCore.TableOfContents, { tree: tree, activeId: pathname, Link: reactRouterDom.Link, onLinkClick: handleTocClick })),
|
|
210
219
|
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: 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 }))));
|
|
212
221
|
};
|
|
213
222
|
|
|
214
223
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -367,13 +376,13 @@ const oas3SourceMap = [
|
|
|
367
376
|
},
|
|
368
377
|
];
|
|
369
378
|
|
|
370
|
-
const isOas2 = (parsed) =>
|
|
379
|
+
const isOas2 = (parsed) => isObject__default["default"](parsed) &&
|
|
371
380
|
'swagger' in parsed &&
|
|
372
381
|
Number.parseInt(String(parsed.swagger)) === 2;
|
|
373
|
-
const isOas3 = (parsed) =>
|
|
382
|
+
const isOas3 = (parsed) => isObject__default["default"](parsed) &&
|
|
374
383
|
'openapi' in parsed &&
|
|
375
384
|
Number.parseFloat(String(parsed.openapi)) >= 3;
|
|
376
|
-
const isOas31 = (parsed) =>
|
|
385
|
+
const isOas31 = (parsed) => isObject__default["default"](parsed) &&
|
|
377
386
|
'openapi' in parsed &&
|
|
378
387
|
Number.parseFloat(String(parsed.openapi)) === 3.1;
|
|
379
388
|
const OAS_MODEL_REGEXP = /((definitions|components)\/?(schemas)?)\//;
|
|
@@ -405,7 +414,7 @@ function computeServiceNode(document, map, transformService, transformOperation)
|
|
|
405
414
|
function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
406
415
|
var _a;
|
|
407
416
|
const nodes = [];
|
|
408
|
-
if (!
|
|
417
|
+
if (!isObject__default["default"](data))
|
|
409
418
|
return nodes;
|
|
410
419
|
for (const key of Object.keys(data)) {
|
|
411
420
|
const sanitizedKey = json.encodePointerFragment(key);
|
|
@@ -423,7 +432,7 @@ function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
|
423
432
|
parsedUri = `/operations/${operationDocument.iid}`;
|
|
424
433
|
}
|
|
425
434
|
else {
|
|
426
|
-
parsedUri = uri.replace(encodedPath, slugify(path));
|
|
435
|
+
parsedUri = uri.replace(encodedPath, elementsCore.slugify(path));
|
|
427
436
|
}
|
|
428
437
|
nodes.push({
|
|
429
438
|
type: types.NodeType.HttpOperation,
|
|
@@ -434,13 +443,13 @@ function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
|
434
443
|
});
|
|
435
444
|
}
|
|
436
445
|
else if (match.type === NodeTypes.Model) {
|
|
437
|
-
const schemaDocument =
|
|
446
|
+
const schemaDocument = get__default["default"](document, jsonPath);
|
|
438
447
|
const parsedUri = uri.replace(OAS_MODEL_REGEXP, 'schemas/');
|
|
439
448
|
nodes.push({
|
|
440
449
|
type: types.NodeType.Model,
|
|
441
450
|
uri: parsedUri,
|
|
442
451
|
data: schemaDocument,
|
|
443
|
-
name: schemaDocument.title ||
|
|
452
|
+
name: schemaDocument.title || last__default["default"](uri.split('/')) || '',
|
|
444
453
|
tags: schemaDocument['x-tags'] || [],
|
|
445
454
|
});
|
|
446
455
|
}
|
|
@@ -451,13 +460,6 @@ function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
|
451
460
|
}
|
|
452
461
|
return nodes;
|
|
453
462
|
}
|
|
454
|
-
function slugify(name) {
|
|
455
|
-
return name
|
|
456
|
-
.replace(/\/|{|}|\s/g, '-')
|
|
457
|
-
.replace(/-{2,}/, '-')
|
|
458
|
-
.replace(/^-/, '')
|
|
459
|
-
.replace(/-$/, '');
|
|
460
|
-
}
|
|
461
463
|
function findMapMatch(key, map) {
|
|
462
464
|
var _a;
|
|
463
465
|
if (typeof key === 'number')
|
|
@@ -540,6 +542,6 @@ const APIImpl = props => {
|
|
|
540
542
|
}
|
|
541
543
|
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
544
|
};
|
|
543
|
-
const API =
|
|
545
|
+
const API = flow__default["default"](elementsCore.withRouter, elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(APIImpl);
|
|
544
546
|
|
|
545
547
|
exports.API = API;
|
package/index.mjs
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
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';
|
|
1
|
+
import { isHttpOperation, isHttpService, Logo, TableOfContents, PoweredByLink, SidebarLayout, ParsedDocs, HttpMethodColors, DeprecatedBadge, TryItWithRequestSamples, Docs, slugify, 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 defaults from 'lodash/defaults.js';
|
|
8
9
|
import cn from 'classnames';
|
|
9
10
|
import { safeStringify } from '@stoplight/yaml';
|
|
10
11
|
import { saveAs } from 'file-saver';
|
|
11
12
|
import { transformOas2Service, transformOas2Operation } from '@stoplight/http-spec/oas2';
|
|
12
13
|
import { transformOas3Service, transformOas3Operation } from '@stoplight/http-spec/oas3';
|
|
13
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';
|
|
14
18
|
|
|
15
19
|
const computeTagGroups = (serviceNode) => {
|
|
16
20
|
const groupsByTagId = {};
|
|
@@ -181,7 +185,7 @@ const APIWithSidebarLayout = ({ serviceNode, logo, hideTryIt, hideSchemas, hideI
|
|
|
181
185
|
React.createElement(Flex, { flexGrow: true, flexShrink: true, overflowY: "auto", direction: "col" },
|
|
182
186
|
React.createElement(TableOfContents, { tree: tree, activeId: pathname, Link: Link, onLinkClick: handleTocClick })),
|
|
183
187
|
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: 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 }))));
|
|
185
189
|
};
|
|
186
190
|
|
|
187
191
|
const itemMatchesHash = (hash, item) => {
|
|
@@ -424,13 +428,6 @@ function computeChildNodes(document, data, map, transformer, parentUri = '') {
|
|
|
424
428
|
}
|
|
425
429
|
return nodes;
|
|
426
430
|
}
|
|
427
|
-
function slugify(name) {
|
|
428
|
-
return name
|
|
429
|
-
.replace(/\/|{|}|\s/g, '-')
|
|
430
|
-
.replace(/-{2,}/, '-')
|
|
431
|
-
.replace(/^-/, '')
|
|
432
|
-
.replace(/-$/, '');
|
|
433
|
-
}
|
|
434
431
|
function findMapMatch(key, map) {
|
|
435
432
|
var _a;
|
|
436
433
|
if (typeof key === 'number')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.5.1",
|
|
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.11",
|
|
30
|
+
"@stoplight/elements-core": "~7.5.1",
|
|
33
31
|
"@stoplight/http-spec": "^4.2.2",
|
|
34
32
|
"@stoplight/json": "^3.10.0",
|
|
35
|
-
"@stoplight/mosaic": "^1.
|
|
33
|
+
"@stoplight/mosaic": "^1.14.0",
|
|
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",
|