@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.
Files changed (59) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/dist/browser/standalone.js +19687 -19597
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts +8 -21
  5. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  6. package/dist/components/ApiReference.vue.js +20 -52
  7. package/dist/components/ApiReference.vue2.js +4 -0
  8. package/dist/components/ApiReferenceLayout.vue.d.ts +2 -2
  9. package/dist/components/ApiReferenceLayout.vue.js +2 -2
  10. package/dist/components/ApiReferenceLayout.vue2.js +1 -1
  11. package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
  12. package/dist/components/Content/Introduction/Introduction.vue2.js +45 -42
  13. package/dist/components/DocumentSelector/DocumentSelector.vue.d.ts +12 -0
  14. package/dist/components/DocumentSelector/DocumentSelector.vue.d.ts.map +1 -0
  15. package/dist/components/DocumentSelector/DocumentSelector.vue.js +67 -0
  16. package/dist/components/DocumentSelector/DocumentSelector.vue2.js +4 -0
  17. package/dist/components/DocumentSelector/index.d.ts +2 -0
  18. package/dist/components/DocumentSelector/index.d.ts.map +1 -0
  19. package/dist/components/Layouts/ClassicLayout.vue.d.ts +4 -4
  20. package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
  21. package/dist/components/Layouts/ClassicLayout.vue.js +28 -22
  22. package/dist/components/Layouts/Layouts.vue.d.ts +4 -7
  23. package/dist/components/Layouts/Layouts.vue.d.ts.map +1 -1
  24. package/dist/components/Layouts/Layouts.vue.js +23 -14
  25. package/dist/components/Layouts/ModernLayout.vue.d.ts +4 -4
  26. package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
  27. package/dist/components/Layouts/ModernLayout.vue.js +2 -2
  28. package/dist/components/Layouts/ModernLayout.vue2.js +33 -30
  29. package/dist/components/Sidebar/SidebarElement.vue.js +2 -2
  30. package/dist/components/SingleApiReference.vue.d.ts +28 -0
  31. package/dist/components/SingleApiReference.vue.d.ts.map +1 -0
  32. package/dist/components/SingleApiReference.vue.js +60 -0
  33. package/dist/components/SingleApiReference.vue3.js +5 -0
  34. package/dist/esm.d.ts +3 -5
  35. package/dist/esm.d.ts.map +1 -1
  36. package/dist/esm.js +12 -13
  37. package/dist/features/ApiClientModal/useApiClient.d.ts +2 -2
  38. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  39. package/dist/features/BaseUrl/BaseUrl.vue.js +31 -30
  40. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  41. package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
  42. package/dist/features/TestRequestButton/TestRequestButton.vue.js +2 -2
  43. package/dist/features/TestRequestButton/TestRequestButton.vue2.js +16 -14
  44. package/dist/hooks/useConfig.d.ts +3 -3
  45. package/dist/hooks/useConfig.d.ts.map +1 -1
  46. package/dist/hooks/useConfig.js +7 -4
  47. package/dist/hooks/useMultipleDocuments.d.ts +87 -0
  48. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -0
  49. package/dist/hooks/useMultipleDocuments.js +49 -0
  50. package/dist/hooks/useNavState.js +38 -38
  51. package/dist/hooks/useReactiveSpec.d.ts +1 -1
  52. package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
  53. package/dist/index.js +80 -81
  54. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  55. package/dist/style.css +1 -1
  56. package/dist/types.d.ts +6 -6
  57. package/dist/types.d.ts.map +1 -1
  58. package/package.json +13 -14
  59. package/dist/components/ApiReference.vue3.js +0 -5
