@stoplight/elements-core 8.4.0 → 8.4.1

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,8 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { AdditionalInfo } from './AdditionalInfo';
3
+ declare const meta: Meta<typeof AdditionalInfo>;
4
+ export default meta;
5
+ declare type Story = StoryObj<typeof AdditionalInfo>;
6
+ export declare const LicenseNameAndURL: Story;
7
+ export declare const LicenseNameAndIdentifier: Story;
8
+ export declare const LicenseIdentifierAndNameAndUrl: Story;
package/index.esm.js CHANGED
@@ -2158,7 +2158,7 @@ const TryItResponse = ({ response }) => {
2158
2158
  response.bodyText && responseType && ['json', 'xml', 'text'].includes(responseType) ? (React.createElement(ResponseCodeViewer, { language: "json", value: responseType && bodyFormat === 'preview'
2159
2159
  ? parseBody(response.bodyText, responseType)
2160
2160
  : response.bodyText })) : response.blob && responseType === 'image' ? (React.createElement(Flex, { justifyContent: "center" },
2161
- React.createElement(Image, { src: URL.createObjectURL(response.blob), alt: "response image" }))) : (React.createElement("p", null,
2161
+ React.createElement(Image, { src: URL.createObjectURL(response.blob), alt: "response image" }))) : !response.bodyText ? null : (React.createElement("p", null,
2162
2162
  React.createElement(Box, { as: Icon, icon: ['fas', 'exclamation-circle'], mr: 2 }),
2163
2163
  "No supported response body returned"))))));
2164
2164
  };
@@ -2945,9 +2945,9 @@ function MethodPathInner({ method, path, chosenServerUrl }) {
2945
2945
  const isDark = useThemeIsDark();
2946
2946
  const fullUrl = `${chosenServerUrl}${path}`;
2947
2947
  const pathElem = (React.createElement(Flex, { overflowX: "hidden", fontSize: "lg", userSelect: "all" },
2948
- React.createElement(Box, { dir: "rtl", color: "muted", textOverflow: "truncate", overflowX: "hidden" },
2949
- React.createElement(Box, { as: "span", dir: "ltr", style: { unicodeBidi: 'bidi-override' } }, chosenServerUrl)),
2950
- React.createElement(Box, { fontWeight: "semibold", flex: 1 }, path)));
2948
+ React.createElement(Box, { dir: "rtl", textOverflow: "truncate", overflowX: "hidden" },
2949
+ React.createElement(Box, { as: "span", color: "muted", dir: "ltr", style: { unicodeBidi: 'bidi-override' } }, chosenServerUrl),
2950
+ React.createElement(Box, { as: "span", fontWeight: "semibold", flex: 1 }, path))));
2951
2951
  return (React.createElement(HStack, { spacing: 3, pl: 2.5, pr: 4, py: 2, bg: "canvas-50", rounded: "lg", fontFamily: "mono", display: "inline-flex", maxW: "full", title: fullUrl },
2952
2952
  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),
2953
2953
  pathElem));
@@ -2988,8 +2988,12 @@ const AdditionalInfo = ({ id, termsOfService, contact, license }) => {
2988
2988
  : (contact === null || contact === void 0 ? void 0 : contact.email)
2989
2989
  ? `[Contact ${contact.name || contact.email}](mailto:${contact.email})`
2990
2990
  : '';
2991
- const licenseUrl = (license === null || license === void 0 ? void 0 : license.url) || `https://spdx.org/licenses/${license === null || license === void 0 ? void 0 : license.identifier}.html`;
2992
- const licenseLink = (license === null || license === void 0 ? void 0 : license.name) && licenseUrl ? `[${license.name} License](${licenseUrl})` : '';
2991
+ const licenseUrl = (license === null || license === void 0 ? void 0 : license.url) || (license === null || license === void 0 ? void 0 : license.identifier) ? `https://spdx.org/licenses/${license === null || license === void 0 ? void 0 : license.identifier}.html` : undefined;
2992
+ const licenseLink = (license === null || license === void 0 ? void 0 : license.name) && licenseUrl
2993
+ ? `[${license.name}](${licenseUrl})`
2994
+ : (license === null || license === void 0 ? void 0 : license.identifier) && licenseUrl
2995
+ ? `[${license === null || license === void 0 ? void 0 : license.identifier}](${licenseUrl})`
2996
+ : undefined;
2993
2997
  const tosLink = termsOfService ? `[Terms of Service](${termsOfService})` : '';
2994
2998
  return contactLink || licenseLink || tosLink ? (React__default.createElement(Panel, { rounded: true, isCollapsible: false, pos: "relative" },
2995
2999
  React__default.createElement(Panel.Titlebar, { bg: "canvas-300" },
package/index.js CHANGED
@@ -2180,7 +2180,7 @@ const TryItResponse = ({ response }) => {
2180
2180
  response.bodyText && responseType && ['json', 'xml', 'text'].includes(responseType) ? (React__namespace.createElement(ResponseCodeViewer, { language: "json", value: responseType && bodyFormat === 'preview'
2181
2181
  ? parseBody(response.bodyText, responseType)
2182
2182
  : response.bodyText })) : response.blob && responseType === 'image' ? (React__namespace.createElement(mosaic.Flex, { justifyContent: "center" },
2183
- React__namespace.createElement(mosaic.Image, { src: URL.createObjectURL(response.blob), alt: "response image" }))) : (React__namespace.createElement("p", null,
2183
+ React__namespace.createElement(mosaic.Image, { src: URL.createObjectURL(response.blob), alt: "response image" }))) : !response.bodyText ? null : (React__namespace.createElement("p", null,
2184
2184
  React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, icon: ['fas', 'exclamation-circle'], mr: 2 }),
2185
2185
  "No supported response body returned"))))));
