@scalar/api-reference 1.28.7 → 1.28.9

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 (38) hide show
  1. package/CHANGELOG.md +45 -0
  2. package/dist/browser/standalone.js +13967 -13923
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/ApiReference.vue.d.ts +2 -2
  5. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  6. package/dist/components/GettingStarted.vue.js +1 -1
  7. package/dist/components/GettingStarted.vue2.js +25 -25
  8. package/dist/components/Sidebar/Sidebar.vue.d.ts.map +1 -1
  9. package/dist/components/Sidebar/Sidebar.vue.js +1 -1
  10. package/dist/components/Sidebar/Sidebar.vue2.js +89 -76
  11. package/dist/components/Sidebar/SidebarElement.vue.js +1 -1
  12. package/dist/components/Sidebar/SidebarElement.vue2.js +1 -1
  13. package/dist/components/SingleApiReference.vue.d.ts +1 -1
  14. package/dist/components/SingleApiReference.vue.d.ts.map +1 -1
  15. package/dist/features/ApiClientModal/useApiClient.d.ts +1334 -990
  16. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  17. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts +46 -1
  18. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  19. package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
  20. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +83 -74
  21. package/dist/helpers/freeze-element.d.ts +11 -0
  22. package/dist/helpers/freeze-element.d.ts.map +1 -0
  23. package/dist/helpers/freeze-element.js +20 -0
  24. package/dist/helpers/get-request.d.ts +4 -4
  25. package/dist/helpers/get-request.d.ts.map +1 -1
  26. package/dist/hooks/useMultipleDocuments.d.ts +26 -23
  27. package/dist/hooks/useMultipleDocuments.d.ts.map +1 -1
  28. package/dist/hooks/useMultipleDocuments.js +66 -50
  29. package/dist/hooks/useReactiveSpec.d.ts +220 -3
  30. package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
  31. package/dist/hooks/useReactiveSpec.js +30 -28
  32. package/dist/index.js +1 -1
  33. package/dist/standalone/lib/html-api.d.ts +5 -5
  34. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  35. package/dist/style.css +1 -1
  36. package/dist/types.d.ts +2 -2
  37. package/dist/types.d.ts.map +1 -1
  38. package/package.json +10 -10
@@ -0,0 +1,20 @@
1
+ const s = (t) => {
2
+ if (!t)
3
+ return () => null;
4
+ const e = t.getBoundingClientRect().top, r = new MutationObserver(() => {
5
+ const n = t.getBoundingClientRect().top;
6
+ if (n !== e) {
7
+ const o = n - e;
8
+ window.scrollBy(0, o);
9
+ }
10
+ });
11
+ return r.observe(document.body, {
12
+ childList: !0,
13
+ subtree: !0,
14
+ attributes: !0,
15
+ characterData: !0
16
+ }), () => r.disconnect();
17
+ };
18
+ export {
19
+ s as freezeElement
20
+ };
@@ -1,9 +1,9 @@
1
1
  import type { WorkspaceStore } from '@scalar/api-client/store';
2
2
  /** Grabs the request from a path + method */
