@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.
- package/CHANGELOG.md +26 -0
- package/dist/browser/standalone.js +7481 -7449
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +71 -71
- package/dist/components/Content/Content.vue2.js +11 -11
- package/dist/components/Content/Lazy/Loading.vue.js +1 -1
- package/dist/components/Content/Operation/ContentTypeSelect.vue.d.ts +27 -0
- package/dist/components/Content/Operation/ContentTypeSelect.vue.d.ts.map +1 -0
- package/dist/components/Content/Operation/ContentTypeSelect.vue.js +7 -0
- package/dist/components/Content/Operation/ContentTypeSelect.vue2.js +41 -0
- package/dist/components/Content/Operation/EndpointDetails.vue.d.ts.map +1 -1
- package/dist/components/Content/Operation/EndpointDetails.vue.js +10 -7
- package/dist/components/Content/Operation/ParameterItem.vue.d.ts +5 -0
- package/dist/components/Content/Operation/ParameterItem.vue.d.ts.map +1 -1
- package/dist/components/Content/Operation/ParameterItem.vue.js +2 -2
- package/dist/components/Content/Operation/ParameterItem.vue2.js +54 -19
- package/dist/components/Content/Operation/Parameters.vue.d.ts +5 -0
- package/dist/components/Content/Operation/Parameters.vue.d.ts.map +1 -1
- package/dist/components/Content/Operation/Parameters.vue.js +2 -2
- package/dist/components/Content/Operation/Parameters.vue2.js +16 -14
- package/dist/components/Content/Operation/PathResponses/ExampleResponse.vue.d.ts.map +1 -1
- package/dist/components/Content/Operation/PathResponses/ExampleResponse.vue.js +1 -1
- package/dist/components/Content/Operation/PathResponses/ExampleResponse.vue2.js +28 -22
- package/dist/components/Content/Tag/Endpoints.vue.d.ts +2 -6
- package/dist/components/Content/Tag/Endpoints.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/Endpoints.vue.js +2 -2
- package/dist/components/Content/Tag/Endpoints.vue2.js +57 -60
- package/dist/components/Content/Tag/Tag.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/Tag.vue.js +2 -2
- package/dist/components/Content/Tag/Tag.vue2.js +21 -33
- package/dist/components/Content/Webhooks/Webhooks.vue.d.ts.map +1 -1
- package/dist/components/Content/Webhooks/Webhooks.vue.js +5 -76
- package/dist/components/Content/Webhooks/Webhooks.vue2.js +76 -2
- package/dist/components/Section/SectionContainer.vue.js +1 -1
- package/dist/components/ShowMoreButton.vue.d.ts.map +1 -1
- package/dist/components/ShowMoreButton.vue.js +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +4 -4
- package/dist/features/ExampleRequest/ExampleRequest.vue2.js +11 -10
- package/dist/hooks/useReactiveSpec.d.ts +2 -0
- package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
- package/dist/hooks/useResponses.d.ts +2 -1
- package/dist/hooks/useResponses.d.ts.map +1 -1
- package/dist/hooks/useResponses.js +12 -11
- package/dist/hooks/useSidebar.d.ts +9 -0
- package/dist/hooks/useSidebar.d.ts.map +1 -1
- package/dist/hooks/useSidebar.js +123 -108
- package/dist/index.js +20 -19
- package/dist/legacy/stores/useOpenApiStore.d.ts +2 -0
- package/dist/legacy/stores/useOpenApiStore.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/package.json +5 -5
- package/dist/components/Content/Tag/mutationObserver.d.ts +0 -3
- package/dist/components/Content/Tag/mutationObserver.d.ts.map +0 -1
- package/dist/components/Content/Tag/mutationObserver.js +0 -7
package/dist/hooks/useSidebar.js
CHANGED
|
@@ -1,75 +1,77 @@
|
|
|
1
|
-
import { ssrState as
|
|
2
|
-
import { ref as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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:
|
|
15
|
+
getHeadingId: z,
|
|
14
16
|
getModelId: P,
|
|
15
17
|
getOperationId: R,
|
|
16
|
-
getSectionId:
|
|
17
|
-
getTagId:
|
|
18
|
+
getSectionId: Q,
|
|
19
|
+
getTagId: U,
|
|
18
20
|
getWebhookId: A,
|
|
19
|
-
hash:
|
|
20
|
-
} =
|
|
21
|
+
hash: O
|
|
22
|
+
} = te(), l = m(void 0), S = J({});
|
|
21
23
|
function q(t) {
|
|
22
|
-
var s,
|
|
23
|
-
return
|
|
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
|
|
26
|
-
|
|
27
|
+
const X = m(!1), Y = m(!1), f = J(
|
|
28
|
+
$["useSidebarContent-collapsedSidebarItems"] ?? {}
|
|
27
29
|
);
|
|
28
|
-
function
|
|
29
|
-
|
|
30
|
+
function ne(t) {
|
|
31
|
+
f[t] = !f[t];
|
|
30
32
|
}
|
|
31
|
-
function
|
|
32
|
-
|
|
33
|
+
function h(t, s) {
|
|
34
|
+
f[t] = s;
|
|
33
35
|
}
|
|
34
|
-
const C =
|
|
35
|
-
function
|
|
36
|
-
const s =
|
|
37
|
-
return s.filter((
|
|
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
|
-
|
|
40
|
-
|
|
41
|
+
r.depth === o || // second highest level, eg. ## Authentication
|
|
42
|
+
r.depth === o + 1
|
|
41
43
|
));
|
|
42
44
|
}
|
|
43
|
-
const
|
|
44
|
-
var
|
|
45
|
-
const { state: t } =
|
|
46
|
-
openApi: { globalSecurity:
|
|
47
|
-
} =
|
|
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
|
|
51
|
-
e.depth ===
|
|
52
|
-
id:
|
|
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
|
-
},
|
|
57
|
-
id:
|
|
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 = (
|
|
63
|
-
var
|
|
64
|
-
return ((
|
|
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
|
|
68
|
+
var i;
|
|
67
69
|
return {
|
|
68
|
-
id:
|
|
70
|
+
id: U(e),
|
|
69
71
|
title: e.name,
|
|
70
72
|
displayTitle: e["x-displayName"] ?? e.name,
|
|
71
73
|
show: !0,
|
|
72
|
-
children: (
|
|
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 &&
|
|
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
|
|
92
|
-
return s[
|
|
93
|
-
id:
|
|
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 &&
|
|
101
|
+
t.showApiClient && D(e, o);
|
|
100
102
|
}
|
|
101
103
|
};
|
|
102
104
|
});
|
|
103
|
-
let
|
|
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(
|
|
110
|
+
children: Object.keys(F(l.value) ?? {}).map(
|
|
109
111
|
(e) => {
|
|
110
112
|
var n;
|
|
111
|
-
const
|
|
112
|
-
return s[
|
|
113
|
-
id:
|
|
114
|
-
title: ((n =
|
|
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
|
-
] : [],
|
|
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 =
|
|
127
|
+
children: Object.keys(((x = l.value) == null ? void 0 : x.webhooks) ?? {}).map((e) => {
|
|
126
128
|
var n, a;
|
|
127
|
-
const
|
|
128
|
-
return s[
|
|
129
|
-
((a = (n =
|
|
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,
|
|
133
|
+
var d, b, W;
|
|
132
134
|
return {
|
|
133
135
|
id: A(e, u),
|
|
134
|
-
title: (W = (
|
|
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
|
|
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
|
|
146
|
+
const i = [];
|
|
145
147
|
return (a = e.tags) == null || a.map((u) => {
|
|
146
|
-
if (u === "models" &&
|
|
147
|
-
|
|
148
|
-
else if (u === "webhooks" &&
|
|
149
|
-
|
|
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 =
|
|
152
|
-
(
|
|
153
|
+
const d = v == null ? void 0 : v.find(
|
|
154
|
+
(b) => b.title === u
|
|
153
155
|
);
|
|
154
|
-
d &&
|
|
156
|
+
d && i.push(d);
|
|
155
157
|
}
|
|
156
158
|
}), {
|
|
157
159
|
id: e.name,
|
|
158
160
|
title: e.name,
|
|
159
|
-
children:
|
|
161
|
+
children: i,
|
|
160
162
|
show: !0,
|
|
161
163
|
isGroup: !0
|
|
162
164
|
};
|
|
163
165
|
}) : void 0, k = [
|
|
164
|
-
...
|
|
165
|
-
...
|
|
166
|
-
...
|
|
167
|
-
...
|
|
166
|
+
...r,
|
|
167
|
+
..._ ?? v ?? [],
|
|
168
|
+
...w,
|
|
169
|
+
...g
|
|
168
170
|
];
|
|
169
|
-
return
|
|
170
|
-
|
|
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
|
-
}),
|
|
177
|
+
}), ue = m(!1), de = K(() => {
|
|
176
178
|
var t, s;
|
|
177
|
-
return ((s = (t =
|
|
178
|
-
})
|
|
179
|
-
|
|
180
|
-
|
|
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,
|
|
183
|
-
return (
|
|
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,
|
|
187
|
-
if (
|
|
188
|
-
const
|
|
189
|
-
|
|
199
|
+
var s, o;
|
|
200
|
+
if (O.value) {
|
|
201
|
+
const r = Q(O.value);
|
|
202
|
+
r && h(r, !0);
|
|
190
203
|
} else {
|
|
191
|
-
const
|
|
192
|
-
|
|
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
|
-
),
|
|
208
|
+
), B(
|
|
196
209
|
() => {
|
|
197
|
-
var s,
|
|
198
|
-
return (
|
|
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
|
|
202
|
-
const s = (
|
|
203
|
-
return 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:
|
|
210
|
-
items:
|
|
211
|
-
isSidebarOpen:
|
|
212
|
-
collapsedSidebarItems:
|
|
213
|
-
toggleCollapsedSidebarItem:
|
|
214
|
-
setCollapsedSidebarItem:
|
|
215
|
-
hideModels:
|
|
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:
|
|
230
|
+
defaultOpenAllTags: Y,
|
|
231
|
+
scrollToOperation: ce
|
|
218
232
|
};
|
|
219
233
|
}
|
|
220
234
|
export {
|
|
221
|
-
|
|
235
|
+
ce as scrollToOperation,
|
|
236
|
+
Ie as useSidebar
|
|
222
237
|
};
|