@scalar/api-client 2.17.8 → 2.18.0

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 (87) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/dist/style.css +1 -1
  3. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  4. package/dist/v2/blocks/operation-block/helpers/build-request.js +46 -51
  5. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +9 -0
  6. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +1 -0
  7. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +7 -0
  8. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  9. package/dist/v2/blocks/operation-block/helpers/get-example.js +12 -10
  10. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +3 -0
  11. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +1 -0
  12. package/dist/v2/blocks/operation-block/helpers/get-server-url.js +12 -0
  13. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  14. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  15. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +87 -65
  16. package/dist/v2/components/code-input/CodeInput.vue.d.ts +115 -144
  17. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  18. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  19. package/dist/v2/components/code-input/CodeInput.vue2.js +120 -107
  20. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -3
  21. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  22. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  23. package/dist/v2/components/data-table/DataTableInput.vue2.js +27 -27
  24. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +3 -2
  25. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  26. package/dist/v2/components/data-table/DataTableInputSelect.vue.js +42 -39
  27. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -3
  28. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  29. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +5 -3
  30. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  31. package/dist/v2/components/sidebar/SidebarMenu.vue.js +25 -30
  32. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  33. package/dist/v2/features/app/App.vue.js +89 -141
  34. package/dist/v2/features/app/app-events.d.ts +22 -0
  35. package/dist/v2/features/app/app-events.d.ts.map +1 -0
  36. package/dist/v2/features/app/app-events.js +136 -0
  37. package/dist/v2/features/app/app-state.d.ts +135 -0
  38. package/dist/v2/features/app/app-state.d.ts.map +1 -0
  39. package/dist/v2/features/app/app-state.js +316 -0
  40. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +6 -3
  41. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  42. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  43. package/dist/v2/features/app/components/AppSidebar.vue2.js +4 -4
  44. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +4 -2
  45. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  46. package/dist/v2/features/app/components/DesktopTabs.vue.js +25 -22
  47. package/dist/v2/features/app/components/WebTopNav.vue.d.ts +9 -5
  48. package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
  49. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +62 -1
  50. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  51. package/dist/v2/features/app/helpers/create-api-client-app.js +14 -10
  52. package/dist/v2/features/app/helpers/routes.d.ts +5 -2
  53. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  54. package/dist/v2/features/collection/WorkspaceCollection.vue.js +7 -7
  55. package/dist/v2/features/collection/components/Form.vue.d.ts +1 -1
  56. package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
  57. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  58. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  59. package/dist/v2/features/modal/Modal.vue.js +2 -2
  60. package/dist/v2/features/modal/Modal.vue2.js +40 -41
  61. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  62. package/dist/v2/features/operation/Operation.vue.js +38 -28
  63. package/dist/v2/features/operation/helpers/combine-params.d.ts +4 -0
  64. package/dist/v2/features/operation/helpers/combine-params.d.ts.map +1 -0
  65. package/dist/v2/features/operation/helpers/combine-params.js +13 -0
  66. package/dist/v2/features/operation/index.d.ts +1 -0
  67. package/dist/v2/features/operation/index.d.ts.map +1 -1
  68. package/dist/v2/features/operation/index.js +10 -8
  69. package/dist/v2/helpers/get-tab-details.d.ts +2 -2
  70. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
  71. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  72. package/package.json +16 -16
  73. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts +0 -40
  74. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +0 -1
  75. package/dist/v2/features/app/hooks/use-app-sidebar.js +0 -134
  76. package/dist/v2/features/app/hooks/use-sync-path.d.ts +0 -11
  77. package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +0 -1
  78. package/dist/v2/features/app/hooks/use-sync-path.js +0 -52
  79. package/dist/v2/features/app/hooks/use-tabs.d.ts +0 -31
  80. package/dist/v2/features/app/hooks/use-tabs.d.ts.map +0 -1
  81. package/dist/v2/features/app/hooks/use-tabs.js +0 -44
  82. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts +0 -18
  83. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +0 -1
  84. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +0 -156
  85. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts +0 -28
  86. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +0 -1
  87. package/dist/v2/features/app/hooks/use-workspace-selector.js +0 -81
