@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.
- package/CHANGELOG.md +16 -0
- package/dist/browser/standalone.js +9327 -9324
- 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 +67 -66
- 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 +25 -23
- package/dist/hooks/useSidebar.d.ts +1 -0
- package/dist/hooks/useSidebar.d.ts.map +1 -1
- package/dist/hooks/useSidebar.js +101 -98
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +6 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/hooks/useSidebar.js
CHANGED
|
@@ -1,91 +1,91 @@
|
|
|
1
|
-
import { ssrState as
|
|
2
|
-
import { ref as
|
|
3
|
-
import { useNavState as
|
|
4
|
-
import { getLowestHeadingLevel as
|
|
5
|
-
import { openClientFor as
|
|
6
|
-
import { hasModels as
|
|
7
|
-
import { getModels as
|
|
8
|
-
import { hasWebhooks as
|
|
9
|
-
import { getHeadingsFromMarkdown as
|
|
10
|
-
import { useApiClientStore as
|
|
11
|
-
import { useOpenApiStore as
|
|
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:
|
|
14
|
-
getModelId:
|
|
15
|
-
getOperationId:
|
|
16
|
-
getSectionId:
|
|
17
|
-
getTagId:
|
|
18
|
-
getWebhookId:
|
|
19
|
-
hash:
|
|
20
|
-
} =
|
|
21
|
-
function
|
|
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
|
|
25
|
-
|
|
24
|
+
const K = p(!1), N = p(!1), g = X(
|
|
25
|
+
U["useSidebarContent-collapsedSidebarItems"] ?? {}
|
|
26
26
|
);
|
|
27
|
-
function
|
|
28
|
-
|
|
27
|
+
function oe(t) {
|
|
28
|
+
g[t] = !g[t];
|
|
29
29
|
}
|
|
30
|
-
function
|
|
31
|
-
|
|
30
|
+
function b(t, s) {
|
|
31
|
+
g[t] = s;
|
|
32
32
|
}
|
|
33
|
-
const
|
|
34
|
-
const s = await
|
|
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
|
-
},
|
|
41
|
-
var k,
|
|
42
|
-
const { state: t } =
|
|
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
|
-
} =
|
|
45
|
-
let
|
|
46
|
-
|
|
44
|
+
} = te(), n = [];
|
|
45
|
+
let h = null;
|
|
46
|
+
S.value.forEach((e) => {
|
|
47
47
|
var i;
|
|
48
|
-
e.depth ===
|
|
49
|
-
id:
|
|
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(
|
|
54
|
-
id:
|
|
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 = (
|
|
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:
|
|
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
|
|
72
|
-
const a =
|
|
73
|
-
return s[a] =
|
|
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:
|
|
75
|
+
title: u,
|
|
76
76
|
httpVerb: r.httpVerb,
|
|
77
|
-
deprecated: ((
|
|
77
|
+
deprecated: ((d = r.information) == null ? void 0 : d.deprecated) ?? !1,
|
|
78
78
|
show: !0,
|
|
79
79
|
select: () => {
|
|
80
|
-
t.showApiClient &&
|
|
80
|
+
t.showApiClient && D(r, l);
|
|
81
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
87
|
var a;
|
|
88
|
-
const i =
|
|
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 &&
|
|
96
|
+
t.showApiClient && D(e, l);
|
|
97
97
|
}
|
|
98
98
|
};
|
|
99
99
|
});
|
|
100
|
-
let
|
|
100
|
+
let m = Z(o.value) && !K.value ? [
|
|
101
101
|
{
|
|
102
|
-
id:
|
|
102
|
+
id: B(),
|
|
103
103
|
title: "Models",
|
|
104
104
|
show: !t.showApiClient,
|
|
105
|
-
children: Object.keys(
|
|
105
|
+
children: Object.keys(F(o.value) ?? {}).map(
|
|
106
106
|
(e) => {
|
|
107
107
|
var r;
|
|
108
|
-
const i =
|
|
108
|
+
const i = B(e);
|
|
109
109
|
return s[i] = e, {
|
|
110
110
|
id: i,
|
|
111
|
-
title: ((r =
|
|
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
|
-
] : [],
|
|
117
|
+
] : [], v = _(o.value) ? [
|
|
118
118
|
{
|
|
119
|
-
id:
|
|
119
|
+
id: C(),
|
|
120
120
|
title: "Webhook",
|
|
121
121
|
show: !t.showApiClient,
|
|
122
|
-
children: Object.keys(((
|
|
122
|
+
children: Object.keys(((x = o.value) == null ? void 0 : x.webhooks) ?? {}).map((e) => {
|
|
123
123
|
var r, a;
|
|
124
|
-
const i =
|
|
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((
|
|
128
|
-
var
|
|
127
|
+
).map((u) => {
|
|
128
|
+
var d, w, L;
|
|
129
129
|
return {
|
|
130
|
-
id:
|
|
131
|
-
title: (
|
|
132
|
-
httpVerb:
|
|
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
|
|
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((
|
|
143
|
-
if (
|
|
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
|
|
149
|
-
(
|
|
148
|
+
const d = f == null ? void 0 : f.find(
|
|
149
|
+
(w) => w.title === u
|
|
150
150
|
);
|
|
151
|
-
|
|
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
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
}),
|
|
172
|
+
}), re = p(!1), ne = q(() => {
|
|
171
173
|
var t, s;
|
|
172
|
-
return ((s = (t =
|
|
174
|
+
return ((s = (t = Q.value) == null ? void 0 : t.titles) == null ? void 0 : s[A.value]) ?? "";
|
|
173
175
|
});
|
|
174
|
-
function
|
|
175
|
-
return t != null && t.parsedSpec && (o.value = t.parsedSpec,
|
|
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 (
|
|
183
|
-
const n =
|
|
184
|
-
n &&
|
|
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 &&
|
|
189
|
+
n && b(J(n), !0);
|
|
188
190
|
}
|
|
189
191
|
}
|
|
190
|
-
),
|
|
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 ?
|
|
200
|
+
return s ? S.value = await le(s) : S.value = [];
|
|
199
201
|
}
|
|
200
202
|
)), {
|
|
201
|
-
breadcrumb:
|
|
202
|
-
items:
|
|
203
|
-
isSidebarOpen:
|
|
204
|
-
collapsedSidebarItems:
|
|
205
|
-
toggleCollapsedSidebarItem:
|
|
206
|
-
setCollapsedSidebarItem:
|
|
207
|
-
hideModels:
|
|
208
|
-
setParsedSpec:
|
|
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
|
-
|
|
215
|
+
Se as useSidebar
|
|
213
216
|
};
|