@stoplight/elements-dev-portal 3.0.6 → 3.0.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 +10 -9
- package/index.js +10 -9
- package/index.mjs +10 -9
- package/package.json +2 -2
- package/types.d.ts +0 -1
- package/version.d.ts +1 -1
- package/web-components.min.js +1 -1
package/index.esm.js
CHANGED
|
@@ -100,7 +100,7 @@ const NodeContent = ({ node, Link, hideMocking, refResolver, maxRefDepth, tryItC
|
|
|
100
100
|
},
|
|
101
101
|
} },
|
|
102
102
|
React.createElement(MockingProvider, { mockUrl: node.links.mock_url, hideMocking: hideMocking },
|
|
103
|
-
React.createElement(Docs, { nodeType: node.type, nodeData: node.data,
|
|
103
|
+
React.createElement(Docs, { nodeType: node.type, nodeData: node.data, nodeTitle: node.title, layoutOptions: {
|
|
104
104
|
compact,
|
|
105
105
|
hideTryIt: hideTryIt,
|
|
106
106
|
hideTryItPanel: hideTryItPanel,
|
|
@@ -124,6 +124,7 @@ const NodeContent = ({ node, Link, hideMocking, refResolver, maxRefDepth, tryItC
|
|
|
124
124
|
const NodeLinkContext = React.createContext(undefined);
|
|
125
125
|
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
126
126
|
const LinkComponent = ({ children, href, title }) => {
|
|
127
|
+
console.log('LinkComponent href-----', href);
|
|
127
128
|
const ctx = React.useContext(NodeLinkContext);
|
|
128
129
|
const routerKind = React.useContext(RouterTypeContext);
|
|
129
130
|
const { pathname } = useLocation();
|
|
@@ -143,6 +144,7 @@ const LinkComponent = ({ children, href, title }) => {
|
|
|
143
144
|
}
|
|
144
145
|
if (href && ctx) {
|
|
145
146
|
const [node, Link] = ctx;
|
|
147
|
+
console.log('LinkComponent node-----', node);
|
|
146
148
|
const { fileUri } = getNodeUriParts(node.uri);
|
|
147
149
|
const { fileUri: hrefFileUri } = getNodeUriParts(href);
|
|
148
150
|
let resolvedUri;
|
|
@@ -292,7 +294,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
|
|
|
292
294
|
React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
|
|
293
295
|
React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
294
296
|
|
|
295
|
-
const appVersion = '3.0.
|
|
297
|
+
const appVersion = '3.0.8';
|
|
296
298
|
|
|
297
299
|
class ResponseError extends Error {
|
|
298
300
|
constructor(message, responseCode) {
|
|
@@ -364,17 +366,17 @@ const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stop
|
|
|
364
366
|
|
|
365
367
|
function useGetTableOfContents({ projectId, branchSlug }) {
|
|
366
368
|
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
367
|
-
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId ? true : false });
|
|
369
|
+
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId && projectId !== 'cHJqOjA' ? true : false });
|
|
368
370
|
}
|
|
369
371
|
|
|
370
372
|
const StoplightProjectImpl = ({ projectId, collapseTableOfContents = false }) => {
|
|
371
|
-
const { branchSlug: encodedBranchSlug = '', nodeSlug = '' } = useParams();
|
|
373
|
+
const { branchSlug: encodedBranchSlug = '', '*': nodeSlug = '' } = useParams();
|
|
372
374
|
const branchSlug = decodeURIComponent(encodedBranchSlug);
|
|
373
375
|
const navigate = useNavigate();
|
|
374
376
|
const { data: tableOfContents, isFetched: isTocFetched } = useGetTableOfContents({ projectId, branchSlug });
|
|
375
377
|
const { data: branches } = useGetBranches({ projectId });
|
|
376
378
|
const { data: node, isLoading: isLoadingNode, isError, error: nodeError, } = useGetNodeContent({
|
|
377
|
-
nodeSlug,
|
|
379
|
+
nodeSlug: nodeSlug !== null && nodeSlug !== void 0 ? nodeSlug : '',
|
|
378
380
|
projectId,
|
|
379
381
|
branchSlug,
|
|
380
382
|
});
|
|
@@ -399,7 +401,7 @@ const StoplightProjectImpl = ({ projectId, collapseTableOfContents = false }) =>
|
|
|
399
401
|
React.createElement(Outlet, { context: [isLoadingNode, isTocFetched, isError, nodeError, node] })));
|
|
400
402
|
};
|
|
401
403
|
const ProjectNode = ({ hideTryIt, hideSecurityInfo, hideServerInfo, hideMocking, hideExport, tryItCredentialsPolicy, tryItCorsProxy, }) => {
|
|
402
|
-
const { branchSlug: encodedBranchSlug = '', nodeSlug = '' } = useParams();
|
|
404
|
+
const { branchSlug: encodedBranchSlug = '', '*': nodeSlug = '' } = useParams();
|
|
403
405
|
const branchSlug = decodeURIComponent(encodedBranchSlug);
|
|
404
406
|
const [isLoadingNode, isTocFetched, isError, nodeError, node] = useOutletContext();
|
|
405
407
|
if (isLoadingNode || !isTocFetched) {
|
|
@@ -437,9 +439,8 @@ const StoplightProjectRouter = (_a) => {
|
|
|
437
439
|
const outerRouter = useInRouterContext();
|
|
438
440
|
const InternalRoutes = () => (React.createElement(Routes, null,
|
|
439
441
|
React.createElement(Route, { path: "/", element: React.createElement(StoplightProjectImpl, Object.assign({}, props)) },
|
|
440
|
-
React.createElement(Route, { path: "/branches/:branchSlug
|
|
441
|
-
React.createElement(Route, { path: "
|
|
442
|
-
React.createElement(Route, { element: React.createElement(ProjectNode, Object.assign({}, props)) }))));
|
|
442
|
+
React.createElement(Route, { path: "/branches/:branchSlug/*", element: React.createElement(ProjectNode, Object.assign({}, props)) }),
|
|
443
|
+
React.createElement(Route, { path: "/*", element: React.createElement(ProjectNode, Object.assign({}, props)) }))));
|
|
443
444
|
if (!outerRouter) {
|
|
444
445
|
return (React.createElement(DevPortalProvider, { platformUrl: platformUrl },
|
|
445
446
|
React.createElement(RouterTypeContext.Provider, { value: router },
|
package/index.js
CHANGED
|
@@ -120,7 +120,7 @@ const NodeContent = ({ node, Link, hideMocking, refResolver, maxRefDepth, tryItC
|
|
|
120
120
|
},
|
|
121
121
|
} },
|
|
122
122
|
React__namespace.createElement(elementsCore.MockingProvider, { mockUrl: node.links.mock_url, hideMocking: hideMocking },
|
|
123
|
-
React__namespace.createElement(elementsCore.Docs, { nodeType: node.type, nodeData: node.data,
|
|
123
|
+
React__namespace.createElement(elementsCore.Docs, { nodeType: node.type, nodeData: node.data, nodeTitle: node.title, layoutOptions: {
|
|
124
124
|
compact,
|
|
125
125
|
hideTryIt: hideTryIt,
|
|
126
126
|
hideTryItPanel: hideTryItPanel,
|
|
@@ -144,6 +144,7 @@ const NodeContent = ({ node, Link, hideMocking, refResolver, maxRefDepth, tryItC
|
|
|
144
144
|
const NodeLinkContext = React__namespace.createContext(undefined);
|
|
145
145
|
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
146
146
|
const LinkComponent = ({ children, href, title }) => {
|
|
147
|
+
console.log('LinkComponent href-----', href);
|
|
147
148
|
const ctx = React__namespace.useContext(NodeLinkContext);
|
|
148
149
|
const routerKind = React__namespace.useContext(elementsCore.RouterTypeContext);
|
|
149
150
|
const { pathname } = reactRouterDom.useLocation();
|
|
@@ -163,6 +164,7 @@ const LinkComponent = ({ children, href, title }) => {
|
|
|
163
164
|
}
|
|
164
165
|
if (href && ctx) {
|
|
165
166
|
const [node, Link] = ctx;
|
|
167
|
+
console.log('LinkComponent node-----', node);
|
|
166
168
|
const { fileUri } = getNodeUriParts(node.uri);
|
|
167
169
|
const { fileUri: hrefFileUri } = getNodeUriParts(href);
|
|
168
170
|
let resolvedUri;
|
|
@@ -312,7 +314,7 @@ const UpgradeToStarter = () => (React.createElement(mosaic.Flex, { as: "a", href
|
|
|
312
314
|
React.createElement(mosaic.Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
|
|
313
315
|
React.createElement(mosaic.Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
314
316
|
|
|
315
|
-
const appVersion = '3.0.
|
|
317
|
+
const appVersion = '3.0.8';
|
|
316
318
|
|
|
317
319
|
class ResponseError extends Error {
|
|
318
320
|
constructor(message, responseCode) {
|
|
@@ -384,17 +386,17 @@ const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stop
|
|
|
384
386
|
|
|
385
387
|
function useGetTableOfContents({ projectId, branchSlug }) {
|
|
386
388
|
const { platformUrl, platformAuthToken, isLoggedIn } = React__namespace.useContext(PlatformContext);
|
|
387
|
-
return reactQuery.useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId ? true : false });
|
|
389
|
+
return reactQuery.useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId && projectId !== 'cHJqOjA' ? true : false });
|
|
388
390
|
}
|
|
389
391
|
|
|
390
392
|
const StoplightProjectImpl = ({ projectId, collapseTableOfContents = false }) => {
|
|
391
|
-
const { branchSlug: encodedBranchSlug = '', nodeSlug = '' } = reactRouterDom.useParams();
|
|
393
|
+
const { branchSlug: encodedBranchSlug = '', '*': nodeSlug = '' } = reactRouterDom.useParams();
|
|
392
394
|
const branchSlug = decodeURIComponent(encodedBranchSlug);
|
|
393
395
|
const navigate = reactRouterDom.useNavigate();
|
|
394
396
|
const { data: tableOfContents, isFetched: isTocFetched } = useGetTableOfContents({ projectId, branchSlug });
|
|
395
397
|
const { data: branches } = useGetBranches({ projectId });
|
|
396
398
|
const { data: node, isLoading: isLoadingNode, isError, error: nodeError, } = useGetNodeContent({
|
|
397
|
-
nodeSlug,
|
|
399
|
+
nodeSlug: nodeSlug !== null && nodeSlug !== void 0 ? nodeSlug : '',
|
|
398
400
|
projectId,
|
|
399
401
|
branchSlug,
|
|
400
402
|
});
|
|
@@ -419,7 +421,7 @@ const StoplightProjectImpl = ({ projectId, collapseTableOfContents = false }) =>
|
|
|
419
421
|
React__namespace.createElement(reactRouterDom.Outlet, { context: [isLoadingNode, isTocFetched, isError, nodeError, node] })));
|
|
420
422
|
};
|
|
421
423
|
const ProjectNode = ({ hideTryIt, hideSecurityInfo, hideServerInfo, hideMocking, hideExport, tryItCredentialsPolicy, tryItCorsProxy, }) => {
|
|
422
|
-
const { branchSlug: encodedBranchSlug = '', nodeSlug = '' } = reactRouterDom.useParams();
|
|
424
|
+
const { branchSlug: encodedBranchSlug = '', '*': nodeSlug = '' } = reactRouterDom.useParams();
|
|
423
425
|
const branchSlug = decodeURIComponent(encodedBranchSlug);
|
|
424
426
|
const [isLoadingNode, isTocFetched, isError, nodeError, node] = reactRouterDom.useOutletContext();
|
|
425
427
|
if (isLoadingNode || !isTocFetched) {
|
|
@@ -457,9 +459,8 @@ const StoplightProjectRouter = (_a) => {
|
|
|
457
459
|
const outerRouter = reactRouterDom.useInRouterContext();
|
|
458
460
|
const InternalRoutes = () => (React__namespace.createElement(reactRouterDom.Routes, null,
|
|
459
461
|
React__namespace.createElement(reactRouterDom.Route, { path: "/", element: React__namespace.createElement(StoplightProjectImpl, Object.assign({}, props)) },
|
|
460
|
-
React__namespace.createElement(reactRouterDom.Route, { path: "/branches/:branchSlug
|
|
461
|
-
React__namespace.createElement(reactRouterDom.Route, { path: "
|
|
462
|
-
React__namespace.createElement(reactRouterDom.Route, { element: React__namespace.createElement(ProjectNode, Object.assign({}, props)) }))));
|
|
462
|
+
React__namespace.createElement(reactRouterDom.Route, { path: "/branches/:branchSlug/*", element: React__namespace.createElement(ProjectNode, Object.assign({}, props)) }),
|
|
463
|
+
React__namespace.createElement(reactRouterDom.Route, { path: "/*", element: React__namespace.createElement(ProjectNode, Object.assign({}, props)) }))));
|
|
463
464
|
if (!outerRouter) {
|
|
464
465
|
return (React__namespace.createElement(DevPortalProvider, { platformUrl: platformUrl },
|
|
465
466
|
React__namespace.createElement(elementsCore.RouterTypeContext.Provider, { value: router },
|
package/index.mjs
CHANGED
|
@@ -100,7 +100,7 @@ const NodeContent = ({ node, Link, hideMocking, refResolver, maxRefDepth, tryItC
|
|
|
100
100
|
},
|
|
101
101
|
} },
|
|
102
102
|
React.createElement(MockingProvider, { mockUrl: node.links.mock_url, hideMocking: hideMocking },
|
|
103
|
-
React.createElement(Docs, { nodeType: node.type, nodeData: node.data,
|
|
103
|
+
React.createElement(Docs, { nodeType: node.type, nodeData: node.data, nodeTitle: node.title, layoutOptions: {
|
|
104
104
|
compact,
|
|
105
105
|
hideTryIt: hideTryIt,
|
|
106
106
|
hideTryItPanel: hideTryItPanel,
|
|
@@ -124,6 +124,7 @@ const NodeContent = ({ node, Link, hideMocking, refResolver, maxRefDepth, tryItC
|
|
|
124
124
|
const NodeLinkContext = React.createContext(undefined);
|
|
125
125
|
const externalRegex = new RegExp('^(?:[a-z]+:)?//', 'i');
|
|
126
126
|
const LinkComponent = ({ children, href, title }) => {
|
|
127
|
+
console.log('LinkComponent href-----', href);
|
|
127
128
|
const ctx = React.useContext(NodeLinkContext);
|
|
128
129
|
const routerKind = React.useContext(RouterTypeContext);
|
|
129
130
|
const { pathname } = useLocation();
|
|
@@ -143,6 +144,7 @@ const LinkComponent = ({ children, href, title }) => {
|
|
|
143
144
|
}
|
|
144
145
|
if (href && ctx) {
|
|
145
146
|
const [node, Link] = ctx;
|
|
147
|
+
console.log('LinkComponent node-----', node);
|
|
146
148
|
const { fileUri } = getNodeUriParts(node.uri);
|
|
147
149
|
const { fileUri: hrefFileUri } = getNodeUriParts(href);
|
|
148
150
|
let resolvedUri;
|
|
@@ -292,7 +294,7 @@ const UpgradeToStarter = () => (React__default.createElement(Flex, { as: "a", hr
|
|
|
292
294
|
React__default.createElement(Icon, { icon: ['fas', 'exclamation-triangle'], size: "4x" }),
|
|
293
295
|
React__default.createElement(Box, { pt: 3 }, "Please upgrade your Stoplight Workspace to the Starter Plan to use Elements Dev Portal in production.")));
|
|
294
296
|
|
|
295
|
-
const appVersion = '3.0.
|
|
297
|
+
const appVersion = '3.0.8';
|
|
296
298
|
|
|
297
299
|
class ResponseError extends Error {
|
|
298
300
|
constructor(message, responseCode) {
|
|
@@ -364,17 +366,17 @@ const getTableOfContents = ({ projectId, branchSlug, platformUrl = 'https://stop
|
|
|
364
366
|
|
|
365
367
|
function useGetTableOfContents({ projectId, branchSlug }) {
|
|
366
368
|
const { platformUrl, platformAuthToken, isLoggedIn } = React.useContext(PlatformContext);
|
|
367
|
-
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId ? true : false });
|
|
369
|
+
return useQuery([...devPortalCacheKeys.branchTOC(projectId, branchSlug !== null && branchSlug !== void 0 ? branchSlug : ''), platformUrl, isLoggedIn], () => getTableOfContents({ projectId, branchSlug, platformUrl, platformAuthToken }), { enabled: projectId && projectId !== 'cHJqOjA' ? true : false });
|
|
368
370
|
}
|
|
369
371
|
|
|
370
372
|
const StoplightProjectImpl = ({ projectId, collapseTableOfContents = false }) => {
|
|
371
|
-
const { branchSlug: encodedBranchSlug = '', nodeSlug = '' } = useParams();
|
|
373
|
+
const { branchSlug: encodedBranchSlug = '', '*': nodeSlug = '' } = useParams();
|
|
372
374
|
const branchSlug = decodeURIComponent(encodedBranchSlug);
|
|
373
375
|
const navigate = useNavigate();
|
|
374
376
|
const { data: tableOfContents, isFetched: isTocFetched } = useGetTableOfContents({ projectId, branchSlug });
|
|
375
377
|
const { data: branches } = useGetBranches({ projectId });
|
|
376
378
|
const { data: node, isLoading: isLoadingNode, isError, error: nodeError, } = useGetNodeContent({
|
|
377
|
-
nodeSlug,
|
|
379
|
+
nodeSlug: nodeSlug !== null && nodeSlug !== void 0 ? nodeSlug : '',
|
|
378
380
|
projectId,
|
|
379
381
|
branchSlug,
|
|
380
382
|
});
|
|
@@ -399,7 +401,7 @@ const StoplightProjectImpl = ({ projectId, collapseTableOfContents = false }) =>
|
|
|
399
401
|
React.createElement(Outlet, { context: [isLoadingNode, isTocFetched, isError, nodeError, node] })));
|
|
400
402
|
};
|
|
401
403
|
const ProjectNode = ({ hideTryIt, hideSecurityInfo, hideServerInfo, hideMocking, hideExport, tryItCredentialsPolicy, tryItCorsProxy, }) => {
|
|
402
|
-
const { branchSlug: encodedBranchSlug = '', nodeSlug = '' } = useParams();
|
|
404
|
+
const { branchSlug: encodedBranchSlug = '', '*': nodeSlug = '' } = useParams();
|
|
403
405
|
const branchSlug = decodeURIComponent(encodedBranchSlug);
|
|
404
406
|
const [isLoadingNode, isTocFetched, isError, nodeError, node] = useOutletContext();
|
|
405
407
|
if (isLoadingNode || !isTocFetched) {
|
|
@@ -437,9 +439,8 @@ const StoplightProjectRouter = (_a) => {
|
|
|
437
439
|
const outerRouter = useInRouterContext();
|
|
438
440
|
const InternalRoutes = () => (React.createElement(Routes, null,
|
|
439
441
|
React.createElement(Route, { path: "/", element: React.createElement(StoplightProjectImpl, Object.assign({}, props)) },
|
|
440
|
-
React.createElement(Route, { path: "/branches/:branchSlug
|
|
441
|
-
React.createElement(Route, { path: "
|
|
442
|
-
React.createElement(Route, { element: React.createElement(ProjectNode, Object.assign({}, props)) }))));
|
|
442
|
+
React.createElement(Route, { path: "/branches/:branchSlug/*", element: React.createElement(ProjectNode, Object.assign({}, props)) }),
|
|
443
|
+
React.createElement(Route, { path: "/*", element: React.createElement(ProjectNode, Object.assign({}, props)) }))));
|
|
443
444
|
if (!outerRouter) {
|
|
444
445
|
return (React.createElement(DevPortalProvider, { platformUrl: platformUrl },
|
|
445
446
|
React.createElement(RouterTypeContext.Provider, { value: router },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements-dev-portal",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.8",
|
|
4
4
|
"description": "UI components for composing beautiful developer documentation.",
|
|
5
5
|
"keywords": [],
|
|
6
6
|
"main": "./index.js",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"react-dom": ">=16.8"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@stoplight/elements-core": "~9.0.
|
|
29
|
+
"@stoplight/elements-core": "~9.0.8",
|
|
30
30
|
"@stoplight/markdown-viewer": "^5.7.1",
|
|
31
31
|
"@stoplight/mosaic": "^1.53.4",
|
|
32
32
|
"@stoplight/path": "^1.3.2",
|
package/types.d.ts
CHANGED
package/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const appVersion = "3.0.
|
|
1
|
+
export declare const appVersion = "3.0.8";
|