@stoplight/elements-core 7.16.1 → 7.16.3

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.
@@ -3,13 +3,14 @@ import * as React from 'react';
3
3
  import { DocsComponentProps } from '..';
4
4
  export declare type HttpOperationProps = DocsComponentProps<IHttpOperation>;
5
5
  export declare const HttpOperation: React.FunctionComponent<HttpOperationProps & import("@stoplight/react-error-boundary").ErrorBoundaryProps<{}>>;
6
- export declare function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, method, path, }: {
6
+ export declare function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, hideServerUrl, method, path, }: {
7
7
  id: string;
8
8
  noHeading?: boolean;
9
9
  hasBadges?: boolean;
10
10
  name?: string;
11
11
  isDeprecated?: boolean;
12
12
  isInternal?: boolean;
13
+ hideServerUrl?: boolean;
13
14
  method: string;
14
15
  path: string;
15
16
  }): JSX.Element | null;
package/index.esm.js CHANGED
@@ -2131,7 +2131,7 @@ const TryIt = ({ httpOperation, mockUrl, onRequestChange, requestBodyIndex, embe
2131
2131
  if (!exists) {
2132
2132
  setChosenServer(firstServer);
2133
2133
  }
2134
- else if (exists !== chosenServer) {
2134
+ else if (exists.id !== chosenServer.id) {
2135
2135
  setChosenServer(exists);
2136
2136
  }
2137
2137
  }, [servers, firstServer, chosenServer, setChosenServer]);
@@ -2690,7 +2690,7 @@ const Callback = ({ data, isCompact }) => {
2690
2690
  return (React.createElement(VStack, { spacing: 10 },
2691
2691
  React.createElement(Box, null,
2692
2692
  React.createElement(SectionSubtitle, { title: data.key, id: "callback-key" }),
2693
- React.createElement(OperationHeader, { id: data.id, method: data.method, path: `/${data.path}`, isDeprecated: isDeprecated, isInternal: isInternal })),
2693
+ React.createElement(OperationHeader, { id: data.id, method: data.method, path: data.path, isDeprecated: isDeprecated, isInternal: isInternal, hideServerUrl: true })),
2694
2694
  data.description && (React.createElement(Box, { pos: "relative" },
2695
2695
  React.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
2696
2696
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
@@ -2729,14 +2729,14 @@ HttpOperationComponent.displayName = 'HttpOperation.Component';
2729
2729
  const HttpOperation = withErrorBoundary(HttpOperationComponent, {
2730
2730
  recoverableProps: ['data'],
2731
2731
  });
2732
- function MethodPath({ method, path }) {
2732
+ function MethodPath({ method, path, hideServerUrl }) {
2733
2733
  const chosenServer = useAtomValue(chosenServerAtom);
2734
2734
  let chosenServerUrl = '';
2735
2735
  if (chosenServer) {
2736
2736
  chosenServerUrl = chosenServer.url.endsWith('/') ? chosenServer.url.slice(0, -1) : chosenServer.url;
2737
2737
  }
2738
2738
  return (React.createElement(Box, null,
2739
- React.createElement(MethodPathInner, { method: method, path: path, chosenServerUrl: chosenServerUrl })));
2739
+ React.createElement(MethodPathInner, { method: method, path: path, chosenServerUrl: hideServerUrl ? '' : chosenServerUrl })));
2740
2740
  }
2741
2741
  function MethodPathInner({ method, path, chosenServerUrl }) {
2742
2742
  const isDark = useThemeIsDark();
@@ -2749,7 +2749,7 @@ function MethodPathInner({ method, path, chosenServerUrl }) {
2749
2749
  React.createElement(Box, { py: 1, px: 2.5, rounded: "lg", bg: !isDark ? HttpMethodColors[method] : 'canvas-100', color: !isDark ? 'on-primary' : 'body', fontSize: "lg", fontWeight: "semibold", textTransform: "uppercase" }, method),
2750
2750
  pathElem));
2751
2751
  }
2752
- function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, method, path, }) {
2752
+ function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, hideServerUrl, method, path, }) {
2753
2753
  const { nodeHasChanged } = useOptionsCtx();
2754
2754
  if (noHeading && !hasBadges) {
2755
2755
  return null;
@@ -2765,7 +2765,7 @@ function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInter
2765
2765
  isInternal && React.createElement(InternalBadge, { isHttpService: true }))),
2766
2766
  React.createElement(NodeAnnotation, { change: lineOneChanged })),
