@scalar/api-reference 1.25.130 → 1.26.1
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 +19687 -19597
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/ApiReference.vue.d.ts +8 -21
- package/dist/components/ApiReference.vue.d.ts.map +1 -1
- package/dist/components/ApiReference.vue.js +20 -52
- package/dist/components/ApiReference.vue2.js +4 -0
- package/dist/components/ApiReferenceLayout.vue.d.ts +2 -2
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +1 -1
- package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
- package/dist/components/Content/Introduction/Introduction.vue2.js +45 -42
- package/dist/components/DocumentSelector/DocumentSelector.vue.d.ts +12 -0
- package/dist/components/DocumentSelector/DocumentSelector.vue.d.ts.map +1 -0
- package/dist/components/DocumentSelector/DocumentSelector.vue.js +67 -0
- package/dist/components/DocumentSelector/DocumentSelector.vue2.js +4 -0
- package/dist/components/DocumentSelector/index.d.ts +2 -0
- package/dist/components/DocumentSelector/index.d.ts.map +1 -0
- package/dist/components/Layouts/ClassicLayout.vue.d.ts +4 -4
- package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/components/Layouts/ClassicLayout.vue.js +28 -22
- package/dist/components/Layouts/Layouts.vue.d.ts +4 -7
- package/dist/components/Layouts/Layouts.vue.d.ts.map +1 -1
- package/dist/components/Layouts/Layouts.vue.js +23 -14
- package/dist/components/Layouts/ModernLayout.vue.d.ts +4 -4
- package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Layouts/ModernLayout.vue.js +2 -2
- package/dist/components/Layouts/ModernLayout.vue2.js +33 -30
- package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
- package/dist/components/SingleApiReference.vue.d.ts +28 -0
- package/dist/components/SingleApiReference.vue.d.ts.map +1 -0
- package/dist/components/SingleApiReference.vue.js +60 -0
- package/dist/components/SingleApiReference.vue3.js +5 -0
- package/dist/esm.d.ts +3 -5
- package/dist/esm.d.ts.map +1 -1
- package/dist/esm.js +12 -13
- package/dist/features/ApiClientModal/useApiClient.d.ts +2 -2
- package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
- package/dist/features/BaseUrl/BaseUrl.vue.js +31 -30
- package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
- package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
- package/dist/features/TestRequestButton/TestRequestButton.vue.js +2 -2
- package/dist/features/TestRequestButton/TestRequestButton.vue2.js +16 -14
- package/dist/hooks/useConfig.d.ts +3 -3
- package/dist/hooks/useConfig.d.ts.map +1 -1
- package/dist/hooks/useConfig.js +7 -4
- package/dist/hooks/useMultipleDocuments.d.ts +87 -0
- package/dist/hooks/useMultipleDocuments.d.ts.map +1 -0
- package/dist/hooks/useMultipleDocuments.js +49 -0
- package/dist/hooks/useNavState.js +38 -38
- package/dist/hooks/useReactiveSpec.d.ts +1 -1
- package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
- package/dist/index.js +80 -81
- package/dist/standalone/lib/html-api.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/types.d.ts +6 -6
- package/dist/types.d.ts.map +1 -1
- package/package.json +13 -14
- package/dist/components/ApiReference.vue3.js +0 -5
|
@@ -1,40 +1,41 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ServerSelector as
|
|
3
|
-
import { useActiveEntities as
|
|
4
|
-
import { ScalarMarkdown as
|
|
5
|
-
import { useConfig as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as g, useId as _, openBlock as l, createElementBlock as x, Fragment as k, createElementVNode as u, unref as e, createBlock as m, createCommentVNode as d, createVNode as C } from "vue";
|
|
2
|
+
import { ServerSelector as V, ServerVariablesForm as B } from "@scalar/api-client/components/Server";
|
|
3
|
+
import { useActiveEntities as h, useWorkspace as y } from "@scalar/api-client/store";
|
|
4
|
+
import { ScalarMarkdown as E } from "@scalar/components";
|
|
5
|
+
import { useConfig as N } from "../../hooks/useConfig.js";
|
|
6
|
+
const U = ["id"], j = /* @__PURE__ */ g({
|
|
7
7
|
__name: "BaseUrl",
|
|
8
|
-
setup(
|
|
9
|
-
const { activeCollection:
|
|
10
|
-
if (!
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
},
|
|
14
|
-
|
|
8
|
+
setup(F) {
|
|
9
|
+
const { activeCollection: n, activeServer: t } = h(), { serverMutators: p } = y(), s = _(), f = (o, a) => {
|
|
10
|
+
if (!t.value) return;
|
|
11
|
+
const r = t.value.variables || {};
|
|
12
|
+
r[o] = { ...r[o], default: a }, p.edit(t.value.uid, "variables", r);
|
|
13
|
+
}, b = N(), S = (o) => {
|
|
14
|
+
var a, r;
|
|
15
|
+
(r = (a = b.value).onServerChange) == null || r.call(a, o);
|
|
15
16
|
};
|
|
16
|
-
return (
|
|
17
|
-
var
|
|
18
|
-
return
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
(
|
|
17
|
+
return (o, a) => {
|
|
18
|
+
var r, i, c, v;
|
|
19
|
+
return l(), x(k, null, [
|
|
20
|
+
a[0] || (a[0] = u("label", { class: "bg-b-2 flex h-8 items-center px-3 py-2.5 text-sm font-medium" }, " Server ", -1)),
|
|
21
|
+
u("div", { id: e(s) }, [
|
|
22
|
+
(i = (r = e(n)) == null ? void 0 : r.servers) != null && i.length ? (l(), m(e(V), {
|
|
22
23
|
key: 0,
|
|
23
|
-
collection: e(
|
|
24
|
-
server: e(
|
|
25
|
-
target: e(
|
|
24
|
+
collection: e(n),
|
|
25
|
+
server: e(t),
|
|
26
|
+
target: e(s),
|
|
26
27
|
onUpdateServer: S
|
|
27
|
-
}, null, 8, ["collection", "server", "target"])) :
|
|
28
|
-
], 8,
|
|
29
|
-
|
|
30
|
-
variables: (
|
|
31
|
-
"onUpdate:variable":
|
|
28
|
+
}, null, 8, ["collection", "server", "target"])) : d("", !0)
|
|
29
|
+
], 8, U),
|
|
30
|
+
C(e(B), {
|
|
31
|
+
variables: (c = e(t)) == null ? void 0 : c.variables,
|
|
32
|
+
"onUpdate:variable": f
|
|
32
33
|
}, null, 8, ["variables"]),
|
|
33
|
-
(v = e(
|
|
34
|
+
(v = e(t)) != null && v.description ? (l(), m(e(E), {
|
|
34
35
|
key: 0,
|
|
35
36
|
class: "text-c-3 px-3 py-1.5",
|
|
36
|
-
value: e(
|
|
37
|
-
}, null, 8, ["value"])) :
|
|
37
|
+
value: e(t).description
|
|
38
|
+
}, null, 8, ["value"])) : d("", !0)
|
|
38
39
|
], 64);
|
|
39
40
|
};
|
|
40
41
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExampleRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ExampleRequest/ExampleRequest.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExampleRequest.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ExampleRequest/ExampleRequest.vue"],"names":[],"mappings":"AAuXA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACP,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAehE,KAAK,WAAW,GAAG;IACjB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,UAAU,EAAE,UAAU,CAAA;IACtB,yDAAyD;IACzD,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,0CAA0C;IAC1C,oBAAoB,EAAE,oBAAoB,CAAA;CAC3C,CAAC;AAsMF,iBAAS,cAAc;WA6OT,OAAO,IAA6B;;wBAXrB,GAAG;wBAEH,GAAG;wBADH,GAAG;wBAEH,GAAG;;;;EAa/B;AAgCD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./ExampleRequest.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-57c79f34"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import t from "./TestRequestButton.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import o from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-4263a1c2"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
a as default
|
|
7
7
|
};
|
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import { defineComponent as d, computed as c, openBlock as i, createElementBlock as
|
|
1
|
+
import { defineComponent as d, computed as c, openBlock as i, createElementBlock as r, withModifiers as f, createVNode as a, unref as h, createElementVNode as k, withCtx as C, createTextVNode as s, toDisplayString as u, Fragment as y } from "vue";
|
|
2
2
|
import { ScalarIcon as B } from "@scalar/components";
|
|
3
3
|
import b from "../../components/ScreenReader.vue.js";
|
|
4
|
-
import { useConfig as
|
|
5
|
-
import { useApiClient as
|
|
6
|
-
const
|
|
4
|
+
import { useConfig as g } from "../../hooks/useConfig.js";
|
|
5
|
+
import { useApiClient as q } from "../ApiClientModal/useApiClient.js";
|
|
6
|
+
const v = ["method"], S = /* @__PURE__ */ d({
|
|
7
7
|
__name: "TestRequestButton",
|
|
8
8
|
props: {
|
|
9
9
|
operation: {}
|
|
10
10
|
},
|
|
11
|
-
setup(
|
|
12
|
-
const { client: t } =
|
|
11
|
+
setup(o) {
|
|
12
|
+
const { client: t } = q(), p = g(), l = c(
|
|
13
|
+
() => p.value.hideTestRequestButton !== !0
|
|
14
|
+
), m = () => {
|
|
13
15
|
var e;
|
|
14
|
-
|
|
15
|
-
requestUid:
|
|
16
|
+
o.operation && ((e = t == null ? void 0 : t.value) != null && e.open) && t.value.open({
|
|
17
|
+
requestUid: o.operation.uid
|
|
16
18
|
});
|
|
17
19
|
};
|
|
18
|
-
return (e,
|
|
20
|
+
return (e, n) => e.operation && l.value ? (i(), r("button", {
|
|
19
21
|
key: 0,
|
|
20
22
|
class: "show-api-client-button",
|
|
21
23
|
method: e.operation.method,
|
|
@@ -26,18 +28,18 @@ const T = ["method"], g = /* @__PURE__ */ d({
|
|
|
26
28
|
icon: "Play",
|
|
27
29
|
size: "sm"
|
|
28
30
|
}),
|
|
29
|
-
|
|
31
|
+
n[0] || (n[0] = k("span", null, "Test Request", -1)),
|
|
30
32
|
a(b, null, {
|
|
31
33
|
default: C(() => [
|
|
32
|
-
|
|
34
|
+
s("(" + u(e.operation.method) + " " + u(e.operation.path) + ")", 1)
|
|
33
35
|
]),
|
|
34
36
|
_: 1
|
|
35
37
|
})
|
|
36
|
-
], 8,
|
|
37
|
-
|
|
38
|
+
], 8, v)) : (i(), r(y, { key: 1 }, [
|
|
39
|
+
s(" ")
|
|
38
40
|
], 64));
|
|
39
41
|
}
|
|
40
42
|
});
|
|
41
43
|
export {
|
|
42
|
-
|
|
44
|
+
S as default
|
|
43
45
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type ApiReferenceConfiguration } from '@scalar/types/api-reference';
|
|
2
|
-
import { type InjectionKey } from 'vue';
|
|
3
|
-
export declare const CONFIGURATION_SYMBOL: InjectionKey<ApiReferenceConfiguration
|
|
2
|
+
import { type ComputedRef, type InjectionKey } from 'vue';
|
|
3
|
+
export declare const CONFIGURATION_SYMBOL: InjectionKey<ComputedRef<ApiReferenceConfiguration>>;
|
|
4
4
|
/** Hook for easy access to the reference configuration */
|
|
5
|
-
export declare const useConfig: () => ApiReferenceConfiguration
|
|
5
|
+
export declare const useConfig: () => ComputedRef<ApiReferenceConfiguration>;
|
|
6
6
|
//# sourceMappingURL=useConfig.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC7G,OAAO,EAAE,KAAK,YAAY,
|
|
1
|
+
{"version":3,"file":"useConfig.d.ts","sourceRoot":"","sources":["../../src/hooks/useConfig.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmC,KAAK,yBAAyB,EAAE,MAAM,6BAA6B,CAAA;AAC7G,OAAO,EAAE,KAAK,WAAW,EAAE,KAAK,YAAY,EAAoB,MAAM,KAAK,CAAA;AAE3E,eAAO,MAAM,oBAAoB,EAAe,YAAY,CAAC,WAAW,CAAC,yBAAyB,CAAC,CAAC,CAAA;AAEpG,0DAA0D;AAC1D,eAAO,MAAM,SAAS,8CAMrB,CAAA"}
|
package/dist/hooks/useConfig.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import { apiReferenceConfigurationSchema as o } from "@scalar/types/api-reference";
|
|
2
|
-
import { inject as n } from "vue";
|
|
3
|
-
const
|
|
2
|
+
import { inject as e, computed as n } from "vue";
|
|
3
|
+
const r = Symbol(), f = () => e(
|
|
4
|
+
r,
|
|
5
|
+
n(() => o.parse({}))
|
|
6
|
+
);
|
|
4
7
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
8
|
+
r as CONFIGURATION_SYMBOL,
|
|
9
|
+
f as useConfig
|
|
7
10
|
};
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { type ApiReferenceConfiguration, type ApiReferenceConfigurationWithSources } from '@scalar/types/api-reference';
|
|
2
|
+
import { type Ref } from 'vue';
|
|
3
|
+
type UseMultipleDocumentsProps = {
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for the API reference.
|
|
6
|
+
* Can be a single configuration or an array of configurations for multiple documents.
|
|
7
|
+
*/
|
|
8
|
+
configuration: Ref<Partial<ApiReferenceConfiguration> | Partial<ApiReferenceConfiguration>[] | Partial<ApiReferenceConfigurationWithSources> | undefined>;
|
|
9
|
+
/** The initial index to pre-select a document, if there is no query parameter available */
|
|
10
|
+
initialIndex?: number;
|
|
11
|
+
};
|
|
12
|
+
export declare const useMultipleDocuments: ({ configuration, initialIndex }: UseMultipleDocumentsProps) => {
|
|
13
|
+
selectedConfiguration: import("vue").ComputedRef<{
|
|
14
|
+
hideClientButton: boolean;
|
|
15
|
+
showSidebar: boolean;
|
|
16
|
+
theme: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
|
|
17
|
+
layout: "modern" | "classic";
|
|
18
|
+
isEditable: boolean;
|
|
19
|
+
hideModels: boolean;
|
|
20
|
+
hideDownloadButton: boolean;
|
|
21
|
+
hideTestRequestButton: boolean;
|
|
22
|
+
hideSearch: boolean;
|
|
23
|
+
hideDarkModeToggle: boolean;
|
|
24
|
+
withDefaultFonts: boolean;
|
|
25
|
+
authentication?: any;
|
|
26
|
+
baseServerURL?: string | undefined;
|
|
27
|
+
proxyUrl?: string | undefined;
|
|
28
|
+
searchHotKey?: "c" | "r" | "o" | "n" | "a" | "b" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "p" | "q" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | undefined;
|
|
29
|
+
servers?: any[] | undefined;
|
|
30
|
+
spec?: {
|
|
31
|
+
url?: string | undefined;
|
|
32
|
+
content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
|
|
33
|
+
title?: string | undefined;
|
|
34
|
+
slug?: string | undefined;
|
|
35
|
+
} | undefined;
|
|
36
|
+
_integration?: "go" | "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "vue" | null | undefined;
|
|
37
|
+
proxy?: string | undefined;
|
|
38
|
+
darkMode?: boolean | undefined;
|
|
39
|
+
forceDarkModeState?: "dark" | "light" | undefined;
|
|
40
|
+
metaData?: any;
|
|
41
|
+
favicon?: string | undefined;
|
|
42
|
+
hiddenClients?: true | string[] | Record<string, boolean | string[]> | undefined;
|
|
43
|
+
defaultHttpClient?: {
|
|
44
|
+
targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
|
|
45
|
+
clientKey: string;
|
|
46
|
+
} | undefined;
|
|
47
|
+
customCss?: string | undefined;
|
|
48
|
+
onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
|
|
49
|
+
onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
|
|
50
|
+
pathRouting?: {
|
|
51
|
+
basePath: string;
|
|
52
|
+
} | undefined;
|
|
53
|
+
generateHeadingSlug?: ((args_0: {
|
|
54
|
+
slug?: string | undefined;
|
|
55
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
56
|
+
generateModelSlug?: ((args_0: {
|
|
57
|
+
name?: string | undefined;
|
|
58
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
59
|
+
generateTagSlug?: ((args_0: {
|
|
60
|
+
name?: string | undefined;
|
|
61
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
62
|
+
generateOperationSlug?: ((args_0: {
|
|
63
|
+
path: string;
|
|
64
|
+
method: string;
|
|
65
|
+
operationId?: string | undefined;
|
|
66
|
+
summary?: string | undefined;
|
|
67
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
68
|
+
generateWebhookSlug?: ((args_0: {
|
|
69
|
+
name: string;
|
|
70
|
+
method?: string | undefined;
|
|
71
|
+
}, ...args: unknown[]) => string) | undefined;
|
|
72
|
+
onLoaded?: ((...args: unknown[]) => void) | undefined;
|
|
73
|
+
redirect?: ((args_0: string, ...args: unknown[]) => string | null | undefined) | undefined;
|
|
74
|
+
defaultOpenAllTags?: boolean | undefined;
|
|
75
|
+
tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
|
|
76
|
+
operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
|
|
77
|
+
}>;
|
|
78
|
+
availableDocuments: import("vue").ComputedRef<{
|
|
79
|
+
url?: string | undefined;
|
|
80
|
+
content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
|
|
81
|
+
title?: string | undefined;
|
|
82
|
+
slug?: string | undefined;
|
|
83
|
+
}[]>;
|
|
84
|
+
selectedDocumentIndex: Ref<number, number>;
|
|
85
|
+
};
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=useMultipleDocuments.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,yBAAyB,EAC9B,KAAK,oCAAoC,EAI1C,MAAM,6BAA6B,CAAA;AAGpC,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAKpD,KAAK,yBAAyB,GAAG;IAC/B;;;OAGG;IACH,aAAa,EAAE,GAAG,CACd,OAAO,CAAC,yBAAyB,CAAC,GAClC,OAAO,CAAC,yBAAyB,CAAC,EAAE,GACpC,OAAO,CAAC,oCAAoC,CAAC,GAC7C,SAAS,CACZ,CAAA;IACD,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAsCD,eAAO,MAAM,oBAAoB,oCAAqC,yBAAyB;;;;;;;;;;;;;;;;;;;eAqGsooB,CAAC;mBAAqC,CAAC,mCAAmC,GAAG;iBAA0E,CAAC;gBAAkC,CAAC;;;;;;;;;;;;;;yCAAw4B,GAAI;2CAA6E,GAAI;;;;;gBAA0J,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qBAA0D,GAAG;qCAAuE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;;mDAtIh/sB,GAAG;;;;;CAqIzE,CAAA"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { isDefined as h } from "@scalar/oas-utils/helpers";
|
|
2
|
+
import { isConfigurationWithSources as s, apiReferenceConfigurationSchema as i } from "@scalar/types/api-reference";
|
|
3
|
+
import w from "github-slugger";
|
|
4
|
+
import { computed as m, ref as S, watch as p } from "vue";
|
|
5
|
+
const c = "api", f = new w(), I = (e, n = 0) => {
|
|
6
|
+
if (!(!(e != null && e.url) && !(e != null && e.content)))
|
|
7
|
+
return f.reset(), e.title ? {
|
|
8
|
+
...e,
|
|
9
|
+
slug: e.slug || f.slug(e.title),
|
|
10
|
+
title: e.title
|
|
11
|
+
} : e.slug ? {
|
|
12
|
+
...e,
|
|
13
|
+
title: e.slug
|
|
14
|
+
} : {
|
|
15
|
+
...e,
|
|
16
|
+
slug: `api-${n + 1}`,
|
|
17
|
+
title: `API #${n + 1}`
|
|
18
|
+
};
|
|
19
|
+
}, U = ({ configuration: e, initialIndex: n }) => {
|
|
20
|
+
const a = m(() => {
|
|
21
|
+
var r;
|
|
22
|
+
return e.value ? (s(e.value) ? ((r = e.value.spec) == null ? void 0 : r.sources) ?? [] : [e.value].flat().map((t) => t.spec)).map((t, l) => t && I(t, l)).filter(h) : [];
|
|
23
|
+
}), v = (u) => {
|
|
24
|
+
if (a.value.length === 1)
|
|
25
|
+
return;
|
|
26
|
+
const r = new URL(window.location.href), t = a.value[u], l = (t == null ? void 0 : t.slug) ?? u.toString();
|
|
27
|
+
r.searchParams.set(c, l), r.hash = "", window.scrollTo({ top: 0, behavior: "instant" }), window.history.replaceState({}, "", r.toString());
|
|
28
|
+
}, o = S((() => {
|
|
29
|
+
const r = new URL(window.location.href).searchParams.get(c) || "0", t = a.value.findIndex((d) => d.slug === r);
|
|
30
|
+
if (t !== -1)
|
|
31
|
+
return t;
|
|
32
|
+
const l = Number.parseInt(r, 10);
|
|
33
|
+
return !isNaN(l) && l >= 0 && l < a.value.length ? l : typeof n == "number" ? n : 0;
|
|
34
|
+
})()), g = m(() => {
|
|
35
|
+
var u;
|
|
36
|
+
return e.value && s(e.value) ? i.parse({
|
|
37
|
+
...e.value,
|
|
38
|
+
spec: (u = e.value.spec) == null ? void 0 : u.sources[o.value]
|
|
39
|
+
}) : i.parse([e.value].flat()[o.value] ?? {});
|
|
40
|
+
});
|
|
41
|
+
return p(o, v, { flush: "sync" }), {
|
|
42
|
+
selectedConfiguration: g,
|
|
43
|
+
availableDocuments: a,
|
|
44
|
+
selectedDocumentIndex: o
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
export {
|
|
48
|
+
U as useMultipleDocuments
|
|
49
|
+
};
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import { useConfig as
|
|
2
|
-
import { ssrState as
|
|
1
|
+
import { useConfig as f } from "./useConfig.js";
|
|
2
|
+
import { ssrState as p, combineUrlAndPath as v } from "@scalar/oas-utils/helpers";
|
|
3
3
|
import { slug as c } from "github-slugger";
|
|
4
|
-
import { ref as
|
|
5
|
-
const
|
|
4
|
+
import { ref as s } from "vue";
|
|
5
|
+
const u = s(""), l = s(p.hash ?? ""), r = s(), m = s(!1), h = (t) => {
|
|
6
6
|
var n;
|
|
7
|
-
if (!
|
|
8
|
-
const
|
|
9
|
-
return decodeURIComponent(
|
|
10
|
-
},
|
|
7
|
+
if (!r.value) return "";
|
|
8
|
+
const a = new RegExp("^" + ((n = r.value) == null ? void 0 : n.basePath) + "/?");
|
|
9
|
+
return decodeURIComponent(t.replace(a, ""));
|
|
10
|
+
}, w = (t = l.value) => {
|
|
11
11
|
var i;
|
|
12
|
-
const
|
|
13
|
-
return
|
|
14
|
-
},
|
|
15
|
-
|
|
12
|
+
const a = (i = t.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = t.startsWith("model") ? "models" : "", o = t.startsWith("webhook") ? "webhooks" : "";
|
|
13
|
+
return a || n || o;
|
|
14
|
+
}, I = () => {
|
|
15
|
+
l.value = r.value ? h(window.location.pathname) : (
|
|
16
16
|
// Must remove the prefix from the hash as the internal hash value should be pure
|
|
17
|
-
decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(
|
|
17
|
+
decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(u.value.length)
|
|
18
18
|
);
|
|
19
|
-
}, $ = (
|
|
20
|
-
const n = new URL(
|
|
21
|
-
|
|
22
|
-
}, S = (
|
|
23
|
-
const
|
|
24
|
-
return
|
|
25
|
-
}, U = (
|
|
26
|
-
const
|
|
19
|
+
}, $ = (t, a = window.location.href) => {
|
|
20
|
+
const n = new URL(a);
|
|
21
|
+
r.value ? n.pathname = v(r.value.basePath, t) : n.hash = u.value + t, l.value = t, window.history.replaceState({}, "", n);
|
|
22
|
+
}, S = (t, a = window.location.href, n = window.location.search) => {
|
|
23
|
+
const o = new URL(a);
|
|
24
|
+
return o.hash = u.value + t, o.search = n, o.toString();
|
|
25
|
+
}, U = (t = l.value) => `${u.value}${t}`, b = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(u.value.length)), x = () => {
|
|
26
|
+
const t = f(), a = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", n = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${c(e.name)}` : "models", o = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${c(e.name)}`;
|
|
27
27
|
return {
|
|
28
|
-
hash:
|
|
28
|
+
hash: l,
|
|
29
29
|
/** Sets the prefix for the hash */
|
|
30
|
-
setHashPrefix: (
|
|
31
|
-
|
|
30
|
+
setHashPrefix: (e) => {
|
|
31
|
+
u.value = e;
|
|
32
32
|
},
|
|
33
33
|
/**
|
|
34
34
|
* Gets the full hash with the prefix
|
|
@@ -50,24 +50,24 @@ const s = l(""), u = l(m.hash ?? ""), o = l(), w = l(!1), h = (e) => {
|
|
|
50
50
|
replaceUrlState: $,
|
|
51
51
|
/** Gets the portion of the hash used by the references */
|
|
52
52
|
getReferenceHash: b,
|
|
53
|
-
getWebhookId: (
|
|
53
|
+
getWebhookId: (e) => e != null && e.name ? typeof t.value.generateWebhookSlug == "function" ? `webhook/${t.value.generateWebhookSlug(e)}` : `webhook/${e.method}/${c(e.name)}` : "webhooks",
|
|
54
54
|
getModelId: n,
|
|
55
|
-
getHeadingId:
|
|
56
|
-
getOperationId: (
|
|
55
|
+
getHeadingId: a,
|
|
56
|
+
getOperationId: (e, g) => {
|
|
57
57
|
var d;
|
|
58
|
-
return typeof
|
|
59
|
-
path:
|
|
60
|
-
operationId:
|
|
61
|
-
method:
|
|
62
|
-
summary: (d =
|
|
63
|
-
})}` : `${
|
|
58
|
+
return typeof t.value.generateOperationSlug == "function" ? `${o(g)}/${t.value.generateOperationSlug({
|
|
59
|
+
path: e.path,
|
|
60
|
+
operationId: e.operationId,
|
|
61
|
+
method: e.httpVerb,
|
|
62
|
+
summary: (d = e.information) == null ? void 0 : d.summary
|
|
63
|
+
})}` : `${o(g)}/${e.httpVerb}${e.path}`;
|
|
64
64
|
},
|
|
65
65
|
getPathRoutingId: h,
|
|
66
|
-
getSectionId:
|
|
67
|
-
getTagId:
|
|
68
|
-
isIntersectionEnabled:
|
|
69
|
-
pathRouting:
|
|
70
|
-
updateHash:
|
|
66
|
+
getSectionId: w,
|
|
67
|
+
getTagId: o,
|
|
68
|
+
isIntersectionEnabled: m,
|
|
69
|
+
pathRouting: r,
|
|
70
|
+
updateHash: I
|
|
71
71
|
};
|
|
72
72
|
};
|
|
73
73
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SpecConfiguration } from '@scalar/types/
|
|
1
|
+
import type { SpecConfiguration } from '@scalar/types/api-reference';
|
|
2
2
|
import { type MaybeRefOrGetter } from 'vue';
|
|
3
3
|
/**
|
|
4
4
|
* Keep the raw spec content in a ref and update it when the configuration changes.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useReactiveSpec.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactiveSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"useReactiveSpec.d.ts","sourceRoot":"","sources":["../../src/hooks/useReactiveSpec.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAA;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAiC,MAAM,KAAK,CAAA;AAoD1E;;GAEG;AACH,wBAAgB,eAAe,CAAC,EAC9B,UAAU,EACV,QAAQ,GACT,EAAE;IACD,UAAU,CAAC,EAAE,gBAAgB,CAAC,iBAAiB,CAAC,CAAA;IAChD,QAAQ,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;CACpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAqDA"}
|