@stoplight/elements-core 7.7.16 → 7.7.18
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
CHANGED
|
@@ -905,11 +905,17 @@ const OAuth2Auth = ({ value, onChange }) => {
|
|
|
905
905
|
React.createElement(AuthTokenInput, { type: "oauth2", name: "Token", value: value, onChange: onChange })));
|
|
906
906
|
};
|
|
907
907
|
|
|
908
|
-
|
|
908
|
+
function getSupportedSecurityScheme(value, supportedSecuritySchemes) {
|
|
909
909
|
var _a;
|
|
910
|
+
if (value && supportedSecuritySchemes.some(s => value.scheme.id === s.id)) {
|
|
911
|
+
return [value.scheme, (_a = value.authValue) !== null && _a !== void 0 ? _a : ''];
|
|
912
|
+
}
|
|
913
|
+
return [supportedSecuritySchemes[0], ''];
|
|
914
|
+
}
|
|
915
|
+
const TryItAuth = ({ operationSecurityScheme: operationAuth, onChange, value }) => {
|
|
910
916
|
const operationSecurityArray = flatten(operationAuth);
|
|
911
917
|
const filteredSecurityItems = operationSecurityArray.filter(scheme => securitySchemeKeys.includes(scheme === null || scheme === void 0 ? void 0 : scheme.type));
|
|
912
|
-
const securityScheme = value
|
|
918
|
+
const [securityScheme, authValue] = getSupportedSecurityScheme(value, filteredSecurityItems);
|
|
913
919
|
const menuName = securityScheme ? getReadableSecurityName(securityScheme) : 'Security Scheme';
|
|
914
920
|
const handleChange = (authValue) => {
|
|
915
921
|
onChange(securityScheme && { scheme: securityScheme, authValue: authValue });
|
|
@@ -938,7 +944,7 @@ const TryItAuth = ({ operationSecurityScheme: operationAuth, onChange, value })
|
|
|
938
944
|
return null;
|
|
939
945
|
return (React.createElement(Panel, { defaultIsOpen: true },
|
|
940
946
|
React.createElement(Panel.Titlebar, { rightComponent: filteredSecurityItems.length > 1 && (React.createElement(Menu, { "aria-label": "security-schemes", items: menuItems, closeOnPress: true, renderTrigger: ({ isOpen }) => (React.createElement(Button, { appearance: "minimal", size: "sm", iconRight: ['fas', 'sort'], active: isOpen }, menuName)) })) }, "Auth"),
|
|
941
|
-
React.createElement(SecuritySchemeComponent, { scheme:
|
|
947
|
+
React.createElement(SecuritySchemeComponent, { scheme: securityScheme, onChange: handleChange, value: authValue })));
|
|
942
948
|
};
|
|
943
949
|
const GenericMessageContainer = ({ scheme }) => {
|
|
944
950
|
return React.createElement(Panel.Content, null,
|
package/index.js
CHANGED
|
@@ -958,11 +958,17 @@ const OAuth2Auth = ({ value, onChange }) => {
|
|
|
958
958
|
React__namespace.createElement(AuthTokenInput, { type: "oauth2", name: "Token", value: value, onChange: onChange })));
|
|
959
959
|
};
|
|
960
960
|
|
|
961
|
-
|
|
961
|
+
function getSupportedSecurityScheme(value, supportedSecuritySchemes) {
|
|
962
962
|
var _a;
|
|
963
|
+
if (value && supportedSecuritySchemes.some(s => value.scheme.id === s.id)) {
|
|
964
|
+
return [value.scheme, (_a = value.authValue) !== null && _a !== void 0 ? _a : ''];
|
|
965
|
+
}
|
|
966
|
+
return [supportedSecuritySchemes[0], ''];
|
|
967
|
+
}
|
|
968
|
+
const TryItAuth = ({ operationSecurityScheme: operationAuth, onChange, value }) => {
|
|
963
969
|
const operationSecurityArray = flatten__default["default"](operationAuth);
|
|
964
970
|
const filteredSecurityItems = operationSecurityArray.filter(scheme => securitySchemeKeys.includes(scheme === null || scheme === void 0 ? void 0 : scheme.type));
|
|
965
|
-
const securityScheme = value
|
|
971
|
+
const [securityScheme, authValue] = getSupportedSecurityScheme(value, filteredSecurityItems);
|
|
966
972
|
const menuName = securityScheme ? getReadableSecurityName(securityScheme) : 'Security Scheme';
|
|
967
973
|
const handleChange = (authValue) => {
|
|
968
974
|
onChange(securityScheme && { scheme: securityScheme, authValue: authValue });
|
|
@@ -991,7 +997,7 @@ const TryItAuth = ({ operationSecurityScheme: operationAuth, onChange, value })
|
|
|
991
997
|
return null;
|
|
992
998
|
return (React__namespace.createElement(mosaic.Panel, { defaultIsOpen: true },
|
|
993
999
|
React__namespace.createElement(mosaic.Panel.Titlebar, { rightComponent: filteredSecurityItems.length > 1 && (React__namespace.createElement(mosaic.Menu, { "aria-label": "security-schemes", items: menuItems, closeOnPress: true, renderTrigger: ({ isOpen }) => (React__namespace.createElement(mosaic.Button, { appearance: "minimal", size: "sm", iconRight: ['fas', 'sort'], active: isOpen }, menuName)) })) }, "Auth"),
|
|
994
|
-
React__namespace.createElement(SecuritySchemeComponent, { scheme:
|
|
1000
|
+
React__namespace.createElement(SecuritySchemeComponent, { scheme: securityScheme, onChange: handleChange, value: authValue })));
|
|
995
1001
|
};
|
|
996
1002
|
const GenericMessageContainer = ({ scheme }) => {
|
|
997
1003
|
return React__namespace.createElement(mosaic.Panel.Content, null,
|
package/index.mjs
CHANGED
|
@@ -905,11 +905,17 @@ const OAuth2Auth = ({ value, onChange }) => {
|
|
|
905
905
|
React.createElement(AuthTokenInput, { type: "oauth2", name: "Token", value: value, onChange: onChange })));
|
|
906
906
|
};
|
|
907
907
|
|
|
908
|
-
|
|
908
|
+
function getSupportedSecurityScheme(value, supportedSecuritySchemes) {
|
|
909
909
|
var _a;
|
|
910
|
+
if (value && supportedSecuritySchemes.some(s => value.scheme.id === s.id)) {
|
|
911
|
+
return [value.scheme, (_a = value.authValue) !== null && _a !== void 0 ? _a : ''];
|
|
912
|
+
}
|
|
913
|
+
return [supportedSecuritySchemes[0], ''];
|
|
914
|
+
}
|
|
915
|
+
const TryItAuth = ({ operationSecurityScheme: operationAuth, onChange, value }) => {
|
|
910
916
|
const operationSecurityArray = flatten(operationAuth);
|
|
911
917
|
const filteredSecurityItems = operationSecurityArray.filter(scheme => securitySchemeKeys.includes(scheme === null || scheme === void 0 ? void 0 : scheme.type));
|
|
912
|
-
const securityScheme = value
|
|
918
|
+
const [securityScheme, authValue] = getSupportedSecurityScheme(value, filteredSecurityItems);
|
|
913
919
|
const menuName = securityScheme ? getReadableSecurityName(securityScheme) : 'Security Scheme';
|
|
914
920
|
const handleChange = (authValue) => {
|
|
915
921
|
onChange(securityScheme && { scheme: securityScheme, authValue: authValue });
|
|
@@ -938,7 +944,7 @@ const TryItAuth = ({ operationSecurityScheme: operationAuth, onChange, value })
|
|
|
938
944
|
return null;
|
|
939
945
|
return (React.createElement(Panel, { defaultIsOpen: true },
|
|
940
946
|
React.createElement(Panel.Titlebar, { rightComponent: filteredSecurityItems.length > 1 && (React.createElement(Menu, { "aria-label": "security-schemes", items: menuItems, closeOnPress: true, renderTrigger: ({ isOpen }) => (React.createElement(Button, { appearance: "minimal", size: "sm", iconRight: ['fas', 'sort'], active: isOpen }, menuName)) })) }, "Auth"),
|
|
941
|
-
React.createElement(SecuritySchemeComponent, { scheme:
|
|
947
|
+
React.createElement(SecuritySchemeComponent, { scheme: securityScheme, onChange: handleChange, value: authValue })));
|
|
942
948
|
};
|
|
943
949
|
const GenericMessageContainer = ({ scheme }) => {
|
|
944
950
|
return React.createElement(Panel.Content, null,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements-core",
|
|
3
|
-
"version": "7.7.
|
|
3
|
+
"version": "7.7.18",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"web-components.min.js",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"@stoplight/json": "^3.18.1",
|
|
29
29
|
"@stoplight/json-schema-ref-parser": "^9.0.5",
|
|
30
30
|
"@stoplight/json-schema-sampler": "0.2.3",
|
|
31
|
-
"@stoplight/json-schema-viewer": "^4.9.
|
|
31
|
+
"@stoplight/json-schema-viewer": "^4.9.1",
|
|
32
32
|
"@stoplight/markdown-viewer": "^5.6.0",
|
|
33
33
|
"@stoplight/mosaic": "^1.33.0",
|
|
34
34
|
"@stoplight/mosaic-code-editor": "^1.33.0",
|