@stoplight/elements-core 7.7.14 → 7.7.15
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/components/Docs/Article/Article.spec.d.ts +1 -0
- package/index.esm.js +15 -5
- package/index.js +14 -4
- package/index.mjs +15 -5
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest, __awaiter } from 'tslib';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useContext, useMemo } from 'react';
|
|
4
4
|
import { convertToJsonSchema } from '@stoplight/http-spec/oas';
|
|
@@ -256,12 +256,22 @@ const MarkdownViewer = (props) => {
|
|
|
256
256
|
};
|
|
257
257
|
MarkdownViewer.displayName = 'MarkdownViewer';
|
|
258
258
|
|
|
259
|
-
const
|
|
259
|
+
const ArticleComponentForHashRouter = React.memo(({ data }) => {
|
|
260
260
|
const { pathname } = useLocation();
|
|
261
|
-
const
|
|
262
|
-
|
|
261
|
+
const basePath = `#${pathname.split('#')[0]}`;
|
|
262
|
+
return React.createElement(BaseArticleComponent, { data: data, tocBasePath: basePath });
|
|
263
|
+
});
|
|
264
|
+
const BaseArticleComponent = React.memo((_a) => {
|
|
265
|
+
var { data } = _a, props = __rest(_a, ["data"]);
|
|
263
266
|
return (React.createElement(Box, { className: "sl-elements-article" },
|
|
264
|
-
React.createElement(MarkdownViewer, { className: "sl-elements-article-content", markdown: data, includeToc: true,
|
|
267
|
+
React.createElement(MarkdownViewer, Object.assign({ className: "sl-elements-article-content", markdown: data, includeToc: true }, props))));
|
|
268
|
+
});
|
|
269
|
+
const ArticleComponent = React.memo(({ data }) => {
|
|
270
|
+
const routerKind = useRouterType();
|
|
271
|
+
if (routerKind === 'hash') {
|
|
272
|
+
return React.createElement(ArticleComponentForHashRouter, { data: data });
|
|
273
|
+
}
|
|
274
|
+
return React.createElement(BaseArticleComponent, { data: data });
|
|
265
275
|
});
|
|
266
276
|
const Article = withErrorBoundary(ArticleComponent, { recoverableProps: ['data'] });
|
|
267
277
|
|
package/index.js
CHANGED
|
@@ -309,12 +309,22 @@ const MarkdownViewer = (props) => {
|
|
|
309
309
|
};
|
|
310
310
|
MarkdownViewer.displayName = 'MarkdownViewer';
|
|
311
311
|
|
|
312
|
-
const
|
|
312
|
+
const ArticleComponentForHashRouter = React__namespace.memo(({ data }) => {
|
|
313
313
|
const { pathname } = reactRouterDom.useLocation();
|
|
314
|
-
const
|
|
315
|
-
|
|
314
|
+
const basePath = `#${pathname.split('#')[0]}`;
|
|
315
|
+
return React__namespace.createElement(BaseArticleComponent, { data: data, tocBasePath: basePath });
|
|
316
|
+
});
|
|
317
|
+
const BaseArticleComponent = React__namespace.memo((_a) => {
|
|
318
|
+
var { data } = _a, props = tslib.__rest(_a, ["data"]);
|
|
316
319
|
return (React__namespace.createElement(mosaic.Box, { className: "sl-elements-article" },
|
|
317
|
-
React__namespace.createElement(MarkdownViewer, { className: "sl-elements-article-content", markdown: data, includeToc: true,
|
|
320
|
+
React__namespace.createElement(MarkdownViewer, Object.assign({ className: "sl-elements-article-content", markdown: data, includeToc: true }, props))));
|
|
321
|
+
});
|
|
322
|
+
const ArticleComponent = React__namespace.memo(({ data }) => {
|
|
323
|
+
const routerKind = useRouterType();
|
|
324
|
+
if (routerKind === 'hash') {
|
|
325
|
+
return React__namespace.createElement(ArticleComponentForHashRouter, { data: data });
|
|
326
|
+
}
|
|
327
|
+
return React__namespace.createElement(BaseArticleComponent, { data: data });
|
|
318
328
|
});
|
|
319
329
|
const Article = reactErrorBoundary.withErrorBoundary(ArticleComponent, { recoverableProps: ['data'] });
|
|
320
330
|
|
package/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __rest, __awaiter } from 'tslib';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default, { useContext, useMemo } from 'react';
|
|
4
4
|
import { convertToJsonSchema } from '@stoplight/http-spec/oas';
|
|
@@ -256,12 +256,22 @@ const MarkdownViewer = (props) => {
|
|
|
256
256
|
};
|
|
257
257
|
MarkdownViewer.displayName = 'MarkdownViewer';
|
|
258
258
|
|
|
259
|
-
const
|
|
259
|
+
const ArticleComponentForHashRouter = React.memo(({ data }) => {
|
|
260
260
|
const { pathname } = useLocation();
|
|
261
|
-
const
|
|
262
|
-
|
|
261
|
+
const basePath = `#${pathname.split('#')[0]}`;
|
|
262
|
+
return React.createElement(BaseArticleComponent, { data: data, tocBasePath: basePath });
|
|
263
|
+
});
|
|
264
|
+
const BaseArticleComponent = React.memo((_a) => {
|
|
265
|
+
var { data } = _a, props = __rest(_a, ["data"]);
|
|
263
266
|
return (React.createElement(Box, { className: "sl-elements-article" },
|
|
264
|
-
React.createElement(MarkdownViewer, { className: "sl-elements-article-content", markdown: data, includeToc: true,
|
|
267
|
+
React.createElement(MarkdownViewer, Object.assign({ className: "sl-elements-article-content", markdown: data, includeToc: true }, props))));
|
|
268
|
+
});
|
|
269
|
+
const ArticleComponent = React.memo(({ data }) => {
|
|
270
|
+
const routerKind = useRouterType();
|
|
271
|
+
if (routerKind === 'hash') {
|
|
272
|
+
return React.createElement(ArticleComponentForHashRouter, { data: data });
|
|
273
|
+
}
|
|
274
|
+
return React.createElement(BaseArticleComponent, { data: data });
|
|
265
275
|
});
|
|
266
276
|
const Article = withErrorBoundary(ArticleComponent, { recoverableProps: ['data'] });
|
|
267
277
|
|