@scalar/api-client 2.1.17 → 2.1.18

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 (43) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/components/CommandPalette/CommandActionForm.vue.d.ts +3 -0
  3. package/dist/components/CommandPalette/CommandActionForm.vue.d.ts.map +1 -1
  4. package/dist/components/CommandPalette/CommandActionForm.vue.js +13 -11
  5. package/dist/components/CommandPalette/CommandActionInput.vue.d.ts +0 -2
  6. package/dist/components/CommandPalette/CommandActionInput.vue.d.ts.map +1 -1
  7. package/dist/components/CommandPalette/CommandActionInput.vue.js +36 -38
  8. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  9. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +100 -80
  10. package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
  11. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +24 -24
  12. package/dist/layouts/App/ApiClientApp.vue.d.ts.map +1 -1
  13. package/dist/layouts/App/ApiClientApp.vue.js +1 -4
  14. package/dist/layouts/Web/ApiClientWeb.vue.d.ts.map +1 -1
  15. package/dist/layouts/Web/ApiClientWeb.vue.js +7 -10
  16. package/dist/libs/extractAttachmentFilename.d.ts +2 -0
  17. package/dist/libs/extractAttachmentFilename.d.ts.map +1 -0
  18. package/dist/libs/extractAttachmentFilename.js +20 -0
  19. package/dist/libs/getOpenApiDocumentDetails.d.ts +10 -0
  20. package/dist/libs/getOpenApiDocumentDetails.d.ts.map +1 -0
  21. package/dist/libs/getOpenApiDocumentDetails.js +40 -0
  22. package/dist/libs/index.d.ts +1 -2
  23. package/dist/libs/index.d.ts.map +1 -1
  24. package/dist/libs/index.js +21 -23
  25. package/dist/libs/isUrl.d.ts +1 -1
  26. package/dist/libs/isUrl.d.ts.map +1 -1
  27. package/dist/libs/isUrl.js +4 -3
  28. package/dist/store/import-spec.d.ts.map +1 -1
  29. package/dist/store/import-spec.js +21 -26
  30. package/dist/style.css +1 -1
  31. package/dist/views/Request/ResponseSection/ResponseBody.vue.d.ts.map +1 -1
  32. package/dist/views/Request/ResponseSection/ResponseBody.vue.js +63 -55
  33. package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.d.ts +2 -0
  34. package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.d.ts.map +1 -1
  35. package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +14 -14
  36. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  37. package/package.json +4 -4
  38. package/dist/libs/getOpenApiDocumentVersion.d.ts +0 -8
  39. package/dist/libs/getOpenApiDocumentVersion.d.ts.map +0 -1
  40. package/dist/libs/getOpenApiDocumentVersion.js +0 -20
  41. package/dist/libs/isDocument.d.ts +0 -3
  42. package/dist/libs/isDocument.d.ts.map +0 -1
  43. package/dist/libs/isDocument.js +0 -7
package/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.1.18
4
+
5
+ ### Patch Changes
6
+
7
+ - 7c2e291: style: removes comamand palette command label + style fixtures
8
+ - 46a55ae: feat(api-client): improve client import ux
9
+ - 5d996a8: feat: download response with filename
10
+ - b26144c: fix(themes): remove variables from theme layer and move selection to default (base) theme
11
+ - Updated dependencies [46a55ae]
12
+ - Updated dependencies [b26144c]
13
+ - @scalar/oas-utils@0.2.53
14
+ - @scalar/themes@0.9.35
15
+ - @scalar/components@0.12.50
16
+
3
17
  ## 2.1.17
4
18
 
5
19
  ### Patch Changes
@@ -1,15 +1,18 @@
1
+ import { type useLoadingState } from '@scalar/components';
1
2
  declare function __VLS_template(): {
2
3
  default?(_: {}): any;
3
4
  options?(_: {}): any;
4
5
  submit?(_: {}): any;
5
6
  };