2186
2186
  };
@@ -2967,9 +2967,9 @@ function MethodPathInner({ method, path, chosenServerUrl }) {
2967
2967
  const isDark = mosaic.useThemeIsDark();
2968
2968
  const fullUrl = `${chosenServerUrl}${path}`;
2969
2969
  const pathElem = (React__namespace.createElement(mosaic.Flex, { overflowX: "hidden", fontSize: "lg", userSelect: "all" },
2970
- React__namespace.createElement(mosaic.Box, { dir: "rtl", color: "muted", textOverflow: "truncate", overflowX: "hidden" },
2971
- React__namespace.createElement(mosaic.Box, { as: "span", dir: "ltr", style: { unicodeBidi: 'bidi-override' } }, chosenServerUrl)),
2972
- React__namespace.createElement(mosaic.Box, { fontWeight: "semibold", flex: 1 }, path)));
2970
+ React__namespace.createElement(mosaic.Box, { dir: "rtl", textOverflow: "truncate", overflowX: "hidden" },
2971
+ React__namespace.createElement(mosaic.Box, { as: "span", color: "muted", dir: "ltr", style: { unicodeBidi: 'bidi-override' } }, chosenServerUrl),
2972
+ React__namespace.createElement(mosaic.Box, { as: "span", fontWeight: "semibold", flex: 1 }, path))));
2973
2973
  return (React__namespace.createElement(mosaic.HStack, { spacing: 3, pl: 2.5, pr: 4, py: 2, bg: "canvas-50", rounded: "lg", fontFamily: "mono", display: "inline-flex", maxW: "full", title: fullUrl },
2974
2974
  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),
2975
2975
  pathElem));
@@ -3010,8 +3010,12 @@ const AdditionalInfo = ({ id, termsOfService, contact, license }) => {
3010
3010
  : (contact === null || contact === void 0 ? void 0 : contact.email)
3011
3011
  ? `[Contact ${contact.name || contact.email}](mailto:${contact.email})`
3012
3012
  : '';
3013
- const licenseUrl = (license === null || license === void 0 ? void 0 : license.url) || `https://spdx.org/licenses/${license === null || license === void 0 ? void 0 : license.identifier}.html`;
3014
- const licenseLink = (license === null || license === void 0 ? void 0 : license.name) && licenseUrl ? `[${license.name} License](${licenseUrl})` : '';
3013
+ const licenseUrl = (license === null || license === void 0 ? void 0 : license.url) || (license === null || license === void 0 ? void 0 : license.identifier) ? `https://spdx.org/licenses/${license === null || license === void 0 ? void 0 : license.identifier}.html` : undefined;
3014
+ const licenseLink = (license === null || license === void 0 ? void 0 : license.name) && licenseUrl
3015
+ ? `[${license.name}](${licenseUrl})`
3016
+ : (license === null || license === void 0 ? void 0 : license.identifier) && licenseUrl
3017
+ ? `[${license === null || license === void 0 ? void 0 : license.identifier}](${licenseUrl})`
3018
+ : undefined;
3015
3019
  const tosLink = termsOfService ? `[Terms of Service](${termsOfService})` : '';
3016
3020
  return contactLink || licenseLink || tosLink ? (React.createElement(mosaic.Panel, { rounded: true, isCollapsible: false, pos: "relative" },
3017
3021
  React.createElement(mosaic.Panel.Titlebar, { bg: "canvas-300" },
package/index.mjs CHANGED
@@ -2158,7 +2158,7 @@ const TryItResponse = ({ response }) => {
2158
2158
  response.bodyText && responseType && ['json', 'xml', 'text'].includes(responseType) ? (React.createElement(ResponseCodeViewer, { language: "json", value: responseType && bodyFormat === 'preview'
2159
2159
  ? parseBody(response.bodyText, responseType)
2160
2160
  : response.bodyText })) : response.blob && responseType === 'image' ? (React.createElement(Flex, { justifyContent: "center" },
2161
- React.createElement(Image, { src: URL.createObjectURL(response.blob), alt: "response image" }))) : (React.createElement("p", null,
2161
+ React.createElement(Image, { src: URL.createObjectURL(response.blob), alt: "response image" }))) : !response.bodyText ? null : (React.createElement("p", null,
2162
2162
  React.createElement(Box, { as: Icon, icon: ['fas', 'exclamation-circle'], mr: 2 }),
2163
2163
  "No supported response body returned"))))));
2164
2164
  };