2767
2767
  React.createElement(Box, { pos: "relative" },
2768
- React.createElement(MethodPath, { method: method, path: path }),
2768
+ React.createElement(MethodPath, { method: method, path: path, hideServerUrl: hideServerUrl }),
2769
2769
  React.createElement(NodeAnnotation, { change: lineTwoChanged }))));
2770
2770
  }
2771
2771
 
package/index.js CHANGED
@@ -2188,7 +2188,7 @@ const TryIt = ({ httpOperation, mockUrl, onRequestChange, requestBodyIndex, embe
2188
2188
  if (!exists) {
2189
2189
  setChosenServer(firstServer);
2190
2190
  }
2191
- else if (exists !== chosenServer) {
2191
+ else if (exists.id !== chosenServer.id) {
2192
2192
  setChosenServer(exists);
2193
2193
  }
2194
2194
  }, [servers, firstServer, chosenServer, setChosenServer]);
@@ -2747,7 +2747,7 @@ const Callback = ({ data, isCompact }) => {
2747
2747
  return (React__namespace.createElement(mosaic.VStack, { spacing: 10 },
2748
2748
  React__namespace.createElement(mosaic.Box, null,
2749
2749
  React__namespace.createElement(SectionSubtitle, { title: data.key, id: "callback-key" }),
2750
- React__namespace.createElement(OperationHeader, { id: data.id, method: data.method, path: `/${data.path}`, isDeprecated: isDeprecated, isInternal: isInternal })),
2750
+ React__namespace.createElement(OperationHeader, { id: data.id, method: data.method, path: data.path, isDeprecated: isDeprecated, isInternal: isInternal, hideServerUrl: true })),
2751
2751
  data.description && (React__namespace.createElement(mosaic.Box, { pos: "relative" },
2752
2752
  React__namespace.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
2753
2753
  React__namespace.createElement(mosaic.NodeAnnotation, { change: descriptionChanged }))),
@@ -2786,14 +2786,14 @@ HttpOperationComponent.displayName = 'HttpOperation.Component';
2786
2786
  const HttpOperation = reactErrorBoundary.withErrorBoundary(HttpOperationComponent, {
2787
2787
  recoverableProps: ['data'],
2788
2788
  });
2789
- function MethodPath({ method, path }) {
2789
+ function MethodPath({ method, path, hideServerUrl }) {
2790
2790
  const chosenServer = utils.useAtomValue(chosenServerAtom);
2791
2791
  let chosenServerUrl = '';
2792
2792
  if (chosenServer) {
2793
2793
  chosenServerUrl = chosenServer.url.endsWith('/') ? chosenServer.url.slice(0, -1) : chosenServer.url;
2794
2794
  }
2795
2795
  return (React__namespace.createElement(mosaic.Box, null,
2796
- React__namespace.createElement(MethodPathInner, { method: method, path: path, chosenServerUrl: chosenServerUrl })));
2796
+ React__namespace.createElement(MethodPathInner, { method: method, path: path, chosenServerUrl: hideServerUrl ? '' : chosenServerUrl })));
2797
2797
  }
2798
2798
  function MethodPathInner({ method, path, chosenServerUrl }) {
2799
2799
  const isDark = mosaic.useThemeIsDark();
@@ -2806,7 +2806,7 @@ function MethodPathInner({ method, path, chosenServerUrl }) {
2806
2806
  React__namespace.createElement(mosaic.Box, { py: 1, px: 2.5, rounded: "lg", bg: !isDark ? HttpMethodColors[method] : 'canvas-100', color: !isDark ? 'on-primary' : 'body', fontSize: "lg", fontWeight: "semibold", textTransform: "uppercase" }, method),
2807
2807
  pathElem));
2808
2808
  }
2809
- function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, method, path, }) {
2809
+ function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, hideServerUrl, method, path, }) {
2810
2810
  const { nodeHasChanged } = useOptionsCtx();
2811
2811
  if (noHeading && !hasBadges) {
2812
2812
  return null;
@@ -2822,7 +2822,7 @@ function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInter
2822
2822
  isInternal && React__namespace.createElement(InternalBadge, { isHttpService: true }))),
2823
2823
  React__namespace.createElement(mosaic.NodeAnnotation, { change: lineOneChanged })),
