@stoplight/elements-core 7.5.14 → 7.5.15

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.
@@ -1,4 +1,4 @@
1
1
  import { IHttpOperation } from '@stoplight/types';
2
2
  export declare const singleSecurityOperation: IHttpOperation;
3
- export declare const emptySecurityOperation: IHttpOperation;
4
- export declare const duplicatedSecurityScheme: IHttpOperation;
3
+ export declare const emptySecurityOperation: any;
4
+ export declare const duplicatedSecurityScheme: any;
@@ -1,5 +1,5 @@
1
- import { IServer } from '@stoplight/types';
2
1
  import * as React from 'react';
2
+ import { IServer } from '../../../utils/http-spec/IServer';
3
3
  interface ServerInfoProps {
4
4
  servers: IServer[];
5
5
  mockUrl?: string;
@@ -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' | 'examples' | 'schema' | 'required'>;
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,4 +1,4 @@
1
- import { IServer } from '@stoplight/types';
1
+ import type { IServer } from '../../../utils/http-spec/IServer';
2
2
  export declare type ServersDropdownProps = {
3
3
  servers: IServer[];
4
4
  };
@@ -1,5 +1,6 @@
1
- import { Dictionary, IHttpOperation, IMediaTypeContent, IServer } from '@stoplight/types';
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 '@stoplight/types';
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',
@@ -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
  },
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',
@@ -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
  },
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',
@@ -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
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stoplight/elements-core",
3
- "version": "7.5.14",
3
+ "version": "7.5.15",
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": ">=12"
20
+ "node": ">=14.13"
21
21
  },
22
22
  "peerDependencies": {
23
23
  "react": ">=16.8",
@@ -25,7 +25,7 @@
25
25
  },
26
26
  "dependencies": {
27
27
  "@fortawesome/free-solid-svg-icons": "^5.14.0",
28
- "@stoplight/json": "^3.10.0",
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",
@@ -35,7 +35,7 @@
35
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": "^12.0.0",
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
- "require": "./index.js",
57
- "import": "./index.mjs"
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;