@scalar/api-reference 1.24.74 → 1.24.76

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 (57) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/browser/standalone.js +7481 -7449
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  5. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  6. package/dist/components/ApiReferenceLayout.vue2.js +71 -71
  7. package/dist/components/Content/Content.vue2.js +11 -11
  8. package/dist/components/Content/Lazy/Loading.vue.js +1 -1
  9. package/dist/components/Content/Operation/ContentTypeSelect.vue.d.ts +27 -0
  10. package/dist/components/Content/Operation/ContentTypeSelect.vue.d.ts.map +1 -0
  11. package/dist/components/Content/Operation/ContentTypeSelect.vue.js +7 -0
  12. package/dist/components/Content/Operation/ContentTypeSelect.vue2.js +41 -0
  13. package/dist/components/Content/Operation/EndpointDetails.vue.d.ts.map +1 -1
  14. package/dist/components/Content/Operation/EndpointDetails.vue.js +10 -7
  15. package/dist/components/Content/Operation/ParameterItem.vue.d.ts +5 -0
  16. package/dist/components/Content/Operation/ParameterItem.vue.d.ts.map +1 -1
  17. package/dist/components/Content/Operation/ParameterItem.vue.js +2 -2
  18. package/dist/components/Content/Operation/ParameterItem.vue2.js +54 -19
  19. package/dist/components/Content/Operation/Parameters.vue.d.ts +5 -0
  20. package/dist/components/Content/Operation/Parameters.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Operation/Parameters.vue.js +2 -2
  22. package/dist/components/Content/Operation/Parameters.vue2.js +16 -14
  23. package/dist/components/Content/Operation/PathResponses/ExampleResponse.vue.d.ts.map +1 -1
  24. package/dist/components/Content/Operation/PathResponses/ExampleResponse.vue.js +1 -1
  25. package/dist/components/Content/Operation/PathResponses/ExampleResponse.vue2.js +28 -22
  26. package/dist/components/Content/Tag/Endpoints.vue.d.ts +2 -6
  27. package/dist/components/Content/Tag/Endpoints.vue.d.ts.map +1 -1
  28. package/dist/components/Content/Tag/Endpoints.vue.js +2 -2
  29. package/dist/components/Content/Tag/Endpoints.vue2.js +57 -60
  30. package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
  31. package/dist/components/Content/Tag/Tag.vue.js +2 -2
  32. package/dist/components/Content/Tag/Tag.vue2.js +21 -33
  33. package/dist/components/Content/Webhooks/Webhooks.vue.d.ts.map +1 -1
  34. package/dist/components/Content/Webhooks/Webhooks.vue.js +5 -76
  35. package/dist/components/Content/Webhooks/Webhooks.vue2.js +76 -2
  36. package/dist/components/Section/SectionContainer.vue.js +1 -1
  37. package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
  38. package/dist/components/ShowMoreButton.vue.js +1 -1
  39. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  40. package/dist/features/ExampleRequest/ExampleRequest.vue.js +4 -4
  41. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +11 -10
  42. package/dist/hooks/useReactiveSpec.d.ts +2 -0
  43. package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
  44. package/dist/hooks/useResponses.d.ts +2 -1
  45. package/dist/hooks/useResponses.d.ts.map +1 -1
  46. package/dist/hooks/useResponses.js +12 -11
  47. package/dist/hooks/useSidebar.d.ts +9 -0
  48. package/dist/hooks/useSidebar.d.ts.map +1 -1
  49. package/dist/hooks/useSidebar.js +123 -108
  50. package/dist/index.js +20 -19
  51. package/dist/legacy/stores/useOpenApiStore.d.ts +2 -0
  52. package/dist/legacy/stores/useOpenApiStore.d.ts.map +1 -1
  53. package/dist/style.css +1 -1
  54. package/package.json +5 -5
  55. package/dist/components/Content/Tag/mutationObserver.d.ts +0 -3
  56. package/dist/components/Content/Tag/mutationObserver.d.ts.map +0 -1
  57. package/dist/components/Content/Tag/mutationObserver.js +0 -7
