@stoplight/elements-dev-portal 1.4.4 → 1.4.8

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,11 +1,11 @@
1
- import { Menu, FieldButton, Provider, Modal, Input, Box, Icon, ListBox, ListBoxItem, Flex, VStack, Heading } from '@stoplight/mosaic';
1
+ import { Menu, FieldButton, Modal, Input, Box, Icon, ListBox, ListBoxItem, Flex, VStack, Heading } from '@stoplight/mosaic';
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
- import { withQueryClientProvider, PersistenceContextProvider, MarkdownComponentsProvider, MockingProvider, Docs, withStyles, withPersistenceBoundary, withMosaicProvider, NodeTypeIconDefs, NodeTypeColors, TableOfContents as TableOfContents$1, PoweredByLink, useRouter, findFirstNode, SidebarLayout } from '@stoplight/elements-core';
4
+ import { withQueryClientProvider, withMosaicProvider, PersistenceContextProvider, MarkdownComponentsProvider, MockingProvider, Docs, withStyles, withPersistenceBoundary, NodeTypeIconDefs, NodeTypeColors, TableOfContents as TableOfContents$1, PoweredByLink, useRouter, findFirstNode, ReactRouterMarkdownLink, SidebarLayout } from '@stoplight/elements-core';
5
5
  import { resolve, dirname } from '@stoplight/path';
6
6
  import { NodeType } from '@stoplight/types';
7
7
  import { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';
8
- import { pipe } from 'lodash/fp';
8
+ import { flow } from 'lodash';
9
9
  import { Route, useParams, useHistory, Redirect, Link } from 'react-router-dom';
10
10
  import { faCircleNotch, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
11
11
  import { useQuery } from 'react-query';
@@ -36,10 +36,9 @@ const BranchSelector = ({ branchSlug, branches, onChange }) => {
36
36
 
37
37
  const PlatformContext = React.createContext({ platformUrl: 'https://stoplight.io' });
38
38
  const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, children, }) => {
39
- return (React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } },
40
- React.createElement(Provider, null, children)));
39
+ return React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } }, children);
41
40
  };
42
- const DevPortalProvider = withQueryClientProvider(PlatformProvider);
41
+ const DevPortalProvider = withQueryClientProvider(withMosaicProvider(PlatformProvider));
43
42
 
44
43
  const NodeContent = ({ node, Link, hideTryIt, hideTryItPanel, hideMocking, hideExport, tryItCredentialsPolicy, tryItCorsProxy, }) => {
45
44
  return (React.createElement(PersistenceContextProvider, null,
@@ -76,7 +75,7 @@ const LinkComponent = ({ children, href }) => {
76
75
  const decodedResolvedUriWithoutAnchor = decodeURIComponent(resolvedUriWithoutAnchor);
77
76
  const edge = node.outbound_edges.find(edge => edge.uri === decodedUrl || edge.uri === decodedResolvedUriWithoutAnchor);
78
77
  if (edge) {
79
- return (React.createElement(Link, { to: edge.slug, hash: hash }, children));
78
+ return React.createElement(Link, { to: `${edge.slug}${hash && `#${hash}`}` }, children);
80
79
  }
81
80
  }
82
81
  return React.createElement("a", { href: href }, children);
@@ -119,7 +118,7 @@ const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch
119
118
  React.createElement(Box, { dangerouslySetInnerHTML: { __html: (_b = searchResult.highlighted.summary) !== null && _b !== void 0 ? _b : '' }, color: "muted", fontSize: "sm", mt: 1, ml: 6 }))));
120
119
  })) : (React.createElement(Flex, { w: "full", h: 80, align: "center", justify: "center", m: -5 }, "No search results"))));
121
120
  };
