@scalar/api-reference 1.25.104 → 1.25.106
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 +34 -0
- package/dist/browser/standalone.js +7083 -7073
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +1 -1
- package/dist/components/ApiReferenceLayout.vue2.js +119 -131
- package/dist/components/Content/Lazy/Loading.vue.js +2 -2
- package/dist/components/Content/Models/Models.vue.js +2 -2
- package/dist/components/Content/Models/Models.vue2.js +2 -2
- package/dist/components/Content/Models/ModelsAccordion.vue.js +2 -2
- package/dist/components/Content/Models/ModelsAccordion.vue2.js +2 -2
- package/dist/components/Content/Tag/Endpoints.vue2.js +3 -3
- package/dist/components/Content/Tag/TagList.vue.js +3 -3
- package/dist/components/Section/CompactSection.vue2.js +4 -4
- package/dist/components/Section/Section.vue2.js +3 -3
- package/dist/components/Sidebar/Sidebar.vue2.js +3 -3
- package/dist/components/Sidebar/SidebarElement.vue2.js +6 -6
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue.d.ts.map +1 -1
- package/dist/features/DownloadLink/DownloadLink.vue.js +2 -2
- package/dist/features/DownloadLink/DownloadLink.vue2.js +14 -21
- package/dist/features/Operation/Webhooks.vue.js +3 -3
- package/dist/features/Operation/Webhooks.vue2.js +9 -9
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +2 -2
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js +34 -49
- package/dist/features/Operation/components/ParameterList.vue.d.ts +2 -2
- package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.js +3 -3
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts +3 -3
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue2.js +34 -31
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +1 -1
- package/dist/features/Operation/components/RequestBody.vue2.js +37 -33
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +34 -34
- package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +12 -12
- package/dist/features/Search/useSearchIndex.js +11 -11
- package/dist/features/TestRequestButton/TestRequestButton.vue.d.ts.map +1 -1
- package/dist/features/TestRequestButton/TestRequestButton.vue.js +2 -2
- package/dist/features/TestRequestButton/TestRequestButton.vue2.js +21 -21
- package/dist/helpers/index.d.ts +0 -1
- package/dist/helpers/index.d.ts.map +1 -1
- package/dist/helpers/parse.d.ts.map +1 -1
- package/dist/helpers/parse.js +59 -60
- package/dist/hooks/useConfig.d.ts +6 -0
- package/dist/hooks/useConfig.d.ts.map +1 -0
- package/dist/hooks/useConfig.js +6 -0
- package/dist/hooks/useNavState.d.ts +8 -3
- package/dist/hooks/useNavState.d.ts.map +1 -1
- package/dist/hooks/useNavState.js +71 -59
- package/dist/hooks/useSidebar.d.ts.map +1 -1
- package/dist/hooks/useSidebar.js +149 -149
- package/dist/index.js +58 -63
- package/dist/style.css +1 -1
- package/package.json +11 -11
- package/dist/features/Operation/components/RequestBodyPropertiesChild.vue.d.ts +0 -7
- package/dist/features/Operation/components/RequestBodyPropertiesChild.vue.d.ts.map +0 -1
- package/dist/helpers/provideSymbols.d.ts +0 -7
- package/dist/helpers/provideSymbols.d.ts.map +0 -1
- package/dist/helpers/provideSymbols.js +0 -7
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/helpers/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAA;AAC1C,cAAc,aAAa,CAAA;AAC3B,cAAc,kBAAkB,CAAA;AAChC,cAAc,8BAA8B,CAAA;AAC5C,cAAc,2BAA2B,CAAA;AACzC,cAAc,yBAAyB,CAAA;AACvC,cAAc,aAAa,CAAA;AAC3B,cAAc,oBAAoB,CAAA;AAClC,cAAc,aAAa,CAAA;AAC3B,cAAc,sBAAsB,CAAA;AACpC,cAAc,eAAe,CAAA;AAC7B,cAAc,WAAW,CAAA;AACzB,cAAc,iBAAiB,CAAA;AAC/B,cAAc,iBAAiB,CAAA;AAC/B,cAAc,mBAAmB,CAAA;AACjC,cAAc,SAAS,CAAA;AACvB,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,iBAAiB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/helpers/parse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../src/helpers/parse.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AAMxD;;;;GAIG;AACH,eAAO,MAAM,KAAK,kBACD,aAAa,GAAG,MAAM,GAAG,SAAS,kBAG9C;IACD,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB,KACA,OAAO,CAAC,IAAI,CA0Dd,CAAA"}
|
package/dist/helpers/parse.js
CHANGED
|
@@ -5,7 +5,7 @@ import { createEmptySpecification as O } from "./createEmptySpecification.js";
|
|
|
5
5
|
import { normalizeRequestMethod as k } from "../legacy/helpers/normalizeRequestMethod.js";
|
|
6
6
|
import { validRequestMethods as F } from "../legacy/fixtures/httpRequestMethods.js";
|
|
7
7
|
const H = (m, {
|
|
8
|
-
proxyUrl:
|
|
8
|
+
proxyUrl: t
|
|
9
9
|
} = {}) => new Promise(async (o, E) => {
|
|
10
10
|
var h;
|
|
11
11
|
try {
|
|
@@ -13,51 +13,51 @@ const H = (m, {
|
|
|
13
13
|
return o(
|
|
14
14
|
I(O())
|
|
15
15
|
);
|
|
16
|
-
const
|
|
16
|
+
const f = performance.now(), { filesystem: s } = await M(m, {
|
|
17
17
|
plugins: [
|
|
18
18
|
C({
|
|
19
|
-
fetch: (
|
|
19
|
+
fetch: (n) => fetch(t ? R(t, n) : n)
|
|
20
20
|
})
|
|
21
21
|
]
|
|
22
|
-
}), { schema:
|
|
23
|
-
return console.log(`dereference: ${Math.round(
|
|
22
|
+
}), { schema: a, errors: r } = await q(s), e = performance.now();
|
|
23
|
+
return console.log(`dereference: ${Math.round(e - f)} ms`), r != null && r.length && console.warn(
|
|
24
24
|
`Please open an issue on https://github.com/scalar/scalar
|
|
25
25
|
`,
|
|
26
26
|
`Scalar OpenAPI Parser Warning:
|
|
27
27
|
`,
|
|
28
|
-
|
|
29
|
-
),
|
|
28
|
+
r
|
|
29
|
+
), a === void 0 ? (E(((h = r == null ? void 0 : r[0]) == null ? void 0 : h.message) ?? "Failed to parse the OpenAPI file."), o(
|
|
30
30
|
I(O())
|
|
31
|
-
)) : o(I(
|
|
32
|
-
} catch (
|
|
31
|
+
)) : o(I(a));
|
|
32
|
+
} catch (f) {
|
|
33
33
|
console.error(
|
|
34
34
|
"[@scalar/api-reference]",
|
|
35
35
|
"Failed to parse the OpenAPI document. It might be invalid?"
|
|
36
|
-
), console.error(
|
|
36
|
+
), console.error(f), E(f);
|
|
37
37
|
}
|
|
38
38
|
return o(
|
|
39
39
|
I(O())
|
|
40
40
|
);
|
|
41
41
|
}), I = (m) => {
|
|
42
|
-
var h;
|
|
43
|
-
let
|
|
44
|
-
m && typeof m == "object" ?
|
|
42
|
+
var h, f;
|
|
43
|
+
let t = {};
|
|
44
|
+
m && typeof m == "object" ? t = structuredClone(m) : t = O(), t.tags || (t.tags = []), t.paths || (t.paths = {});
|
|
45
45
|
const o = {};
|
|
46
|
-
return Object.keys(
|
|
47
|
-
var
|
|
48
|
-
Object.keys(((
|
|
49
|
-
var n,
|
|
50
|
-
const
|
|
51
|
-
if (!(!
|
|
52
|
-
if (Array.isArray(
|
|
53
|
-
const
|
|
54
|
-
var
|
|
55
|
-
return (
|
|
46
|
+
return Object.keys(t.webhooks ?? {}).forEach((s) => {
|
|
47
|
+
var a;
|
|
48
|
+
Object.keys(((a = t.webhooks) == null ? void 0 : a[s]) ?? {}).forEach((r) => {
|
|
49
|
+
var n, l, g, y;
|
|
50
|
+
const e = (n = t.webhooks) == null ? void 0 : n[s][r];
|
|
51
|
+
if (!(!e || u(e))) {
|
|
52
|
+
if (Array.isArray(e.tags)) {
|
|
53
|
+
const i = (l = e.tags) == null ? void 0 : l.map((c) => {
|
|
54
|
+
var w;
|
|
55
|
+
return (w = t.tags) == null ? void 0 : w.find((p) => p.name === c);
|
|
56
56
|
});
|
|
57
|
-
if (
|
|
58
|
-
(
|
|
59
|
-
),
|
|
60
|
-
(
|
|
57
|
+
if (e.tags = i == null ? void 0 : i.filter(
|
|
58
|
+
(c) => !u(c)
|
|
59
|
+
), i != null && i.some(
|
|
60
|
+
(c) => u(c)
|
|
61
61
|
))
|
|
62
62
|
return;
|
|
63
63
|
}
|
|
@@ -65,70 +65,69 @@ const H = (m, {
|
|
|
65
65
|
// Transformed data
|
|
66
66
|
httpVerb: k(r),
|
|
67
67
|
path: s,
|
|
68
|
-
operationId: (
|
|
69
|
-
name: (
|
|
70
|
-
description: (
|
|
71
|
-
pathParameters: (
|
|
68
|
+
operationId: (e == null ? void 0 : e.operationId) || s,
|
|
69
|
+
name: (e == null ? void 0 : e.summary) || s || "",
|
|
70
|
+
description: (e == null ? void 0 : e.description) || "",
|
|
71
|
+
pathParameters: (y = (g = t.paths) == null ? void 0 : g[s]) == null ? void 0 : y.parameters,
|
|
72
72
|
// Original webhook
|
|
73
73
|
information: {
|
|
74
|
-
...
|
|
74
|
+
...e
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
}), Object.keys(((h =
|
|
80
|
-
var
|
|
81
|
-
u((r = (
|
|
82
|
-
}), Object.keys(
|
|
83
|
-
Object.keys(
|
|
79
|
+
}), Object.keys(((h = t.components) == null ? void 0 : h.schemas) ?? {}).forEach((s) => {
|
|
80
|
+
var a, r, e, n;
|
|
81
|
+
u((r = (a = t.components) == null ? void 0 : a.schemas) == null ? void 0 : r[s]) && ((n = (e = t.components) == null ? void 0 : e.schemas) == null || delete n[s]);
|
|
82
|
+
}), Object.keys(t.paths).forEach((s) => {
|
|
83
|
+
Object.keys(t.paths[s]).filter(
|
|
84
84
|
(r) => F.includes(r.toUpperCase())
|
|
85
85
|
).forEach((r) => {
|
|
86
|
-
var
|
|
87
|
-
const
|
|
88
|
-
if (
|
|
86
|
+
var l, g, y, i, c, w;
|
|
87
|
+
const e = t.paths[s][r];
|
|
88
|
+
if (e === void 0 || u(e))
|
|
89
89
|
return;
|
|
90
90
|
const n = {
|
|
91
91
|
httpVerb: k(r),
|
|
92
92
|
path: s,
|
|
93
|
-
operationId:
|
|
94
|
-
name:
|
|
95
|
-
description:
|
|
93
|
+
operationId: e.operationId || s,
|
|
94
|
+
name: e.summary || s || "",
|
|
95
|
+
description: e.description || "",
|
|
96
96
|
information: {
|
|
97
|
-
...
|
|
97
|
+
...e
|
|
98
98
|
},
|
|
99
|
-
pathParameters: (
|
|
99
|
+
pathParameters: (g = (l = t.paths) == null ? void 0 : l[s]) == null ? void 0 : g.parameters
|
|
100
100
|
};
|
|
101
|
-
if (!
|
|
102
|
-
(
|
|
101
|
+
if (!e.tags || e.tags.length === 0) {
|
|
102
|
+
(y = t.tags) != null && y.find(
|
|
103
103
|
(d) => d.name === "default"
|
|
104
|
-
) || (
|
|
104
|
+
) || (i = t.tags) == null || i.push({
|
|
105
105
|
name: "default",
|
|
106
106
|
description: "",
|
|
107
107
|
operations: []
|
|
108
108
|
});
|
|
109
|
-
const p = (
|
|
109
|
+
const p = (c = t.tags) == null ? void 0 : c.findIndex(
|
|
110
110
|
(d) => d.name === "default"
|
|
111
111
|
);
|
|
112
|
-
p >= 0 && ((
|
|
112
|
+
p >= 0 && ((w = t.tags[p]) == null || w.operations.push(n));
|
|
113
113
|
} else
|
|
114
|
-
|
|
114
|
+
e.tags.forEach((p) => {
|
|
115
115
|
var b, x, j;
|
|
116
|
-
const d = (b =
|
|
116
|
+
const d = (b = t.tags) == null ? void 0 : b.findIndex(
|
|
117
117
|
(A) => A.name === p
|
|
118
118
|
);
|
|
119
|
-
d === -1 && ((x =
|
|
119
|
+
d === -1 && ((x = t.tags) == null || x.push({
|
|
120
120
|
name: p,
|
|
121
121
|
description: ""
|
|
122
122
|
}));
|
|
123
|
-
const P = d !== -1 ? d :
|
|
124
|
-
typeof ((j =
|
|
123
|
+
const P = d !== -1 ? d : t.tags.length - 1;
|
|
124
|
+
typeof ((j = t.tags[P]) == null ? void 0 : j.operations) > "u" && (t.tags[P].operations = []), t.tags[P].operations.push(n);
|
|
125
125
|
});
|
|
126
|
-
e.tags = (w = e.tags) == null ? void 0 : w.filter(
|
|
127
|
-
(p) => !u(p)
|
|
128
|
-
);
|
|
129
126
|
});
|
|
130
|
-
}),
|
|
131
|
-
|
|
127
|
+
}), t.tags = (f = t.tags) == null ? void 0 : f.filter(
|
|
128
|
+
(s) => !u(s)
|
|
129
|
+
), {
|
|
130
|
+
...t,
|
|
132
131
|
webhooks: o
|
|
133
132
|
};
|
|
134
133
|
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ReferenceConfiguration } from '../types';
|
|
2
|
+
import { type InjectionKey } from 'vue';
|
|
3
|
+
export declare const CONFIGURATION_SYMBOL: InjectionKey<ReferenceConfiguration>;
|
|
4
|
+
/** Hook for easy access to the reference configuration */
|
|
5
|
+
export declare const useConfig: () => ReferenceConfiguration | undefined;
|
|
6
|
+
//# sourceMappingURL=useConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfig.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,SAAS,CAAA;AACrD,OAAO,EAAE,KAAK,YAAY,EAAU,MAAM,KAAK,CAAA;AAE/C,eAAO,MAAM,oBAAoB,EACnB,YAAY,CAAC,sBAAsB,CAAC,CAAA;AAElD,0DAA0D;AAC1D,eAAO,MAAM,SAAS,0CAGrB,CAAA"}
|
|
@@ -31,13 +31,18 @@ export declare const useNavState: () => {
|
|
|
31
31
|
replaceUrlState: (replacementHash: string, url?: string) => void;
|
|
32
32
|
/** Gets the portion of the hash used by the references */
|
|
33
33
|
getReferenceHash: () => string;
|
|
34
|
-
getWebhookId: (
|
|
35
|
-
|
|
34
|
+
getWebhookId: (webhook?: {
|
|
35
|
+
name: string;
|
|
36
|
+
method?: string;
|
|
37
|
+
}) => string;
|
|
38
|
+
getModelId: (model?: {
|
|
39
|
+
name: string;
|
|
40
|
+
}) => string;
|
|
36
41
|
getHeadingId: (heading: Heading) => string;
|
|
37
42
|
getOperationId: (operation: TransformedOperation, parentTag: Tag) => string;
|
|
38
43
|
getPathRoutingId: (pathName: string) => string;
|
|
39
44
|
getSectionId: (hashStr?: string) => string;
|
|
40
|
-
getTagId: (
|
|
45
|
+
getTagId: (tag: Tag) => string;
|
|
41
46
|
isIntersectionEnabled: import("vue").Ref<boolean, boolean>;
|
|
42
47
|
pathRouting: import("vue").Ref<PathRouting | undefined, PathRouting | undefined>;
|
|
43
48
|
updateHash: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useNavState.d.ts","sourceRoot":"","sources":["../../src/hooks/useNavState.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAI9E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAqF3C;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;IAsDpB,mCAAmC;4BACX,MAAM;IAG9B;;;;OAIG;+BAnF0B,MAAM;IAqFnC;;;;;OAKG;oCApGY,MAAM;IAsGrB;;;OAGG;uCA9HY,MAAM;IAgIrB,0DAA0D;;6BAjC5B;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;yBA5BrC;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE;4BATb,OAAO;gCAyBH,oBAAoB,aAAa,GAAG;iCA9GrC,MAAM;;oBAuGjB,GAAG;;;;CAiE3B,CAAA"}
|
|
@@ -1,68 +1,80 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useConfig as p } from "./useConfig.js";
|
|
2
|
+
import { ssrState as m } from "@scalar/oas-utils/helpers";
|
|
2
3
|
import { slug as c } from "github-slugger";
|
|
3
4
|
import { ref as l } from "vue";
|
|
4
|
-
import { joinWithSlash as
|
|
5
|
-
const
|
|
6
|
-
var
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
return decodeURIComponent(e.replace(
|
|
10
|
-
},
|
|
5
|
+
import { joinWithSlash as f } from "../helpers/joinWithSlash.js";
|
|
6
|
+
const s = l(""), u = l(m.hash ?? ""), a = l(), w = l(!1), d = (e) => {
|
|
7
|
+
var n;
|
|
8
|
+
if (!a.value) return "";
|
|
9
|
+
const r = new RegExp("^" + ((n = a.value) == null ? void 0 : n.basePath) + "/?");
|
|
10
|
+
return decodeURIComponent(e.replace(r, ""));
|
|
11
|
+
}, I = (e = u.value) => {
|
|
11
12
|
var i;
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
|
|
13
|
+
const r = (i = e.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = e.startsWith("model") ? "models" : "", o = e.startsWith("webhook") ? "webhooks" : "";
|
|
14
|
+
return r || n || o;
|
|
15
|
+
}, v = () => {
|
|
16
|
+
u.value = a.value ? d(window.location.pathname) : (
|
|
16
17
|
// Must remove the prefix from the hash as the internal hash value should be pure
|
|
17
18
|
decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(
|
|
18
|
-
|
|
19
|
+
s.value.length
|
|
19
20
|
)
|
|
20
21
|
);
|
|
21
|
-
}, $ = (e,
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
window.location.hash.replace(/^#/, "").slice(
|
|
29
|
-
),
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
22
|
+
}, $ = (e, r = window.location.href) => {
|
|
23
|
+
const n = new URL(r);
|
|
24
|
+
a.value ? n.pathname = f(a.value.basePath, e) : n.hash = s.value + e, u.value = e, window.history.replaceState({}, "", n);
|
|
25
|
+
}, S = (e, r = window.location.href, n = window.location.search) => {
|
|
26
|
+
const o = new URL(r);
|
|
27
|
+
return o.hash = s.value + e, o.search = n, o.toString();
|
|
28
|
+
}, y = (e = u.value) => `${s.value}${e}`, R = () => decodeURIComponent(
|
|
29
|
+
window.location.hash.replace(/^#/, "").slice(s.value.length)
|
|
30
|
+
), C = () => {
|
|
31
|
+
const e = p(), r = (t) => typeof (e == null ? void 0 : e.generateHeadingSlug) == "function" ? `${e.generateHeadingSlug(t)}` : t.slug ? `description/${t.slug}` : "", n = (t) => t != null && t.name ? typeof (e == null ? void 0 : e.generateModelSlug) == "function" ? `model/${e.generateModelSlug(t)}` : `model/${c(t.name)}` : "models", o = (t) => typeof (e == null ? void 0 : e.generateTagSlug) == "function" ? `tag/${e.generateTagSlug(t)}` : `tag/${c(t.name)}`;
|
|
32
|
+
return {
|
|
33
|
+
hash: u,
|
|
34
|
+
/** Sets the prefix for the hash */
|
|
35
|
+
setHashPrefix: (t) => {
|
|
36
|
+
s.value = t;
|
|
37
|
+
},
|
|
38
|
+
/**
|
|
39
|
+
* Gets the full hash with the prefix
|
|
40
|
+
* @param hashTarget The hash to target with the return
|
|
41
|
+
* @returns The full hash
|
|
42
|
+
*/
|
|
43
|
+
getFullHash: y,
|
|
44
|
+
/**
|
|
45
|
+
* Gets the hashed url with the prefix
|
|
46
|
+
* @param replacementHash The hash to replace the current hash with
|
|
47
|
+
* @param url The url to get the hashed url from
|
|
48
|
+
* @returns The hashed url
|
|
49
|
+
*/
|
|
50
|
+
getHashedUrl: S,
|
|
51
|
+
/**
|
|
52
|
+
* Replaces the URL state with the new url and hash
|
|
53
|
+
* Replacement is used so that hash changes don't trigger the url hash watcher and cause a scroll
|
|
54
|
+
*/
|
|
55
|
+
replaceUrlState: $,
|
|
56
|
+
/** Gets the portion of the hash used by the references */
|
|
57
|
+
getReferenceHash: R,
|
|
58
|
+
getWebhookId: (t) => t != null && t.name ? typeof (e == null ? void 0 : e.generateWebhookSlug) == "function" ? `webhook/${e.generateWebhookSlug(t)}` : `webhook/${t.method}/${c(t.name)}` : "webhooks",
|
|
59
|
+
getModelId: n,
|
|
60
|
+
getHeadingId: r,
|
|
61
|
+
getOperationId: (t, g) => {
|
|
62
|
+
var h;
|
|
63
|
+
return typeof (e == null ? void 0 : e.generateOperationSlug) == "function" ? `${o(g)}/${e.generateOperationSlug({
|
|
64
|
+
path: t.path,
|
|
65
|
+
operationId: t.operationId,
|
|
66
|
+
method: t.httpVerb,
|
|
67
|
+
summary: (h = t.information) == null ? void 0 : h.summary
|
|
68
|
+
})}` : `${o(g)}/${t.httpVerb}${t.path}`;
|
|
69
|
+
},
|
|
70
|
+
getPathRoutingId: d,
|
|
71
|
+
getSectionId: I,
|
|
72
|
+
getTagId: o,
|
|
73
|
+
isIntersectionEnabled: w,
|
|
74
|
+
pathRouting: a,
|
|
75
|
+
updateHash: v
|
|
76
|
+
};
|
|
77
|
+
};
|
|
66
78
|
export {
|
|
67
|
-
|
|
79
|
+
C as useNavState
|
|
68
80
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSidebar.d.ts","sourceRoot":"","sources":["../../src/hooks/useSidebar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAc3E,MAAM,MAAM,YAAY,GAAG;IACzB,EAAE,EAAE,MAA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