@@ -1,75 +1,77 @@
1
- import { ssrState as Z } from "@scalar/oas-utils/helpers";
2
- import { ref as h, reactive as z, computed as J, watch as D } from "vue";
3
- import { useNavState as _ } from "./useNavState.js";
4
- import { getLowestHeadingLevel as K } from "../helpers/getLowestHeadingLevel.js";
5
- import { openClientFor as F } from "../helpers/openClientFor.js";
6
- import { hasModels as $ } from "../helpers/hasModels.js";
7
- import { getModels as V } from "../helpers/getModels.js";
8
- import { hasWebhooks as ee } from "../helpers/hasWebhooks.js";
9
- import { getHeadingsFromMarkdown as te } from "../helpers/getHeadingsFromMarkdown.js";
10
- import { useApiClientStore as se } from "../legacy/stores/useApiClientStore.js";
11
- import { useOpenApiStore as oe } from "../legacy/stores/useOpenApiStore.js";
1
+ import { ssrState as $ } from "@scalar/oas-utils/helpers";
2
+ import { ref as m, reactive as J, computed as K, watch as B } from "vue";
3
+ import { lazyBus as ee } from "../components/Content/Lazy/lazyBus.js";
4
+ import { useNavState as te } from "./useNavState.js";
5
+ import { getLowestHeadingLevel as N } from "../helpers/getLowestHeadingLevel.js";
6
+ import { openClientFor as D } from "../helpers/openClientFor.js";
7
+ import { hasModels as se } from "../helpers/hasModels.js";
8
+ import { getModels as F } from "../helpers/getModels.js";
9
+ import { hasWebhooks as oe } from "../helpers/hasWebhooks.js";
10
+ import { scrollToId as V } from "../helpers/scrollToId.js";
11
+ import { getHeadingsFromMarkdown as ie } from "../helpers/getHeadingsFromMarkdown.js";
12
+ import { useApiClientStore as re } from "../legacy/stores/useApiClientStore.js";
13
+ import { useOpenApiStore as le } from "../legacy/stores/useOpenApiStore.js";
12
14
  const {
13
- getHeadingId: B,
15
+ getHeadingId: z,
14
16
  getModelId: P,
15
17
  getOperationId: R,
16
- getSectionId: ie,
17
- getTagId: N,
18
+ getSectionId: Q,
19
+ getTagId: U,
18
20
  getWebhookId: A,
19
- hash: I
20
- } = _(), r = h(void 0), w = z({});
21
+ hash: O
22
+ } = te(), l = m(void 0), S = J({});
21
23
  function q(t) {
22
- var s, i;
23
- return w.tagsSorter === "alpha" ? t.tags = (s = t.tags) == null ? void 0 : s.sort((l, c) => l.name.localeCompare(c.name)) : typeof w.tagsSorter == "function" && (t.tags = (i = t.tags) == null ? void 0 : i.sort(w.tagsSorter)), r.value = t;
24
+ var s, o;
25
+ return S.tagsSorter === "alpha" ? t.tags = (s = t.tags) == null ? void 0 : s.sort((r, c) => r.name.localeCompare(c.name)) : typeof S.tagsSorter == "function" && (t.tags = (o = t.tags) == null ? void 0 : o.sort(S.tagsSorter)), l.value = t;
24
26
  }
