@scalar/api-reference 1.25.102 → 1.25.104

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.
Files changed (99) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/dist/blocks/constants.d.ts +9 -0
  3. package/dist/blocks/constants.d.ts.map +1 -0
  4. package/dist/blocks/constants.js +8 -0
  5. package/dist/blocks/helpers/getPointer.d.ts +22 -0
  6. package/dist/blocks/helpers/getPointer.d.ts.map +1 -0
  7. package/dist/blocks/helpers/getPointer.js +12 -0
  8. package/dist/blocks/hooks/useBlockProps.d.ts +32 -0
  9. package/dist/blocks/hooks/useBlockProps.d.ts.map +1 -0
  10. package/dist/blocks/hooks/useBlockProps.js +28 -0
  11. package/dist/browser/standalone.js +12846 -12739
  12. package/dist/browser/webpack-stats.json +1 -1
  13. package/dist/components/ApiReference.vue.js +31 -31
  14. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  15. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  16. package/dist/components/ApiReferenceLayout.vue2.js +2 -1
  17. package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
  18. package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
  19. package/dist/components/Content/Introduction/Introduction.vue2.js +84 -70
  20. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -0
  21. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  22. package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
  23. package/dist/components/Content/Schema/SchemaProperty.vue2.js +118 -111
  24. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  25. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +3 -3
  26. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +91 -77
  27. package/dist/components/Content/Schema/helpers/formatExample.d.ts +5 -0
  28. package/dist/components/Content/Schema/helpers/formatExample.d.ts.map +1 -0
  29. package/dist/components/Content/Schema/helpers/formatExample.js +6 -0
  30. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts +9 -0
  31. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts.map +1 -0
  32. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.js +20 -0
  33. package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -1
  34. package/dist/components/HttpMethod/HttpMethod.vue.d.ts.map +1 -1
  35. package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
  36. package/dist/components/Layouts/ClassicLayout.vue.js +30 -27
  37. package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
  38. package/dist/components/Layouts/ModernLayout.vue.js +2 -2
  39. package/dist/components/Layouts/ModernLayout.vue2.js +55 -50
  40. package/dist/features/ApiClientModal/useApiClient.d.ts +336 -254
  41. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  42. package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -1
  43. package/dist/features/DownloadLink/DownloadLink.vue.js +2 -2
  44. package/dist/features/DownloadLink/DownloadLink.vue2.js +10 -3
  45. package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
  46. package/dist/features/Operation/Operation.vue.js +37 -26
  47. package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
  48. package/dist/features/Operation/components/OperationResponses.vue.js +8 -7
  49. package/dist/features/Operation/components/ParameterList.vue.d.ts +2 -0
  50. package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
  51. package/dist/features/Operation/components/ParameterList.vue.js +2 -2
  52. package/dist/features/Operation/components/ParameterList.vue2.js +18 -16
  53. package/dist/features/Operation/components/ParameterListItem.vue.d.ts +2 -0
  54. package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
  55. package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
  56. package/dist/features/Operation/components/ParameterListItem.vue2.js +27 -25
  57. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -0
  58. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  59. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  60. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +108 -101
  61. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -0
  62. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  63. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  64. package/dist/features/Operation/layouts/ModernLayout.vue2.js +54 -50
  65. package/dist/helpers/get-request.d.ts +2 -0
  66. package/dist/helpers/get-request.d.ts.map +1 -1
  67. package/dist/helpers/parse.d.ts.map +1 -1
  68. package/dist/helpers/parse.js +88 -68
  69. package/dist/index.d.ts +0 -1
  70. package/dist/index.d.ts.map +1 -1
  71. package/dist/index.js +79 -83
  72. package/dist/style.css +1 -1
  73. package/package.json +11 -12
  74. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.d.ts +0 -10
  75. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.d.ts.map +0 -1
  76. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue.js +0 -7
  77. package/dist/components/DarkModeToggle/DarkModeIconToggle.vue2.js +0 -30
  78. package/dist/components/DarkModeToggle/DarkModeToggle.vue.d.ts +0 -11
  79. package/dist/components/DarkModeToggle/DarkModeToggle.vue.d.ts.map +0 -1
  80. package/dist/components/DarkModeToggle/DarkModeToggle.vue.js +0 -7
  81. package/dist/components/DarkModeToggle/DarkModeToggle.vue2.js +0 -31
  82. package/dist/components/DarkModeToggle/index.d.ts +0 -3
  83. package/dist/components/DarkModeToggle/index.d.ts.map +0 -1
  84. package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts +0 -10
  85. package/dist/embeds/ExampleRequest/ExampleRequest.vue.d.ts.map +0 -1
  86. package/dist/embeds/ExampleRequest/index.d.ts +0 -2
  87. package/dist/embeds/ExampleRequest/index.d.ts.map +0 -1
  88. package/dist/embeds/ExampleResponses/ExampleResponses.vue.d.ts +0 -7
  89. package/dist/embeds/ExampleResponses/ExampleResponses.vue.d.ts.map +0 -1
  90. package/dist/embeds/ExampleResponses/index.d.ts +0 -2
  91. package/dist/embeds/ExampleResponses/index.d.ts.map +0 -1
  92. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +0 -782
  93. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts.map +0 -1
  94. package/dist/embeds/OpenApiDocument/index.d.ts +0 -3
  95. package/dist/embeds/OpenApiDocument/index.d.ts.map +0 -1
  96. package/dist/embeds/OpenApiDocument/types.d.ts +0 -3
  97. package/dist/embeds/OpenApiDocument/types.d.ts.map +0 -1
  98. package/dist/embeds/index.d.ts +0 -4
  99. package/dist/embeds/index.d.ts.map +0 -1
