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