@scalar/api-reference 1.25.63 → 1.25.65

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 (49) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/dist/browser/standalone.js +19184 -19124
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/Anchor/Anchor.vue.d.ts.map +1 -1
  5. package/dist/components/Anchor/Anchor.vue.js +2 -2
  6. package/dist/components/Anchor/Anchor.vue2.js +4 -4
  7. package/dist/components/ApiReference.vue.d.ts.map +1 -1
  8. package/dist/components/ApiReference.vue.js +59 -61
  9. package/dist/components/Content/Operation/OperationAccordion.vue.js +2 -2
  10. package/dist/components/Content/Operation/OperationAccordion.vue2.js +18 -18
  11. package/dist/embeds/OpenApiDocument/OpenApiDocument.vue.d.ts +7 -7
  12. package/dist/features/ApiClientModal/ApiClientModal.vue.js +17 -17
  13. package/dist/features/ApiClientModal/useApiClient.d.ts +634 -302
  14. package/dist/features/ApiClientModal/useApiClient.d.ts.map +1 -1
  15. package/dist/features/BaseUrl/ServerUrlSelect.vue.d.ts.map +1 -1
  16. package/dist/features/BaseUrl/ServerUrlSelect.vue.js +4 -4
  17. package/dist/features/BaseUrl/ServerUrlSelect.vue2.js +4 -5
  18. package/dist/features/BaseUrl/ServerVariablesSelect.vue.d.ts.map +1 -1
  19. package/dist/features/BaseUrl/ServerVariablesSelect.vue.js +4 -4
  20. package/dist/features/BaseUrl/ServerVariablesSelect.vue2.js +27 -23
  21. package/dist/features/ExampleRequest/ExampleRequest.vue.d.ts.map +1 -1
  22. package/dist/features/ExampleRequest/ExampleRequest.vue.js +2 -2
  23. package/dist/features/ExampleRequest/ExampleRequest.vue2.js +36 -35
  24. package/dist/features/ExampleResponses/ExampleResponses.vue.js +3 -3
  25. package/dist/features/ExampleResponses/ExampleResponses.vue2.js +14 -14
  26. package/dist/helpers/getApiClientRequest.js +19 -19
  27. package/dist/helpers/getExampleCode.d.ts.map +1 -1
  28. package/dist/helpers/getExampleCode.js +16 -14
  29. package/dist/hooks/index.d.ts +0 -2
  30. package/dist/hooks/index.d.ts.map +1 -1
  31. package/dist/hooks/useReactiveSpec.d.ts +7 -7
  32. package/dist/index.js +33 -37
  33. package/dist/legacy/components/SecurityScheme.vue.js +2 -2
  34. package/dist/legacy/components/SecurityScheme.vue2.js +8 -8
  35. package/dist/legacy/helpers/getUrlFromServerState.d.ts +4 -1
  36. package/dist/legacy/helpers/getUrlFromServerState.d.ts.map +1 -1
  37. package/dist/legacy/helpers/getUrlFromServerState.js +15 -6
  38. package/dist/legacy/helpers/prepareClientRequestConfig.d.ts +1 -1
  39. package/dist/legacy/stores/useOpenApiStore.d.ts +5 -5
  40. package/dist/legacy/stores/useServerStore.d.ts.map +1 -1
  41. package/dist/legacy/stores/useServerStore.js +47 -36
  42. package/dist/style.css +1 -1
  43. package/package.json +8 -7
  44. package/dist/hooks/useClipboard.d.ts +0 -4
  45. package/dist/hooks/useClipboard.d.ts.map +0 -1
  46. package/dist/hooks/useClipboard.js +0 -14
  47. package/dist/hooks/useDarkModeState.d.ts +0 -7
  48. package/dist/hooks/useDarkModeState.d.ts.map +0 -1
  49. package/dist/hooks/useDarkModeState.js +0 -31
@@ -1,7 +1,7 @@
1
1
  import o from "./SecurityScheme.vue2.js";
2
2
  /* empty css */
3
3
  import t from "../../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ t(o, [["__scopeId", "data-v-b6e18839"]]);
4
+ const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a744ab96"]]);
5
5
  export {
6
- c as default
6
+ m as default
7
7
  };
@@ -137,7 +137,7 @@ const Se = /* @__PURE__ */ Q({
137
137
  }), console.error("[authorizeWithPassword]", u);
138
138
  });
139
139
  }