@@ -1,76 +1,94 @@
1
- import { redirectToProxy as R } from "@scalar/oas-utils/helpers";
2
- import { load as j, dereference as M } from "@scalar/openapi-parser";
3
- import { fetchUrls as q } from "@scalar/openapi-parser/plugins/fetch-urls";
4
- import { createEmptySpecification as m } from "./createEmptySpecification.js";
5
- import { normalizeRequestMethod as E } from "../legacy/helpers/normalizeRequestMethod.js";
6
- import { validRequestMethods as A } from "../legacy/fixtures/httpRequestMethods.js";
7
- const D = (p, {
1
+ import { redirectToProxy as R, shouldIgnoreEntity as u } from "@scalar/oas-utils/helpers";
2
+ import { load as M, dereference as q } from "@scalar/openapi-parser";
3
+ import { fetchUrls as C } from "@scalar/openapi-parser/plugins/fetch-urls";
4
+ import { createEmptySpecification as O } from "./createEmptySpecification.js";
5
+ import { normalizeRequestMethod as k } from "../legacy/helpers/normalizeRequestMethod.js";
6
+ import { validRequestMethods as F } from "../legacy/fixtures/httpRequestMethods.js";
7
+ const H = (m, {
8
8
  proxyUrl: e
9
- } = {}) => new Promise(async (a, h) => {
10
- var s;
9
+ } = {}) => new Promise(async (o, E) => {
10
+ var h;
11
11
  try {
12
- if (!p)
13
- return a(
14
- u(m())
12
+ if (!m)
13
+ return o(
14
+ I(O())
15
15
  );
16
- const o = performance.now(), { filesystem: n } = await j(p, {
16
+ const s = performance.now(), { filesystem: i } = await M(m, {
17
17
  plugins: [
18
- q({
19
- fetch: (i) => fetch(e ? R(e, i) : i)
18
+ C({
19
+ fetch: (c) => fetch(e ? R(e, c) : c)
20
20
  })
21
21
  ]
22
- }), { schema: t, errors: r } = await M(n), c = performance.now();
23
- return console.log(`dereference: ${Math.round(c - o)} ms`), r != null && r.length && console.warn(
22
+ }), { schema: r, errors: t } = await q(i), n = performance.now();
23
+ return console.log(`dereference: ${Math.round(n - s)} ms`), t != null && t.length && console.warn(
24
24
  `Please open an issue on https://github.com/scalar/scalar
25
25
  `,
26
26
  `Scalar OpenAPI Parser Warning:
27
27
  `,
28
- r
29
- ), t === void 0 ? (h(((s = r == null ? void 0 : r[0]) == null ? void 0 : s.message) ?? "Failed to parse the OpenAPI file."), a(
30
- u(m())
31
- )) : a(u(t));
32
- } catch (o) {
28
+ t
29
+ ), r === void 0 ? (E(((h = t == null ? void 0 : t[0]) == null ? void 0 : h.message) ?? "Failed to parse the OpenAPI file."), o(
30
+ I(O())
31
+ )) : o(I(r));
32
+ } catch (s) {
33
33
  console.error(
34
34
  "[@scalar/api-reference]",
35
35
  "Failed to parse the OpenAPI document. It might be invalid?"
36
- ), console.error(o), h(o);
36
+ ), console.error(s), E(s);
37
37
  }
38
- return a(
39
- u(m())
38
+ return o(
39
+ I(O())
40
40
  );
41
- }), u = (p) => {
41
+ }), I = (m) => {
42
+ var h;
42
43
  let e = {};
43
- p && typeof p == "object" ? e = structuredClone(p) : e = m(), e.tags || (e.tags = []), e.paths || (e.paths = {});
44
- const a = {};
44
+ m && typeof m == "object" ? e = structuredClone(m) : e = O(), e.tags || (e.tags = []), e.paths || (e.paths = {});
45
+ const o = {};
45
46
  return Object.keys(e.webhooks ?? {}).forEach((s) => {
46
- var o;
47
- Object.keys(((o = e.webhooks) == null ? void 0 : o[s]) ?? {}).forEach((n) => {
48
- var r, c, i;
49
- const t = (r = e.webhooks) == null ? void 0 : r[s][n];
50
- (t == null ? void 0 : t["x-internal"]) !== !0 && (a[s] === void 0 && (a[s] = {}), a[s][n] = {
51
- // Transformed data
52
- httpVerb: E(n),
53
- path: s,
54
- operationId: (t == null ? void 0 : t.operationId) || s,
55
- name: (t == null ? void 0 : t.summary) || s || "",
56
- description: (t == null ? void 0 : t.description) || "",
57
- pathParameters: (i = (c = e.paths) == null ? void 0 : c[s]) == null ? void 0 : i.parameters,
58
- // Original webhook
59
- information: {
60
- ...t
47
+ var i;
48
+ Object.keys(((i = e.webhooks) == null ? void 0 : i[s]) ?? {}).forEach((r) => {
49
+ var n, c, l, g;
50
+ const t = (n = e.webhooks) == null ? void 0 : n[s][r];
51
+ if (!(!t || u(t))) {
52
+ if (Array.isArray(t.tags)) {
53
+ const a = (c = t.tags) == null ? void 0 : c.map((f) => {
54
+ var y;
55
+ return (y = e.tags) == null ? void 0 : y.find((w) => w.name === f);
56
+ });
57
+ if (t.tags = a == null ? void 0 : a.filter(
58
+ (f) => !u(f)
59
+ ), a != null && a.some(
60
+ (f) => u(f)
61
+ ))
62
+ return;
61
63
  }
62
- });
64
+ o[s] === void 0 && (o[s] = {}), o[s][r] = {
65
+ // Transformed data
66
+ httpVerb: k(r),
67
+ path: s,
68
+ operationId: (t == null ? void 0 : t.operationId) || s,
69
+ name: (t == null ? void 0 : t.summary) || s || "",
70
+ description: (t == null ? void 0 : t.description) || "",
71
+ pathParameters: (g = (l = e.paths) == null ? void 0 : l[s]) == null ? void 0 : g.parameters,
72
+ // Original webhook
73
+ information: {
74
+ ...t
75
+ }
76
+ };
77
+ }
63
78
  });
79
+ }), Object.keys(((h = e.components) == null ? void 0 : h.schemas) ?? {}).forEach((s) => {
80
+ var i, r, t, n;
81
+ u((r = (i = e.components) == null ? void 0 : i.schemas) == null ? void 0 : r[s]) && ((n = (t = e.components) == null ? void 0 : t.schemas) == null || delete n[s]);
64
82
  }), Object.keys(e.paths).forEach((s) => {
65
83
  Object.keys(e.paths[s]).filter(
66
- (n) => A.includes(n.toUpperCase())
67
- ).forEach((n) => {
68
- var c, i, g, w, y, I;
69
- const t = e.paths[s][n];
70
- if (t === void 0 || t["x-internal"] === !0)
84
+ (r) => F.includes(r.toUpperCase())
85
+ ).forEach((r) => {
86
+ var c, l, g, a, f, y, w;
87
+ const t = e.paths[s][r];
88
+ if (t === void 0 || u(t))
71
89
  return;
72
- const r = {
73
- httpVerb: E(n),
90
+ const n = {
91
+ httpVerb: k(r),
74
92
  path: s,
75
93
  operationId: t.operationId || s,
76
94
  name: t.summary || s || "",
@@ -78,40 +96,42 @@ const D = (p, {
78
96
  information: {
79
97
  ...t
80
98
  },
81
- pathParameters: (i = (c = e.paths) == null ? void 0 : c[s]) == null ? void 0 : i.parameters
99
+ pathParameters: (l = (c = e.paths) == null ? void 0 : c[s]) == null ? void 0 : l.parameters
82
100
  };
83
101
  if (!t.tags || t.tags.length === 0) {
84
102
  (g = e.tags) != null && g.find(
85
- (f) => f.name === "default"
86
- ) || (w = e.tags) == null || w.push({
103
+ (d) => d.name === "default"
104
+ ) || (a = e.tags) == null || a.push({
87
105
  name: "default",
88
106
  description: "",
89
107
  operations: []
90
108
  });
91
- const d = (y = e.tags) == null ? void 0 : y.findIndex(
92
- (f) => f.name === "default"
109
+ const p = (f = e.tags) == null ? void 0 : f.findIndex(
110
+ (d) => d.name === "default"
93
111
  );
94
- d >= 0 && ((I = e.tags[d]) == null || I.operations.push(r));
112
+ p >= 0 && ((y = e.tags[p]) == null || y.operations.push(n));
95
113
  } else
96
- t.tags.forEach((d) => {
97
- var O, x, P;
98
- const f = (O = e.tags) == null ? void 0 : O.findIndex(
99
- // @ts-expect-error TODO: The types are just screwed, needs refactoring
100
- (b) => b.name === d
114
+ t.tags.forEach((p) => {
115
+ var b, x, j;
116
+ const d = (b = e.tags) == null ? void 0 : b.findIndex(
117
+ (A) => A.name === p
101
118
  );
102
- f === -1 && ((x = e.tags) == null || x.push({
103
- name: d,
119
+ d === -1 && ((x = e.tags) == null || x.push({
120
+ name: p,
104
121
  description: ""
105
122
  }));
106
- const l = f !== -1 ? f : e.tags.length - 1;
107
- typeof ((P = e.tags[l]) == null ? void 0 : P.operations) > "u" && (e.tags[l].operations = []), e.tags[l].operations.push(r);
123
+ const P = d !== -1 ? d : e.tags.length - 1;
124
+ typeof ((j = e.tags[P]) == null ? void 0 : j.operations) > "u" && (e.tags[P].operations = []), e.tags[P].operations.push(n);
108
125
  });
126
+ e.tags = (w = e.tags) == null ? void 0 : w.filter(
127
+ (p) => !u(p)
128
+ );
109
129
  });
110
130
  }), {
111
131
  ...e,
112
- webhooks: a
132
+ webhooks: o
113
133
  };
114
134
  };
115
135
  export {
116
- D as parse
136
+ H as parse
117
137
  };
package/dist/index.d.ts CHANGED
@@ -5,7 +5,6 @@ export * from './features/Search';
5
5
  export { default as GettingStarted } from './components/GettingStarted.vue.js';
6
6
  export { createScalarReferences } from './esm.js';
7
7
  export { useReactiveSpec } from './hooks/useReactiveSpec.js';
8
- export * from './components/DarkModeToggle';
9
8
  export * from './components/Sidebar';
10
9
  export * from './components/Card';
11
10
  export * from './components/Layouts';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAC/E,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,cAAc,6BAA6B,CAAA;AAC3C,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,uCAAuC,CAAA;AAC/E,cAAc,mBAAmB,CAAA;AACjC,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAC3E,OAAO,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAA;AAEzD,cAAc,sBAAsB,CAAA;AACpC,cAAc,mBAAmB,CAAA;AACjC,cAAc,sBAAsB,CAAA;AAEpC,cAAc,UAAU,CAAA;AACxB,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,SAAS,CAAA"}