2824
2824
  React__namespace.createElement(mosaic.Box, { pos: "relative" },
2825
- React__namespace.createElement(MethodPath, { method: method, path: path }),
2825
+ React__namespace.createElement(MethodPath, { method: method, path: path, hideServerUrl: hideServerUrl }),
2826
2826
  React__namespace.createElement(mosaic.NodeAnnotation, { change: lineTwoChanged }))));
2827
2827
  }
2828
2828
 
package/index.mjs CHANGED
@@ -2131,7 +2131,7 @@ const TryIt = ({ httpOperation, mockUrl, onRequestChange, requestBodyIndex, embe
2131
2131
  if (!exists) {
2132
2132
  setChosenServer(firstServer);
2133
2133
  }
2134
- else if (exists !== chosenServer) {
2134
+ else if (exists.id !== chosenServer.id) {
2135
2135
  setChosenServer(exists);
2136
2136
  }
2137
2137
  }, [servers, firstServer, chosenServer, setChosenServer]);
@@ -2690,7 +2690,7 @@ const Callback = ({ data, isCompact }) => {
2690
2690
  return (React.createElement(VStack, { spacing: 10 },
2691
2691
  React.createElement(Box, null,
2692
2692
  React.createElement(SectionSubtitle, { title: data.key, id: "callback-key" }),
2693
- React.createElement(OperationHeader, { id: data.id, method: data.method, path: `/${data.path}`, isDeprecated: isDeprecated, isInternal: isInternal })),
2693
+ React.createElement(OperationHeader, { id: data.id, method: data.method, path: data.path, isDeprecated: isDeprecated, isInternal: isInternal, hideServerUrl: true })),
2694
2694
  data.description && (React.createElement(Box, { pos: "relative" },
2695
2695
  React.createElement(MarkdownViewer, { className: "HttpOperation__Description", markdown: data.description }),
2696
2696
  React.createElement(NodeAnnotation, { change: descriptionChanged }))),
@@ -2729,14 +2729,14 @@ HttpOperationComponent.displayName = 'HttpOperation.Component';
2729
2729
  const HttpOperation = withErrorBoundary(HttpOperationComponent, {
2730
2730
  recoverableProps: ['data'],
2731
2731
  });
2732
- function MethodPath({ method, path }) {
2732
+ function MethodPath({ method, path, hideServerUrl }) {
2733
2733
  const chosenServer = useAtomValue(chosenServerAtom);
2734
2734
  let chosenServerUrl = '';
2735
2735
  if (chosenServer) {
2736
2736
  chosenServerUrl = chosenServer.url.endsWith('/') ? chosenServer.url.slice(0, -1) : chosenServer.url;
2737
2737
  }
2738
2738
  return (React.createElement(Box, null,
2739
- React.createElement(MethodPathInner, { method: method, path: path, chosenServerUrl: chosenServerUrl })));
2739
+ React.createElement(MethodPathInner, { method: method, path: path, chosenServerUrl: hideServerUrl ? '' : chosenServerUrl })));
2740
2740
  }
2741
2741
  function MethodPathInner({ method, path, chosenServerUrl }) {
2742
2742
  const isDark = useThemeIsDark();
@@ -2749,7 +2749,7 @@ function MethodPathInner({ method, path, chosenServerUrl }) {
2749
2749
  React.createElement(Box, { py: 1, px: 2.5, rounded: "lg", bg: !isDark ? HttpMethodColors[method] : 'canvas-100', color: !isDark ? 'on-primary' : 'body', fontSize: "lg", fontWeight: "semibold", textTransform: "uppercase" }, method),
2750
2750
  pathElem));
2751
2751
  }
2752
- function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, method, path, }) {
2752
+ function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInternal, hideServerUrl, method, path, }) {
2753
2753
  const { nodeHasChanged } = useOptionsCtx();
2754
2754
  if (noHeading && !hasBadges) {
2755
2755
  return null;
@@ -2765,7 +2765,7 @@ function OperationHeader({ id, noHeading, hasBadges, name, isDeprecated, isInter
2765
2765
  isInternal && React.createElement(InternalBadge, { isHttpService: true }))),
2766
2766
  React.createElement(NodeAnnotation, { change: lineOneChanged })),
2767
2767
  React.createElement(Box, { pos: "relative" },
2768
- React.createElement(MethodPath, { method: method, path: path }),
2768
+ React.createElement(MethodPath, { method: method, path: path, hideServerUrl: hideServerUrl }),
2769
2769
  React.createElement(NodeAnnotation, { change: lineTwoChanged }))));
2770
2770
  }
2771
2771
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "7.16.1",
3
+ "version": "7.16.3",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",