@@ -1,40 +1,41 @@
1
- import { defineComponent as _, useId as x, openBlock as s, createElementBlock as k, Fragment as g, createElementVNode as m, unref as e, createBlock as d, createCommentVNode as p, createVNode as V } from "vue";
2
- import { ServerSelector as B, ServerVariablesForm as y } from "@scalar/api-client/components/Server";
3
- import { useActiveEntities as C, useWorkspace as E } from "@scalar/api-client/store";
4
- import { ScalarMarkdown as N } from "@scalar/components";
5
- import { useConfig as U } from "../../hooks/useConfig.js";
6
- const F = ["id"], j = /* @__PURE__ */ _({
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(M) {
9
- const { activeCollection: i, activeServer: r } = C(), { serverMutators: f } = E(), n = x(), b = (a, o) => {
10
- if (!r.value) return;
11
- const t = r.value.variables || {};
12
- t[a] = { ...t[a], default: o }, f.edit(r.value.uid, "variables", t);
13
- }, { onServerChange: l } = U(), S = (a) => {
14
- l == null || l(a);
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 (a, o) => {
17
- var t, c, u, v;
18
- return s(), k(g, null, [
19
- o[0] || (o[0] = m("label", { class: "bg-b-2 flex h-8 items-center px-3 py-2.5 text-sm font-medium" }, " Server ", -1)),
20
- m("div", { id: e(n) }, [
21
- (c = (t = e(i)) == null ? void 0 : t.servers) != null && c.length ? (s(), d(e(B), {
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(i),
24
- server: e(r),
25
- target: e(n),
24
+ collection: e(n),
25
+ server: e(t),
26
+ target: e(s),
26
27
  onUpdateServer: S
27
- }, null, 8, ["collection", "server", "target"])) : p("", !0)
28
- ], 8, F),
29
- V(e(y), {
30
- variables: (u = e(r)) == null ? void 0 : u.variables,
31
- "onUpdate:variable": b
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(r)) != null && v.description ? (s(), d(e(N), {
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(r).description
37
- }, null, 8, ["value"])) : p("", !0)
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":"AA2XA,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EACT,MAAM,EACP,MAAM,iCAAiC,CAAA;AAExC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAmBhE,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,IAA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,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 p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c9ad100f"]]);
4
+ const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-57c79f34"]]);
5
5
  export {
6
- p as default
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 m = /* @__PURE__ */ o(t, [["__scopeId", "data-v-e1499c8d"]]);
4
+ const a = /* @__PURE__ */ o(t, [["__scopeId", "data-v-4263a1c2"]]);
5
5
  export {
6
- m as default
6
+ a as default
7
7
  };
@@ -1,21 +1,23 @@
1
- import { defineComponent as d, computed as c, openBlock as i, createElementBlock as s, withModifiers as f, createVNode as a, unref as h, createElementVNode as k, withCtx as C, createTextVNode as u, toDisplayString as p, Fragment as y } from "vue";
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 q } from "../../hooks/useConfig.js";
5
- import { useApiClient as R } from "../ApiClientModal/useApiClient.js";
6
- const T = ["method"], g = /* @__PURE__ */ d({
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(n) {
12
- const { client: t } = R(), o = q(), l = c(() => (o == null ? void 0 : o.hideTestRequestButton) !== !0), m = () => {
11
+ setup(o) {
12
+ const { client: t } = q(), p = g(), l = c(
13
+ () => p.value.hideTestRequestButton !== !0
14
+ ), m = () => {
13
15
  var e;
14
- n.operation && ((e = t == null ? void 0 : t.value) != null && e.open) && t.value.open({
15
- requestUid: n.operation.uid
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, r) => e.operation && l.value ? (i(), s("button", {
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
- r[0] || (r[0] = k("span", null, "Test Request", -1)),
31
+ n[0] || (n[0] = k("span", null, "Test Request", -1)),
30
32
  a(b, null, {
31
33
  default: C(() => [
32
- u("(" + p(e.operation.method) + " " + p(e.operation.path) + ")", 1)
34
+ s("(" + u(e.operation.method) + " " + u(e.operation.path) + ")", 1)
33
35
  ]),
34
36
  _: 1
35
37
  })
36
- ], 8, T)) : (i(), s(y, { key: 1 }, [
37
- u(" ")
38
+ ], 8, v)) : (i(), r(y, { key: 1 }, [
39
+ s(" ")
38
40
  ], 64));
39
41
  }
40
42
  });
41
43
  export {
42
- g as default
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,EAAU,MAAM,KAAK,CAAA;AAE/C,eAAO,MAAM,oBAAoB,EAAe,YAAY,CAAC,yBAAyB,CAAC,CAAA;AAEvF,0DAA0D;AAC1D,eAAO,MAAM,SAAS,iCAGrB,CAAA"}
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"}
@@ -1,7 +1,10 @@
1
1
  import { apiReferenceConfigurationSchema as o } from "@scalar/types/api-reference";
2
- import { inject as n } from "vue";
3
- const e = Symbol(), c = () => n(e, o.parse({}));
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
- e as CONFIGURATION_SYMBOL,
6
- c as useConfig
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 p } from "./useConfig.js";
2
- import { ssrState as m, combineUrlAndPath as f } from "@scalar/oas-utils/helpers";
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 l } from "vue";
5
- const s = l(""), u = l(m.hash ?? ""), o = l(), w = l(!1), h = (e) => {
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 (!o.value) return "";
8
- const r = new RegExp("^" + ((n = o.value) == null ? void 0 : n.basePath) + "/?");
9
- return decodeURIComponent(e.replace(r, ""));
10
- }, I = (e = u.value) => {
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 r = (i = e.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = e.startsWith("model") ? "models" : "", a = e.startsWith("webhook") ? "webhooks" : "";
13
- return r || n || a;
14
- }, v = () => {
15
- u.value = o.value ? h(window.location.pathname) : (
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(s.value.length)
17
+ decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(u.value.length)
18
18
  );
19
- }, $ = (e, r = window.location.href) => {
20
- const n = new URL(r);
21
- o.value ? n.pathname = f(o.value.basePath, e) : n.hash = s.value + e, u.value = e, window.history.replaceState({}, "", n);
22
- }, S = (e, r = window.location.href, n = window.location.search) => {
23
- const a = new URL(r);
24
- return a.hash = s.value + e, a.search = n, a.toString();
25
- }, U = (e = u.value) => `${s.value}${e}`, b = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(s.value.length)), x = () => {
26
- 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", a = (t) => typeof (e == null ? void 0 : e.generateTagSlug) == "function" ? `tag/${e.generateTagSlug(t)}` : `tag/${c(t.name)}`;
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: u,
28
+ hash: l,
29
29
  /** Sets the prefix for the hash */
30
- setHashPrefix: (t) => {
31
- s.value = t;
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: (t) => t != null && t.name ? typeof (e == null ? void 0 : e.generateWebhookSlug) == "function" ? `webhook/${e.generateWebhookSlug(t)}` : `webhook/${t.method}/${c(t.name)}` : "webhooks",
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: r,
56
- getOperationId: (t, g) => {
55
+ getHeadingId: a,
56
+ getOperationId: (e, g) => {
57
57
  var d;
58
- return typeof (e == null ? void 0 : e.generateOperationSlug) == "function" ? `${a(g)}/${e.generateOperationSlug({
59
- path: t.path,
60
- operationId: t.operationId,
61
- method: t.httpVerb,
62
- summary: (d = t.information) == null ? void 0 : d.summary
63
- })}` : `${a(g)}/${t.httpVerb}${t.path}`;
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: I,
67
- getTagId: a,
68
- isIntersectionEnabled: w,
69
- pathRouting: o,
70
- updateHash: v
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/legacy';
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,sBAAsB,CAAA;AAC7D,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,MAA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