@@ -2945,9 +2945,9 @@ function MethodPathInner({ method, path, chosenServerUrl }) {
2945
2945
  const isDark = useThemeIsDark();
2946
2946
  const fullUrl = `${chosenServerUrl}${path}`;
2947
2947
  const pathElem = (React.createElement(Flex, { overflowX: "hidden", fontSize: "lg", userSelect: "all" },
2948
- React.createElement(Box, { dir: "rtl", color: "muted", textOverflow: "truncate", overflowX: "hidden" },
2949
- React.createElement(Box, { as: "span", dir: "ltr", style: { unicodeBidi: 'bidi-override' } }, chosenServerUrl)),
2950
- React.createElement(Box, { fontWeight: "semibold", flex: 1 }, path)));
2948
+ React.createElement(Box, { dir: "rtl", textOverflow: "truncate", overflowX: "hidden" },
2949
+ React.createElement(Box, { as: "span", color: "muted", dir: "ltr", style: { unicodeBidi: 'bidi-override' } }, chosenServerUrl),
2950
+ React.createElement(Box, { as: "span", fontWeight: "semibold", flex: 1 }, path))));
2951
2951
  return (React.createElement(HStack, { spacing: 3, pl: 2.5, pr: 4, py: 2, bg: "canvas-50", rounded: "lg", fontFamily: "mono", display: "inline-flex", maxW: "full", title: fullUrl },
2952
2952
  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),
2953
2953
  pathElem));
@@ -2988,8 +2988,12 @@ const AdditionalInfo = ({ id, termsOfService, contact, license }) => {
2988
2988
  : (contact === null || contact === void 0 ? void 0 : contact.email)
2989
2989
  ? `[Contact ${contact.name || contact.email}](mailto:${contact.email})`
2990
2990
  : '';
2991
- const licenseUrl = (license === null || license === void 0 ? void 0 : license.url) || `https://spdx.org/licenses/${license === null || license === void 0 ? void 0 : license.identifier}.html`;
2992
- const licenseLink = (license === null || license === void 0 ? void 0 : license.name) && licenseUrl ? `[${license.name} License](${licenseUrl})` : '';
2991
+ const licenseUrl = (license === null || license === void 0 ? void 0 : license.url) || (license === null || license === void 0 ? void 0 : license.identifier) ? `https://spdx.org/licenses/${license === null || license === void 0 ? void 0 : license.identifier}.html` : undefined;
2992
+ const licenseLink = (license === null || license === void 0 ? void 0 : license.name) && licenseUrl
2993
+ ? `[${license.name}](${licenseUrl})`
2994
+ : (license === null || license === void 0 ? void 0 : license.identifier) && licenseUrl
2995
+ ? `[${license === null || license === void 0 ? void 0 : license.identifier}](${licenseUrl})`
2996
+ : undefined;
2993
2997
  const tosLink = termsOfService ? `[Terms of Service](${termsOfService})` : '';
2994
2998
  return contactLink || licenseLink || tosLink ? (React__default.createElement(Panel, { rounded: true, isCollapsible: false, pos: "relative" },
2995
2999
  React__default.createElement(Panel.Titlebar, { bg: "canvas-300" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "8.4.0",
3
+ "version": "8.4.1",
4
4
  "main": "./index.js",
5
5
  "sideEffects": [
6
6
  "web-components.min.js",
package/utils/http.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  import { HttpCodeColor } from '../constants';
2
- export declare function getHttpCodeColor(code: number | string): typeof HttpCodeColor[keyof typeof HttpCodeColor];
2
+ export declare function getHttpCodeColor(code: number | string): (typeof HttpCodeColor)[keyof typeof HttpCodeColor];