@stoplight/elements-core 7.5.13 → 7.5.16
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/__fixtures__/operations/securedOperation.d.ts +2 -2
- package/components/Docs/HttpService/ServerInfo.d.ts +1 -1
- package/components/TryIt/Parameters/parameter-utils.d.ts +4 -2
- package/components/TryIt/Servers/ServersDropdown.d.ts +1 -1
- package/components/TryIt/build-request.d.ts +2 -1
- package/components/TryIt/chosenServer.d.ts +1 -1
- package/index.esm.js +20 -5
- package/index.js +20 -5
- package/index.mjs +20 -5
- package/package.json +12 -10
- package/utils/http-spec/IServer.d.ts +2 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { IHttpOperation } from '@stoplight/types';
|
|
2
2
|
export declare const singleSecurityOperation: IHttpOperation;
|
|
3
|
-
export declare const emptySecurityOperation:
|
|
4
|
-
export declare const duplicatedSecurityScheme:
|
|
3
|
+
export declare const emptySecurityOperation: any;
|
|
4
|
+
export declare const duplicatedSecurityScheme: any;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { IHttpParam } from '@stoplight/types';
|
|
1
|
+
import type { IHttpParam, INodeExample, INodeExternalExample } from '@stoplight/types';
|
|
2
2
|
import { JSONSchema7Definition } from 'json-schema';
|
|
3
|
-
export declare type ParameterSpec = Pick<IHttpParam, 'name' | '
|
|
3
|
+
export declare type ParameterSpec = Pick<IHttpParam, 'name' | 'schema' | 'required'> & {
|
|
4
|
+
examples?: (Omit<INodeExample, 'id'> | Omit<INodeExternalExample, 'id'>)[];
|
|
5
|
+
};
|
|
4
6
|
export declare function parameterOptions(parameter: ParameterSpec): ({
|
|
5
7
|
value: string | number;
|
|
6
8
|
} | {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Dictionary, IHttpOperation, IMediaTypeContent
|
|
1
|
+
import { Dictionary, IHttpOperation, IMediaTypeContent } from '@stoplight/types';
|
|
2
2
|
import { Request as HarRequest } from 'har-format';
|
|
3
|
+
import { IServer } from '../../utils/http-spec/IServer';
|
|
3
4
|
import { HttpSecuritySchemeWithValues } from './Auth/authentication-utils';
|
|
4
5
|
import { BodyParameterValues } from './Body/request-body-utils';
|
|
5
6
|
import { MockData } from './Mocking/mocking-utils';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IServer } from '
|
|
1
|
+
import type { IServer } from '../../utils/http-spec/IServer';
|
|
2
2
|
export declare const chosenServerAtom: import("jotai").Atom<IServer | null | undefined> & {
|
|
3
3
|
write: (get: {
|
|
4
4
|
<Value>(atom: import("jotai").Atom<Value | Promise<Value>>): Value;
|
package/index.esm.js
CHANGED
|
@@ -158,6 +158,7 @@ const parserMap = {
|
|
|
158
158
|
[NodeType.Generic]: parseUnknown,
|
|
159
159
|
[NodeType.TableOfContents]: parseUnknown,
|
|
160
160
|
[NodeType.SpectralRuleset]: parseUnknown,
|
|
161
|
+
[NodeType.Styleguide]: parseUnknown,
|
|
161
162
|
[NodeType.Unknown]: parseUnknown,
|
|
162
163
|
};
|
|
163
164
|
function parseArticleData(rawData) {
|
|
@@ -235,6 +236,7 @@ const NodeTypeColors = {
|
|
|
235
236
|
unknown: '',
|
|
236
237
|
table_of_contents: '',
|
|
237
238
|
spectral_ruleset: '',
|
|
239
|
+
styleguide: '',
|
|
238
240
|
};
|
|
239
241
|
const NodeTypePrettyName = {
|
|
240
242
|
http_operation: 'Endpoint',
|
|
@@ -246,6 +248,7 @@ const NodeTypePrettyName = {
|
|
|
246
248
|
unknown: '',
|
|
247
249
|
table_of_contents: '',
|
|
248
250
|
spectral_ruleset: '',
|
|
251
|
+
styleguide: '',
|
|
249
252
|
};
|
|
250
253
|
const NodeTypeIconDefs = {
|
|
251
254
|
http_operation: faCrosshairs,
|
|
@@ -257,6 +260,7 @@ const NodeTypeIconDefs = {
|
|
|
257
260
|
generic: faQuestionCircle,
|
|
258
261
|
table_of_contents: faQuestionCircle,
|
|
259
262
|
spectral_ruleset: faQuestionCircle,
|
|
263
|
+
styleguide: faQuestionCircle,
|
|
260
264
|
};
|
|
261
265
|
const HttpMethodColors = {
|
|
262
266
|
get: 'success',
|
|
@@ -1603,7 +1607,7 @@ const ResponseError = ({ state: { error } }) => (React.createElement(Panel, { de
|
|
|
1603
1607
|
React.createElement(Panel.Content, null, isNetworkError(error) ? React.createElement(NetworkErrorMessage, null) : React.createElement("p", null, error.message))));
|
|
1604
1608
|
const NetworkErrorMessage = () => (React.createElement(React.Fragment, null,
|
|
1605
1609
|
React.createElement("p", { className: "sl-pb-2" },
|
|
1606
|
-
React.createElement("strong", null, "Network Error
|
|
1610
|
+
React.createElement("strong", null, "Network Error occurred.")),
|
|
1607
1611
|
React.createElement("p", { className: "sl-pb-2" }, "1. Double check that your computer is connected to the internet."),
|
|
1608
1612
|
React.createElement("p", { className: "sl-pb-2" }, "2. Make sure the API is actually running and available under the specified URL."),
|
|
1609
1613
|
React.createElement("p", null,
|
|
@@ -2410,29 +2414,34 @@ function parseHttpRequest(data) {
|
|
|
2410
2414
|
id: '?http-operation-id?',
|
|
2411
2415
|
method: data.method,
|
|
2412
2416
|
path: uri.is('absolute') ? uri.path() : data.url,
|
|
2413
|
-
servers: [{ url: uri.is('absolute') ? uri.origin() : data.baseUrl || '' }],
|
|
2417
|
+
servers: [{ id: `?http-server-${uri.href()}?`, url: uri.is('absolute') ? uri.origin() : data.baseUrl || '' }],
|
|
2414
2418
|
request: Object.assign({ query: Object.entries(data.query || {}).map(([key, value]) => {
|
|
2415
2419
|
const defaultVal = Array.isArray(value) ? value[0] : value;
|
|
2416
2420
|
return {
|
|
2421
|
+
id: `?http-query-${key}-id?`,
|
|
2417
2422
|
name: key,
|
|
2418
2423
|
style: HttpParamStyles.Form,
|
|
2419
2424
|
schema: { default: defaultVal },
|
|
2420
2425
|
required: isHttpRequestParamRequired(defaultVal),
|
|
2421
2426
|
};
|
|
2422
2427
|
}), headers: Object.entries(data.headers || {}).map(([key, value]) => ({
|
|
2428
|
+
id: `?http-header-${key}-id?`,
|
|
2423
2429
|
name: key,
|
|
2424
2430
|
style: HttpParamStyles.Simple,
|
|
2425
2431
|
schema: { default: value },
|
|
2426
2432
|
required: isHttpRequestParamRequired(value),
|
|
2427
2433
|
})), path: pathParam === null || pathParam === void 0 ? void 0 : pathParam.map(name => ({
|
|
2434
|
+
id: `?http-param-${name}-id?`,
|
|
2428
2435
|
name,
|
|
2429
2436
|
style: HttpParamStyles.Simple,
|
|
2430
2437
|
required: true,
|
|
2431
2438
|
})) }, (data.body
|
|
2432
2439
|
? {
|
|
2433
2440
|
body: {
|
|
2441
|
+
id: '?http-request-body?',
|
|
2434
2442
|
contents: [
|
|
2435
2443
|
{
|
|
2444
|
+
id: '?http-request-body-media?',
|
|
2436
2445
|
mediaType: 'application/json',
|
|
2437
2446
|
schema: { default: data.body },
|
|
2438
2447
|
},
|
|
@@ -2483,10 +2492,16 @@ function getHtmlIdFromItemId(id) {
|
|
|
2483
2492
|
}
|
|
2484
2493
|
function isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault = 0) {
|
|
2485
2494
|
return (depth < maxDepthOpenByDefault ||
|
|
2486
|
-
(activeId &&
|
|
2495
|
+
(activeId &&
|
|
2496
|
+
(('slug' in item && activeId === item.slug) ||
|
|
2497
|
+
('id' in item && activeId === item.id) ||
|
|
2498
|
+
hasActiveItem(item.items, activeId))));
|
|
2487
2499
|
}
|
|
2488
2500
|
function hasActiveItem(items, activeId) {
|
|
2489
2501
|
return items.some(item => {
|
|
2502
|
+
if ('slug' in item && activeId === item.slug) {
|
|
2503
|
+
return true;
|
|
2504
|
+
}
|
|
2490
2505
|
if ('id' in item && activeId === item.id) {
|
|
2491
2506
|
return true;
|
|
2492
2507
|
}
|
|
@@ -2607,7 +2622,7 @@ const Item = React.memo(({ depth, isActive, id, title, meta, icon, onClick }) =>
|
|
|
2607
2622
|
});
|
|
2608
2623
|
const Node = React.memo(({ item, depth, meta, onClick, onLinkClick = () => { } }) => {
|
|
2609
2624
|
const activeId = React.useContext(ActiveIdContext);
|
|
2610
|
-
const isActive = activeId === item.id;
|
|
2625
|
+
const isActive = activeId === item.slug || activeId === item.id;
|
|
2611
2626
|
const LinkComponent = React.useContext(LinkContext);
|
|
2612
2627
|
const handleClick = (e) => {
|
|
2613
2628
|
if (isActive) {
|
|
@@ -2622,7 +2637,7 @@ const Node = React.memo(({ item, depth, meta, onClick, onLinkClick = () => { } }
|
|
|
2622
2637
|
}
|
|
2623
2638
|
};
|
|
2624
2639
|
return (React.createElement(Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
|
|
2625
|
-
React.createElement(Item, { id: getHtmlIdFromItemId(item.id), isActive: isActive, 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 })));
|
|
2640
|
+
React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive, 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 })));
|
|
2626
2641
|
});
|
|
2627
2642
|
const Version = ({ value }) => {
|
|
2628
2643
|
return (React.createElement(Box, { mr: 2 },
|
package/index.js
CHANGED
|
@@ -212,6 +212,7 @@ const parserMap = {
|
|
|
212
212
|
[types.NodeType.Generic]: parseUnknown,
|
|
213
213
|
[types.NodeType.TableOfContents]: parseUnknown,
|
|
214
214
|
[types.NodeType.SpectralRuleset]: parseUnknown,
|
|
215
|
+
[types.NodeType.Styleguide]: parseUnknown,
|
|
215
216
|
[types.NodeType.Unknown]: parseUnknown,
|
|
216
217
|
};
|
|
217
218
|
function parseArticleData(rawData) {
|
|
@@ -289,6 +290,7 @@ const NodeTypeColors = {
|
|
|
289
290
|
unknown: '',
|
|
290
291
|
table_of_contents: '',
|
|
291
292
|
spectral_ruleset: '',
|
|
293
|
+
styleguide: '',
|
|
292
294
|
};
|
|
293
295
|
const NodeTypePrettyName = {
|
|
294
296
|
http_operation: 'Endpoint',
|
|
@@ -300,6 +302,7 @@ const NodeTypePrettyName = {
|
|
|
300
302
|
unknown: '',
|
|
301
303
|
table_of_contents: '',
|
|
302
304
|
spectral_ruleset: '',
|
|
305
|
+
styleguide: '',
|
|
303
306
|
};
|
|
304
307
|
const NodeTypeIconDefs = {
|
|
305
308
|
http_operation: freeSolidSvgIcons.faCrosshairs,
|
|
@@ -311,6 +314,7 @@ const NodeTypeIconDefs = {
|
|
|
311
314
|
generic: freeSolidSvgIcons.faQuestionCircle,
|
|
312
315
|
table_of_contents: freeSolidSvgIcons.faQuestionCircle,
|
|
313
316
|
spectral_ruleset: freeSolidSvgIcons.faQuestionCircle,
|
|
317
|
+
styleguide: freeSolidSvgIcons.faQuestionCircle,
|
|
314
318
|
};
|
|
315
319
|
const HttpMethodColors = {
|
|
316
320
|
get: 'success',
|
|
@@ -1657,7 +1661,7 @@ const ResponseError = ({ state: { error } }) => (React__namespace.createElement(
|
|
|
1657
1661
|
React__namespace.createElement(mosaic.Panel.Content, null, isNetworkError(error) ? React__namespace.createElement(NetworkErrorMessage, null) : React__namespace.createElement("p", null, error.message))));
|
|
1658
1662
|
const NetworkErrorMessage = () => (React__namespace.createElement(React__namespace.Fragment, null,
|
|
1659
1663
|
React__namespace.createElement("p", { className: "sl-pb-2" },
|
|
1660
|
-
React__namespace.createElement("strong", null, "Network Error
|
|
1664
|
+
React__namespace.createElement("strong", null, "Network Error occurred.")),
|
|
1661
1665
|
React__namespace.createElement("p", { className: "sl-pb-2" }, "1. Double check that your computer is connected to the internet."),
|
|
1662
1666
|
React__namespace.createElement("p", { className: "sl-pb-2" }, "2. Make sure the API is actually running and available under the specified URL."),
|
|
1663
1667
|
React__namespace.createElement("p", null,
|
|
@@ -2464,29 +2468,34 @@ function parseHttpRequest(data) {
|
|
|
2464
2468
|
id: '?http-operation-id?',
|
|
2465
2469
|
method: data.method,
|
|
2466
2470
|
path: uri.is('absolute') ? uri.path() : data.url,
|
|
2467
|
-
servers: [{ url: uri.is('absolute') ? uri.origin() : data.baseUrl || '' }],
|
|
2471
|
+
servers: [{ id: `?http-server-${uri.href()}?`, url: uri.is('absolute') ? uri.origin() : data.baseUrl || '' }],
|
|
2468
2472
|
request: Object.assign({ query: Object.entries(data.query || {}).map(([key, value]) => {
|
|
2469
2473
|
const defaultVal = Array.isArray(value) ? value[0] : value;
|
|
2470
2474
|
return {
|
|
2475
|
+
id: `?http-query-${key}-id?`,
|
|
2471
2476
|
name: key,
|
|
2472
2477
|
style: types.HttpParamStyles.Form,
|
|
2473
2478
|
schema: { default: defaultVal },
|
|
2474
2479
|
required: isHttpRequestParamRequired(defaultVal),
|
|
2475
2480
|
};
|
|
2476
2481
|
}), headers: Object.entries(data.headers || {}).map(([key, value]) => ({
|
|
2482
|
+
id: `?http-header-${key}-id?`,
|
|
2477
2483
|
name: key,
|
|
2478
2484
|
style: types.HttpParamStyles.Simple,
|
|
2479
2485
|
schema: { default: value },
|
|
2480
2486
|
required: isHttpRequestParamRequired(value),
|
|
2481
2487
|
})), path: pathParam === null || pathParam === void 0 ? void 0 : pathParam.map(name => ({
|
|
2488
|
+
id: `?http-param-${name}-id?`,
|
|
2482
2489
|
name,
|
|
2483
2490
|
style: types.HttpParamStyles.Simple,
|
|
2484
2491
|
required: true,
|
|
2485
2492
|
})) }, (data.body
|
|
2486
2493
|
? {
|
|
2487
2494
|
body: {
|
|
2495
|
+
id: '?http-request-body?',
|
|
2488
2496
|
contents: [
|
|
2489
2497
|
{
|
|
2498
|
+
id: '?http-request-body-media?',
|
|
2490
2499
|
mediaType: 'application/json',
|
|
2491
2500
|
schema: { default: data.body },
|
|
2492
2501
|
},
|
|
@@ -2537,10 +2546,16 @@ function getHtmlIdFromItemId(id) {
|
|
|
2537
2546
|
}
|
|
2538
2547
|
function isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault = 0) {
|
|
2539
2548
|
return (depth < maxDepthOpenByDefault ||
|
|
2540
|
-
(activeId &&
|
|
2549
|
+
(activeId &&
|
|
2550
|
+
(('slug' in item && activeId === item.slug) ||
|
|
2551
|
+
('id' in item && activeId === item.id) ||
|
|
2552
|
+
hasActiveItem(item.items, activeId))));
|
|
2541
2553
|
}
|
|
2542
2554
|
function hasActiveItem(items, activeId) {
|
|
2543
2555
|
return items.some(item => {
|
|
2556
|
+
if ('slug' in item && activeId === item.slug) {
|
|
2557
|
+
return true;
|
|
2558
|
+
}
|
|
2544
2559
|
if ('id' in item && activeId === item.id) {
|
|
2545
2560
|
return true;
|
|
2546
2561
|
}
|
|
@@ -2661,7 +2676,7 @@ const Item = React__namespace.memo(({ depth, isActive, id, title, meta, icon, on
|
|
|
2661
2676
|
});
|
|
2662
2677
|
const Node = React__namespace.memo(({ item, depth, meta, onClick, onLinkClick = () => { } }) => {
|
|
2663
2678
|
const activeId = React__namespace.useContext(ActiveIdContext);
|
|
2664
|
-
const isActive = activeId === item.id;
|
|
2679
|
+
const isActive = activeId === item.slug || activeId === item.id;
|
|
2665
2680
|
const LinkComponent = React__namespace.useContext(LinkContext);
|
|
2666
2681
|
const handleClick = (e) => {
|
|
2667
2682
|
if (isActive) {
|
|
@@ -2676,7 +2691,7 @@ const Node = React__namespace.memo(({ item, depth, meta, onClick, onLinkClick =
|
|
|
2676
2691
|
}
|
|
2677
2692
|
};
|
|
2678
2693
|
return (React__namespace.createElement(mosaic.Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
|
|
2679
|
-
React__namespace.createElement(Item, { id: getHtmlIdFromItemId(item.id), isActive: isActive, 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 })));
|
|
2694
|
+
React__namespace.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive, 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 })));
|
|
2680
2695
|
});
|
|
2681
2696
|
const Version = ({ value }) => {
|
|
2682
2697
|
return (React__namespace.createElement(mosaic.Box, { mr: 2 },
|
package/index.mjs
CHANGED
|
@@ -158,6 +158,7 @@ const parserMap = {
|
|
|
158
158
|
[NodeType.Generic]: parseUnknown,
|
|
159
159
|
[NodeType.TableOfContents]: parseUnknown,
|
|
160
160
|
[NodeType.SpectralRuleset]: parseUnknown,
|
|
161
|
+
[NodeType.Styleguide]: parseUnknown,
|
|
161
162
|
[NodeType.Unknown]: parseUnknown,
|
|
162
163
|
};
|
|
163
164
|
function parseArticleData(rawData) {
|
|
@@ -235,6 +236,7 @@ const NodeTypeColors = {
|
|
|
235
236
|
unknown: '',
|
|
236
237
|
table_of_contents: '',
|
|
237
238
|
spectral_ruleset: '',
|
|
239
|
+
styleguide: '',
|
|
238
240
|
};
|
|
239
241
|
const NodeTypePrettyName = {
|
|
240
242
|
http_operation: 'Endpoint',
|
|
@@ -246,6 +248,7 @@ const NodeTypePrettyName = {
|
|
|
246
248
|
unknown: '',
|
|
247
249
|
table_of_contents: '',
|
|
248
250
|
spectral_ruleset: '',
|
|
251
|
+
styleguide: '',
|
|
249
252
|
};
|
|
250
253
|
const NodeTypeIconDefs = {
|
|
251
254
|
http_operation: faCrosshairs,
|
|
@@ -257,6 +260,7 @@ const NodeTypeIconDefs = {
|
|
|
257
260
|
generic: faQuestionCircle,
|
|
258
261
|
table_of_contents: faQuestionCircle,
|
|
259
262
|
spectral_ruleset: faQuestionCircle,
|
|
263
|
+
styleguide: faQuestionCircle,
|
|
260
264
|
};
|
|
261
265
|
const HttpMethodColors = {
|
|
262
266
|
get: 'success',
|
|
@@ -1603,7 +1607,7 @@ const ResponseError = ({ state: { error } }) => (React.createElement(Panel, { de
|
|
|
1603
1607
|
React.createElement(Panel.Content, null, isNetworkError(error) ? React.createElement(NetworkErrorMessage, null) : React.createElement("p", null, error.message))));
|
|
1604
1608
|
const NetworkErrorMessage = () => (React.createElement(React.Fragment, null,
|
|
1605
1609
|
React.createElement("p", { className: "sl-pb-2" },
|
|
1606
|
-
React.createElement("strong", null, "Network Error
|
|
1610
|
+
React.createElement("strong", null, "Network Error occurred.")),
|
|
1607
1611
|
React.createElement("p", { className: "sl-pb-2" }, "1. Double check that your computer is connected to the internet."),
|
|
1608
1612
|
React.createElement("p", { className: "sl-pb-2" }, "2. Make sure the API is actually running and available under the specified URL."),
|
|
1609
1613
|
React.createElement("p", null,
|
|
@@ -2410,29 +2414,34 @@ function parseHttpRequest(data) {
|
|
|
2410
2414
|
id: '?http-operation-id?',
|
|
2411
2415
|
method: data.method,
|
|
2412
2416
|
path: uri.is('absolute') ? uri.path() : data.url,
|
|
2413
|
-
servers: [{ url: uri.is('absolute') ? uri.origin() : data.baseUrl || '' }],
|
|
2417
|
+
servers: [{ id: `?http-server-${uri.href()}?`, url: uri.is('absolute') ? uri.origin() : data.baseUrl || '' }],
|
|
2414
2418
|
request: Object.assign({ query: Object.entries(data.query || {}).map(([key, value]) => {
|
|
2415
2419
|
const defaultVal = Array.isArray(value) ? value[0] : value;
|
|
2416
2420
|
return {
|
|
2421
|
+
id: `?http-query-${key}-id?`,
|
|
2417
2422
|
name: key,
|
|
2418
2423
|
style: HttpParamStyles.Form,
|
|
2419
2424
|
schema: { default: defaultVal },
|
|
2420
2425
|
required: isHttpRequestParamRequired(defaultVal),
|
|
2421
2426
|
};
|
|
2422
2427
|
}), headers: Object.entries(data.headers || {}).map(([key, value]) => ({
|
|
2428
|
+
id: `?http-header-${key}-id?`,
|
|
2423
2429
|
name: key,
|
|
2424
2430
|
style: HttpParamStyles.Simple,
|
|
2425
2431
|
schema: { default: value },
|
|
2426
2432
|
required: isHttpRequestParamRequired(value),
|
|
2427
2433
|
})), path: pathParam === null || pathParam === void 0 ? void 0 : pathParam.map(name => ({
|
|
2434
|
+
id: `?http-param-${name}-id?`,
|
|
2428
2435
|
name,
|
|
2429
2436
|
style: HttpParamStyles.Simple,
|
|
2430
2437
|
required: true,
|
|
2431
2438
|
})) }, (data.body
|
|
2432
2439
|
? {
|
|
2433
2440
|
body: {
|
|
2441
|
+
id: '?http-request-body?',
|
|
2434
2442
|
contents: [
|
|
2435
2443
|
{
|
|
2444
|
+
id: '?http-request-body-media?',
|
|
2436
2445
|
mediaType: 'application/json',
|
|
2437
2446
|
schema: { default: data.body },
|
|
2438
2447
|
},
|
|
@@ -2483,10 +2492,16 @@ function getHtmlIdFromItemId(id) {
|
|
|
2483
2492
|
}
|
|
2484
2493
|
function isGroupOpenByDefault(depth, item, activeId, maxDepthOpenByDefault = 0) {
|
|
2485
2494
|
return (depth < maxDepthOpenByDefault ||
|
|
2486
|
-
(activeId &&
|
|
2495
|
+
(activeId &&
|
|
2496
|
+
(('slug' in item && activeId === item.slug) ||
|
|
2497
|
+
('id' in item && activeId === item.id) ||
|
|
2498
|
+
hasActiveItem(item.items, activeId))));
|
|
2487
2499
|
}
|
|
2488
2500
|
function hasActiveItem(items, activeId) {
|
|
2489
2501
|
return items.some(item => {
|
|
2502
|
+
if ('slug' in item && activeId === item.slug) {
|
|
2503
|
+
return true;
|
|
2504
|
+
}
|
|
2490
2505
|
if ('id' in item && activeId === item.id) {
|
|
2491
2506
|
return true;
|
|
2492
2507
|
}
|
|
@@ -2607,7 +2622,7 @@ const Item = React.memo(({ depth, isActive, id, title, meta, icon, onClick }) =>
|
|
|
2607
2622
|
});
|
|
2608
2623
|
const Node = React.memo(({ item, depth, meta, onClick, onLinkClick = () => { } }) => {
|
|
2609
2624
|
const activeId = React.useContext(ActiveIdContext);
|
|
2610
|
-
const isActive = activeId === item.id;
|
|
2625
|
+
const isActive = activeId === item.slug || activeId === item.id;
|
|
2611
2626
|
const LinkComponent = React.useContext(LinkContext);
|
|
2612
2627
|
const handleClick = (e) => {
|
|
2613
2628
|
if (isActive) {
|
|
@@ -2622,7 +2637,7 @@ const Node = React.memo(({ item, depth, meta, onClick, onLinkClick = () => { } }
|
|
|
2622
2637
|
}
|
|
2623
2638
|
};
|
|
2624
2639
|
return (React.createElement(Box, { as: LinkComponent, to: item.slug, display: "block", textDecoration: "no-underline", className: "ElementsTableOfContentsItem" },
|
|
2625
|
-
React.createElement(Item, { id: getHtmlIdFromItemId(item.id), isActive: isActive, 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 })));
|
|
2640
|
+
React.createElement(Item, { id: getHtmlIdFromItemId(item.slug || item.id), isActive: isActive, 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 })));
|
|
2626
2641
|
});
|
|
2627
2642
|
const Version = ({ value }) => {
|
|
2628
2643
|
return (React.createElement(Box, { mr: 2 },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stoplight/elements-core",
|
|
3
|
-
"version": "7.5.
|
|
3
|
+
"version": "7.5.16",
|
|
4
4
|
"main": "./index.js",
|
|
5
5
|
"sideEffects": [
|
|
6
6
|
"web-components.min.js",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
},
|
|
18
18
|
"license": "Apache-2.0",
|
|
19
19
|
"engines": {
|
|
20
|
-
"node": ">=
|
|
20
|
+
"node": ">=14.13"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
23
|
"react": ">=16.8",
|
|
@@ -25,17 +25,17 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@fortawesome/free-solid-svg-icons": "^5.14.0",
|
|
28
|
-
"@stoplight/json": "^3.
|
|
28
|
+
"@stoplight/json": "^3.18.0",
|
|
29
29
|
"@stoplight/json-schema-ref-parser": "^9.0.5",
|
|
30
30
|
"@stoplight/json-schema-sampler": "0.2.2",
|
|
31
31
|
"@stoplight/json-schema-viewer": "^4.5.0",
|
|
32
32
|
"@stoplight/markdown-viewer": "^5.4.2",
|
|
33
|
-
"@stoplight/mosaic": "^1.
|
|
34
|
-
"@stoplight/mosaic-code-editor": "^1.
|
|
35
|
-
"@stoplight/mosaic-code-viewer": "^1.
|
|
33
|
+
"@stoplight/mosaic": "^1.16.2",
|
|
34
|
+
"@stoplight/mosaic-code-editor": "^1.16.2",
|
|
35
|
+
"@stoplight/mosaic-code-viewer": "^1.16.2",
|
|
36
36
|
"@stoplight/path": "^1.3.2",
|
|
37
37
|
"@stoplight/react-error-boundary": "^2.0.0",
|
|
38
|
-
"@stoplight/types": "^
|
|
38
|
+
"@stoplight/types": "^13.0.0",
|
|
39
39
|
"@stoplight/yaml": "^4.2.2",
|
|
40
40
|
"classnames": "^2.2.6",
|
|
41
41
|
"httpsnippet": "^1.24.0",
|
|
@@ -52,11 +52,13 @@
|
|
|
52
52
|
"util": "^0.12.4",
|
|
53
53
|
"xml-formatter": "^2.4.0"
|
|
54
54
|
},
|
|
55
|
+
"type": "commonjs",
|
|
55
56
|
"exports": {
|
|
56
|
-
"
|
|
57
|
-
|
|
57
|
+
".": {
|
|
58
|
+
"require": "./index.js",
|
|
59
|
+
"import": "./index.mjs"
|
|
60
|
+
}
|
|
58
61
|
},
|
|
59
62
|
"typings": "index.d.ts",
|
|
60
|
-
"type": "commonjs",
|
|
61
63
|
"module": "./index.esm.js"
|
|
62
64
|
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { IServer } from '@stoplight/types';
|
|
1
|
+
import { IServer as _IServer } from '@stoplight/types';
|
|
2
|
+
export declare type IServer = Omit<_IServer, 'id'>;
|
|
2
3
|
export declare const getServersToDisplay: (originalServers: IServer[], mockUrl?: string | undefined) => IServer[];
|
|
3
4
|
export declare const getServerUrlWithDefaultValues: (server: IServer) => string | null;
|