140
- const T = X({
140
+ const U = X({
141
141
  get: () => r.oAuth2.scopes,
142
142
  set: (t) => p({ oAuth2: { ...r.oAuth2, scopes: t } })
143
143
  }), J = (t) => {
@@ -309,19 +309,19 @@ const Se = /* @__PURE__ */ Q({
309
309
  ((w = (c = (h = t.value) == null ? void 0 : h.flows) == null ? void 0 : c.implicit) == null ? void 0 : w.scopes) ?? ((S = (k = (A = t.value) == null ? void 0 : A.flows) == null ? void 0 : k.password) == null ? void 0 : S.scopes) ?? {}
310
310
  ).length > 0 ? (n(), m(R, {
311
311
  key: 0,
312
- selected: T.value,
313
- "onUpdate:selected": e[1] || (e[1] = (U) => T.value = U),
312
+ selected: U.value,
313
+ "onUpdate:selected": e[1] || (e[1] = (T) => U.value = T),
314
314
  scopes: ((I = (b = (y = t.value) == null ? void 0 : y.flows) == null ? void 0 : b.implicit) == null ? void 0 : I.scopes) ?? ((B = (g = t.value) == null ? void 0 : g.flows) == null ? void 0 : B.password.scopes)
315
315
  }, null, 8, ["selected", "scopes"])) : v("", !0),
316
316
  W("button", {
317
317
  class: "cardform-auth-button",
318
318
  type: "button",
319
319
  onClick: e[2] || (e[2] = () => {
320
- var U, O;
320
+ var T, O;
321
321
  return q(
322
- (O = (U = t.value.flows) == null ? void 0 : U.password) == null ? void 0 : O.tokenUrl,
322
+ (O = (T = t.value.flows) == null ? void 0 : T.password) == null ? void 0 : O.tokenUrl,
323
323
  {
324
- baseUrl: l(ae)(l(N)),
324
+ baseUrl: l(ae)(l(N)).modifiedUrl,
325
325
  proxy: t.proxy
326
326
  }
327
327
  );
@@ -355,8 +355,8 @@ const Se = /* @__PURE__ */ Q({
355
355
  ((h = t.value.flows.implicit) == null ? void 0 : h.scopes) ?? ((c = t.value.flows.password) == null ? void 0 : c.scopes) ?? ((w = t.value.flows.authorizationCode) == null ? void 0 : w.scopes)
356
356
  ).length > 0 ? (n(), m(R, {
357
357
  key: 0,
358
- selected: T.value,
359
- "onUpdate:selected": e[3] || (e[3] = (y) => T.value = y),
358
+ selected: U.value,
359
+ "onUpdate:selected": e[3] || (e[3] = (y) => U.value = y),
360
360
  scopes: ((A = t.value.flows.implicit) == null ? void 0 : A.scopes) ?? ((k = t.value.flows.password) == null ? void 0 : k.scopes) ?? ((S = t.value.flows.authorizationCode) == null ? void 0 : S.scopes)
361
361
  }, null, 8, ["selected", "scopes"])) : v("", !0),
362
362
  W("button", {
@@ -2,5 +2,8 @@ import type { ServerState } from '#legacy';
2
2
  /**
3
3
  * Get the URL from the server state.
4
4
  */
5
- export declare function getUrlFromServerState(state: ServerState): string | undefined;
5
+ export declare function getUrlFromServerState(state: ServerState): {
6
+ originalUrl: string | undefined;
7
+ modifiedUrl: string | undefined;
8
+ };
6
9
  //# sourceMappingURL=getUrlFromServerState.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getUrlFromServerState.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/getUrlFromServerState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW,sBAevD"}
1
+ {"version":3,"file":"getUrlFromServerState.d.ts","sourceRoot":"","sources":["../../../src/legacy/helpers/getUrlFromServerState.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAG1C;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,WAAW;;;EAgCvD"}
@@ -1,9 +1,18 @@
1
- import { replaceVariables as o } from "@scalar/oas-utils/helpers";
2
- function f(r) {
3
- var u, i;
4
- const l = (u = r == null ? void 0 : r.servers) == null ? void 0 : u[r.selectedServer ?? 0];
5
- return (i = l == null ? void 0 : l.url) != null && i.endsWith("/") && (l.url = l.url.slice(0, -1)), typeof (l == null ? void 0 : l.url) == "string" ? o(l == null ? void 0 : l.url, r.variables) : l == null ? void 0 : l.url;
1
+ import { replaceVariables as a, REGEX as g } from "@scalar/oas-utils/helpers";
2
+ function _(o) {
3
+ var u, e;
4
+ const l = (u = o == null ? void 0 : o.servers) == null ? void 0 : u[o.selectedServer ?? 0];
5
+ (e = l == null ? void 0 : l.url) != null && e.endsWith("/") && (l.url = l.url.slice(0, -1));
6
+ const d = l == null ? void 0 : l.url, n = typeof (l == null ? void 0 : l.url) == "string" ? a(l == null ? void 0 : l.url, o.variables) : l == null ? void 0 : l.url, r = n == null ? void 0 : n.match(g.PATH), f = (r == null ? void 0 : r.reduce((i, p) => {
7
+ var m;
8
+ const c = p.replace(/{|}/g, ""), t = (m = o.variables) == null ? void 0 : m[c];
9
+ return i == null ? void 0 : i.replace(
10
+ p,
11
+ t || `__${c.toUpperCase()}__`
12
+ );
13
+ }, n)) ?? n;
14
+ return { originalUrl: d, modifiedUrl: f };
6
15
  }
7
16
  export {
8
- f as getUrlFromServerState
17
+ _ as getUrlFromServerState
9
18
  };
@@ -14,7 +14,7 @@ export declare const prepareClientRequestConfig: (configuration: {
14
14
  url: string;
15
15
  type: string;
16
16
  path: string;
17
- variables?: import("@scalar/types/legacy").BaseParameter[];
17
+ variables?: import("@scalar/types").BaseParameter[];
18
18
  query?: import("..").Query[];
19
19
  cookies?: import("..").Cookie[];
20
20
  headers?: import("..").Header[];
@@ -33,11 +33,11 @@ export declare const useOpenApiStore: () => {
33
33
  default?: any;
34
34
  format?: string | undefined;
35
35
  description?: string | undefined;
36
- properties?: Record<string, import("@scalar/types/legacy").Schema> | undefined;
36
+ properties?: Record<string, import("@scalar/types").Schema> | undefined;
37
37
  } | undefined;
38
38
  example?: any;
39
39
  examples?: (Map<string, any> & Omit<Map<string, any>, keyof Map<any, any>>) | undefined;
40
- content?: import("@scalar/types/legacy").RequestBodyMimeTypes | undefined;
40
+ content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
41
41
  headers?: {
42
42
  [key: string]: import("@scalar/openapi-types").OpenAPI.HeaderObject;
43
43
  } | undefined;
@@ -47,7 +47,7 @@ export declare const useOpenApiStore: () => {
47
47
  requestBody?: {
48
48
  description?: string | undefined;
49
49
  required?: boolean | undefined;
50
- content?: import("@scalar/types/legacy").RequestBodyMimeTypes | undefined;
50
+ content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
51
51
  } | undefined;
52
52
  summary?: string | undefined;
53
53
  tags?: string[] | undefined;
@@ -85,11 +85,11 @@ export declare const useOpenApiStore: () => {
85
85
  default?: any;
86
86
  format?: string | undefined;
87
87
  description?: string | undefined;
88
- properties?: Record<string, import("@scalar/types/legacy").Schema> | undefined;
88
+ properties?: Record<string, import("@scalar/types").Schema> | undefined;
89
89
  } | undefined;
90
90
  example?: any;
91
91
  examples?: (Map<string, any> & Omit<Map<string, any>, keyof Map<any, any>>) | undefined;
92
- content?: import("@scalar/types/legacy").RequestBodyMimeTypes | undefined;
92
+ content?: import("@scalar/types").RequestBodyMimeTypes | undefined;
93
93
  headers?: {
94
94
  [key: string]: import("@scalar/openapi-types").OpenAPI.HeaderObject;
95
95
  } | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"useServerStore.d.ts","sourceRoot":"","sources":["../../../src/legacy/stores/useServerStore.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACnE,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,KAAK,GAAG,EAAmB,MAAM,KAAK,CAAA;AAK/C,MAAM,MAAM,WAAW,GAAG;IACxB,cAAc,EAAE,IAAI,GAAG,MAAM,CAAA;IAC7B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,YAAY,GAAG,WAAW,CAAC,YAAY,CAAC,EAAE,CAAA;IAC/D,SAAS,EAAE;QAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAA;CACrC,CAAA;AAED,eAAO,MAAM,sBAAsB,QAAO,WAIxC,CAAA;AA8CF,eAAO,MAAM,cAAc,mDAIxB;IACD,aAAa,CAAC,EAAE,GAAG,CAAC,IAAI,GAAG,SAAS,CAAC,CAAA;IACrC;;OAEG;IACH,g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C,YAAY,CAAC,EAAE,GAAG,SAAS,CAClE,CAAA;CACF;;wBAzFiB,IAAI,GAAG,MAAM;sBACf,MAAM;;;;;;;;;;;;mBAET;YAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;SAAE;;0BAWT,OAAO,CAAC,WAAW,CAAC;CA4HhD,CAAA"}
@@ -1,64 +1,75 @@
1
- import { reactive as u, watch as g } from "vue";
2
- import { getServers as S } from "../../features/BaseUrl/utils/getServers.js";
3
- import { createEmptySpecification as b } from "../../helpers/createEmptySpecification.js";
1
+ import { reactive as l, watch as s } from "vue";
2
+ import { getServers as u } from "../../features/BaseUrl/utils/getServers.js";
3
+ import { createEmptySpecification as v } from "../../helpers/createEmptySpecification.js";
4
4
  const j = () => ({
5
5
  selectedServer: null,
6
6
  servers: [],
7
7
  variables: {}
8
- }), r = u(j()), v = (t) => {
9
- Object.assign(r, {
10
- ...r,
11
- ...t
8
+ }), o = l(j()), n = (e) => {
9
+ var b;
10
+ const t = (b = o.servers) == null ? void 0 : b[e.selectedServer ?? o.selectedServer ?? 0], r = t != null && t.variables ? Object.fromEntries(
11
+ Object.entries(t.variables).map(([a, m]) => [
12
+ a,
13
+ m.default ?? ""
14
+ ])
15
+ ) : {};
16
+ Object.assign(o, {
17
+ ...o,
18
+ ...e,
19
+ variables: {
20
+ ...r,
21
+ ...e.variables
22
+ }
12
23
  });
13
24
  };
14
- function E(t) {
25
+ function O(e) {
15
26
  return Object.fromEntries(
16
- Object.entries(t ?? {}).map(([m, e]) => {
17
- var a, o, n;
27
+ Object.entries(e ?? {}).map(([t, r]) => {
28
+ var b, a, m;
18
29
  return [
19
- m,
30
+ t,
20
31
  // 1) Default
21
- ((a = e.default) == null ? void 0 : a.toString()) ?? // 2) First enum value
22
- ((n = (o = e.enum) == null ? void 0 : o[0]) == null ? void 0 : n.toString()) ?? // 3) Empty string
32
+ ((b = r.default) == null ? void 0 : b.toString()) ?? // 2) First enum value
33
+ ((m = (a = r.enum) == null ? void 0 : a[0]) == null ? void 0 : m.toString()) ?? // 3) Empty string
23
34
  ""
24
35
  ];
25
36
  })
26
37
  );
27
38
  }
28
- function O(t, m) {
39
+ function g(e, t) {
29
40
  return Object.fromEntries(
30
- Object.entries(t).filter(
31
- ([e]) => e in (m.variables ?? {})
41
+ Object.entries(e).filter(
42
+ ([r]) => r in (t.variables ?? {})
32
43
  )
33
44
  );
34
45
  }
35
46
  const V = ({
36
- specification: t,
37
- defaultServerUrl: m,
38
- servers: e
39
- } = {}) => ((t == null ? void 0 : t.value) !== void 0 && g(
40
- () => [t == null ? void 0 : t.value, e == null ? void 0 : e.value, m == null ? void 0 : m.value],
47
+ specification: e,
48
+ defaultServerUrl: t,
49
+ servers: r
50
+ } = {}) => ((e == null ? void 0 : e.value) !== void 0 && s(
51
+ () => [e == null ? void 0 : e.value, r == null ? void 0 : r.value, t == null ? void 0 : t.value],
41
52
  () => {
42
- const a = (
53
+ const b = (
43
54
  // Use the specification
44
- (e == null ? void 0 : e.value) === void 0 ? (t == null ? void 0 : t.value) ?? b() : (
55
+ (r == null ? void 0 : r.value) === void 0 ? (e == null ? void 0 : e.value) ?? v() : (
45
56
  // Or create an empty one with the specified servers list
46
- b({
47
- servers: e.value
57
+ v({
58
+ servers: r.value
48
59
  })
49
60
  )
50
- ), o = S(a, {
51
- defaultServerUrl: m == null ? void 0 : m.value
52
- }), n = o == null ? void 0 : o[r.selectedServer ?? 0];
53
- v({
54
- servers: o,
61
+ ), a = u(b, {
62
+ defaultServerUrl: t == null ? void 0 : t.value
63
+ }), m = a == null ? void 0 : a[o.selectedServer ?? 0];
64
+ n({
65
+ servers: a,
55
66
  variables: {
56
67
  // Set the initial values for the variables
57
- ...E((n == null ? void 0 : n.variables) ?? {}),
68
+ ...O((m == null ? void 0 : m.variables) ?? {}),
58
69
  // Don’t overwrite existing values, but filter out non-existing variables
59
- ...O(
60
- r.variables,
61
- (o == null ? void 0 : o[r.selectedServer ?? 0]) ?? {}
70
+ ...g(
71
+ o.variables,
72
+ (a == null ? void 0 : a[o.selectedServer ?? 0]) ?? {}
62
73
  )
63
74
  }
64
75
  });
@@ -68,8 +79,8 @@ const V = ({
68
79
  immediate: !0
69
80
  }
70
81
  ), {
71
- server: r,
72
- setServer: v
82
+ server: o,
83
+ setServer: n
73
84
  });
74
85
  export {
75
86
  j as createEmptyServerState,