122
- const Search = pipe(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(SearchImpl);
121
+ const Search = flow(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(SearchImpl);
123
122
 
124
123
  /*! *****************************************************************************
125
124
  Copyright (c) Microsoft Corporation.
@@ -183,7 +182,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
183
182
  React__default.createElement(Icon, { icon: faExclamationTriangle, size: "4x" }),
184
183
  React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
185
184
 
186
- const appVersion = '1.4.4';
185
+ const appVersion = '1.4.8';
187
186
 
188
187
  class ResponseError extends Error {
189
188
  constructor(message, responseCode) {
@@ -297,7 +296,7 @@ const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, c
297
296
  elem = React.createElement(NotFound, null);
298
297
  }
299
298
  else {
300
- elem = (React.createElement(NodeContent, { node: node, Link: Link, hideTryIt: hideTryIt, hideMocking: hideMocking, hideExport: hideExport, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }));
299
+ elem = (React.createElement(NodeContent, { node: node, Link: ReactRouterMarkdownLink, hideTryIt: hideTryIt, hideMocking: hideMocking, hideExport: hideExport, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }));
301
300
  }
302
301
  const handleTocClick = () => {
303
302
  if (container.current) {
@@ -320,7 +319,7 @@ const StoplightProjectRouter = (_a) => {
320
319
  React.createElement(Route, { path: "/", exact: true },
321
320
  React.createElement(StoplightProjectImpl, Object.assign({}, props))))));
322
321
  };
323
- const StoplightProject = pipe(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(StoplightProjectRouter);
322
+ const StoplightProject = flow(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(StoplightProjectRouter);
324
323
 
325
324
  const getNodes = ({ workspaceId, branchSlug, projectIds, search, platformUrl = 'https://stoplight.io', platformAuthToken, }) => __awaiter(void 0, void 0, void 0, function* () {
326
325
  const queryParams = [];
package/index.js CHANGED
@@ -8,7 +8,7 @@ var elementsCore = require('@stoplight/elements-core');
8
8
  var path = require('@stoplight/path');
9
9
  var types = require('@stoplight/types');
10
10
  var faSearch = require('@fortawesome/free-solid-svg-icons/faSearch');
11
- var fp = require('lodash/fp');
11
+ var lodash = require('lodash');
12
12
  var reactRouterDom = require('react-router-dom');
13
13
  var freeSolidSvgIcons = require('@fortawesome/free-solid-svg-icons');
14
14
  var reactQuery = require('react-query');
@@ -62,10 +62,9 @@ const BranchSelector = ({ branchSlug, branches, onChange }) => {
62
62
 
63
63
  const PlatformContext = React__namespace.createContext({ platformUrl: 'https://stoplight.io' });
64
64
  const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, children, }) => {
65
- return (React__namespace.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } },
66
- React__namespace.createElement(mosaic.Provider, null, children)));
65
+ return React__namespace.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } }, children);
67
66
  };
68
- const DevPortalProvider = elementsCore.withQueryClientProvider(PlatformProvider);
67
+ const DevPortalProvider = elementsCore.withQueryClientProvider(elementsCore.withMosaicProvider(PlatformProvider));
69
68
 
70
69
  const NodeContent = ({ node, Link, hideTryIt, hideTryItPanel, hideMocking, hideExport, tryItCredentialsPolicy, tryItCorsProxy, }) => {
71
70
  return (React__namespace.createElement(elementsCore.PersistenceContextProvider, null,
@@ -102,7 +101,7 @@ const LinkComponent = ({ children, href }) => {
102
101
  const decodedResolvedUriWithoutAnchor = decodeURIComponent(resolvedUriWithoutAnchor);
103
102
  const edge = node.outbound_edges.find(edge => edge.uri === decodedUrl || edge.uri === decodedResolvedUriWithoutAnchor);
104
103
  if (edge) {
105
- return (React__namespace.createElement(Link, { to: edge.slug, hash: hash }, children));
104
+ return React__namespace.createElement(Link, { to: `${edge.slug}${hash && `#${hash}`}` }, children);
106
105
  }
107
106
  }
108
107
  return React__namespace.createElement("a", { href: href }, children);
@@ -145,7 +144,7 @@ const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch
145
144
  React__namespace.createElement(mosaic.Box, { dangerouslySetInnerHTML: { __html: (_b = searchResult.highlighted.summary) !== null && _b !== void 0 ? _b : '' }, color: "muted", fontSize: "sm", mt: 1, ml: 6 }))));
146
145
  })) : (React__namespace.createElement(mosaic.Flex, { w: "full", h: 80, align: "center", justify: "center", m: -5 }, "No search results"))));
147
146
  };
148
- const Search = fp.pipe(elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(SearchImpl);
147
+ const Search = lodash.flow(elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(SearchImpl);
149
148
 
150
149
  /*! *****************************************************************************
151
150
  Copyright (c) Microsoft Corporation.
@@ -209,7 +208,7 @@ const UpgradeToStarter = () => (React__default["default"].createElement(mosaic.F
209
208
  React__default["default"].createElement(mosaic.Icon, { icon: freeSolidSvgIcons.faExclamationTriangle, size: "4x" }),
210
209
  React__default["default"].createElement(mosaic.Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
211
210
 
212
- const appVersion = '1.4.4';
211
+ const appVersion = '1.4.8';
213
212
 
214
213
  class ResponseError extends Error {
215
214
  constructor(message, responseCode) {
@@ -323,7 +322,7 @@ const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, c
323
322
  elem = React__namespace.createElement(NotFound, null);
324
323
  }
325
324
  else {
326
- elem = (React__namespace.createElement(NodeContent, { node: node, Link: reactRouterDom.Link, hideTryIt: hideTryIt, hideMocking: hideMocking, hideExport: hideExport, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }));
325
+ elem = (React__namespace.createElement(NodeContent, { node: node, Link: elementsCore.ReactRouterMarkdownLink, hideTryIt: hideTryIt, hideMocking: hideMocking, hideExport: hideExport, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }));
327
326
  }
328
327
  const handleTocClick = () => {
329
328
  if (container.current) {
@@ -346,7 +345,7 @@ const StoplightProjectRouter = (_a) => {
346
345
  React__namespace.createElement(reactRouterDom.Route, { path: "/", exact: true },
347
346
  React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props))))));
348
347
  };
349
- const StoplightProject = fp.pipe(elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(StoplightProjectRouter);
348
+ const StoplightProject = lodash.flow(elementsCore.withStyles, elementsCore.withPersistenceBoundary, elementsCore.withMosaicProvider, elementsCore.withQueryClientProvider)(StoplightProjectRouter);
350
349
 
351
350
  const getNodes = ({ workspaceId, branchSlug, projectIds, search, platformUrl = 'https://stoplight.io', platformAuthToken, }) => __awaiter(void 0, void 0, void 0, function* () {
352
351
  const queryParams = [];
package/index.mjs CHANGED
@@ -1,11 +1,11 @@
1
- import { Menu, FieldButton, Provider, Modal, Input, Box, Icon, ListBox, ListBoxItem, Flex, VStack, Heading } from '@stoplight/mosaic';
1
+ import { Menu, FieldButton, Modal, Input, Box, Icon, ListBox, ListBoxItem, Flex, VStack, Heading } from '@stoplight/mosaic';
2
2
  import * as React from 'react';
3
3
  import React__default from 'react';
4
- import { withQueryClientProvider, PersistenceContextProvider, MarkdownComponentsProvider, MockingProvider, Docs, withStyles, withPersistenceBoundary, withMosaicProvider, NodeTypeIconDefs, NodeTypeColors, TableOfContents as TableOfContents$1, PoweredByLink, useRouter, findFirstNode, SidebarLayout } from '@stoplight/elements-core';
4
+ import { withQueryClientProvider, withMosaicProvider, PersistenceContextProvider, MarkdownComponentsProvider, MockingProvider, Docs, withStyles, withPersistenceBoundary, NodeTypeIconDefs, NodeTypeColors, TableOfContents as TableOfContents$1, PoweredByLink, useRouter, findFirstNode, ReactRouterMarkdownLink, SidebarLayout } from '@stoplight/elements-core';
5
5
  import { resolve, dirname } from '@stoplight/path';
6
6
  import { NodeType } from '@stoplight/types';
7
7
  import { faSearch } from '@fortawesome/free-solid-svg-icons/faSearch';
8
- import { pipe } from 'lodash/fp';
8
+ import { flow } from 'lodash';
9
9
  import { Route, useParams, useHistory, Redirect, Link } from 'react-router-dom';
10
10
  import { faCircleNotch, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
11
11
  import { useQuery } from 'react-query';
@@ -36,10 +36,9 @@ const BranchSelector = ({ branchSlug, branches, onChange }) => {
36
36
 
37
37
  const PlatformContext = React.createContext({ platformUrl: 'https://stoplight.io' });
38
38
  const PlatformProvider = ({ platformUrl = 'https://stoplight.io', platformAuthToken, children, }) => {
39
- return (React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } },
40
- React.createElement(Provider, null, children)));
39
+ return React.createElement(PlatformContext.Provider, { value: { platformUrl, platformAuthToken } }, children);
41
40
  };
42
- const DevPortalProvider = withQueryClientProvider(PlatformProvider);
41
+ const DevPortalProvider = withQueryClientProvider(withMosaicProvider(PlatformProvider));
43
42
 
44
43
  const NodeContent = ({ node, Link, hideTryIt, hideTryItPanel, hideMocking, hideExport, tryItCredentialsPolicy, tryItCorsProxy, }) => {
45
44
  return (React.createElement(PersistenceContextProvider, null,
@@ -76,7 +75,7 @@ const LinkComponent = ({ children, href }) => {
76
75
  const decodedResolvedUriWithoutAnchor = decodeURIComponent(resolvedUriWithoutAnchor);
77
76
  const edge = node.outbound_edges.find(edge => edge.uri === decodedUrl || edge.uri === decodedResolvedUriWithoutAnchor);
78
77
  if (edge) {
79
- return (React.createElement(Link, { to: edge.slug, hash: hash }, children));
78
+ return React.createElement(Link, { to: `${edge.slug}${hash && `#${hash}`}` }, children);
80
79
  }
81
80
  }
82
81
  return React.createElement("a", { href: href }, children);
@@ -119,7 +118,7 @@ const SearchImpl = ({ search, searchResults, isOpen, onClose, onClick, onSearch
119
118
  React.createElement(Box, { dangerouslySetInnerHTML: { __html: (_b = searchResult.highlighted.summary) !== null && _b !== void 0 ? _b : '' }, color: "muted", fontSize: "sm", mt: 1, ml: 6 }))));
120
119
  })) : (React.createElement(Flex, { w: "full", h: 80, align: "center", justify: "center", m: -5 }, "No search results"))));
121
120
  };
122
- const Search = pipe(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(SearchImpl);
121
+ const Search = flow(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(SearchImpl);
123
122
 
124
123
  /*! *****************************************************************************
125
124
  Copyright (c) Microsoft Corporation.
@@ -183,7 +182,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
183
182
  React__default.createElement(Icon, { icon: faExclamationTriangle, size: "4x" }),
184
183
  React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
185
184
 
186
- const appVersion = '1.4.4';
185
+ const appVersion = '1.4.8';
187
186
 
188
187
  class ResponseError extends Error {
189
188
  constructor(message, responseCode) {
@@ -297,7 +296,7 @@ const StoplightProjectImpl = ({ projectId, hideTryIt, hideMocking, hideExport, c
297
296
  elem = React.createElement(NotFound, null);
298
297
  }
299
298
  else {
300
- elem = (React.createElement(NodeContent, { node: node, Link: Link, hideTryIt: hideTryIt, hideMocking: hideMocking, hideExport: hideExport, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }));
299
+ elem = (React.createElement(NodeContent, { node: node, Link: ReactRouterMarkdownLink, hideTryIt: hideTryIt, hideMocking: hideMocking, hideExport: hideExport, tryItCredentialsPolicy: tryItCredentialsPolicy, tryItCorsProxy: tryItCorsProxy }));
301
300
  }
302
301
  const handleTocClick = () => {
303
302
  if (container.current) {
@@ -320,7 +319,7 @@ const StoplightProjectRouter = (_a) => {
320
319
  React.createElement(Route, { path: "/", exact: true },
321
320
  React.createElement(StoplightProjectImpl, Object.assign({}, props))))));
322
321
  };
323
- const StoplightProject = pipe(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(StoplightProjectRouter);
322
+ const StoplightProject = flow(withStyles, withPersistenceBoundary, withMosaicProvider, withQueryClientProvider)(StoplightProjectRouter);
324
323
 
325
324
  const getNodes = ({ workspaceId, branchSlug, projectIds, search, platformUrl = 'https://stoplight.io', platformAuthToken, }) => __awaiter(void 0, void 0, void 0, function* () {
326
325
  const queryParams = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-dev-portal",
3
- "version": "1.4.4",
3
+ "version": "1.4.8",
4
4
  "description": "UI components for composing beautiful developer documentation.",
5
5
  "keywords": [],
6
6
  "main": "./index.js",
@@ -27,9 +27,9 @@
27
27
  },
28
28
  "dependencies": {
29
29
  "@fortawesome/free-solid-svg-icons": "^5.10.2",
30
- "@stoplight/elements-core": "~7.3.7",
30
+ "@stoplight/elements-core": "~7.3.11",
31
31
  "@stoplight/markdown-viewer": "^5.3.2",
32
- "@stoplight/mosaic": "^1.8.2",
32
+ "@stoplight/mosaic": "^1.12.4",
33
33
  "@stoplight/path": "^1.3.2",
34
34
  "@stoplight/types": "^12.0.0",
35
35
  "classnames": "^2.2.6",