@scalar/api-reference 1.24.41 → 1.24.43

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