@@ -1 +1 @@
1
- {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAI5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAO1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CA6FA,CAAA"}
1
+ {"version":3,"file":"build-request.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/build-request.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAKnE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qEAAqE,CAAA;AACxG,OAAO,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AACtH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAA;AAG5F,OAAO,EAAU,KAAK,aAAa,EAAkB,MAAM,eAAe,CAAA;AAS1E;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,GAAI,iHAU1B;IACD,8CAA8C;IAC9C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,qCAAqC;IACrC,UAAU,EAAE,MAAM,CAAA;IAClB,mCAAmC;IACnC,aAAa,EAAE,aAAa,EAAE,CAAA;IAC9B,uCAAuC;IACvC,MAAM,EAAE,UAAU,CAAA;IAClB,2BAA2B;IAC3B,SAAS,EAAE,eAAe,CAAA;IAC1B,gCAAgC;IAChC,IAAI,EAAE,MAAM,CAAA;IACZ,oDAAoD;IACpD,QAAQ,EAAE,MAAM,CAAA;IAChB,wBAAwB;IACxB,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,8DAA8D;IAC9D,uBAAuB,EAAE,oBAAoB,EAAE,CAAA;CAChD,KAAG,aAAa,CAAC;IAChB,UAAU,EAAE,eAAe,CAAA;IAC3B,OAAO,EAAE,OAAO,CAAA;IAChB,YAAY,EAAE,OAAO,CAAA;CACtB,CA4EA,CAAA"}
@@ -1,70 +1,65 @@
1
- import { replaceVariables as P } from "@scalar/helpers/regex/replace-variables";
2
- import { mergeUrls as L } from "@scalar/helpers/url/merge-urls";
3
- import { shouldUseProxy as x, redirectToProxy as I } from "@scalar/oas-utils/helpers";
4
- import { getResolvedRef as T } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
- import { objectEntries as V } from "@vueuse/core";
6
- import { isElectron as h } from "../../../../libs/electron.js";
7
- import { ERRORS as k, normalizeError as _ } from "../../../../libs/errors.js";
8
- import { buildRequestBody as D } from "./build-request-body.js";
9
- import { buildRequestCookieHeader as j } from "./build-request-cookie-header.js";
10
- import { buildRequestParameters as z } from "./build-request-parameters.js";
11
- import { buildRequestSecurity as F } from "./build-request-security.js";
12
- const K = ({
13
- environment: q,
14
- exampleKey: u = "default",
15
- globalCookies: y,
16
- method: v,
1
+ import { replaceVariables as S } from "@scalar/helpers/regex/replace-variables";
2
+ import { mergeUrls as A } from "@scalar/helpers/url/merge-urls";
3
+ import { shouldUseProxy as H, redirectToProxy as w } from "@scalar/oas-utils/helpers";
4
+ import { getResolvedRef as B } from "@scalar/workspace-store/helpers/get-resolved-ref";
5
+ import { isElectron as R } from "../../../../libs/electron.js";
6
+ import { ERRORS as g, normalizeError as L } from "../../../../libs/errors.js";
7
+ import { getEnvironmentVariables as x } from "./get-environment-variables.js";
8
+ import { getServerUrl as I } from "./get-server-url.js";
9
+ import { buildRequestBody as T } from "./build-request-body.js";
10
+ import { buildRequestCookieHeader as V } from "./build-request-cookie-header.js";
11
+ import { buildRequestParameters as _ } from "./build-request-parameters.js";
12
+ import { buildRequestSecurity as D } from "./build-request-security.js";
13
+ const Z = ({
14
+ environment: U,
15
+ exampleKey: n = "default",
16
+ globalCookies: b,
17
+ method: P,
17
18
  operation: m,
18
- path: a,
19
- proxyUrl: c,
20
- server: d,
21
- selectedSecuritySchemes: C
19
+ path: t,
20
+ proxyUrl: l,
21
+ server: h,
22
+ selectedSecuritySchemes: k
22
23
  }) => {
23
24
  try {
24
- const e = q.variables.reduce(
25
- (t, o) => (t[o.name] = typeof o.value == "string" ? o.value : o.value.default, t),
26
- {}
27
- ), E = V(d?.variables ?? {}).reduce(
28
- (t, [o, U]) => (U.default && (t[o] = U.default), t),
29
- {}
30
- ), i = P(d?.url ?? "", { ...e, ...E }), A = T(m.requestBody);
31
- if (!i && !a)
32
- throw k.URL_EMPTY;
33
- const s = z(m.parameters ?? [], e, u), H = D(A, e, u), n = F(C, e), r = { ...s.headers, ...n.headers }, S = new URLSearchParams([...s.urlParams, ...n.urlParams]), f = P(a, { ...e, ...s.pathVariables }), p = L(i, f, S), R = x(c, p), w = I(c, p), b = r["User-Agent"] || r["user-agent"];
34
- h() && b && (r["X-Scalar-User-Agent"] = b);
35
- const l = j({
36
- paramCookies: [...s.cookies, ...n.cookies],
37
- globalCookies: y,
38
- env: e,
39
- path: f,
40
- originalCookieHeader: r.Cookie || r.cookie,
41
- url: i || a,
42
- useCustomCookieHeader: h() || R
25
+ const r = x(U), s = I(h, r), q = B(m.requestBody);
26
+ if (!s && !t)
27
+ throw g.URL_EMPTY;
28
+ const o = _(m.parameters ?? [], r, n), y = T(q, r, n), i = D(k, r), e = { ...o.headers, ...i.headers }, C = new URLSearchParams([...o.urlParams, ...i.urlParams]), c = S(t, { ...r, ...o.pathVariables }), u = A(s, c, C), d = H(l, u), E = w(l, u), p = e["User-Agent"] || e["user-agent"];
29
+ R() && p && (e["X-Scalar-User-Agent"] = p);
30
+ const a = V({
31
+ paramCookies: [...o.cookies, ...i.cookies],
32
+ globalCookies: b,
33
+ env: r,
34
+ path: c,
35
+ originalCookieHeader: e.Cookie || e.cookie,
36
+ url: s || t,
37
+ useCustomCookieHeader: R() || d
43
38
  });
44
- l && (r[l.name] = l.value);
45
- const g = new AbortController(), B = new Request(w, {
39
+ a && (e[a.name] = a.value);
40
+ const f = new AbortController(), v = new Request(E, {
46
41
  /**
47
42
  * Ensure that all methods are uppercased (though only needed for patch)
48
43
  *
49
44
  * @see https://github.com/whatwg/fetch/issues/50
50
45
  */
51
- method: v.toUpperCase(),
52
- headers: r,
53
- signal: g.signal,
54
- body: H
46
+ method: P.toUpperCase(),
47
+ headers: e,
48
+ signal: f.signal,
49
+ body: y
55
50
  });
56
51
  return [
57
52
  null,
58
53
  {
59
- controller: g,
60
- isUsingProxy: R,
61
- request: B
54
+ controller: f,
55
+ isUsingProxy: d,
56
+ request: v
62
57
  }
63
58
  ];
64
- } catch (e) {
65
- return [_(e, k.BUILDING_REQUEST_FAILED), null];
59
+ } catch (r) {
60
+ return [L(r, g.BUILDING_REQUEST_FAILED), null];
66
61
  }
67
62
  };
68
63
  export {
69
- K as buildRequest
64
+ Z as buildRequest
70
65
  };
@@ -0,0 +1,9 @@
1
+ import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
2
+ /**
3
+ * Flattens the environment variables array into a key-value object.
4
+ * If a variable value is a string, use it directly; otherwise, use its default value.
5
+ *
6
+ * @returns An object mapping variable names to their resolved values.
7
+ */
8
+ export declare const getEnvironmentVariables: (environment: XScalarEnvironment) => Record<string, string>;
9
+ //# sourceMappingURL=get-environment-variables.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-environment-variables.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-environment-variables.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,aAAa,kBAAkB,2BAQtE,CAAA"}
@@ -0,0 +1,7 @@
1
+ const n = (a) => a.variables.reduce(
2
+ (t, e) => (t[e.name] = typeof e.value == "string" ? e.value : e.value.default, t),
3
+ {}
4
+ );
5
+ export {
6
+ n as getEnvironmentVariables
7
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SAuDlB,CAAA"}
1
+ {"version":3,"file":"get-example.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-example.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAClB,MAAM,8DAA8D,CAAA;AAIrE;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,GACrB,OAAO,eAAe,GAAG,iBAAiB,EAC1C,YAAY,MAAM,GAAG,SAAS,EAC9B,aAAa,MAAM,GAAG,SAAS,KAC9B,aAAa,GAAG,SA6DlB,CAAA"}
@@ -1,14 +1,14 @@
1
- import { getResolvedRef as f } from "@scalar/workspace-store/helpers/get-resolved-ref";
1
+ import { getResolvedRef as l } from "@scalar/workspace-store/helpers/get-resolved-ref";
2
2
  import { getResolvedRefDeep as s } from "../../operation-code-sample/helpers/get-resolved-ref-deep.js";
3
- const r = (n, c, m) => {
3
+ const d = (n, c, o) => {
4
4
  if ("content" in n) {
5
- const t = n.content?.[m ?? Object.keys(n.content)[0] ?? ""], o = t?.examples ?? {}, i = c ?? Object.keys(o)[0] ?? "", l = s(o[i]);
6
- return typeof l < "u" ? l : !c && t?.example ? { value: s(t.example) } : void 0;
5
+ const t = n.content?.[o ?? Object.keys(n.content)[0] ?? ""], f = t?.examples ?? {}, m = c || Object.keys(f)[0] || "", i = s(f[m]);
6
+ return typeof i < "u" ? i : !c && t?.example ? { value: s(t.example) } : void 0;
7
7
  }
8
8
  if ("examples" in n || "example" in n) {
9
- const t = f(n.examples) ?? {}, o = c ?? Object.keys(t)[0] ?? "", i = s(t?.[o]);
10
- if (typeof i < "u")
11
- return i;
9
+ const t = l(n.examples) ?? {}, f = c || Object.keys(t)[0] || "", m = s(t?.[f]);
10
+ if (typeof m < "u")
11
+ return m;
12
12
  if (!c && n.example)
13
13
  return { value: s(n.example) };
14
14
  }
@@ -16,12 +16,14 @@ const r = (n, c, m) => {
16
16
  if ("schema" in e && e.schema) {
17
17
  if ("default" in e.schema && typeof e.schema.default < "u")
18
18
  return { value: e.schema.default };
19
- if ("enum" in e.schema && e.schema.enum?.[0])
19
+ if ("enum" in e.schema && typeof e.schema.enum?.[0] < "u")
20
20
  return { value: e.schema.enum[0] };
21
- if ("examples" in e.schema && e.schema.examples?.[0])
21
+ if ("examples" in e.schema && typeof e.schema.examples?.[0] < "u")
22
22
  return { value: e.schema.examples[0] };
23
+ if ("example" in e.schema && typeof e.schema.example < "u")
24
+ return { value: e.schema.example };
23
25
  }
24
26
  };
25
27
  export {
26
- r as getExample
28
+ d as getExample
27
29
  };
@@ -0,0 +1,3 @@
1
+ import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server';
2
+ export declare const getServerUrl: (server: ServerObject | null, environmentVariables: Record<string, string>) => string;
3
+ //# sourceMappingURL=get-server-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-server-url.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/helpers/get-server-url.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAGtF,eAAO,MAAM,YAAY,GAAI,QAAQ,YAAY,GAAG,IAAI,EAAE,sBAAsB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,WAarG,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { replaceVariables as i } from "@scalar/helpers/regex/replace-variables";
2
+ import { objectEntries as s } from "@vueuse/core";
3
+ const n = (r, o) => {
4
+ const l = s(r?.variables ?? {}).reduce(
5
+ (e, [a, t]) => (t.default && (e[a] = t.default), e),
6
+ {}
7
+ );
8
+ return i(r?.url ?? "", { ...o, ...l });
9
+ };
10
+ export {
11
+ n as getServerUrl
12
+ };
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"AA8ZA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAWhG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C,OAA0B,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEzE,KAAK,WAAW,GAAG;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB;IAClB,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;;;;;;;;;;;AA0iBF,wBAQG"}
1
+ {"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-address-bar-block/components/AddressBar.vue"],"names":[],"mappings":"AAubA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAKrF,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAWhG,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAO3C,OAA0B,EAAE,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAA;AAEzE,KAAK,WAAW,GAAG;IACjB,2BAA2B;IAC3B,IAAI,EAAE,MAAM,CAAA;IACZ,6BAA6B;IAC7B,MAAM,EAAE,cAAc,CAAA;IACtB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,mDAAmD;IACnD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,8BAA8B;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAA;IAClB,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;IACpB,gBAAgB;IAChB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kBAAkB;IAClB,WAAW,EAAE,kBAAkB,CAAA;CAChC,CAAC;;;;;;;;;;;AAylBF,wBAQG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./AddressBar.vue2.js";
2
2
  /* empty css */
3
3
  import r from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-3bb71855"]]);
4
+ const m = /* @__PURE__ */ r(o, [["__scopeId", "data-v-a165ba6c"]]);
5
5
  export {
6
6
  m as default
7
7
  };
@@ -1,19 +1,24 @@
1
- import { defineComponent as I, useId as L, computed as w, ref as S, useTemplateRef as U, onMounted as M, onBeforeUnmount as N, createElementBlock as z, openBlock as h, unref as n, createElementVNode as s, normalizeClass as D, createVNode as a, createCommentVNode as E, normalizeStyle as F, createBlock as H, createTextVNode as p, toDisplayString as m, withCtx as W } from "vue";
2
- import { ScalarWrappingText as O, ScalarButton as P, ScalarIcon as K } from "@scalar/components";
3
- import { REQUEST_METHODS as Q } from "@scalar/helpers/http/http-info";
4
- import { ScalarIconWarningCircle as j } from "@scalar/icons";
5
- import { useLoadingAnimation as G } from "../hooks/use-loading-animation.js";
6
- import J from "./AddressBarHistory.vue.js";
7
- import X from "../../../../components/HttpMethod/HttpMethod.vue.js";
8
- import Y from "../../../components/server/ServerDropdown.vue.js";
9
- import Z from "../../../components/code-input/CodeInput.vue.js";
10
- const _ = ["id"], ee = { class: "pointer-events-none absolute top-0 left-0 block h-full w-full overflow-hidden rounded-lg border" }, te = { class: "z-context-plus flex gap-1" }, oe = { class: "scroll-timeline-x scroll-timeline-x-hidden z-context-plus relative flex w-full bg-blend-normal" }, se = {
1
+ import { defineComponent as W, useId as D, computed as S, ref as U, useTemplateRef as V, onMounted as F, onBeforeUnmount as H, createElementBlock as z, openBlock as h, unref as n, createElementVNode as s, normalizeClass as P, createVNode as r, createCommentVNode as E, normalizeStyle as O, createBlock as K, withCtx as R, createTextVNode as b, toDisplayString as m } from "vue";
2
+ import { ScalarButton as $, ScalarWrappingText as Q, ScalarIcon as j } from "@scalar/components";
3
+ import { REQUEST_METHODS as G } from "@scalar/helpers/http/http-info";
4
+ import { replaceVariables as J } from "@scalar/helpers/regex/replace-variables";
5
+ import { mergeUrls as X } from "@scalar/helpers/url/merge-urls";
6
+ import { ScalarIconCopy as Y, ScalarIconWarningCircle as Z } from "@scalar/icons";
7
+ import { useClipboard as _ } from "@scalar/use-hooks/useClipboard";
8
+ import { getEnvironmentVariables as ee } from "../../operation-block/helpers/get-environment-variables.js";
9
+ import { getServerUrl as te } from "../../operation-block/helpers/get-server-url.js";
10
+ import { useLoadingAnimation as oe } from "../hooks/use-loading-animation.js";
11
+ import se from "./AddressBarHistory.vue.js";
12
+ import ne from "../../../../components/HttpMethod/HttpMethod.vue.js";
13
+ import le from "../../../components/server/ServerDropdown.vue.js";
14
+ import re from "../../../components/code-input/CodeInput.vue.js";
15
+ const ae = ["id"], ie = { class: "pointer-events-none absolute top-0 left-0 block h-full w-full overflow-hidden rounded-lg border" }, de = { class: "z-context-plus flex gap-1" }, ue = { class: "scroll-timeline-x scroll-timeline-x-hidden z-context-plus relative flex w-full bg-blend-normal" }, me = {
11
16
  key: 0,
12
17
  class: "z-context absolute inset-x-0 top-[calc(100%+4px)] flex flex-col items-center rounded px-6"
13
- }, ne = { class: "text-c-danger bg-b-danger border-c-danger flex items-center gap-1 rounded border p-1" }, le = { class: "min-w-0 flex-1" }, re = {
18
+ }, fe = { class: "text-c-danger bg-b-danger border-c-danger flex items-center gap-1 rounded border p-1" }, ve = { class: "min-w-0 flex-1" }, ce = {
14
19
  "aria-hidden": "true",
15
20
  class: "inline-flex items-center gap-1"
16
- }, ae = { class: "sr-only" }, be = /* @__PURE__ */ I({
21
+ }, pe = { class: "sr-only" }, Re = /* @__PURE__ */ W({
17
22
  __name: "AddressBar",
18
23
  props: {
19
24
  path: {},
@@ -26,67 +31,72 @@ const _ = ["id"], ee = { class: "pointer-events-none absolute top-0 left-0 block
26
31
  environment: {}
27
32
  },
28
33
  emits: ["execute", "update:servers"],
29
- setup(o, { expose: R, emit: $ }) {
30
- const f = $, v = L(), { percentage: b, startLoading: g, stopLoading: c } = G(), V = w(() => ({
31
- backgroundColor: `color-mix(in srgb, transparent 90%, ${Q[o.method].colorVar})`,
32
- transform: `translate3d(-${b.value}%,0,0)`
33
- })), d = S(null), r = S(null), x = w(() => r.value || d.value), B = (e, t, l) => {
34
- const A = i.value?.cursorPosition();
34
+ setup(o, { expose: q, emit: T }) {
35
+ const f = T, v = D(), { percentage: g, startLoading: x, stopLoading: c } = oe(), I = S(() => ({
36
+ backgroundColor: `color-mix(in srgb, transparent 90%, ${G[o.method].colorVar})`,
37
+ transform: `translate3d(-${g.value}%,0,0)`
38
+ })), i = U(null), a = U(null), y = S(() => a.value || i.value), B = (e, t, l) => {
39
+ const p = d.value?.cursorPosition();
35
40
  o.eventBus.emit(
36
41
  "operation:update:pathMethod",
37
42
  {
38
43
  meta: { method: o.method, path: o.path },
39
44
  payload: { method: e, path: t },
40
45
  callback: (u) => {
41
- (u === "success" || u === "no-change") && (r.value = null, d.value = null), u === "success" ? o.eventBus.emit("ui:focus:address-bar", { position: A }) : u === "conflict" && (e !== o.method && (r.value = e), t !== o.path && (d.value = t));
46
+ (u === "success" || u === "no-change") && (a.value = null, i.value = null), u === "success" ? o.eventBus.emit("ui:focus:address-bar", { position: p }) : u === "conflict" && (e !== o.method && (a.value = e), t !== o.path && (i.value = t));
42
47
  }
43
48
  },
44
49
  l
45
50
  );
46
- }, q = (e) => B(e, d.value ?? o.path), T = (e) => {
51
+ }, L = (e) => B(e, i.value ?? o.path), A = (e) => {
47
52
  const t = e.startsWith("/") ? e : `/${e}`;
48
- B(r.value ?? o.method, t, {
53
+ B(a.value ?? o.method, t, {
49
54
  debounceKey: `operation:update:pathMethod-${o.path}-${o.method}`
50
55
  });
51
- }, y = U("sendButtonRef"), i = U("addressBarRef"), C = () => y.value?.$el?.focus(), k = (e) => {
52
- if (i.value?.isFocused && o.layout !== "desktop")
56
+ }, C = V("sendButtonRef"), d = V("addressBarRef"), k = () => C.value?.$el?.focus(), w = (e) => {
57
+ if (d.value?.isFocused && o.layout !== "desktop")
53
58
  return;
54
59
  const t = e && "position" in e ? e.position : "end";
55
- i.value?.focus(t), e && "event" in e && e.event.preventDefault();
60
+ d.value?.focus(t), e && "event" in e && e.event.preventDefault();
56
61
  };
57
- return M(() => {
58
- o.eventBus.on("ui:focus:address-bar", k), o.eventBus.on("ui:focus:send-button", C), o.eventBus.on("hooks:on:request:sent", g), o.eventBus.on("hooks:on:request:complete", c);
59
- }), N(() => {
60
- o.eventBus.off("ui:focus:address-bar", k), o.eventBus.off("ui:focus:send-button", C), o.eventBus.off("hooks:on:request:sent", g), o.eventBus.off("hooks:on:request:complete", c), c();
61
- }), R({
62
- methodConflict: r,
63
- pathConflict: d
62
+ F(() => {
63
+ o.eventBus.on("ui:focus:address-bar", w), o.eventBus.on("ui:focus:send-button", k), o.eventBus.on("hooks:on:request:sent", x), o.eventBus.on("hooks:on:request:complete", c);
64
+ }), H(() => {
65
+ o.eventBus.off("ui:focus:address-bar", w), o.eventBus.off("ui:focus:send-button", k), o.eventBus.off("hooks:on:request:sent", x), o.eventBus.off("hooks:on:request:complete", c), c();
66
+ });
67
+ const { copyToClipboard: M } = _(), N = async () => {
68
+ const e = ee(o.environment), t = te(o.server, e), l = J(o.path, e), p = X(t, l);
69
+ await M(p);
70
+ };
71
+ return q({
72
+ methodConflict: a,
73
+ pathConflict: i
64
74
  }), (e, t) => (h(), z("div", {
65
75
  id: n(v),
66
76
  class: "scalar-address-bar order-last flex h-(--scalar-address-bar-height) w-full [--scalar-address-bar-height:32px] lg:order-none lg:w-auto"
67
77
  }, [
68
78
  s("div", {
69
- class: D(["address-bar-bg-states text-xxs group relative order-last flex w-full max-w-[calc(100dvw-24px)] flex-1 flex-row items-stretch rounded-lg p-0.75 lg:order-none lg:max-w-[580px] lg:min-w-[580px] xl:max-w-[720px] xl:min-w-[720px]", {
70
- "outline-c-danger outline": x.value
79
+ class: P(["address-bar-bg-states text-xxs group relative order-last flex w-full max-w-[calc(100dvw-24px)] flex-1 flex-row items-stretch rounded-lg p-0.75 lg:order-none lg:max-w-[580px] lg:min-w-[580px] xl:max-w-[720px] xl:min-w-[720px]", {
80
+ "outline-c-danger outline": y.value
71
81
  }])
72
82
  }, [
73
- s("div", ee, [
83
+ s("div", ie, [
74
84
  s("div", {
75
85
  class: "absolute top-0 left-0 z-[1002] h-full w-full",
76
- style: F(V.value)
86
+ style: O(I.value)
77
87
  }, null, 4)
78
88
  ]),
79
- s("div", te, [
80
- a(n(X), {
89
+ s("div", de, [
90
+ r(n(ne), {
81
91
  isEditable: e.layout !== "modal",
82
92
  isSquare: "",
83
- method: r.value ?? e.method,
93
+ method: a.value ?? e.method,
84
94
  teleport: "",
85
- onChange: q
95
+ onChange: L
86
96
  }, null, 8, ["isEditable", "method"])
87
97
  ]),
88
- s("div", oe, [
89
- e.servers.length ? (h(), H(n(Y), {
98
+ s("div", ue, [
99
+ e.servers.length ? (h(), K(n(le), {
90
100
  key: 0,
91
101
  layout: e.layout,
92
102
  server: e.server,
@@ -97,9 +107,9 @@ const _ = ["id"], ee = { class: "pointer-events-none absolute top-0 left-0 block
97
107
  "onUpdate:variable": t[2] || (t[2] = (l) => e.eventBus.emit("server:update:variables", l))
98
108
  }, null, 8, ["layout", "server", "servers", "target"])) : E("", !0),
99
109
  t[6] || (t[6] = s("div", { class: "fade-left" }, null, -1)),
100
- a(n(Z), {
110
+ r(n(re), {
101
111
  ref_key: "addressBarRef",
102
- ref: i,
112
+ ref: d,
103
113
  alwaysEmitChange: "",
104
114
  "aria-label": "Path",
105
115
  class: "min-w-fit outline-none",
@@ -121,52 +131,64 @@ const _ = ["id"], ee = { class: "pointer-events-none absolute top-0 left-0 block
121
131
  }
122
132
  })),
123
133
  onSubmit: t[4] || (t[4] = (l) => f("execute")),
124
- "onUpdate:modelValue": T
134
+ "onUpdate:modelValue": A
125
135
  }, null, 8, ["disabled", "environment", "layout", "modelValue", "placeholder"]),
126
136
  t[7] || (t[7] = s("div", { class: "fade-right" }, null, -1))
127
137
  ]),
128
- a(J, {
138
+ r(n($), {
139
+ class: "hover:bg-b-3 mx-1",
140
+ size: "xs",
141
+ variant: "ghost",
142
+ onClick: N
143
+ }, {
144
+ default: R(() => [
145
+ r(n(Y)),
146
+ t[8] || (t[8] = s("span", { class: "sr-only" }, "Copy URL", -1))
147
+ ]),
148
+ _: 1
149
+ }),
150
+ r(se, {
129
151
  history: e.history,
130
152
  target: n(v)
131
153
  }, null, 8, ["history", "target"]),
132
- x.value ? (h(), z("div", se, [
133
- s("div", ne, [
134
- a(n(j), { size: "sm" }),
135
- s("div", le, [
136
- t[8] || (t[8] = p(" A ", -1)),
137
- s("em", null, m(r.value?.toUpperCase() ?? e.method.toUpperCase()), 1),
138
- t[9] || (t[9] = p(" request to ", -1)),
139
- a(n(O), {
140
- text: d.value ?? e.path
154
+ y.value ? (h(), z("div", me, [
155
+ s("div", fe, [
156
+ r(n(Z), { size: "sm" }),
157
+ s("div", ve, [
158
+ t[9] || (t[9] = b(" A ", -1)),
159
+ s("em", null, m(a.value?.toUpperCase() ?? e.method.toUpperCase()), 1),
160
+ t[10] || (t[10] = b(" request to ", -1)),
161
+ r(n(Q), {
162
+ text: i.value ?? e.path
141
163
  }, null, 8, ["text"]),
142
- t[10] || (t[10] = p(" already exists in this document ", -1))
164
+ t[11] || (t[11] = b(" already exists in this document ", -1))
143
165
  ])
144
166
  ])
145
167
  ])) : E("", !0),
146
- a(n(P), {
168
+ r(n($), {
147
169
  ref_key: "sendButtonRef",
148
- ref: y,
170
+ ref: C,
149
171
  class: "z-context-plus relative h-auto shrink-0 overflow-hidden py-1 pr-2.5 pl-2 font-bold",
150
- disabled: n(b) < 100,
172
+ disabled: n(g) < 100,
151
173
  onClick: t[5] || (t[5] = (l) => f("execute"))
152
174
  }, {
153
- default: W(() => [
154
- s("span", re, [
155
- a(n(K), {
175
+ default: R(() => [
176
+ s("span", ce, [
177
+ r(n(j), {
156
178
  class: "relative shrink-0 fill-current",
157
179
  icon: "Play",
158
180
  size: "xs"
159
181
  }),
160
- t[11] || (t[11] = s("span", { class: "text-xxs hidden lg:flex" }, "Send", -1))
182
+ t[12] || (t[12] = s("span", { class: "text-xxs hidden lg:flex" }, "Send", -1))
161
183
  ]),
162
- s("span", ae, " Send " + m(e.method) + " request to " + m(e.server?.url ?? "") + m(e.path), 1)
184
+ s("span", pe, " Send " + m(e.method) + " request to " + m(e.server?.url ?? "") + m(e.path), 1)
163
185
  ]),
164
186
  _: 1
165
187
  }, 8, ["disabled"])
166
188
  ], 2)
167
- ], 8, _));
189
+ ], 8, ae));
168
190
  }
169
191
  });
170
192
  export {
171
- be as default
193
+ Re as default
172
194
  };