@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.
@@ -0,0 +1 @@
1
+ export {};
package/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- import { __awaiter, __rest } from 'tslib';
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 ArticleComponent = React.memo(({ data }) => {
259
+ const ArticleComponentForHashRouter = React.memo(({ data }) => {
260
260
  const { pathname } = useLocation();
261
- const routerKind = React.useContext(RouterTypeContext);
262
- const basePath = routerKind === 'hash' ? `#${pathname.split('#')[0]}` : '';
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, tocBasePath: basePath })));
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 ArticleComponent = React__namespace.memo(({ data }) => {
312
+ const ArticleComponentForHashRouter = React__namespace.memo(({ data }) => {
313
313
  const { pathname } = reactRouterDom.useLocation();
314
- const routerKind = React__namespace.useContext(RouterTypeContext);
315
- const basePath = routerKind === 'hash' ? `#${pathname.split('#')[0]}` : '';
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, tocBasePath: basePath })));
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 { __awaiter, __rest } from 'tslib';
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 ArticleComponent = React.memo(({ data }) => {
259
+ const ArticleComponentForHashRouter = React.memo(({ data }) => {
260
260
  const { pathname } = useLocation();
261
- const routerKind = React.useContext(RouterTypeContext);
262
- const basePath = routerKind === 'hash' ? `#${pathname.split('#')[0]}` : '';
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, tocBasePath: basePath })));
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "7.7.14",
3
+ "version": "7.7.15",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",