25
- const Q = h(!1), U = h(!1), S = z(
26
- Z["useSidebarContent-collapsedSidebarItems"] ?? {}
27
+ const X = m(!1), Y = m(!1), f = J(
28
+ $["useSidebarContent-collapsedSidebarItems"] ?? {}
27
29
  );
28
- function re(t) {
29
- S[t] = !S[t];
30
+ function ne(t) {
31
+ f[t] = !f[t];
30
32
  }
31
- function b(t, s) {
32
- S[t] = s;
33
+ function h(t, s) {
34
+ f[t] = s;
33
35
  }
34
- const C = h([]);
35
- function le(t) {
36
- const s = te(t), i = K(s);
37
- return s.filter((l) => (
36
+ const C = m([]);
37
+ function ae(t) {
38
+ const s = ie(t), o = N(s);
39
+ return s.filter((r) => (
38
40
  // highest level, eg. # Introduction
39
- l.depth === i || // second highest level, eg. ## Authentication
40
- l.depth === i + 1
41
+ r.depth === o || // second highest level, eg. ## Authentication
42
+ r.depth === o + 1
41
43
  ));
42
44
  }
43
- const X = J(() => {
44
- var O, T, y, H, M, j, x, E, G, L;
45
- const { state: t } = se(), s = {}, {
46
- openApi: { globalSecurity: i }
47
- } = oe(), l = [];
45
+ const Z = K(() => {
46
+ var T, I, y, H, M, j, x, E, G, L;
47
+ const { state: t } = re(), s = {}, {
48
+ openApi: { globalSecurity: o }
49
+ } = le(), r = [];
48
50
  let c = null;
49
51
  C.value.forEach((e) => {
50
- var o;
51
- e.depth === K(C.value) ? (c = {
52
- id: B(e),
52
+ var i;
53
+ e.depth === N(C.value) ? (c = {
54
+ id: z(e),
53
55
  title: e.value,
54
56
  show: !t.showApiClient,
55
57
  children: []
56
- }, l.push(c)) : c && ((o = c.children) == null || o.push({
57
- id: B(e),
58
+ }, r.push(c)) : c && ((i = c.children) == null || i.push({
59
+ id: z(e),
58
60
  title: e.value,
59
61
  show: !t.showApiClient
60
62
  }));
61
63
  });
62
- const p = (T = (O = r.value) == null ? void 0 : O.tags) == null ? void 0 : T[0], f = p && ((e) => (e == null ? void 0 : e.length) !== 1 || e[0].name !== "default" || e[0].description !== "")((y = r.value) == null ? void 0 : y.tags) ? (M = (H = r.value) == null ? void 0 : H.tags) == null ? void 0 : M.filter((e) => {
63
- var o;
64
- return ((o = e.operations) == null ? void 0 : o.length) > 0;
64
+ const p = (I = (T = l.value) == null ? void 0 : T.tags) == null ? void 0 : I[0], v = p && ((e) => (e == null ? void 0 : e.length) !== 1 || e[0].name !== "default" || e[0].description !== "")((y = l.value) == null ? void 0 : y.tags) ? (M = (H = l.value) == null ? void 0 : H.tags) == null ? void 0 : M.filter((e) => {
65
+ var i;
66
+ return ((i = e.operations) == null ? void 0 : i.length) > 0;
65
67
  }).map((e) => {
66
- var o;
68
+ var i;
67
69
  return {
68
- id: N(e),
70
+ id: U(e),
69
71
  title: e.name,
70
72
  displayTitle: e["x-displayName"] ?? e.name,
71
73
  show: !0,
72
- children: (o = e.operations) == null ? void 0 : o.map(
74
+ children: (i = e.operations) == null ? void 0 : i.map(
73
75
  (n) => {
74
76
  var d;
75
77
  const a = R(n, e), u = n.name ?? n.path;
@@ -80,7 +82,7 @@ const X = J(() => {
80
82
  deprecated: ((d = n.information) == null ? void 0 : d.deprecated) ?? !1,
81
83
  show: !0,
82
84
  select: () => {
83
- t.showApiClient && F(n, i);
85
+ t.showApiClient && D(n, o);
84
86
  }
85
87
  };
86
88
  }
@@ -88,50 +90,50 @@ const X = J(() => {
88
90
  };
89
91
  }) : (j = p == null ? void 0 : p.operations) == null ? void 0 : j.map((e) => {
90
92
  var a;
91
- const o = R(e, p), n = e.name ?? e.path;
92
- return s[o] = n, {
93
- id: o,
93
+ const i = R(e, p), n = e.name ?? e.path;
94
+ return s[i] = n, {
95
+ id: i,
94
96
  title: n,
95
97
  httpVerb: e.httpVerb,
96
98
  deprecated: ((a = e.information) == null ? void 0 : a.deprecated) ?? !1,
97
99
  show: !0,
98
100
  select: () => {
99
- t.showApiClient && F(e, i);
101
+ t.showApiClient && D(e, o);
100
102
  }
101
103
  };
102
104
  });
103
- let m = $(r.value) && !Q.value ? [
105
+ let g = se(l.value) && !X.value ? [
104
106
  {
105
107
  id: P(),
106
108
  title: "Models",
107
109
  show: !t.showApiClient,
108
- children: Object.keys(V(r.value) ?? {}).map(
110
+ children: Object.keys(F(l.value) ?? {}).map(
109
111
  (e) => {
110
112
  var n;
111
- const o = P(e);
112
- return s[o] = e, {
113
- id: o,
114
- title: ((n = V(r.value)) == null ? void 0 : n[e]).title ?? e,
113
+ const i = P(e);
114
+ return s[i] = e, {
115
+ id: i,
116
+ title: ((n = F(l.value)) == null ? void 0 : n[e]).title ?? e,
115
117
  show: !t.showApiClient
116
118
  };
117
119
  }
118
120
  )
119
121
  }
120
- ] : [], v = ee(r.value) ? [
122
+ ] : [], w = oe(l.value) ? [
121
123
  {
122
124
  id: A(),
123
125
  title: "Webhooks",
124
126
  show: !t.showApiClient,
125
- children: Object.keys(((x = r.value) == null ? void 0 : x.webhooks) ?? {}).map((e) => {
127
+ children: Object.keys(((x = l.value) == null ? void 0 : x.webhooks) ?? {}).map((e) => {
126
128
  var n, a;
127
- const o = A(e);
128
- return s[o] = e, Object.keys(
129
- ((a = (n = r.value) == null ? void 0 : n.webhooks) == null ? void 0 : a[e]) ?? {}
129
+ const i = A(e);
130
+ return s[i] = e, Object.keys(
131
+ ((a = (n = l.value) == null ? void 0 : n.webhooks) == null ? void 0 : a[e]) ?? {}
130
132
  ).map((u) => {
131
- var d, g, W;
133
+ var d, b, W;
132
134
  return {
133
135
  id: A(e, u),
134
- title: (W = (g = (d = r.value) == null ? void 0 : d.webhooks) == null ? void 0 : g[e][u]) == null ? void 0 : W.name,
136
+ title: (W = (b = (d = l.value) == null ? void 0 : d.webhooks) == null ? void 0 : b[e][u]) == null ? void 0 : W.name,
135
137
  httpVerb: u,
136
138
  show: !t.showApiClient
137
139
  };
@@ -139,84 +141,97 @@ const X = J(() => {
139
141
  }).flat()
140
142
  }
141
143
  ] : [];
142
- const Y = (E = r.value) != null && E["x-tagGroups"] ? (L = (G = r.value) == null ? void 0 : G["x-tagGroups"]) == null ? void 0 : L.map((e) => {
144
+ const _ = (E = l.value) != null && E["x-tagGroups"] ? (L = (G = l.value) == null ? void 0 : G["x-tagGroups"]) == null ? void 0 : L.map((e) => {
143
145
  var a;
144
- const o = [];
146
+ const i = [];
145
147
  return (a = e.tags) == null || a.map((u) => {
146
- if (u === "models" && m.length > 0)
147
- o.push(m[0]), m = [];
148
- else if (u === "webhooks" && v.length > 0)
149
- o.push(v[0]), v = [];
148
+ if (u === "models" && g.length > 0)
149
+ i.push(g[0]), g = [];
150
+ else if (u === "webhooks" && w.length > 0)
151
+ i.push(w[0]), w = [];
150
152
  else {
151
- const d = f == null ? void 0 : f.find(
152
- (g) => g.title === u
153
+ const d = v == null ? void 0 : v.find(
154
+ (b) => b.title === u
153
155
  );
154
- d && o.push(d);
156
+ d && i.push(d);
155
157
  }
156
158
  }), {
157
159
  id: e.name,
158
160
  title: e.name,
159
- children: o,
161
+ children: i,
160
162
  show: !0,
161
163
  isGroup: !0
162
164
  };
163
165
  }) : void 0, k = [
164
- ...l,
165
- ...Y ?? f ?? [],
166
- ...v,
167
- ...m
166
+ ...r,
167
+ ..._ ?? v ?? [],
168
+ ...w,
169
+ ...g
168
170
  ];
169
- return U.value && k.forEach((e) => {
170
- b(e.id, !0), e.show = !0;
171
+ return Y.value && k.forEach((e) => {
172
+ h(e.id, !0), e.show = !0;
171
173
  }), {
172
174
  entries: k,
173
175
  titles: s
174
176
  };
175
- }), ne = h(!1), ae = J(() => {
177
+ }), ue = m(!1), de = K(() => {
176
178
  var t, s;
177
- return ((s = (t = X.value) == null ? void 0 : t.titles) == null ? void 0 : s[I.value]) ?? "";
178
- });
179
- function Ce(t) {
180
- return Object.assign(w, t), t != null && t.parsedSpec && (q(t.parsedSpec), D(
179
+ return ((s = (t = Z.value) == null ? void 0 : t.titles) == null ? void 0 : s[O.value]) ?? "";
180
+ }), ce = (t) => {
181
+ const s = Q(t);
182
+ if (s !== t)
183
+ if (f[s])
184
+ V(t);
185
+ else {
186
+ const o = ee.on((r) => {
187
+ r.id === t && (V(t), o());
188
+ });
189
+ h(s, !0);
190
+ }
191
+ };
192
+ function Ie(t) {
193
+ return Object.assign(S, t), t != null && t.parsedSpec && (q(t.parsedSpec), B(
181
194
  () => {
182
- var s, i;
183
- return (i = (s = r.value) == null ? void 0 : s.tags) == null ? void 0 : i.length;
195
+ var s, o;
196
+ return (o = (s = l.value) == null ? void 0 : s.tags) == null ? void 0 : o.length;
184
197
  },
185
198
  () => {
186
- var s, i;
187
- if (I.value) {
188
- const l = ie(I.value);
189
- l && b(l, !0);
199
+ var s, o;
200
+ if (O.value) {
201
+ const r = Q(O.value);
202
+ r && h(r, !0);
190
203
  } else {
191
- const l = (i = (s = r.value) == null ? void 0 : s.tags) == null ? void 0 : i[0];
192
- l && b(N(l), !0);
204
+ const r = (o = (s = l.value) == null ? void 0 : s.tags) == null ? void 0 : o[0];
205
+ r && h(U(r), !0);
193
206
  }
194
207
  }
195
- ), D(
208
+ ), B(
196
209
  () => {
197
- var s, i;
198
- return (i = (s = r.value) == null ? void 0 : s.info) == null ? void 0 : i.description;
210
+ var s, o;
211
+ return (o = (s = l.value) == null ? void 0 : s.info) == null ? void 0 : o.description;
199
212
  },
200
213
  () => {
201
- var i, l;
202
- const s = (l = (i = r.value) == null ? void 0 : i.info) == null ? void 0 : l.description;
203
- return s ? C.value = le(s) : C.value = [];
214
+ var o, r;
215
+ const s = (r = (o = l.value) == null ? void 0 : o.info) == null ? void 0 : r.description;
216
+ return s ? C.value = ae(s) : C.value = [];
204
217
  },
205
218
  {
206
219
  immediate: !0
207
220
  }
208
221
  )), {
209
- breadcrumb: ae,
210
- items: X,
211
- isSidebarOpen: ne,
212
- collapsedSidebarItems: S,
213
- toggleCollapsedSidebarItem: re,
214
- setCollapsedSidebarItem: b,
215
- hideModels: Q,
222
+ breadcrumb: de,
223
+ items: Z,
224
+ isSidebarOpen: ue,
225
+ collapsedSidebarItems: f,
226
+ toggleCollapsedSidebarItem: ne,
227
+ setCollapsedSidebarItem: h,
228
+ hideModels: X,
216
229
  setParsedSpec: q,
217
- defaultOpenAllTags: U
230
+ defaultOpenAllTags: Y,
231
+ scrollToOperation: ce
218
232
  };
219
233
  }
220
234
  export {
221
- Ce as useSidebar
235
+ ce as scrollToOperation,
236
+ Ie as useSidebar
222
237
  };