3
3
  export declare const getRequest: (requests: WorkspaceStore["requests"], path: string, method: string) => {
4
+ uid: string & import("zod").BRAND<"operation">;
4
5
  path: string;
5
6
  type: "request";
6
- uid: string & import("zod").BRAND<"operation">;
7
7
  selectedSecuritySchemeUids: ((string & import("zod").BRAND<"securityScheme">) | (string & import("zod").BRAND<"securityScheme">)[])[];
8
8
  selectedServerUid: (string & import("zod").BRAND<"server">) | null;
9
9
  servers: (string & import("zod").BRAND<"server">)[];
@@ -22,12 +22,12 @@ export declare const getRequest: (requests: WorkspaceStore["requests"], path: st
22
22
  deprecated?: boolean | undefined;
23
23
  operationId?: string | undefined;
24
24
  parameters?: {
25
- required: boolean;
26
25
  name: string;
27
- in: "path" | "cookie" | "query" | "header";
26
+ required: boolean;
27
+ in: "cookie" | "path" | "query" | "header";
28
28
  deprecated: boolean;
29
- example?: unknown;
30
29
  description?: string | undefined;
30
+ example?: unknown;
31
31
  schema?: unknown;
32
32
  content?: unknown;
33
33
  style?: "matrix" | "simple" | "form" | "label" | "spaceDelimited" | "pipeDelimited" | "deepObject" | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"get-request.d.ts","sourceRoot":"","sources":["../../src/helpers/get-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,6CAA6C;AAC7C,eAAO,MAAM,UAAU,aAAc,cAAc,CAAC,UAAU,CAAC,QAAQ,MAAM,UAAU,MAAM;;;yBAE2yT,KAAK;kDAA4E,KAAK,8CAA8C,KAAK;wCAA6E,KAAK;8BAA6D,KAAK;+BAAyD,KAAK;;;;;;mBAAwR,CAAC;;;;;;;;;;;;;eAA0f,CAAC;mBAAkC,CAAC;cAAwC,CAAC;eAA8B,CAAC;aAA4B,CAAC;gBAA8H,CAAC;iBAAoD,CAAC;mBAAkC,CAAC;;;;;kCAAiM,eAAe;aAD77W,CAAA"}
1
+ {"version":3,"file":"get-request.d.ts","sourceRoot":"","sources":["../../src/helpers/get-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAA;AAE9D,6CAA6C;AAC7C,eAAO,MAAM,UAAU,aAAc,cAAc,CAAC,UAAU,CAAC,QAAQ,MAAM,UAAU,MAAM;yBAE4vT,KAAK;;;kDAA2H,KAAK,8CAA8C,KAAK;wCAA6E,KAAK;8BAA6D,KAAK;+BAAyD,KAAK;;;;;;mBAAwR,CAAC;;;;;;;;;;;;;mBAA8f,CAAC;eAAyC,CAAC;cAA6B,CAAC;eAA8B,CAAC;aAA4B,CAAC;gBAA8H,CAAC;iBAAoD,CAAC;mBAAkC,CAAC;;;;;kCAAiM,eAAe;aAD77W,CAAA"}
@@ -1,58 +1,53 @@
1
1
  import type { NavState } from '../hooks/useNavState.js';
2
- import { type ApiReferenceConfiguration, type ApiReferenceConfigurationWithSources } from '@scalar/types/api-reference';
2
+ import { type AnyApiReferenceConfiguration } from '@scalar/types/api-reference';
3
3
  import { type Ref } from 'vue';
4
4
  type UseMultipleDocumentsProps = {
5
5
  /**
6
6
  * Configuration for the API reference.
7
7
  * Can be a single configuration or an array of configurations for multiple documents.
8
8
  */
9
- configuration: Ref<Partial<ApiReferenceConfiguration> | Partial<ApiReferenceConfiguration>[] | Partial<ApiReferenceConfigurationWithSources> | undefined>;
9
+ configuration: Ref<AnyApiReferenceConfiguration | undefined>;
10
10
  /** The initial index to pre-select a document, if there is no query parameter available */
11
11
  initialIndex?: number;
12
12
  } & NavState;
13
13
  export declare const useMultipleDocuments: ({ configuration, initialIndex, isIntersectionEnabled, hash, hashPrefix, }: UseMultipleDocumentsProps) => {
14
14
  selectedConfiguration: import("vue").ComputedRef<{
15
- hideClientButton: boolean;
16
- showSidebar: boolean;
17
- theme: "alternate" | "default" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none";
18
- layout: "modern" | "classic";
19
- isEditable: boolean;
20
- isLoading: boolean;
21
- hideModels: boolean;
22
- hideDownloadButton: boolean;
23
- hideTestRequestButton: boolean;
24
- hideSearch: boolean;
25
- hideDarkModeToggle: boolean;
26
- withDefaultFonts: boolean;
27
15
  url?: string | undefined;
28
16
  content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
29
17
  title?: string | undefined;
30
18
  slug?: string | undefined;
31
- spec?: {
32
- url?: string | undefined;
33
- content?: string | Record<string, any> | ((...args: unknown[]) => Record<string, any>) | null | undefined;
34
- title?: string | undefined;
35
- slug?: string | undefined;
36
- } | undefined;
19
+ default?: boolean;
20
+ hideClientButton?: boolean | undefined;
21
+ showSidebar?: boolean | undefined;
22
+ theme?: "default" | "alternate" | "moon" | "purple" | "solarized" | "bluePlanet" | "deepSpace" | "saturn" | "kepler" | "elysiajs" | "fastify" | "mars" | "none" | undefined;
23
+ layout?: "modern" | "classic" | undefined;
24
+ isEditable?: boolean | undefined;
25
+ isLoading?: boolean | undefined;
26
+ hideModels?: boolean | undefined;
27
+ hideDownloadButton?: boolean | undefined;
28
+ hideTestRequestButton?: boolean | undefined;
29
+ hideSearch?: boolean | undefined;
30
+ hideDarkModeToggle?: boolean | undefined;
31
+ withDefaultFonts?: boolean | undefined;
37
32
  authentication?: any;
38
33
  baseServerURL?: string | undefined;
39
34
  proxyUrl?: string | undefined;
40
- 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;
35
+ searchHotKey?: "o" | "n" | "c" | "r" | "a" | "b" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "p" | "q" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | undefined;
41
36
  servers?: any[] | undefined;
42
37
  _integration?: "go" | "elysiajs" | "fastify" | "adonisjs" | "docusaurus" | "dotnet" | "express" | "fastapi" | "hono" | "html" | "laravel" | "litestar" | "nestjs" | "nextjs" | "nitro" | "nuxt" | "platformatic" | "react" | "rust" | "vue" | null | undefined;
43
- proxy?: string | undefined;
44
38
  darkMode?: boolean | undefined;
45
39
  forceDarkModeState?: "dark" | "light" | undefined;
46
40
  metaData?: any;
47
41
  favicon?: string | undefined;
48
42
  hiddenClients?: true | string[] | Record<string, boolean | string[]> | undefined;
49
43
  defaultHttpClient?: {
50
- targetKey: "c" | "clojure" | "csharp" | "go" | "http" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
44
+ targetKey: "http" | "c" | "clojure" | "csharp" | "go" | "java" | "js" | "kotlin" | "node" | "objc" | "ocaml" | "php" | "powershell" | "python" | "r" | "ruby" | "shell" | "swift" | "dart";
51
45
  clientKey: string;
52
46
  } | undefined;
53
47
  customCss?: string | undefined;
54
48
  onSpecUpdate?: ((args_0: string, ...args: unknown[]) => void) | undefined;
55
49
  onServerChange?: ((args_0: string, ...args: unknown[]) => void) | undefined;
50
+ onDocumentSelect?: ((...args: unknown[]) => void | Promise<void>) | undefined;
56
51
  pathRouting?: {
57
52
  basePath: string;
58
53
  } | undefined;
@@ -80,6 +75,14 @@ export declare const useMultipleDocuments: ({ configuration, initialIndex, isInt
80
75
  defaultOpenAllTags?: boolean | undefined;
81
76
  tagsSorter?: "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
82
77
  operationsSorter?: "method" | "alpha" | ((args_0: any, args_1: any, ...args: unknown[]) => number) | undefined;
78
+ sources?: ({
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
+ default?: boolean;
85
+ })[] | undefined;
83
86
  }>;
84
87
  availableDocuments: import("vue").ComputedRef<{
85
88
  url?: string | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,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,GAAG,QAAQ,CAAA;AAsCZ,eAAO,MAAM,oBAAoB,8EAM9B,yBAAyB;;;;;;;;;;;;;;;mDAgI63xB,GAA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;;;;;;;mDAAH,GAAG;;;;;;;;CAuIT,CAAA"}
@@ -1,67 +1,83 @@
1
1
  import { isDefined as S } from "@scalar/oas-utils/helpers";
2
- import { isConfigurationWithSources as p, apiReferenceConfigurationSchema as m } from "@scalar/types/api-reference";
3
- import y from "github-slugger";
4
- import { computed as v, ref as R, watch as b } from "vue";
5
- const d = "api", w = new y(), A = (e, r = 0) => {
2
+ import { isConfigurationWithSources as m } from "@scalar/types/api-reference";
3
+ import h from "github-slugger";
4
+ import { computed as p, ref as y, watch as b } from "vue";
5
+ const w = "api", g = new h(), I = (l, a = 0) => {
6
+ const e = {
7
+ ...l,
8
+ // @ts-expect-error this is before parsing so we transform the old style
9
+ ...l.spec ?? {}
10
+ };
6
11
  if (!(!(e != null && e.url) && !(e != null && e.content)))
7
- return w.reset(), e.title ? {
12
+ return g.reset(), e.title ? {
8
13
  ...e,
9
- slug: e.slug || w.slug(e.title),
14
+ slug: e.slug || g.slug(e.title),
10
15
  title: e.title
11
16
  } : e.slug ? {
12
17
  ...e,
13
18
  title: e.slug
14
19
  } : {
15
20
  ...e,
16
- slug: `api-${r + 1}`,
17
- title: `API #${r + 1}`
21
+ slug: `api-${a + 1}`,
22
+ title: `API #${a + 1}`
18
23
  };
19
- }, N = ({
20
- configuration: e,
21
- initialIndex: r,
22
- isIntersectionEnabled: s,
23
- hash: o,
24
- hashPrefix: f
24
+ }, P = ({
25
+ configuration: l,
26
+ initialIndex: a,
27
+ isIntersectionEnabled: e,
28
+ hash: c,
29
+ hashPrefix: d
25
30
  }) => {
26
- const a = v(() => {
27
- var l;
28
- return e.value ? (p(e.value) ? ((l = e.value) == null ? void 0 : l.sources) ?? [] : [e.value].flat().map((t) => t)).map((t, n) => t && A(t, n)).filter(S) : [];
29
- }), g = (i) => {
30
- if (typeof window > "u" || a.value.length === 1)
31
- return;
32
- const l = new URL(window.location.href), t = a.value[i], n = (t == null ? void 0 : t.slug) ?? i.toString();
33
- l.searchParams.set(d, n), l.hash = "", window.history.replaceState({}, "", l.toString()), o.value = "", f.value = "", s.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" });
34
- }, u = R((() => {
31
+ const r = p(() => l.value ? (m(l.value) ? (
32
+ // This IFFE is needed for the type guard as it doens't persist into the callback scope
33
+ (() => {
34
+ const { sources: t, ...u } = l.value;
35
+ return (t == null ? void 0 : t.map((n) => ({ ...u, ...n }))) ?? [];
36
+ })()
37
+ ) : [l.value].flat()).map((t, u) => t && I(t, u)).filter(S) : []), o = y((() => {
35
38
  if (typeof window > "u")
36
- return typeof r == "number" ? r : 0;
37
- const l = new URL(window.location.href).searchParams.get(d) || "0", t = a.value.findIndex((h) => h.slug === l);
38
- if (t !== -1)
39
- return t;
40
- const n = Number.parseInt(l, 10);
41
- return !isNaN(n) && n >= 0 && n < a.value.length ? n : typeof r == "number" ? r : 0;
42
- })()), c = v(() => {
43
- var l, t;
44
- if (e.value && p(e.value))
45
- return m.parse({
46
- ...e.value,
47
- ...(t = (l = e.value) == null ? void 0 : l.sources) == null ? void 0 : t[u.value],
48
- ...a.value[u.value]
49
- });
50
- const i = [e.value].flat()[u.value] ?? {};
51
- return m.parse({
52
- ...i,
53
- ...a.value[u.value]
54
- });
39
+ return typeof a == "number" ? a : 0;
40
+ const t = new URL(window.location.href).searchParams.get(w);
41
+ if (t) {
42
+ const n = r.value.findIndex((f) => f.slug === t);
43
+ if (n !== -1)
44
+ return n;
45
+ const s = Number.parseInt(t, 10);
46
+ if (!isNaN(s) && s >= 0 && s < r.value.length)
47
+ return s;
48
+ }
49
+ const u = r.value.findIndex((n) => "default" in n && n.default === !0);
50
+ return u !== -1 ? u : typeof a == "number" ? a : 0;
51
+ })()), v = p(() => {
52
+ var t, u;
53
+ return l.value && m(l.value) ? {
54
+ ...l.value,
55
+ ...(u = (t = l.value) == null ? void 0 : t.sources) == null ? void 0 : u[o.value],
56
+ ...r.value[o.value]
57
+ } : {
58
+ ...[l.value].flat()[o.value] ?? {},
59
+ ...r.value[o.value]
60
+ };
55
61
  });
56
- return b(u, g, { flush: "sync" }), {
57
- selectedConfiguration: c,
58
- availableDocuments: a,
59
- selectedDocumentIndex: u,
60
- isIntersectionEnabled: s,
61
- hash: o,
62
- hashPrefix: f
62
+ return b(
63
+ o,
64
+ (i) => {
65
+ var s, f;
66
+ if (typeof window > "u" || r.value.length === 1)
67
+ return;
68
+ const t = new URL(window.location.href), u = r.value[i], n = (u == null ? void 0 : u.slug) ?? i.toString();
69
+ t.searchParams.set(w, n), t.hash = "", window.history.replaceState({}, "", t.toString()), c.value = "", d.value = "", e.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" }), (f = (s = v.value).onDocumentSelect) == null || f.call(s);
70
+ },
71
+ { flush: "sync" }
72
+ ), {
73
+ selectedConfiguration: v,
74
+ availableDocuments: r,
75
+ selectedDocumentIndex: o,
76
+ isIntersectionEnabled: e,
77
+ hash: c,
78
+ hashPrefix: d
63
79
  };
64
80
  };
65
81
  export {
66
- N as useMultipleDocuments
82
+ P as useMultipleDocuments
67
83
  };
@@ -8,7 +8,7 @@ export declare function useReactiveSpec({ specConfig, proxyUrl, }: {
8
8
  proxyUrl?: MaybeRefOrGetter<string>;
9
9
  }): {
10
10
  rawSpec: import("vue").Ref<string, string>;
11
- parsedSpec: {
11
+ parsedSpec: import("vue").Ref<{
12
12
  tags?: {
13
13
  name: string;
14
14
  description: string;
@@ -166,15 +166,232 @@ export declare function useReactiveSpec({ specConfig, proxyUrl, }: {
166
166
  description?: string | undefined;
167
167
  } | undefined;
168
168
  servers?: {
169
+ url?: string | undefined;
170
+ description?: string | undefined;
171
+ variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
172
+ }[] | {
169
173
  url?: string | undefined;
170
174
  description?: string | undefined;
171
175
  variables?: {
172
176
  [variable: string]: import("@scalar/openapi-types").OpenAPIV3.ServerVariableObject;
173
177
  } | undefined;
174
- }[] | {
178
+ }[] | undefined;
179
+ components?: {
180
+ schemas?: {
181
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.SchemaObject;
182
+ } | undefined;
183
+ responses?: {
184
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.ResponseObject;
185
+ } | undefined;
186
+ parameters?: {
187
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.ParameterObject;
188
+ } | undefined;
189
+ examples?: {
190
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.ExampleObject;
191
+ } | undefined;
192
+ requestBodies?: {
193
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.RequestBodyObject;
194
+ } | undefined;
195
+ headers?: {
196
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.HeaderObject;
197
+ } | undefined;
198
+ securitySchemes?: {
199
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.SecuritySchemeObject;
200
+ } | undefined;
201
+ links?: {
202
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.LinkObject;
203
+ } | undefined;
204
+ callbacks?: {
205
+ [key: string]: import("@scalar/openapi-types").OpenAPIV3.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3.CallbackObject;
206
+ } | undefined;
207
+ } | {
208
+ schemas?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.SchemaObject> | undefined;
209
+ responses?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.ResponseObject> | undefined;
210
+ parameters?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.ParameterObject> | undefined;
211
+ examples?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.ExampleObject> | undefined;
212
+ requestBodies?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.RequestBodyObject> | undefined;
213
+ headers?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.HeaderObject> | undefined;
214
+ securitySchemes?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.SecuritySchemeObject> | undefined;
215
+ links?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.LinkObject> | undefined;
216
+ callbacks?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.CallbackObject> | undefined;
217
+ pathItems?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ReferenceObject | import("@scalar/openapi-types").OpenAPIV3_1.PathItemObject> | undefined;
218
+ } | undefined;
219
+ webhooks?: import("@scalar/types").Webhooks | undefined;
220
+ definitions?: import("@scalar/types").Definitions | undefined;
221
+ swagger?: import("@scalar/openapi-types").OpenAPIV2.Document["swagger"];
222
+ openapi?: import("@scalar/openapi-types").OpenAPIV3.Document["openapi"] | import("@scalar/openapi-types").OpenAPIV3_1.Document["openapi"];
223
+ 'x-tagGroups'?: {
224
+ name: string;
225
+ tags: string[];
226
+ }[] | undefined;
227
+ security?: import("@scalar/openapi-types").OpenAPIV3.SecurityRequirementObject[] | undefined;
228
+ }, import("@scalar/types").Spec | {
229
+ tags?: {
230
+ name: string;
231
+ description: string;
232
+ operations: {
233
+ httpVerb: "GET" | "HEAD" | "PATCH" | "POST" | "PUT" | "TRACE" | "CONNECT" | "DELETE" | "OPTIONS";
234
+ path: string;
235
+ operationId?: string | undefined;
236
+ name?: string | undefined;
237
+ description?: string | undefined;
238
+ information?: {
239
+ description?: string | undefined;
240
+ operationId?: (string | number) | undefined;
241
+ parameters?: {
242
+ name: string;
243
+ in?: string | undefined;
244
+ description?: string | undefined;
245
+ required?: boolean | undefined;
246
+ deprecated?: boolean | undefined;
247
+ allowEmptyValue?: boolean | undefined;
248
+ style?: ("form" | "simple") | undefined;
249
+ explode?: boolean | undefined;
250
+ allowReserved?: boolean | undefined;
251
+ schema?: {
252
+ type: string;
253
+ name?: string | undefined;
254
+ example?: any;
255
+ default?: any;
256
+ format?: string | undefined;
257
+ description?: string | undefined;
258
+ properties?: Record<string, import("@scalar/types").Schema> | undefined;
259
+ } | undefined;
260
+ example?: any;
261
+ examples?: (Map<string, any> & Omit<Map<string, any>, keyof Map<any, any>>) | undefined;
262
+ content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
263
+ headers?: {
264
+ [key: string]: import("@scalar/openapi-types").OpenAPI.HeaderObject;
265
+ } | undefined;
266
+ }[] | undefined;
267
+ responses?: Record<string, import("@scalar/openapi-types").OpenAPI.ResponseObject> | undefined;
268
+ security?: import("@scalar/openapi-types").OpenAPIV3.SecurityRequirementObject[] | undefined;
269
+ requestBody?: {
270
+ description?: string | undefined;
271
+ required?: boolean | undefined;
272
+ content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
273
+ } | undefined;
274
+ summary?: string | undefined;
275
+ tags?: string[] | undefined;
276
+ deprecated?: boolean | undefined;
277
+ servers?: {
278
+ url?: string | undefined;
279
+ description?: string | undefined;
280
+ variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
281
+ }[] | undefined;
282
+ 'x-custom-examples'?: {
283
+ lang: string;
284
+ label: string;
285
+ source: string;
286
+ }[] | undefined;
287
+ 'x-scalar-stability'?: import("@scalar/types").XScalarStability | undefined;
288
+ 'x-codeSamples'?: {
289
+ lang: string;
290
+ label: string;
291
+ source: string;
292
+ }[] | undefined;
293
+ 'x-code-samples'?: {
294
+ lang: string;
295
+ label: string;
296
+ source: string;
297
+ }[] | undefined;
298
+ } | undefined;
299
+ servers?: {
300
+ url?: string | undefined;
301
+ description?: string | undefined;
302
+ variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
303
+ }[] | undefined;
304
+ pathParameters?: {
305
+ name: string;
306
+ in?: string | undefined;
307
+ description?: string | undefined;
308
+ required?: boolean | undefined;
309
+ deprecated?: boolean | undefined;
310
+ allowEmptyValue?: boolean | undefined;
311
+ style?: ("form" | "simple") | undefined;
312
+ explode?: boolean | undefined;
313
+ allowReserved?: boolean | undefined;
314
+ schema?: {
315
+ type: string;
316
+ name?: string | undefined;
317
+ example?: any;
318
+ default?: any;
319
+ format?: string | undefined;
320
+ description?: string | undefined;
321
+ properties?: Record<string, import("@scalar/types").Schema> | undefined;
322
+ } | undefined;
323
+ example?: any;
324
+ examples?: (Map<string, any> & Omit<Map<string, any>, keyof Map<any, any>>) | undefined;
325
+ content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
326
+ headers?: {
327
+ [key: string]: import("@scalar/openapi-types").OpenAPI.HeaderObject;
328
+ } | undefined;
329
+ }[] | undefined;
330
+ }[];
331
+ 'x-displayName'?: string | undefined;
332
+ }[] | undefined;
333
+ info: {
334
+ title?: string | undefined;
335
+ description?: string | undefined;
336
+ termsOfService?: string | undefined;
337
+ contact?: {
338
+ name?: string | undefined;
339
+ url?: string | undefined;
340
+ email?: string | undefined;
341
+ } | undefined;
342
+ license?: {
343
+ name?: string | undefined;
344
+ url?: string | undefined;
345
+ } | undefined;
346
+ version?: string | undefined;
347
+ } | {
348
+ title?: string | undefined;
349
+ description?: string | undefined;
350
+ termsOfService?: string | undefined;
351
+ contact?: {
352
+ name?: string | undefined;
353
+ url?: string | undefined;
354
+ email?: string | undefined;
355
+ } | undefined;
356
+ license?: {
357
+ name?: string | undefined;
358
+ url?: string | undefined;
359
+ } | undefined;
360
+ version?: string | undefined;
361
+ } | {
362
+ title?: string | undefined;
363
+ description?: string | undefined;
364
+ termsOfService?: string | undefined;
365
+ contact?: {
366
+ name?: string | undefined;
367
+ url?: string | undefined;
368
+ email?: string | undefined;
369
+ } | undefined;
370
+ version?: string | undefined;
371
+ summary?: string | undefined;
372
+ license?: {
373
+ name?: string | undefined;
374
+ url?: string | undefined;
375
+ identifier?: string | undefined;
376
+ } | undefined;
377
+ } | undefined;
378
+ host?: import("@scalar/openapi-types").OpenAPIV2.Document["host"];
379
+ basePath?: import("@scalar/openapi-types").OpenAPIV2.Document["basePath"];
380
+ schemes?: import("@scalar/openapi-types").OpenAPIV2.Document["schemes"];
381
+ externalDocs?: {
382
+ url: string;
383
+ description?: string | undefined;
384
+ } | undefined;
385
+ servers?: {
175
386
  url?: string | undefined;
176
387
  description?: string | undefined;
177
388
  variables?: Record<string, import("@scalar/openapi-types").OpenAPIV3_1.ServerVariableObject> | undefined;
389
+ }[] | {
390
+ url?: string | undefined;
391
+ description?: string | undefined;
392
+ variables?: {
393
+ [variable: string]: import("@scalar/openapi-types").OpenAPIV3.ServerVariableObject;
394
+ } | undefined;
178
395
  }[] | undefined;
179
396
  components?: {
180
397
  schemas?: {
@@ -225,7 +442,7 @@ export declare function useReactiveSpec({ specConfig, proxyUrl, }: {
225
442
  tags: string[];
226
443
  }[] | undefined;
227
444
  security?: import("@scalar/openapi-types").OpenAPIV3.SecurityRequirementObject[] | undefined;
228
- };
445
+ }>;
229
446
  specErrors: import("vue").Ref<string | null, string | null>;
230
447
  };
231
448
  //# sourceMappingURL=useReactiveSpec.d.ts.map
@@ -1 +1 @@
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;A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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwDA"}
@@ -1,46 +1,48 @@
1
- import { isValidUrl as d, fetchSpecFromUrl as f, prettyPrintJson as h } from "@scalar/oas-utils/helpers";
2
- import { ref as u, reactive as g, watch as m, toValue as s } from "vue";
1
+ import { isValidUrl as d, fetchSpecFromUrl as u, prettyPrintJson as h } from "@scalar/oas-utils/helpers";
2
+ import { ref as s, watch as m, toValue as p } from "vue";
3
3
  import { parse as v } from "../helpers/parse.js";
4
4
  import { createEmptySpecification as l } from "../helpers/createEmptySpecification.js";
5
- const y = async ({ url: e, content: r }, n) => {
5
+ const y = async ({ url: e, content: o }, n) => {
6
6
  if (e) {
7
- const a = performance.now();
7
+ const i = performance.now();
8
8
  try {
9
- const c = d(e) ? await f(e, n) : await f(e), o = performance.now();
10
- return console.log(`fetch: ${Math.round(o - a)} ms (${e})`), console.log("size:", Math.round(c.length / 1024), "kB"), c;
9
+ const c = d(e) ? await u(e, n) : await u(e), r = performance.now();
10
+ return console.log(`fetch: ${Math.round(r - i)} ms (${e})`), console.log("size:", Math.round(c.length / 1024), "kB"), c;
11
11
  } catch (c) {
12
12
  console.error("Failed to fetch spec from URL:", c);
13
13
  }
14
14
  }
15
- const t = typeof r == "function" ? r() : r;
15
+ const t = typeof o == "function" ? o() : o;
16
16
  if (typeof t == "string")
17
17
  return t;
18
18
  if (typeof t == "object")
19
19
  return h(t);
20
20
  };
21
- function C({
21
+ function E({
22
22
  specConfig: e,
23
- proxyUrl: r
23
+ proxyUrl: o
24
24
  }) {
25
- const n = u(""), t = g(l()), a = u(null);
26
- function c(o) {
27
- return o ? v(o, {
28
- proxyUrl: r ? s(r) : void 0
29
- }).then((i) => {
30
- a.value = null, Object.assign(t, {
31
- ...i
32
- });
33
- }).catch((i) => {
34
- a.value = i.toString();
35
- }) : Object.assign(t, l());
25
+ const n = s(""), t = s(l()), i = s(null);
26
+ function c(r) {
27
+ if (!r) {
28
+ t.value = l();
29
+ return;
30
+ }
31
+ v(r, {
32
+ proxyUrl: o ? p(o) : void 0
33
+ }).then((a) => {
34
+ i.value = null, t.value = a;
35
+ }).catch((a) => {
36
+ i.value = a.toString();
37
+ });
36
38
  }
37
39
  return m(
38
- () => s(e),
39
- async (o) => {
40
- var i;
41
- if (o) {
42
- const p = (i = await y(o, s(r))) == null ? void 0 : i.trim();
43
- typeof p == "string" && (n.value = p);
40
+ () => p(e),
41
+ async (r) => {
42
+ var a;
43
+ if (r) {
44
+ const f = (a = await y(r, p(o))) == null ? void 0 : a.trim();
45
+ typeof f == "string" && (n.value = f);
44
46
  }
45
47
  },
46
48
  { immediate: !0, deep: !0 }
@@ -49,9 +51,9 @@ function C({
49
51
  }), {
50
52
  rawSpec: n,
51
53
  parsedSpec: t,
52
- specErrors: a
54
+ specErrors: i
53
55
  };
54
56
  }
55
57
  export {
56
- C as useReactiveSpec
58
+ E as useReactiveSpec
57
59
  };