@scalar/api-reference 1.24.46 → 1.24.49

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