6
7
  declare const __VLS_component: import("vue").DefineComponent<__VLS_TypePropsToOption<{
8
+ loading?: ReturnType<typeof useLoadingState>;
7
9
  disabled?: boolean;
8
10
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
9
11
  submit: () => void;
10
12
  cancel: () => void;
11
13
  back: (e: KeyboardEvent) => void;
12
14
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
15
+ loading?: ReturnType<typeof useLoadingState>;
13
16
  disabled?: boolean;
14
17
  }>>> & {
15
18
  onSubmit?: (() => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandActionForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionForm.vue"],"names":[],"mappings":"AAyDA,iBAAS,cAAc;qBA8DM,GAAG;qBACH,GAAG;oBACJ,GAAG;EAgB9B;AACD,QAAA,MAAM,eAAe;eAjGR,OAAO;;;;;;eAAP,OAAO;;;;;UAwGlB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"CommandActionForm.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionForm.vue"],"names":[],"mappings":"AAsCA,OAAO,EAAgB,KAAK,eAAe,EAAE,MAAM,oBAAoB,CAAA;AAsBvE,iBAAS,cAAc;qBA+DM,GAAG;qBACH,GAAG;oBACJ,GAAG;EAgB9B;AACD,QAAA,MAAM,eAAe;cAnGT,UAAU,CAAC,OAAO,eAAe,CAAC;eACjC,OAAO;;;;;;cADR,UAAU,CAAC,OAAO,eAAe,CAAC;eACjC,OAAO;;;;;UAyGlB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAAvG,wBAAwG;AAOxG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACpC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC;AAEN,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,28 +1,30 @@
1
- import { defineComponent as n, openBlock as i, createElementBlock as a, withKeys as d, withModifiers as l, createElementVNode as o, renderSlot as s, createVNode as r, unref as m, withCtx as p, createTextVNode as f } from "vue";
1
+ import { defineComponent as n, openBlock as i, createElementBlock as a, withKeys as d, withModifiers as l, createElementVNode as t, renderSlot as s, createVNode as r, unref as m, withCtx as p, createTextVNode as f } from "vue";
2
2
  import { ScalarButton as u } from "@scalar/components";
3
- const c = { class: "gap-3 rounded min-h-20 relative" }, b = { class: "flex gap-2" }, x = { class: "flex flex-1 max-h-8" }, $ = /* @__PURE__ */ n({
3
+ const c = { class: "flex flex-col rounded min-h-20 relative" }, b = { class: "flex gap-2" }, x = { class: "flex flex-1 max-h-8" }, _ = /* @__PURE__ */ n({
4
4
  __name: "CommandActionForm",
5
5
  props: {
6
+ loading: {},
6
7
  disabled: { type: Boolean }
7
8
  },
8
9
  emits: ["submit", "cancel", "back"],
9
- setup(h) {
10
- return (e, t) => (i(), a("form", {
10
+ setup(g) {
11
+ return (e, o) => (i(), a("form", {
11
12
  class: "flex w-full flex-col gap-3",
12
- onKeydown: t[0] || (t[0] = d(l(() => {
13
+ onKeydown: o[0] || (o[0] = d(l(() => {
13
14
  }, ["stop"]), ["enter"])),
14
- onSubmit: t[1] || (t[1] = l((v) => e.$emit("submit"), ["prevent", "stop"]))
15
+ onSubmit: o[1] || (o[1] = l((h) => e.$emit("submit"), ["prevent", "stop"]))
15
16
  }, [
16
- o("div", c, [
17
+ t("div", c, [
17
18
  s(e.$slots, "default")
18
19
  ]),
19
- o("div", b, [
20
- o("div", x, [
20
+ t("div", b, [
21
+ t("div", x, [
21
22
  s(e.$slots, "options")
22
23
  ]),
23
24
  r(m(u), {
24
25
  class: "max-h-8 text-xs p-0 px-3",
25
26
  disabled: e.disabled,
27
+ loading: e.loading,
26
28
  type: "submit"
27
29
  }, {
28
30
  default: p(() => [
@@ -31,11 +33,11 @@ const c = { class: "gap-3 rounded min-h-20 relative" }, b = { class: "flex gap-2
31
33
  ])
32
34
  ]),
33
35
  _: 3
34
- }, 8, ["disabled"])
36
+ }, 8, ["disabled", "loading"])
35
37
  ])
36
38
  ], 32));
37
39
  }
38
40
  });
39
41
  export {
40
- $ as default
42
+ _ as default
41
43
  };
@@ -4,12 +4,10 @@ declare const _default: import("vue").DefineComponent<__VLS_TypePropsToOption<{
4
4
  }>, {}, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
5
5
  "update:modelValue": (v: string) => void;
6
6
  onDelete: (event: KeyboardEvent) => void;
7
- paste: (event: ClipboardEvent) => void;
8
7
  }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<{
9
8
  modelValue?: string;
10
9
  placeholder?: string;
11
10
  }>>> & {
12
- onPaste?: ((event: ClipboardEvent) => any) | undefined;
13
11
  "onUpdate:modelValue"?: ((v: string) => any) | undefined;
14
12
  onOnDelete?: ((event: KeyboardEvent) => any) | undefined;
15
13
  }, {}, {}>;
@@ -1 +1 @@
1
- {"version":3,"file":"CommandActionInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionInput.vue"],"names":[],"mappings":";iBA6De,MAAM;kBACL,MAAM;;;;;;iBADP,MAAM;kBACL,MAAM;;;;;;AAoGtB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
1
+ {"version":3,"file":"CommandActionInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandActionInput.vue"],"names":[],"mappings":";iBA0De,MAAM;kBACL,MAAM;;;;;iBADP,MAAM;kBACL,MAAM;;;;;AAiGtB,wBAOG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,51 +1,49 @@
1
- import { defineComponent as f, ref as h, onMounted as y, nextTick as v, computed as w, openBlock as V, createElementBlock as k, Fragment as g, createElementVNode as u, unref as d, withDirectives as x, mergeProps as D, withKeys as _, withModifiers as b, vModelDynamic as B } from "vue";
2
- import { nanoid as M } from "nanoid";
3
- const P = ["for"], A = ["id", "placeholder"], K = /* @__PURE__ */ f({
1
+ import { defineComponent as f, ref as c, onMounted as h, nextTick as g, computed as v, withDirectives as w, openBlock as x, createElementBlock as k, mergeProps as y, withKeys as s, vModelText as D } from "vue";
2
+ const E = ["placeholder"], b = /* @__PURE__ */ f({
4
3
  inheritAttrs: !1,
5
4
  __name: "CommandActionInput",
6
5
  props: {
7
6
  modelValue: {},
8
7
  placeholder: {}
9
8
  },
10
- emits: ["update:modelValue", "onDelete", "paste"],
9
+ emits: ["update:modelValue", "onDelete"],
11
10
  setup(i, { emit: p }) {
12
- const r = i, l = p, a = M(), s = h(null);
13
- y(() => v(() => {
11
+ const l = i, r = p, a = c(null);
12
+ h(() => g(() => {
14
13
  var e;
15
- return (e = s.value) == null ? void 0 : e.focus();
14
+ return (e = a.value) == null ? void 0 : e.focus();
16
15
  }));
17
- const n = w({
18
- get: () => r.modelValue ?? "",
19
- set: (e) => l("update:modelValue", e)
20
- }), m = (e) => {
21
- n.value === "" && l("onDelete", e);
22
- }, c = (e) => {
23
- l("paste", e);
24
- };
25
- return (e, t) => (V(), k(g, null, [
26
- u("label", {
27
- class: "absolute w-full h-full opacity-0 cursor-text",
28
- for: d(a)
29
- }, null, 8, P),
30
- x(u("input", D({
31
- id: d(a),
32
- ref_key: "input",
33
- ref: s,
34
- "onUpdate:modelValue": t[0] || (t[0] = (o) => n.value = o),
35
- autocomplete: "off",
36
- class: "border-transparent outline-none w-full pl-8 text-sm min-h-8 py-1.5",
37
- "data-form-type": "other",
38
- "data-lpignore": "true",
39
- placeholder: r.placeholder
40
- }, e.$attrs, {
41
- onKeydown: t[1] || (t[1] = _(b((o) => m(o), ["stop"]), ["delete"])),
42
- onPaste: t[2] || (t[2] = (o) => c(o))
43
- }), null, 16, A), [
44
- [B, n.value]
45
- ])
46
- ], 64));
16
+ const o = v({
17
+ get: () => l.modelValue ?? "",
18
+ set: (e) => r("update:modelValue", e)
19
+ });
20
+ function d(e) {
21
+ var u;
22
+ if (e.shiftKey || !e.target) return;
23
+ e.preventDefault();
24
+ const t = e.target, n = new Event("submit", { cancelable: !0 });
25
+ (u = t.form) == null || u.dispatchEvent(n);
26
+ }
27
+ function m(e) {
28
+ o.value === "" && (e.preventDefault(), e.stopPropagation(), r("onDelete", e));
29
+ }
30
+ return (e, t) => w((x(), k("textarea", y({
31
+ ref_key: "input",
32
+ ref: a,
33
+ "onUpdate:modelValue": t[0] || (t[0] = (n) => o.value = n),
34
+ class: "border-none outline-none flex-1 w-full pl-8 text-sm min-h-8 py-1.5 resize-none",
35
+ placeholder: l.placeholder,
36
+ wrap: "hard"
37
+ }, e.$attrs, {
38
+ onKeydown: [
39
+ t[1] || (t[1] = s((n) => m(n), ["delete"])),
40
+ t[2] || (t[2] = s((n) => d(n), ["enter"]))
41
+ ]
42
+ }), null, 16, E)), [
43
+ [D, o.value]
44
+ ]);
47
45
  }
48
46
  });
49
47
  export {
50
- K as default
48
+ b as default
51
49
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA0bA,wBAMG"}
1
+ {"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPaletteImport.vue"],"names":[],"mappings":";;;;;;;AA6eA,wBAMG"}
@@ -1,76 +1,83 @@
1
- import { defineComponent as V, ref as _, openBlock as s, createBlock as u, withCtx as l, createVNode as p, unref as r, createTextVNode as d, createElementBlock as h, Fragment as A, createCommentVNode as O } from "vue";
2
- import { ScalarButton as x, ScalarIcon as P, ScalarCodeBlock as B } from "@scalar/components";
3
- import { useToasts as $ } from "@scalar/use-toasts";
4
- import N from "./CommandActionForm.vue.js";
5
- import T from "./CommandActionInput.vue.js";
6
- import { useFileDialog as L } from "../../hooks/useFileDialog.js";
7
- import { getOpenApiDocumentVersion as f } from "../../libs/getOpenApiDocumentVersion.js";
8
- import { isUrl as v } from "../../libs/isUrl.js";
9
- import { isDocument as M } from "../../libs/isDocument.js";
10
- import { useWorkspace as R } from "../../store/store.js";
11
- const X = /* @__PURE__ */ V({
1
+ import { defineComponent as O, ref as P, computed as v, openBlock as l, createBlock as k, unref as n, withCtx as p, createVNode as y, createTextVNode as s, createElementBlock as c, Fragment as u, toDisplayString as _, createElementVNode as w, createCommentVNode as $ } from "vue";
2
+ import { useLoadingState as R, ScalarButton as h, ScalarIcon as T, ScalarCodeBlock as j } from "@scalar/components";
3
+ import { useToasts as M } from "@scalar/use-toasts";
4
+ import z from "./CommandActionForm.vue.js";
5
+ import E from "./CommandActionInput.vue.js";
6
+ import { getOpenApiDocumentDetails as W } from "../../libs/getOpenApiDocumentDetails.js";
7
+ import { isUrl as x } from "../../libs/isUrl.js";
8
+ import { useFileDialog as J } from "../../hooks/useFileDialog.js";
9
+ import { useWorkspace as Y } from "../../store/store.js";
10
+ const q = { class: "flex justify-between" }, G = /* @__PURE__ */ w("div", { class: "pl-8 text-xs min-h-8 py-2 text-c-2" }, "Preview", -1), ne = /* @__PURE__ */ O({
12
11
  __name: "CommandPaletteImport",
13
12
  emits: ["close", "back"],
14
- setup(j, { emit: b }) {
15
- const m = b, { activeWorkspace: c, importSpecFile: g, importSpecFromUrl: C } = R(), { toast: n } = $(), e = _(""), { open: y } = L({
13
+ setup(H, { emit: U }) {
14
+ const f = U, { activeWorkspace: g, importSpecFile: b, importSpecFromUrl: D } = Y(), { toast: m } = M(), i = R(), e = P(""), o = v(
15
+ () => W(e.value)
16
+ ), C = v(
17
+ () => o.value ? o.value.type : "json"
18
+ ), S = v(() => x(e.value)), F = v(() => !!o.value), { open: L } = J({
16
19
  onChange: async (a) => {
17
- const o = a == null ? void 0 : a[0];
18
- if (o) {
19
- const t = new FileReader();
20
- t.onload = async (w) => {
21
- var k;
22
- const F = (k = w.target) == null ? void 0 : k.result;
20
+ const t = a == null ? void 0 : a[0];
21
+ if (t) {
22
+ const r = new FileReader();
23
+ r.onload = async (A) => {
24
+ var I;
25
+ const B = (I = A.target) == null ? void 0 : I.result;
23
26
  try {
24
- await g(F, c.value.uid), n("Import successful", "info"), m("close");
25
- } catch (i) {
26
- console.error(i);
27
- const U = (i == null ? void 0 : i.message) || "Unknown error";
28
- n(`Import failed: ${U}`, "error");
27
+ await b(B, g.value.uid), m("Import successful", "info"), f("close");
28
+ } catch (d) {
29
+ console.error(d);
30
+ const N = (d == null ? void 0 : d.message) || "Unknown error";
31
+ m(`Import failed: ${N}`, "error");
29
32
  }
30
- }, t.readAsText(o);
33
+ }, r.readAsText(t);
31
34
  }
32
35
  },
33
36
  multiple: !1,
34
37
  accept: ".json,.yaml,.yml"
35
38
  });
36
- async function I() {
37
- try {
38
- e.value && (v(e.value) ? await C(
39
- e.value,
40
- void 0,
41
- void 0,
42
- c.value.uid
43
- ) : M(e.value) ? await g(
44
- String(e.value),
45
- c.value.uid
46
- ) : n("Import failed: Invalid URL or OpenAPI document", "error")), m("close"), n("Import successful", "info");
47
- } catch (a) {
48
- console.error("[importCollection]", a);
49
- const o = (a == null ? void 0 : a.message) || "Unknown error";
50
- n(`Import failed: ${o}`, "error");
39
+ async function V() {
40
+ if (!(!e.value || i.isLoading)) {
41
+ i.startLoading();
42
+ try {
43
+ if (S.value)
44
+ await D(
45
+ e.value,
46
+ void 0,
47
+ void 0,
48
+ g.value.uid
49
+ );
50
+ else if (F.value)
51
+ await b(
52
+ String(e.value),
53
+ g.value.uid
54
+ );
55
+ else {
56
+ m("Import failed: Invalid URL or OpenAPI document", "error"), i.invalidate(2e3, !0);
57
+ return;
58
+ }
59
+ i.clear(), f("close"), m("Import successful", "info");
60
+ } catch (a) {
61
+ console.error("[importCollection]", a);
62
+ const t = (a == null ? void 0 : a.message) || "Unknown error";
63
+ i.invalidate(2e3, !0), m(`Import failed: ${t}`, "error");
64
+ }
51
65
  }
52
66
  }
53
- function S() {
54
- return (f(e.value) || {}).type ?? "json";
55
- }
56
- function D(a) {
57
- var t;
58
- const o = (t = a.clipboardData) == null ? void 0 : t.getData("text");
59
- o && (e.value = o);
60
- }
61
- return (a, o) => (s(), u(N, {
67
+ return (a, t) => (l(), k(z, {
62
68
  disabled: !e.value.trim(),
63
- onSubmit: I
69
+ loading: n(i),
70
+ onSubmit: V
64
71
  }, {
65
- options: l(() => [
66
- p(r(x), {
72
+ options: p(() => [
73
+ y(n(h), {
67
74
  class: "p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
68
75
  variant: "outlined",
69
- onClick: r(y)
76
+ onClick: n(L)
70
77
  }, {
71
- default: l(() => [
72
- d(" JSON, or YAML File "),
73
- p(r(P), {
78
+ default: p(() => [
79
+ s(" JSON, or YAML File "),
80
+ y(n(T), {
74
81
  class: "text-c-3",
75
82
  icon: "UploadSimple",
76
83
  size: "md"
@@ -79,41 +86,54 @@ const X = /* @__PURE__ */ V({
79
86
  _: 1
80
87
  }, 8, ["onClick"])
81
88
  ]),
82
- submit: l(() => [
83
- d("Import Collection")
89
+ submit: p(() => [
90
+ s(" Import "),
91
+ S.value ? (l(), c(u, { key: 0 }, [
92
+ s(" from URL ")
93
+ ], 64)) : o.value && C.value ? (l(), c(u, { key: 1 }, [
94
+ o.value.title ? (l(), c(u, { key: 0 }, [
95
+ s(' "' + _(o.value.title) + '" ', 1)
96
+ ], 64)) : (l(), c(u, { key: 1 }, [
97
+ s(_(o.value.version) + " Spec", 1)
98
+ ], 64))
99
+ ], 64)) : (l(), c(u, { key: 2 }, [
100
+ s("Collection")
101
+ ], 64))
84
102
  ]),
85
- default: l(() => [
86
- !r(f)(e.value) || r(v)(e.value) ? (s(), u(T, {
103
+ default: p(() => [
104
+ !o.value || n(x)(e.value) ? (l(), k(E, {
87
105
  key: 0,
88
106
  modelValue: e.value,
89
- "onUpdate:modelValue": o[0] || (o[0] = (t) => e.value = t),
107
+ "onUpdate:modelValue": t[0] || (t[0] = (r) => e.value = r),
90
108
  placeholder: "Paste Swagger/OpenAPI File URL or content",
91
- onOnDelete: o[1] || (o[1] = (t) => m("back", t)),
92
- onPaste: o[2] || (o[2] = (t) => D(t))
93
- }, null, 8, ["modelValue"])) : (s(), h(A, { key: 1 }, [
94
- p(r(x), {
95
- class: "ml-auto p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
96
- variant: "ghost",
97
- onClick: o[3] || (o[3] = (t) => e.value = "")
98
- }, {
99
- default: l(() => [
100
- d(" Clear ")
101
- ]),
102
- _: 1
103
- }),
104
- r(f)(e.value) && !r(v)(e.value) ? (s(), u(r(B), {
109
+ onOnDelete: t[1] || (t[1] = (r) => f("back", r))
110
+ }, null, 8, ["modelValue"])) : (l(), c(u, { key: 1 }, [
111
+ w("div", q, [
112
+ G,
113
+ y(n(h), {
114
+ class: "ml-auto p-2 max-h-8 gap-1.5 text-xs hover:bg-b-2 relative",
115
+ variant: "ghost",
116
+ onClick: t[2] || (t[2] = (r) => e.value = "")
117
+ }, {
118
+ default: p(() => [
119
+ s(" Clear ")
120
+ ]),
121
+ _: 1
122
+ })
123
+ ]),
124
+ o.value && !n(x)(e.value) ? (l(), k(n(j), {
105
125
  key: 0,
106
- class: "bg-backdropdark border max-h-[25dvh] mt-2 rounded",
126
+ class: "border max-h-[40dvh] mt-1 bg-b-2 rounded [--scalar-small:--scalar-font-size-4]",
107
127
  content: e.value,
108
128
  copy: !1,
109
- lang: S()
110
- }, null, 8, ["content", "lang"])) : O("", !0)
129
+ lang: C.value
130
+ }, null, 8, ["content", "lang"])) : $("", !0)
111
131
  ], 64))
112
132
  ]),
113
133
  _: 1
114
- }, 8, ["disabled"]));
134
+ }, 8, ["disabled", "loading"]));
115
135
  }
116
136
  });
117
137
  export {
118
- X as default
138
+ ne as default
119
139
  };
@@ -2,7 +2,7 @@ import o from "./TheCommandPalette.vue2.js";
2
2
  import { PaletteComponents as s } from "./TheCommandPalette.vue2.js";
3
3
  /* empty css */
4
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
5
- const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-c08d90be"]]);
5
+ const a = /* @__PURE__ */ t(o, [["__scopeId", "data-v-272ef6cf"]]);
6
6
  export {
7
7
  s as PaletteComponents,
8
8
  a as default
@@ -1,5 +1,5 @@
1
- import { defineComponent as F, ref as u, computed as P, watch as U, onMounted as G, onBeforeUnmount as Q, openBlock as a, createElementBlock as r, Fragment as d, withDirectives as h, createElementVNode as m, vShow as w, unref as f, createVNode as y, withKeys as g, withModifiers as S, vModelText as j, renderList as K, toDisplayString as M, normalizeClass as J, createTextVNode as O, createCommentVNode as X, createBlock as Y, resolveDynamicComponent as Z, mergeProps as ee, nextTick as T } from "vue";
2
- import { useModal as oe, ScalarIcon as $ } from "@scalar/components";
1
+ import { defineComponent as F, ref as u, computed as P, watch as U, onMounted as G, onBeforeUnmount as Q, openBlock as a, createElementBlock as r, Fragment as d, withDirectives as h, createElementVNode as m, vShow as w, unref as f, createVNode as y, withKeys as g, withModifiers as $, vModelText as j, renderList as K, toDisplayString as M, normalizeClass as J, createTextVNode as O, createCommentVNode as X, createBlock as Y, resolveDynamicComponent as Z, mergeProps as ee, nextTick as T } from "vue";
2
+ import { useModal as oe, ScalarIcon as S } from "@scalar/components";
3
3
  import { useRouter as te } from "vue-router";
4
4
  import ne from "./CommandPaletteCollection.vue.js";
5
5
  import ae from "./CommandPaletteExample.vue.js";
@@ -29,7 +29,7 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
29
29
  setup(be) {
30
30
  const A = [
31
31
  {
32
- label: "Add to Request Sidebar",
32
+ label: "",
33
33
  commands: [
34
34
  {
35
35
  name: "Create Request",
@@ -76,7 +76,7 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
76
76
  }
77
77
  ]
78
78
  }
79
- ], c = oe(), { push: z } = te(), { activeWorkspace: N } = ie(), k = u(), l = u(""), s = u(null), i = u(-1), R = u([]), p = P(
79
+ ], c = oe(), { push: z } = te(), { activeWorkspace: N } = ie(), k = u(), l = u(""), s = u(null), i = u(-1), D = u([]), p = P(
80
80
  () => A.reduce((e, o) => {
81
81
  const t = o.commands.filter(
82
82
  (n) => n.name.toLowerCase().includes(l.value.toLowerCase())
@@ -85,14 +85,14 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
85
85
  }, [])
86
86
  ), v = () => {
87
87
  c.hide(), l.value = "", s.value = null, i.value = -1;
88
- }, q = (e) => {
88
+ }, H = (e) => {
89
89
  l.value !== "" && (e == null || e.preventDefault()), s.value = null, T(() => {
90
90
  var o;
91
91
  return (o = b.value) == null ? void 0 : o.focus();
92
92
  });
93
- }, D = (e) => {
93
+ }, L = (e) => {
94
94
  "path" in e ? (z(`/workspace/${N.value.uid}${e.path}`), v()) : s.value = e.name;
95
- }, b = u(), L = ({
95
+ }, b = u(), R = ({
96
96
  commandName: e,
97
97
  metaData: o
98
98
  } = {}) => {
@@ -109,21 +109,21 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
109
109
  if (!c.open) return;
110
110
  o.preventDefault();
111
111
  const t = e === "up" ? -1 : 1, n = p.value.length;
112
- i.value = (i.value + t + n) % n, (C = R.value[i.value]) == null || C.scrollIntoView({
112
+ i.value = (i.value + t + n) % n, (C = D.value[i.value]) == null || C.scrollIntoView({
113
113
  behavior: "smooth",
114
114
  block: "nearest"
115
115
  });
116
116
  }, x = P(
117
117
  () => p.value[i.value]
118
- ), H = (e) => {
119
- !x.value || s.value || (e.preventDefault(), e.stopPropagation(), D(x.value));
118
+ ), q = (e) => {
119
+ !x.value || s.value || (e.preventDefault(), e.stopPropagation(), L(x.value));
120
120
  }, E = (e) => {
121
121
  c.open && e.closeModal && v();
122
122
  };
123
123
  return G(() => {
124
- V.on(L), W.on(E);
124
+ V.on(R), W.on(E);
125
125
  }), Q(() => {
126
- V.off(L), W.off(E);
126
+ V.off(R), W.off(E);
127
127
  }), (e, o) => (a(), r(d, null, [
128
128
  h(m("div", {
129
129
  class: "commandmenu-clickout",
@@ -138,23 +138,23 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
138
138
  type: "button",
139
139
  onClick: o[4] || (o[4] = (t) => s.value = null)
140
140
  }, [
141
- y(f($), {
141
+ y(f(S), {
142
142
  icon: "ChevronLeft",
143
143
  size: "md",
144
144
  thickness: "1.5"
145
145
  })
146
146
  ]),
147
147
  (a(), Y(Z(ke[s.value]), ee(k.value ? { metaData: k.value } : {}, {
148
- onBack: o[5] || (o[5] = (t) => q(t)),
148
+ onBack: o[5] || (o[5] = (t) => H(t)),
149
149
  onClose: v
150
150
  }), null, 16))
151
151
  ], 64)) : (a(), r(d, { key: 0 }, [
152
152
  m("div", de, [
153
153
  m("label", fe, [
154
- y(f($), {
155
- class: "text-c-1 mr-2.5",
154
+ y(f(S), {
155
+ class: "text-c-2 mr-2.5",
156
156
  icon: "Search",
157
- size: "sm",
157
+ size: "md",
158
158
  thickness: "1.5"
159
159
  })
160
160
  ]),
@@ -169,9 +169,9 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
169
169
  placeholder: "Search commands...",
170
170
  type: "text",
171
171
  onKeydown: [
172
- o[2] || (o[2] = g(S((t) => B("down", t), ["stop"]), ["down"])),
173
- g(S(H, ["stop"]), ["enter"]),
174
- o[3] || (o[3] = g(S((t) => B("up", t), ["stop"]), ["up"]))
172
+ o[2] || (o[2] = g($((t) => B("down", t), ["stop"]), ["down"])),
173
+ g($(q, ["stop"]), ["enter"]),
174
+ o[3] || (o[3] = g($((t) => B("up", t), ["stop"]), ["up"]))
175
175
  ]
176
176
  }, null, 40, pe), [
177
177
  [j, l.value]
@@ -196,15 +196,15 @@ const ue = { class: "commandmenu custom-scroll" }, de = { class: "bg-b-2 flex it
196
196
  key: n.name,
197
197
  ref_for: !0,
198
198
  ref: (_) => {
199
- _ && (R.value[C] = _);
199
+ _ && (D.value[C] = _);
200
200
  },
201
201
  class: J(["commandmenu-item text-sm flex items-center py-1.5 px-2 rounded hover:bg-b-2 cursor-pointer", {
202
202
  "bg-b-2": n.name === ((I = x.value) == null ? void 0 : I.name)
203
203
  }]),
204
- onClick: (_) => D(n)
204
+ onClick: (_) => L(n)
205
205
  }, [
206
- y(f($), {
207
- class: "text-c-1 mr-2.5",
206
+ y(f(S), {
207
+ class: "text-c-2 mr-2.5",
208
208
  icon: n.icon,
209
209
  size: "md",
210
210
  thickness: "1.5"
@@ -1 +1 @@
1
- {"version":3,"file":"ApiClientApp.vue.d.ts","sourceRoot":"","sources":["../../../src/layouts/App/ApiClientApp.vue"],"names":[],"mappings":";;cA6I8B,MAAM;aAAO,MAAM;;;;cAAnB,MAAM;aAAO,MAAM;;;AAuMjD,wBAMG"}
1
+ {"version":3,"file":"ApiClientApp.vue.d.ts","sourceRoot":"","sources":["../../../src/layouts/App/ApiClientApp.vue"],"names":[],"mappings":";;cA0I8B,MAAM;aAAO,MAAM;;;;cAAnB,MAAM;aAAO,MAAM;;;AAoMjD,wBAMG"}
@@ -30,10 +30,7 @@ const O = ["innerHTML"], U = {
30
30
  const s = (o) => W(o, { hotKeys: u });
31
31
  c(() => window.addEventListener("keydown", s)), y(() => window.removeEventListener("keydown", s));
32
32
  const v = b(
33
- () => r.activeWorkspace.value && `<style>
34
- ${H(r.activeWorkspace.value.themeId, {
35
- fonts: !0
36
- })}</style>`
33
+ () => r.activeWorkspace.value && `<style>${H(r.activeWorkspace.value.themeId)}</style>`
37
34
  );
38
35
  return (o, I) => {
39
36
  var m;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiClientWeb.vue.d.ts","sourceRoot":"","sources":["../../../src/layouts/Web/ApiClientWeb.vue"],"names":[],"mappings":";AAmRA,wBAKG"}
1
+ {"version":3,"file":"ApiClientWeb.vue.d.ts","sourceRoot":"","sources":["../../../src/layouts/Web/ApiClientWeb.vue"],"names":[],"mappings":";AA6QA,wBAKG"}