@stoplight/elements 7.3.12 → 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 CHANGED
@@ -1,16 +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 { defaults, isObject, get, last, flow } from 'lodash';
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, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
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) => {
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 lodash = require('lodash');
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 = lodash.defaults(config, defaultComputerAPITreeConfig);
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, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
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) => lodash.isObject(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) => lodash.isObject(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) => lodash.isObject(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 (!lodash.isObject(data))
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);
@@ -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 = lodash.get(document, jsonPath);
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 || lodash.last(uri.split('/')) || '',
452
+ name: schemaDocument.title || last__default["default"](uri.split('/')) || '',
444
453
  tags: schemaDocument['x-tags'] || [],
445
454
  });
446
455
  }
@@ -540,6 +549,6 @@ const APIImpl = props => {
540
549
  }
541
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 }))));
542
551
  };
543
- const API = lodash.flow(elementsCore.withRouter, elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(APIImpl);
552
+ const API = flow__default["default"](elementsCore.withRouter, elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(APIImpl);
544
553
 
545
554
  exports.API = API;
package/index.mjs CHANGED
@@ -1,16 +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 { defaults, isObject, get, last, flow } from 'lodash';
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, allowRouting: true, exportProps: exportProps, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }))));
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) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements",
3
- "version": "7.3.12",
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
- "@fortawesome/react-fontawesome": "^0.1.11",
32
- "@stoplight/elements-core": "~7.3.11",
30
+ "@stoplight/elements-core": "~7.4.0",
33
31
  "@stoplight/http-spec": "^4.2.2",
34
32
  "@stoplight/json": "^3.10.0",
35
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",