@stoplight/elements-core 7.11.0 → 7.12.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.
- package/components/MosaicTableOfContents/constants.d.ts +8 -0
- package/components/MosaicTableOfContents/types.d.ts +1 -0
- package/components/TryIt/Servers/ServerVariables.d.ts +1 -1
- package/components/TryIt/Servers/useServerVariables.d.ts +1 -1
- package/index.esm.js +57 -24
- package/index.js +57 -24
- package/index.mjs +57 -24
- package/package.json +1 -1
|
@@ -2,11 +2,19 @@ import { IIconProps } from '@stoplight/mosaic';
|
|
|
2
2
|
export declare const NODE_TYPE_TITLE_ICON: {
|
|
3
3
|
[nodeType: string]: IIconProps['icon'];
|
|
4
4
|
};
|
|
5
|
+
export declare const NODE_TITLE_ICON: {
|
|
6
|
+
[nodeTitle: string]: IIconProps['icon'];
|
|
7
|
+
};
|
|
5
8
|
export declare const NODE_TYPE_META_ICON: {
|
|
6
9
|
[nodeType: string]: IIconProps['icon'];
|
|
7
10
|
};
|
|
8
11
|
export declare const NODE_TYPE_ICON_COLOR: {
|
|
9
12
|
model: string;
|
|
13
|
+
http_service: string;
|
|
14
|
+
http_operation: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const NODE_TITLE_ICON_COLOR: {
|
|
17
|
+
Schemas: string;
|
|
10
18
|
};
|
|
11
19
|
export declare const NODE_META_COLOR: {
|
|
12
20
|
get: string;
|
|
@@ -3,7 +3,7 @@ import { ServerVariable } from '../../../utils/http-spec/IServer';
|
|
|
3
3
|
interface ServerVariablesProps<P extends keyof any = string> {
|
|
4
4
|
variables: readonly ServerVariable[];
|
|
5
5
|
values: Record<P, string>;
|
|
6
|
-
onChangeValue: (variableName: P, newValue: string) => void;
|
|
6
|
+
onChangeValue: (op: 'set' | 'unset', variableName: P, newValue: string) => void;
|
|
7
7
|
}
|
|
8
8
|
export declare const ServerVariables: React.FC<ServerVariablesProps>;
|
|
9
9
|
export {};
|
package/index.esm.js
CHANGED
|
@@ -293,6 +293,11 @@ var faBookOpen = {
|
|
|
293
293
|
iconName: 'book-open',
|
|
294
294
|
icon: [576, 512, [128366, 128214], "f518", "M144.3 32.04C106.9 31.29 63.7 41.44 18.6 61.29c-11.42 5.026-18.6 16.67-18.6 29.15l0 357.6c0 11.55 11.99 19.55 22.45 14.65c126.3-59.14 219.8 11 223.8 14.01C249.1 478.9 252.5 480 256 480c12.4 0 16-11.38 16-15.98V80.04c0-5.203-2.531-10.08-6.781-13.08C263.3 65.58 216.7 33.35 144.3 32.04zM557.4 61.29c-45.11-19.79-88.48-29.61-125.7-29.26c-72.44 1.312-118.1 33.55-120.9 34.92C306.5 69.96 304 74.83 304 80.04v383.1C304 468.4 307.5 480 320 480c3.484 0 6.938-1.125 9.781-3.328c3.925-3.018 97.44-73.16 223.8-14c10.46 4.896 22.45-3.105 22.45-14.65l.0001-357.6C575.1 77.97 568.8 66.31 557.4 61.29z"]
|
|
295
295
|
};
|
|
296
|
+
var faBullseye = {
|
|
297
|
+
prefix: 'fas',
|
|
298
|
+
iconName: 'bullseye',
|
|
299
|
+
icon: [512, 512, [], "f140", "M288 256C288 273.7 273.7 288 256 288C238.3 288 224 273.7 224 256C224 238.3 238.3 224 256 224C273.7 224 288 238.3 288 256zM112 256C112 176.5 176.5 112 256 112C335.5 112 400 176.5 400 256C400 335.5 335.5 400 256 400C176.5 400 112 335.5 112 256zM256 336C300.2 336 336 300.2 336 256C336 211.8 300.2 176 256 176C211.8 176 176 211.8 176 256C176 300.2 211.8 336 256 336zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 64C149.1 64 64 149.1 64 256C64 362 149.1 448 256 448C362 448 448 362 448 256C448 149.1 362 64 256 64z"]
|
|
300
|
+
};
|
|
296
301
|
var faCircleQuestion = {
|
|
297
302
|
prefix: 'fas',
|
|
298
303
|
iconName: 'circle-question',
|
|
@@ -314,6 +319,11 @@ var faCube = {
|
|
|
314
319
|
iconName: 'cube',
|
|
315
320
|
icon: [512, 512, [], "f1b2", "M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"]
|
|
316
321
|
};
|
|
322
|
+
var faCubes = {
|
|
323
|
+
prefix: 'fas',
|
|
324
|
+
iconName: 'cubes',
|
|
325
|
+
icon: [576, 512, [], "f1b3", "M172.1 40.16L268.1 3.76C280.9-1.089 295.1-1.089 307.9 3.76L403.9 40.16C425.6 48.41 440 69.25 440 92.52V204.7C441.3 205.1 442.6 205.5 443.9 205.1L539.9 242.4C561.6 250.6 576 271.5 576 294.7V413.9C576 436.1 562.9 456.2 542.5 465.1L446.5 507.3C432.2 513.7 415.8 513.7 401.5 507.3L288 457.5L174.5 507.3C160.2 513.7 143.8 513.7 129.5 507.3L33.46 465.1C13.13 456.2 0 436.1 0 413.9V294.7C0 271.5 14.39 250.6 36.15 242.4L132.1 205.1C133.4 205.5 134.7 205.1 136 204.7V92.52C136 69.25 150.4 48.41 172.1 40.16V40.16zM290.8 48.64C289 47.95 286.1 47.95 285.2 48.64L206.8 78.35L287.1 109.5L369.2 78.35L290.8 48.64zM392 210.6V121L309.6 152.6V241.8L392 210.6zM154.8 250.9C153 250.2 150.1 250.2 149.2 250.9L70.81 280.6L152 311.7L233.2 280.6L154.8 250.9zM173.6 455.3L256 419.1V323.2L173.6 354.8V455.3zM342.8 280.6L424 311.7L505.2 280.6L426.8 250.9C425 250.2 422.1 250.2 421.2 250.9L342.8 280.6zM528 413.9V323.2L445.6 354.8V455.3L523.2 421.2C526.1 419.9 528 417.1 528 413.9V413.9z"]
|
|
326
|
+
};
|
|
317
327
|
var faDatabase = {
|
|
318
328
|
prefix: 'fas',
|
|
319
329
|
iconName: 'database',
|
|
@@ -1928,8 +1938,15 @@ const isNetworkError = (error) => error instanceof NetworkError;
|
|
|
1928
1938
|
const persistedServerVariableValuesAtom = atom({});
|
|
1929
1939
|
const useServerVariables = () => {
|
|
1930
1940
|
const [serverVariables, setPersistedServerVariableValues] = useAtom(persistedServerVariableValuesAtom);
|
|
1931
|
-
const updateServerVariableValue = (name, value) => {
|
|
1932
|
-
|
|
1941
|
+
const updateServerVariableValue = (op, name, value) => {
|
|
1942
|
+
const newServerVariables = Object.assign({}, serverVariables);
|
|
1943
|
+
if (op === 'unset') {
|
|
1944
|
+
delete newServerVariables[name];
|
|
1945
|
+
}
|
|
1946
|
+
else {
|
|
1947
|
+
newServerVariables[name] = value;
|
|
1948
|
+
}
|
|
1949
|
+
setPersistedServerVariableValues(newServerVariables);
|
|
1933
1950
|
};
|
|
1934
1951
|
return { serverVariables, updateServerVariableValue };
|
|
1935
1952
|
};
|
|
@@ -1972,7 +1989,10 @@ const VariableEditor = ({ variable, value, onChange }) => {
|
|
|
1972
1989
|
const ServerVariables = ({ variables, values, onChangeValue }) => {
|
|
1973
1990
|
return (React.createElement(Panel, { defaultIsOpen: true },
|
|
1974
1991
|
React.createElement(Panel.Titlebar, null, "Server Variables"),
|
|
1975
|
-
React.createElement(Panel.Content, { className: "sl-overflow-y-auto ParameterGrid ServerVariablesContent" }, variables.map(variable => (React.createElement(VariableEditor, { key: variable.name, variable: variable, value: values[variable.name], onChange: (value) =>
|
|
1992
|
+
React.createElement(Panel.Content, { className: "sl-overflow-y-auto ParameterGrid ServerVariablesContent" }, variables.map(variable => (React.createElement(VariableEditor, { key: variable.name, variable: variable, value: values[variable.name], onChange: (value) => {
|
|
1993
|
+
const actualValue = String(value);
|
|
1994
|
+
onChangeValue(variable.enum || actualValue !== '' ? 'set' : 'unset', variable.name, actualValue);
|
|
1995
|
+
} }))))));
|
|
1976
1996
|
};
|
|
1977
1997
|
|
|
1978
1998
|
const defaultServers = [];
|
|
@@ -3029,12 +3049,22 @@ function useFirstRender() {
|
|
|
3029
3049
|
|
|
3030
3050
|
const NODE_TYPE_TITLE_ICON = {
|
|
3031
3051
|
http_service: faCloud,
|
|
3052
|
+
http_operation: faBullseye,
|
|
3053
|
+
model: faCube,
|
|
3054
|
+
};
|
|
3055
|
+
const NODE_TITLE_ICON = {
|
|
3056
|
+
Schemas: faCubes,
|
|
3032
3057
|
};
|
|
3033
3058
|
const NODE_TYPE_META_ICON = {
|
|
3034
3059
|
model: faCube,
|
|
3035
3060
|
};
|
|
3036
3061
|
const NODE_TYPE_ICON_COLOR = {
|
|
3037
3062
|
model: 'warning',
|
|
3063
|
+
http_service: '#D812EA',
|
|
3064
|
+
http_operation: '#9747FF',
|
|
3065
|
+
};
|
|
3066
|
+
const NODE_TITLE_ICON_COLOR = {
|
|
3067
|
+
Schemas: 'warning',
|
|
3038
3068
|
};
|
|
3039
3069
|
const NODE_META_COLOR = {
|
|
3040
3070
|
get: 'success',
|
|
@@ -3101,7 +3131,7 @@ function isExternalLink(item) {
|
|
|
3101
3131
|
|
|
3102
3132
|
const ActiveIdContext = React.createContext(undefined);
|
|
3103
3133
|
const LinkContext = React.createContext(undefined);
|
|
3104
|
-
const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, onLinkClick }) => {
|
|
3134
|
+
const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, isInResponsiveMode = false, onLinkClick, }) => {
|
|
3105
3135
|
const container = React.useRef(null);
|
|
3106
3136
|
const child = React.useRef(null);
|
|
3107
3137
|
const firstRender = useFirstRender();
|
|
@@ -3118,35 +3148,35 @@ const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefaul
|
|
|
3118
3148
|
}
|
|
3119
3149
|
}, 0);
|
|
3120
3150
|
}, [activeId]);
|
|
3121
|
-
return (React.createElement(Box, { ref: container, w: "full", bg:
|
|
3151
|
+
return (React.createElement(Box, { ref: container, w: "full", bg: isInResponsiveMode ? 'canvas' : 'canvas-100', overflowY: "auto" },
|
|
3122
3152
|
React.createElement(Box, { ref: child, my: 3 },
|
|
3123
3153
|
React.createElement(LinkContext.Provider, { value: Link },
|
|
3124
3154
|
React.createElement(ActiveIdContext.Provider, { value: activeId }, tree.map((item, key) => {
|
|
3125
3155
|
if (isDivider(item)) {
|
|
3126
|
-
return React.createElement(Divider, { key: key, item: item });
|
|
3156
|
+
return React.createElement(Divider, { key: key, item: item, isInResponsiveMode: isInResponsiveMode });
|
|
3127
3157
|
}
|
|
3128
|
-
return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick }));
|
|
3158
|
+
return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3129
3159
|
}))))));
|
|
3130
3160
|
});
|
|
3131
|
-
const Divider = React.memo(({ item }) => {
|
|
3132
|
-
return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize:
|
|
3161
|
+
const Divider = React.memo(({ item, isInResponsiveMode = false }) => {
|
|
3162
|
+
return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: isInResponsiveMode ? 'lg' : 'sm', lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
|
|
3133
3163
|
});
|
|
3134
|
-
const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, onLinkClick }) => {
|
|
3164
|
+
const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick }) => {
|
|
3135
3165
|
if (isExternalLink(item)) {
|
|
3136
3166
|
return (React.createElement(Box, { as: "a", href: item.url, target: "_blank", rel: "noopener noreferrer", display: "block" },
|
|
3137
|
-
React.createElement(Item, { depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
|
|
3167
|
+
React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
|
|
3138
3168
|
}
|
|
3139
3169
|
else if (isGroup(item) || isNodeGroup(item)) {
|
|
3140
|
-
return React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick });
|
|
3170
|
+
return (React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3141
3171
|
}
|
|
3142
3172
|
else if (isNode(item)) {
|
|
3143
|
-
return (React.createElement(Node, { depth: depth, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
|
|
3173
|
+
return (React.createElement(Node, { depth: depth, isInResponsiveMode: isInResponsiveMode, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
|
|
3144
3174
|
item.version && React.createElement(Version, { value: item.version }),
|
|
3145
|
-
React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] })))) }));
|
|
3175
|
+
item.type !== 'model' && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] }))))) }));
|
|
3146
3176
|
}
|
|
3147
3177
|
return null;
|
|
3148
3178
|
});
|
|
3149
|
-
const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = () => { } }) => {
|
|
3179
|
+
const Group = React.memo(({ depth, item, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick = () => { } }) => {
|
|
3150
3180
|
const activeId = React.useContext(ActiveIdContext);
|
|
3151
3181
|
const [isOpen, setIsOpen] = React.useState(() => isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault));
|
|
3152
3182
|
const hasActive = !!activeId && hasActiveItem(item.items, activeId);
|
|
@@ -3174,25 +3204,28 @@ const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = ()
|
|
|
3174
3204
|
const showAsActive = hasActive && !isOpen;
|
|
3175
3205
|
let elem;
|
|
3176
3206
|
if (isNodeGroup(item)) {
|
|
3177
|
-
elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick }));
|
|
3207
|
+
elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3178
3208
|
}
|
|
3179
3209
|
else {
|
|
3180
|
-
elem = React.createElement(Item, { title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive });
|
|
3210
|
+
elem = (React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive, icon: NODE_TITLE_ICON[item.title] && (React.createElement(Box, { as: Icon, color: NODE_TITLE_ICON_COLOR[item.title], icon: NODE_TITLE_ICON[item.title] })) }));
|
|
3181
3211
|
}
|
|
3182
3212
|
return (React.createElement(React.Fragment, null,
|
|
3183
3213
|
elem,
|
|
3184
3214
|
isOpen &&
|
|
3185
3215
|
item.items.map((groupItem, key) => {
|
|
3186
|
-
return React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick });
|
|
3216
|
+
return (React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3187
3217
|
})));
|
|
3188
3218
|
});
|
|
3189
|
-
const Item = React.memo(({ depth, isActive, id, title, meta, icon, onClick }) => {
|
|
3190
|
-
return (React.createElement(Flex, { id: id, bg: {
|
|
3219
|
+
const Item = React.memo(({ depth, isActive, id, title, meta, icon, isInResponsiveMode, onClick }) => {
|
|
3220
|
+
return (React.createElement(Flex, { id: id, bg: {
|
|
3221
|
+
default: isInResponsiveMode ? 'canvas' : isActive ? 'primary-tint' : 'canvas-100',
|
|
3222
|
+
hover: isActive ? undefined : 'canvas-200',
|
|
3223
|
+
}, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: isInResponsiveMode ? 'lg' : 'md', align: "center", userSelect: "none", onClick: onClick, title: title },
|
|
3191
3224
|
icon,
|
|
3192
|
-
React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate" }, title),
|
|
3193
|
-
React.createElement(Flex, { alignItems: "center", fontSize:
|
|
3225
|
+
React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate", fontSize: isInResponsiveMode ? 'lg' : 'base' }, title),
|
|
3226
|
+
React.createElement(Flex, { alignItems: "center", fontSize: isInResponsiveMode ? 'base' : 'xs' }, meta)));
|
|
3194
3227
|
});
|
|
3195
|
-
const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick = () => { } }) => {
|
|
3228
|
+
const Node = React.memo(({ item, depth, meta, showAsActive, isInResponsiveMode, onClick, onLinkClick = () => { } }) => {
|
|
3196
3229
|
const activeId = React.useContext(ActiveIdContext);
|
|
3197
3230
|
const isActive = activeId === item.slug || activeId === item.id;
|
|
3198
3231
|
const LinkComponent = React.useContext(LinkContext);
|
|
@@ -3209,7 +3242,7 @@ const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick
|
|
|
3209
3242
|
}
|
|
3210
3243
|
};
|
|
3211
3244
|
return (React.createElement(Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
|
|
3212
|
-
React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, onClick: handleClick })));
|
|
3245
|
+
React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, isInResponsiveMode: isInResponsiveMode, onClick: handleClick })));
|
|
3213
3246
|
});
|
|
3214
3247
|
const Version = ({ value }) => {
|
|
3215
3248
|
return (React.createElement(Box, { mr: 2 },
|
package/index.js
CHANGED
|
@@ -349,6 +349,11 @@ var faBookOpen = {
|
|
|
349
349
|
iconName: 'book-open',
|
|
350
350
|
icon: [576, 512, [128366, 128214], "f518", "M144.3 32.04C106.9 31.29 63.7 41.44 18.6 61.29c-11.42 5.026-18.6 16.67-18.6 29.15l0 357.6c0 11.55 11.99 19.55 22.45 14.65c126.3-59.14 219.8 11 223.8 14.01C249.1 478.9 252.5 480 256 480c12.4 0 16-11.38 16-15.98V80.04c0-5.203-2.531-10.08-6.781-13.08C263.3 65.58 216.7 33.35 144.3 32.04zM557.4 61.29c-45.11-19.79-88.48-29.61-125.7-29.26c-72.44 1.312-118.1 33.55-120.9 34.92C306.5 69.96 304 74.83 304 80.04v383.1C304 468.4 307.5 480 320 480c3.484 0 6.938-1.125 9.781-3.328c3.925-3.018 97.44-73.16 223.8-14c10.46 4.896 22.45-3.105 22.45-14.65l.0001-357.6C575.1 77.97 568.8 66.31 557.4 61.29z"]
|
|
351
351
|
};
|
|
352
|
+
var faBullseye = {
|
|
353
|
+
prefix: 'fas',
|
|
354
|
+
iconName: 'bullseye',
|
|
355
|
+
icon: [512, 512, [], "f140", "M288 256C288 273.7 273.7 288 256 288C238.3 288 224 273.7 224 256C224 238.3 238.3 224 256 224C273.7 224 288 238.3 288 256zM112 256C112 176.5 176.5 112 256 112C335.5 112 400 176.5 400 256C400 335.5 335.5 400 256 400C176.5 400 112 335.5 112 256zM256 336C300.2 336 336 300.2 336 256C336 211.8 300.2 176 256 176C211.8 176 176 211.8 176 256C176 300.2 211.8 336 256 336zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 64C149.1 64 64 149.1 64 256C64 362 149.1 448 256 448C362 448 448 362 448 256C448 149.1 362 64 256 64z"]
|
|
356
|
+
};
|
|
352
357
|
var faCircleQuestion = {
|
|
353
358
|
prefix: 'fas',
|
|
354
359
|
iconName: 'circle-question',
|
|
@@ -370,6 +375,11 @@ var faCube = {
|
|
|
370
375
|
iconName: 'cube',
|
|
371
376
|
icon: [512, 512, [], "f1b2", "M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"]
|
|
372
377
|
};
|
|
378
|
+
var faCubes = {
|
|
379
|
+
prefix: 'fas',
|
|
380
|
+
iconName: 'cubes',
|
|
381
|
+
icon: [576, 512, [], "f1b3", "M172.1 40.16L268.1 3.76C280.9-1.089 295.1-1.089 307.9 3.76L403.9 40.16C425.6 48.41 440 69.25 440 92.52V204.7C441.3 205.1 442.6 205.5 443.9 205.1L539.9 242.4C561.6 250.6 576 271.5 576 294.7V413.9C576 436.1 562.9 456.2 542.5 465.1L446.5 507.3C432.2 513.7 415.8 513.7 401.5 507.3L288 457.5L174.5 507.3C160.2 513.7 143.8 513.7 129.5 507.3L33.46 465.1C13.13 456.2 0 436.1 0 413.9V294.7C0 271.5 14.39 250.6 36.15 242.4L132.1 205.1C133.4 205.5 134.7 205.1 136 204.7V92.52C136 69.25 150.4 48.41 172.1 40.16V40.16zM290.8 48.64C289 47.95 286.1 47.95 285.2 48.64L206.8 78.35L287.1 109.5L369.2 78.35L290.8 48.64zM392 210.6V121L309.6 152.6V241.8L392 210.6zM154.8 250.9C153 250.2 150.1 250.2 149.2 250.9L70.81 280.6L152 311.7L233.2 280.6L154.8 250.9zM173.6 455.3L256 419.1V323.2L173.6 354.8V455.3zM342.8 280.6L424 311.7L505.2 280.6L426.8 250.9C425 250.2 422.1 250.2 421.2 250.9L342.8 280.6zM528 413.9V323.2L445.6 354.8V455.3L523.2 421.2C526.1 419.9 528 417.1 528 413.9V413.9z"]
|
|
382
|
+
};
|
|
373
383
|
var faDatabase = {
|
|
374
384
|
prefix: 'fas',
|
|
375
385
|
iconName: 'database',
|
|
@@ -1984,8 +1994,15 @@ const isNetworkError = (error) => error instanceof NetworkError;
|
|
|
1984
1994
|
const persistedServerVariableValuesAtom = jotai.atom({});
|
|
1985
1995
|
const useServerVariables = () => {
|
|
1986
1996
|
const [serverVariables, setPersistedServerVariableValues] = jotai.useAtom(persistedServerVariableValuesAtom);
|
|
1987
|
-
const updateServerVariableValue = (name, value) => {
|
|
1988
|
-
|
|
1997
|
+
const updateServerVariableValue = (op, name, value) => {
|
|
1998
|
+
const newServerVariables = Object.assign({}, serverVariables);
|
|
1999
|
+
if (op === 'unset') {
|
|
2000
|
+
delete newServerVariables[name];
|
|
2001
|
+
}
|
|
2002
|
+
else {
|
|
2003
|
+
newServerVariables[name] = value;
|
|
2004
|
+
}
|
|
2005
|
+
setPersistedServerVariableValues(newServerVariables);
|
|
1989
2006
|
};
|
|
1990
2007
|
return { serverVariables, updateServerVariableValue };
|
|
1991
2008
|
};
|
|
@@ -2028,7 +2045,10 @@ const VariableEditor = ({ variable, value, onChange }) => {
|
|
|
2028
2045
|
const ServerVariables = ({ variables, values, onChangeValue }) => {
|
|
2029
2046
|
return (React__namespace.createElement(mosaic.Panel, { defaultIsOpen: true },
|
|
2030
2047
|
React__namespace.createElement(mosaic.Panel.Titlebar, null, "Server Variables"),
|
|
2031
|
-
React__namespace.createElement(mosaic.Panel.Content, { className: "sl-overflow-y-auto ParameterGrid ServerVariablesContent" }, variables.map(variable => (React__namespace.createElement(VariableEditor, { key: variable.name, variable: variable, value: values[variable.name], onChange: (value) =>
|
|
2048
|
+
React__namespace.createElement(mosaic.Panel.Content, { className: "sl-overflow-y-auto ParameterGrid ServerVariablesContent" }, variables.map(variable => (React__namespace.createElement(VariableEditor, { key: variable.name, variable: variable, value: values[variable.name], onChange: (value) => {
|
|
2049
|
+
const actualValue = String(value);
|
|
2050
|
+
onChangeValue(variable.enum || actualValue !== '' ? 'set' : 'unset', variable.name, actualValue);
|
|
2051
|
+
} }))))));
|
|
2032
2052
|
};
|
|
2033
2053
|
|
|
2034
2054
|
const defaultServers = [];
|
|
@@ -3085,12 +3105,22 @@ function useFirstRender() {
|
|
|
3085
3105
|
|
|
3086
3106
|
const NODE_TYPE_TITLE_ICON = {
|
|
3087
3107
|
http_service: faCloud,
|
|
3108
|
+
http_operation: faBullseye,
|
|
3109
|
+
model: faCube,
|
|
3110
|
+
};
|
|
3111
|
+
const NODE_TITLE_ICON = {
|
|
3112
|
+
Schemas: faCubes,
|
|
3088
3113
|
};
|
|
3089
3114
|
const NODE_TYPE_META_ICON = {
|
|
3090
3115
|
model: faCube,
|
|
3091
3116
|
};
|
|
3092
3117
|
const NODE_TYPE_ICON_COLOR = {
|
|
3093
3118
|
model: 'warning',
|
|
3119
|
+
http_service: '#D812EA',
|
|
3120
|
+
http_operation: '#9747FF',
|
|
3121
|
+
};
|
|
3122
|
+
const NODE_TITLE_ICON_COLOR = {
|
|
3123
|
+
Schemas: 'warning',
|
|
3094
3124
|
};
|
|
3095
3125
|
const NODE_META_COLOR = {
|
|
3096
3126
|
get: 'success',
|
|
@@ -3157,7 +3187,7 @@ function isExternalLink(item) {
|
|
|
3157
3187
|
|
|
3158
3188
|
const ActiveIdContext = React__namespace.createContext(undefined);
|
|
3159
3189
|
const LinkContext = React__namespace.createContext(undefined);
|
|
3160
|
-
const TableOfContents = React__namespace.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, onLinkClick }) => {
|
|
3190
|
+
const TableOfContents = React__namespace.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, isInResponsiveMode = false, onLinkClick, }) => {
|
|
3161
3191
|
const container = React__namespace.useRef(null);
|
|
3162
3192
|
const child = React__namespace.useRef(null);
|
|
3163
3193
|
const firstRender = useFirstRender();
|
|
@@ -3174,35 +3204,35 @@ const TableOfContents = React__namespace.memo(({ tree, activeId, Link, maxDepthO
|
|
|
3174
3204
|
}
|
|
3175
3205
|
}, 0);
|
|
3176
3206
|
}, [activeId]);
|
|
3177
|
-
return (React__namespace.createElement(mosaic.Box, { ref: container, w: "full", bg:
|
|
3207
|
+
return (React__namespace.createElement(mosaic.Box, { ref: container, w: "full", bg: isInResponsiveMode ? 'canvas' : 'canvas-100', overflowY: "auto" },
|
|
3178
3208
|
React__namespace.createElement(mosaic.Box, { ref: child, my: 3 },
|
|
3179
3209
|
React__namespace.createElement(LinkContext.Provider, { value: Link },
|
|
3180
3210
|
React__namespace.createElement(ActiveIdContext.Provider, { value: activeId }, tree.map((item, key) => {
|
|
3181
3211
|
if (isDivider(item)) {
|
|
3182
|
-
return React__namespace.createElement(Divider, { key: key, item: item });
|
|
3212
|
+
return React__namespace.createElement(Divider, { key: key, item: item, isInResponsiveMode: isInResponsiveMode });
|
|
3183
3213
|
}
|
|
3184
|
-
return (React__namespace.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick }));
|
|
3214
|
+
return (React__namespace.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3185
3215
|
}))))));
|
|
3186
3216
|
});
|
|
3187
|
-
const Divider = React__namespace.memo(({ item }) => {
|
|
3188
|
-
return (React__namespace.createElement(mosaic.Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize:
|
|
3217
|
+
const Divider = React__namespace.memo(({ item, isInResponsiveMode = false }) => {
|
|
3218
|
+
return (React__namespace.createElement(mosaic.Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: isInResponsiveMode ? 'lg' : 'sm', lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
|
|
3189
3219
|
});
|
|
3190
|
-
const GroupItem = React__namespace.memo(({ item, depth, maxDepthOpenByDefault, onLinkClick }) => {
|
|
3220
|
+
const GroupItem = React__namespace.memo(({ item, depth, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick }) => {
|
|
3191
3221
|
if (isExternalLink(item)) {
|
|
3192
3222
|
return (React__namespace.createElement(mosaic.Box, { as: "a", href: item.url, target: "_blank", rel: "noopener noreferrer", display: "block" },
|
|
3193
|
-
React__namespace.createElement(Item, { depth: depth, title: item.title, meta: React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, icon: ['fas', 'external-link'] }) })));
|
|
3223
|
+
React__namespace.createElement(Item, { isInResponsiveMode: isInResponsiveMode, depth: depth, title: item.title, meta: React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, icon: ['fas', 'external-link'] }) })));
|
|
3194
3224
|
}
|
|
3195
3225
|
else if (isGroup(item) || isNodeGroup(item)) {
|
|
3196
|
-
return React__namespace.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick });
|
|
3226
|
+
return (React__namespace.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3197
3227
|
}
|
|
3198
3228
|
else if (isNode(item)) {
|
|
3199
|
-
return (React__namespace.createElement(Node, { depth: depth, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React__namespace.createElement(mosaic.Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React__namespace.createElement(mosaic.Flex, { alignItems: "center" },
|
|
3229
|
+
return (React__namespace.createElement(Node, { depth: depth, isInResponsiveMode: isInResponsiveMode, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React__namespace.createElement(mosaic.Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React__namespace.createElement(mosaic.Flex, { alignItems: "center" },
|
|
3200
3230
|
item.version && React__namespace.createElement(Version, { value: item.version }),
|
|
3201
|
-
React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] })))) }));
|
|
3231
|
+
item.type !== 'model' && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] }))))) }));
|
|
3202
3232
|
}
|
|
3203
3233
|
return null;
|
|
3204
3234
|
});
|
|
3205
|
-
const Group = React__namespace.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = () => { } }) => {
|
|
3235
|
+
const Group = React__namespace.memo(({ depth, item, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick = () => { } }) => {
|
|
3206
3236
|
const activeId = React__namespace.useContext(ActiveIdContext);
|
|
3207
3237
|
const [isOpen, setIsOpen] = React__namespace.useState(() => isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault));
|
|
3208
3238
|
const hasActive = !!activeId && hasActiveItem(item.items, activeId);
|
|
@@ -3230,25 +3260,28 @@ const Group = React__namespace.memo(({ depth, item, maxDepthOpenByDefault, onLin
|
|
|
3230
3260
|
const showAsActive = hasActive && !isOpen;
|
|
3231
3261
|
let elem;
|
|
3232
3262
|
if (isNodeGroup(item)) {
|
|
3233
|
-
elem = (React__namespace.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick }));
|
|
3263
|
+
elem = (React__namespace.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3234
3264
|
}
|
|
3235
3265
|
else {
|
|
3236
|
-
elem = React__namespace.createElement(Item, { title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive });
|
|
3266
|
+
elem = (React__namespace.createElement(Item, { isInResponsiveMode: isInResponsiveMode, title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive, icon: NODE_TITLE_ICON[item.title] && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TITLE_ICON_COLOR[item.title], icon: NODE_TITLE_ICON[item.title] })) }));
|
|
3237
3267
|
}
|
|
3238
3268
|
return (React__namespace.createElement(React__namespace.Fragment, null,
|
|
3239
3269
|
elem,
|
|
3240
3270
|
isOpen &&
|
|
3241
3271
|
item.items.map((groupItem, key) => {
|
|
3242
|
-
return React__namespace.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick });
|
|
3272
|
+
return (React__namespace.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3243
3273
|
})));
|
|
3244
3274
|
});
|
|
3245
|
-
const Item = React__namespace.memo(({ depth, isActive, id, title, meta, icon, onClick }) => {
|
|
3246
|
-
return (React__namespace.createElement(mosaic.Flex, { id: id, bg: {
|
|
3275
|
+
const Item = React__namespace.memo(({ depth, isActive, id, title, meta, icon, isInResponsiveMode, onClick }) => {
|
|
3276
|
+
return (React__namespace.createElement(mosaic.Flex, { id: id, bg: {
|
|
3277
|
+
default: isInResponsiveMode ? 'canvas' : isActive ? 'primary-tint' : 'canvas-100',
|
|
3278
|
+
hover: isActive ? undefined : 'canvas-200',
|
|
3279
|
+
}, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: isInResponsiveMode ? 'lg' : 'md', align: "center", userSelect: "none", onClick: onClick, title: title },
|
|
3247
3280
|
icon,
|
|
3248
|
-
React__namespace.createElement(mosaic.Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate" }, title),
|
|
3249
|
-
React__namespace.createElement(mosaic.Flex, { alignItems: "center", fontSize:
|
|
3281
|
+
React__namespace.createElement(mosaic.Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate", fontSize: isInResponsiveMode ? 'lg' : 'base' }, title),
|
|
3282
|
+
React__namespace.createElement(mosaic.Flex, { alignItems: "center", fontSize: isInResponsiveMode ? 'base' : 'xs' }, meta)));
|
|
3250
3283
|
});
|
|
3251
|
-
const Node = React__namespace.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick = () => { } }) => {
|
|
3284
|
+
const Node = React__namespace.memo(({ item, depth, meta, showAsActive, isInResponsiveMode, onClick, onLinkClick = () => { } }) => {
|
|
3252
3285
|
const activeId = React__namespace.useContext(ActiveIdContext);
|
|
3253
3286
|
const isActive = activeId === item.slug || activeId === item.id;
|
|
3254
3287
|
const LinkComponent = React__namespace.useContext(LinkContext);
|
|
@@ -3265,7 +3298,7 @@ const Node = React__namespace.memo(({ item, depth, meta, showAsActive, onClick,
|
|
|
3265
3298
|
}
|
|
3266
3299
|
};
|
|
3267
3300
|
return (React__namespace.createElement(mosaic.Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
|
|
3268
|
-
React__namespace.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, onClick: handleClick })));
|
|
3301
|
+
React__namespace.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React__namespace.createElement(mosaic.Box, { as: mosaic.Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, isInResponsiveMode: isInResponsiveMode, onClick: handleClick })));
|
|
3269
3302
|
});
|
|
3270
3303
|
const Version = ({ value }) => {
|
|
3271
3304
|
return (React__namespace.createElement(mosaic.Box, { mr: 2 },
|
package/index.mjs
CHANGED
|
@@ -293,6 +293,11 @@ var faBookOpen = {
|
|
|
293
293
|
iconName: 'book-open',
|
|
294
294
|
icon: [576, 512, [128366, 128214], "f518", "M144.3 32.04C106.9 31.29 63.7 41.44 18.6 61.29c-11.42 5.026-18.6 16.67-18.6 29.15l0 357.6c0 11.55 11.99 19.55 22.45 14.65c126.3-59.14 219.8 11 223.8 14.01C249.1 478.9 252.5 480 256 480c12.4 0 16-11.38 16-15.98V80.04c0-5.203-2.531-10.08-6.781-13.08C263.3 65.58 216.7 33.35 144.3 32.04zM557.4 61.29c-45.11-19.79-88.48-29.61-125.7-29.26c-72.44 1.312-118.1 33.55-120.9 34.92C306.5 69.96 304 74.83 304 80.04v383.1C304 468.4 307.5 480 320 480c3.484 0 6.938-1.125 9.781-3.328c3.925-3.018 97.44-73.16 223.8-14c10.46 4.896 22.45-3.105 22.45-14.65l.0001-357.6C575.1 77.97 568.8 66.31 557.4 61.29z"]
|
|
295
295
|
};
|
|
296
|
+
var faBullseye = {
|
|
297
|
+
prefix: 'fas',
|
|
298
|
+
iconName: 'bullseye',
|
|
299
|
+
icon: [512, 512, [], "f140", "M288 256C288 273.7 273.7 288 256 288C238.3 288 224 273.7 224 256C224 238.3 238.3 224 256 224C273.7 224 288 238.3 288 256zM112 256C112 176.5 176.5 112 256 112C335.5 112 400 176.5 400 256C400 335.5 335.5 400 256 400C176.5 400 112 335.5 112 256zM256 336C300.2 336 336 300.2 336 256C336 211.8 300.2 176 256 176C211.8 176 176 211.8 176 256C176 300.2 211.8 336 256 336zM512 256C512 397.4 397.4 512 256 512C114.6 512 0 397.4 0 256C0 114.6 114.6 0 256 0C397.4 0 512 114.6 512 256zM256 64C149.1 64 64 149.1 64 256C64 362 149.1 448 256 448C362 448 448 362 448 256C448 149.1 362 64 256 64z"]
|
|
300
|
+
};
|
|
296
301
|
var faCircleQuestion = {
|
|
297
302
|
prefix: 'fas',
|
|
298
303
|
iconName: 'circle-question',
|
|
@@ -314,6 +319,11 @@ var faCube = {
|
|
|
314
319
|
iconName: 'cube',
|
|
315
320
|
icon: [512, 512, [], "f1b2", "M234.5 5.709C248.4 .7377 263.6 .7377 277.5 5.709L469.5 74.28C494.1 83.38 512 107.5 512 134.6V377.4C512 404.5 494.1 428.6 469.5 437.7L277.5 506.3C263.6 511.3 248.4 511.3 234.5 506.3L42.47 437.7C17 428.6 0 404.5 0 377.4V134.6C0 107.5 17 83.38 42.47 74.28L234.5 5.709zM256 65.98L82.34 128L256 190L429.7 128L256 65.98zM288 434.6L448 377.4V189.4L288 246.6V434.6z"]
|
|
316
321
|
};
|
|
322
|
+
var faCubes = {
|
|
323
|
+
prefix: 'fas',
|
|
324
|
+
iconName: 'cubes',
|
|
325
|
+
icon: [576, 512, [], "f1b3", "M172.1 40.16L268.1 3.76C280.9-1.089 295.1-1.089 307.9 3.76L403.9 40.16C425.6 48.41 440 69.25 440 92.52V204.7C441.3 205.1 442.6 205.5 443.9 205.1L539.9 242.4C561.6 250.6 576 271.5 576 294.7V413.9C576 436.1 562.9 456.2 542.5 465.1L446.5 507.3C432.2 513.7 415.8 513.7 401.5 507.3L288 457.5L174.5 507.3C160.2 513.7 143.8 513.7 129.5 507.3L33.46 465.1C13.13 456.2 0 436.1 0 413.9V294.7C0 271.5 14.39 250.6 36.15 242.4L132.1 205.1C133.4 205.5 134.7 205.1 136 204.7V92.52C136 69.25 150.4 48.41 172.1 40.16V40.16zM290.8 48.64C289 47.95 286.1 47.95 285.2 48.64L206.8 78.35L287.1 109.5L369.2 78.35L290.8 48.64zM392 210.6V121L309.6 152.6V241.8L392 210.6zM154.8 250.9C153 250.2 150.1 250.2 149.2 250.9L70.81 280.6L152 311.7L233.2 280.6L154.8 250.9zM173.6 455.3L256 419.1V323.2L173.6 354.8V455.3zM342.8 280.6L424 311.7L505.2 280.6L426.8 250.9C425 250.2 422.1 250.2 421.2 250.9L342.8 280.6zM528 413.9V323.2L445.6 354.8V455.3L523.2 421.2C526.1 419.9 528 417.1 528 413.9V413.9z"]
|
|
326
|
+
};
|
|
317
327
|
var faDatabase = {
|
|
318
328
|
prefix: 'fas',
|
|
319
329
|
iconName: 'database',
|
|
@@ -1928,8 +1938,15 @@ const isNetworkError = (error) => error instanceof NetworkError;
|
|
|
1928
1938
|
const persistedServerVariableValuesAtom = atom({});
|
|
1929
1939
|
const useServerVariables = () => {
|
|
1930
1940
|
const [serverVariables, setPersistedServerVariableValues] = useAtom(persistedServerVariableValuesAtom);
|
|
1931
|
-
const updateServerVariableValue = (name, value) => {
|
|
1932
|
-
|
|
1941
|
+
const updateServerVariableValue = (op, name, value) => {
|
|
1942
|
+
const newServerVariables = Object.assign({}, serverVariables);
|
|
1943
|
+
if (op === 'unset') {
|
|
1944
|
+
delete newServerVariables[name];
|
|
1945
|
+
}
|
|
1946
|
+
else {
|
|
1947
|
+
newServerVariables[name] = value;
|
|
1948
|
+
}
|
|
1949
|
+
setPersistedServerVariableValues(newServerVariables);
|
|
1933
1950
|
};
|
|
1934
1951
|
return { serverVariables, updateServerVariableValue };
|
|
1935
1952
|
};
|
|
@@ -1972,7 +1989,10 @@ const VariableEditor = ({ variable, value, onChange }) => {
|
|
|
1972
1989
|
const ServerVariables = ({ variables, values, onChangeValue }) => {
|
|
1973
1990
|
return (React.createElement(Panel, { defaultIsOpen: true },
|
|
1974
1991
|
React.createElement(Panel.Titlebar, null, "Server Variables"),
|
|
1975
|
-
React.createElement(Panel.Content, { className: "sl-overflow-y-auto ParameterGrid ServerVariablesContent" }, variables.map(variable => (React.createElement(VariableEditor, { key: variable.name, variable: variable, value: values[variable.name], onChange: (value) =>
|
|
1992
|
+
React.createElement(Panel.Content, { className: "sl-overflow-y-auto ParameterGrid ServerVariablesContent" }, variables.map(variable => (React.createElement(VariableEditor, { key: variable.name, variable: variable, value: values[variable.name], onChange: (value) => {
|
|
1993
|
+
const actualValue = String(value);
|
|
1994
|
+
onChangeValue(variable.enum || actualValue !== '' ? 'set' : 'unset', variable.name, actualValue);
|
|
1995
|
+
} }))))));
|
|
1976
1996
|
};
|
|
1977
1997
|
|
|
1978
1998
|
const defaultServers = [];
|
|
@@ -3029,12 +3049,22 @@ function useFirstRender() {
|
|
|
3029
3049
|
|
|
3030
3050
|
const NODE_TYPE_TITLE_ICON = {
|
|
3031
3051
|
http_service: faCloud,
|
|
3052
|
+
http_operation: faBullseye,
|
|
3053
|
+
model: faCube,
|
|
3054
|
+
};
|
|
3055
|
+
const NODE_TITLE_ICON = {
|
|
3056
|
+
Schemas: faCubes,
|
|
3032
3057
|
};
|
|
3033
3058
|
const NODE_TYPE_META_ICON = {
|
|
3034
3059
|
model: faCube,
|
|
3035
3060
|
};
|
|
3036
3061
|
const NODE_TYPE_ICON_COLOR = {
|
|
3037
3062
|
model: 'warning',
|
|
3063
|
+
http_service: '#D812EA',
|
|
3064
|
+
http_operation: '#9747FF',
|
|
3065
|
+
};
|
|
3066
|
+
const NODE_TITLE_ICON_COLOR = {
|
|
3067
|
+
Schemas: 'warning',
|
|
3038
3068
|
};
|
|
3039
3069
|
const NODE_META_COLOR = {
|
|
3040
3070
|
get: 'success',
|
|
@@ -3101,7 +3131,7 @@ function isExternalLink(item) {
|
|
|
3101
3131
|
|
|
3102
3132
|
const ActiveIdContext = React.createContext(undefined);
|
|
3103
3133
|
const LinkContext = React.createContext(undefined);
|
|
3104
|
-
const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, onLinkClick }) => {
|
|
3134
|
+
const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefault, externalScrollbar = false, isInResponsiveMode = false, onLinkClick, }) => {
|
|
3105
3135
|
const container = React.useRef(null);
|
|
3106
3136
|
const child = React.useRef(null);
|
|
3107
3137
|
const firstRender = useFirstRender();
|
|
@@ -3118,35 +3148,35 @@ const TableOfContents = React.memo(({ tree, activeId, Link, maxDepthOpenByDefaul
|
|
|
3118
3148
|
}
|
|
3119
3149
|
}, 0);
|
|
3120
3150
|
}, [activeId]);
|
|
3121
|
-
return (React.createElement(Box, { ref: container, w: "full", bg:
|
|
3151
|
+
return (React.createElement(Box, { ref: container, w: "full", bg: isInResponsiveMode ? 'canvas' : 'canvas-100', overflowY: "auto" },
|
|
3122
3152
|
React.createElement(Box, { ref: child, my: 3 },
|
|
3123
3153
|
React.createElement(LinkContext.Provider, { value: Link },
|
|
3124
3154
|
React.createElement(ActiveIdContext.Provider, { value: activeId }, tree.map((item, key) => {
|
|
3125
3155
|
if (isDivider(item)) {
|
|
3126
|
-
return React.createElement(Divider, { key: key, item: item });
|
|
3156
|
+
return React.createElement(Divider, { key: key, item: item, isInResponsiveMode: isInResponsiveMode });
|
|
3127
3157
|
}
|
|
3128
|
-
return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick }));
|
|
3158
|
+
return (React.createElement(GroupItem, { key: key, item: item, depth: 0, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3129
3159
|
}))))));
|
|
3130
3160
|
});
|
|
3131
|
-
const Divider = React.memo(({ item }) => {
|
|
3132
|
-
return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize:
|
|
3161
|
+
const Divider = React.memo(({ item, isInResponsiveMode = false }) => {
|
|
3162
|
+
return (React.createElement(Box, { pl: 4, mb: 2, mt: 6, textTransform: "uppercase", fontSize: isInResponsiveMode ? 'lg' : 'sm', lineHeight: "relaxed", letterSpacing: "wide", fontWeight: "bold" }, item.title));
|
|
3133
3163
|
});
|
|
3134
|
-
const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, onLinkClick }) => {
|
|
3164
|
+
const GroupItem = React.memo(({ item, depth, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick }) => {
|
|
3135
3165
|
if (isExternalLink(item)) {
|
|
3136
3166
|
return (React.createElement(Box, { as: "a", href: item.url, target: "_blank", rel: "noopener noreferrer", display: "block" },
|
|
3137
|
-
React.createElement(Item, { depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
|
|
3167
|
+
React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, depth: depth, title: item.title, meta: React.createElement(Box, { as: Icon, icon: ['fas', 'external-link'] }) })));
|
|
3138
3168
|
}
|
|
3139
3169
|
else if (isGroup(item) || isNodeGroup(item)) {
|
|
3140
|
-
return React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick });
|
|
3170
|
+
return (React.createElement(Group, { depth: depth, item: item, maxDepthOpenByDefault: maxDepthOpenByDefault, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3141
3171
|
}
|
|
3142
3172
|
else if (isNode(item)) {
|
|
3143
|
-
return (React.createElement(Node, { depth: depth, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
|
|
3173
|
+
return (React.createElement(Node, { depth: depth, isInResponsiveMode: isInResponsiveMode, item: item, onLinkClick: onLinkClick, meta: item.meta ? (React.createElement(Box, { color: NODE_META_COLOR[item.meta], textTransform: "uppercase", fontWeight: "medium" }, item.meta)) : (NODE_TYPE_META_ICON[item.type] && (React.createElement(Flex, { alignItems: "center" },
|
|
3144
3174
|
item.version && React.createElement(Version, { value: item.version }),
|
|
3145
|
-
React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] })))) }));
|
|
3175
|
+
item.type !== 'model' && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_META_ICON[item.type] }))))) }));
|
|
3146
3176
|
}
|
|
3147
3177
|
return null;
|
|
3148
3178
|
});
|
|
3149
|
-
const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = () => { } }) => {
|
|
3179
|
+
const Group = React.memo(({ depth, item, maxDepthOpenByDefault, isInResponsiveMode, onLinkClick = () => { } }) => {
|
|
3150
3180
|
const activeId = React.useContext(ActiveIdContext);
|
|
3151
3181
|
const [isOpen, setIsOpen] = React.useState(() => isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault));
|
|
3152
3182
|
const hasActive = !!activeId && hasActiveItem(item.items, activeId);
|
|
@@ -3174,25 +3204,28 @@ const Group = React.memo(({ depth, item, maxDepthOpenByDefault, onLinkClick = ()
|
|
|
3174
3204
|
const showAsActive = hasActive && !isOpen;
|
|
3175
3205
|
let elem;
|
|
3176
3206
|
if (isNodeGroup(item)) {
|
|
3177
|
-
elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick }));
|
|
3207
|
+
elem = (React.createElement(Node, { depth: depth, item: item, meta: meta, showAsActive: showAsActive, onClick: handleClick, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3178
3208
|
}
|
|
3179
3209
|
else {
|
|
3180
|
-
elem = React.createElement(Item, { title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive });
|
|
3210
|
+
elem = (React.createElement(Item, { isInResponsiveMode: isInResponsiveMode, title: item.title, meta: meta, onClick: handleClick, depth: depth, isActive: showAsActive, icon: NODE_TITLE_ICON[item.title] && (React.createElement(Box, { as: Icon, color: NODE_TITLE_ICON_COLOR[item.title], icon: NODE_TITLE_ICON[item.title] })) }));
|
|
3181
3211
|
}
|
|
3182
3212
|
return (React.createElement(React.Fragment, null,
|
|
3183
3213
|
elem,
|
|
3184
3214
|
isOpen &&
|
|
3185
3215
|
item.items.map((groupItem, key) => {
|
|
3186
|
-
return React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick });
|
|
3216
|
+
return (React.createElement(GroupItem, { key: key, item: groupItem, depth: depth + 1, onLinkClick: onLinkClick, isInResponsiveMode: isInResponsiveMode }));
|
|
3187
3217
|
})));
|
|
3188
3218
|
});
|
|
3189
|
-
const Item = React.memo(({ depth, isActive, id, title, meta, icon, onClick }) => {
|
|
3190
|
-
return (React.createElement(Flex, { id: id, bg: {
|
|
3219
|
+
const Item = React.memo(({ depth, isActive, id, title, meta, icon, isInResponsiveMode, onClick }) => {
|
|
3220
|
+
return (React.createElement(Flex, { id: id, bg: {
|
|
3221
|
+
default: isInResponsiveMode ? 'canvas' : isActive ? 'primary-tint' : 'canvas-100',
|
|
3222
|
+
hover: isActive ? undefined : 'canvas-200',
|
|
3223
|
+
}, cursor: "pointer", pl: 4 + depth * 4, pr: 4, h: isInResponsiveMode ? 'lg' : 'md', align: "center", userSelect: "none", onClick: onClick, title: title },
|
|
3191
3224
|
icon,
|
|
3192
|
-
React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate" }, title),
|
|
3193
|
-
React.createElement(Flex, { alignItems: "center", fontSize:
|
|
3225
|
+
React.createElement(Box, { alignItems: "center", flex: 1, mr: meta ? 1.5 : undefined, ml: icon && 1.5, textOverflow: "truncate", fontSize: isInResponsiveMode ? 'lg' : 'base' }, title),
|
|
3226
|
+
React.createElement(Flex, { alignItems: "center", fontSize: isInResponsiveMode ? 'base' : 'xs' }, meta)));
|
|
3194
3227
|
});
|
|
3195
|
-
const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick = () => { } }) => {
|
|
3228
|
+
const Node = React.memo(({ item, depth, meta, showAsActive, isInResponsiveMode, onClick, onLinkClick = () => { } }) => {
|
|
3196
3229
|
const activeId = React.useContext(ActiveIdContext);
|
|
3197
3230
|
const isActive = activeId === item.slug || activeId === item.id;
|
|
3198
3231
|
const LinkComponent = React.useContext(LinkContext);
|
|
@@ -3209,7 +3242,7 @@ const Node = React.memo(({ item, depth, meta, showAsActive, onClick, onLinkClick
|
|
|
3209
3242
|
}
|
|
3210
3243
|
};
|
|
3211
3244
|
return (React.createElement(Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
|
|
3212
|
-
React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, onClick: handleClick })));
|
|
3245
|
+
React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive || showAsActive, depth: depth, title: item.title, icon: NODE_TYPE_TITLE_ICON[item.type] && (React.createElement(Box, { as: Icon, color: NODE_TYPE_ICON_COLOR[item.type], icon: NODE_TYPE_TITLE_ICON[item.type] })), meta: meta, isInResponsiveMode: isInResponsiveMode, onClick: handleClick })));
|
|
3213
3246
|
});
|
|
3214
3247
|
const Version = ({ value }) => {
|
|
3215
3248
|
return (React.createElement(Box, { mr: 2 },
|