@scalar/api-client 2.0.25 → 2.0.26

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  # @scalar/api-client
2
2
 
3
+ ## 2.0.26
4
+
5
+ ### Patch Changes
6
+
7
+ - 54f7654: fix: add local storage to client.scalar/com
8
+ - b0b3290: feat: create a default workspace if no OpenAPI document is passed to the modal
9
+ - 7e01b12: fix: only trigger codeinput change event if the value has changed
10
+ - b7211fb: fix: request history
11
+ - Updated dependencies [67aefbf]
12
+ - Updated dependencies [7761630]
13
+ - @scalar/components@0.12.17
14
+ - @scalar/oas-utils@0.2.16
15
+
3
16
  ## 2.0.25
4
17
 
5
18
  ### Patch Changes
@@ -1 +1 @@
1
- {"version":3,"file":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBarHistory.vue"],"names":[],"mappings":";UA8HQ,OAAO;;UAAP,OAAO;;AAqPf,wBAMG;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":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBarHistory.vue"],"names":[],"mappings":";UAkHQ,OAAO;;UAAP,OAAO;;AA0Of,wBAMG;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,34 +1,34 @@
1
- import { defineComponent as q, openBlock as n, createElementBlock as f, Fragment as d, unref as t, createBlock as i, withCtx as m, createVNode as x, createCommentVNode as b, createElementVNode as o, normalizeClass as h, renderList as U, toDisplayString as c } from "vue";
1
+ import { defineComponent as y, openBlock as n, createElementBlock as p, Fragment as f, unref as e, createBlock as i, withCtx as m, createVNode as d, createCommentVNode as x, createElementVNode as r, normalizeClass as h, renderList as k, toDisplayString as u } from "vue";
2
2
  import { formatMs as w } from "../../libs/formatters.js";
3
- import { useWorkspace as y } from "../../store/workspace.js";
4
- import { ListboxButton as C, ListboxOptions as L, ListboxOption as R } from "@headlessui/vue";
5
- import { ScalarIcon as B } from "@scalar/components";
6
- import { httpStatusCodes as S } from "@scalar/oas-utils/helpers";
7
- import { useRouter as H } from "vue-router";
3
+ import { useWorkspace as C } from "../../store/workspace.js";
4
+ import { ListboxButton as q, ListboxOptions as U, ListboxOption as L } from "@headlessui/vue";
5
+ import { ScalarIcon as R } from "@scalar/components";
6
+ import { httpStatusCodes as B } from "@scalar/oas-utils/helpers";
7
+ import { useRouter as S } from "vue-router";
8
8
  import P from "../HttpMethod/HttpMethod.vue.js";
9
9
  import { getStatusCodeColor as z } from "./httpStatusCodeColors.js";
10
- const E = { class: "font-code flex flex-1 gap-1.5 text-sm font-medium" }, N = { class: "text-c-2 gap-0" }, V = { class: "font-code text-c-3 flex flex-row items-center gap-1.5 text-sm font-medium" }, Q = /* @__PURE__ */ q({
10
+ const E = { class: "font-code flex flex-1 gap-1.5 text-sm font-medium" }, H = { class: "text-c-2 gap-0" }, N = { class: "font-code text-c-3 flex flex-row items-center gap-1.5 text-sm font-medium" }, G = /* @__PURE__ */ y({
11
11
  __name: "AddressBarHistory",
12
12
  props: {
13
13
  open: { type: Boolean }
14
14
  },
15
- setup($) {
16
- const { requestsHistory: u, activeRequest: g, requestExampleMutators: _ } = y(), v = H();
17
- function p(a, r) {
18
- const e = new URL(a.responseURL), s = new URLSearchParams(e.search).get("scalar_url");
19
- return s ? new URL(s)[r].toString() : e.origin;
15
+ setup(V) {
16
+ const { activeRequest: l, requestExampleMutators: b } = C(), g = S();
17
+ function _(a) {
18
+ const o = new URL(a), s = new URLSearchParams(o.search).get("scalar_url");
19
+ return s ? new URL(s).href : o.href;
20
20
  }
21
- function k(a) {
22
- const r = u.value[a];
23
- g.value.uid !== r.request.requestUid && v.push(`/request/${r.request.requestUid}`), _.set(r.request);
21
+ function v(a) {
22
+ const o = l.value.history[a];
23
+ l.value.uid !== o.request.requestUid && g.push(`/request/${o.request.requestUid}`), b.set(o.request);
24
24
  }
25
- return (a, r) => (n(), f(d, null, [
26
- t(u).length ? (n(), i(t(C), {
25
+ return (a, o) => (n(), p(f, null, [
26
+ e(l).history.length ? (n(), i(e(q), {
27
27
  key: 0,
28
28
  class: "hover:bg-b-2 mr-1 rounded p-1.5"
29
29
  }, {
30
30
  default: m(() => [
31
- x(t(B), {
31
+ d(e(R), {
32
32
  class: "text-c-3",
33
33
  icon: "History",
34
34
  size: "sm",
@@ -36,38 +36,38 @@ const E = { class: "font-code flex flex-1 gap-1.5 text-sm font-medium" }, N = {
36
36
  })
37
37
  ]),
38
38
  _: 1
39
- })) : b("", !0),
40
- o("div", {
39
+ })) : x("", !0),
40
+ r("div", {
41
41
  class: h([
42
42
  "absolute left-0 top-[33px] w-full rounded before:pointer-events-none before:absolute before:left-0 before:top-[-33px] before:h-[calc(100%+33px)] before:w-full before:rounded z-50",
43
43
  { "before:shadow-lg": a.open }
44
44
  ])
45
45
  }, [
46
- x(t(L), { class: "bg-b-1 custom-scroll bg-mix-transparent bg-mix-amount-30 max-h-[300px] rounded-b p-[3px] pt-0 backdrop-blur" }, {
46
+ d(e(U), { class: "bg-b-1 custom-scroll bg-mix-transparent bg-mix-amount-30 max-h-[300px] rounded-b p-[3px] pt-0 backdrop-blur" }, {
47
47
  default: m(() => [
48
- (n(!0), f(d, null, U(t(u), ({ response: e }, l) => (n(), i(t(R), {
49
- key: l,
48
+ (n(!0), p(f, null, k(e(l).history, ({ response: t }, s) => (n(), i(e(L), {
49
+ key: s,
50
50
  class: "ui-active:bg-b-2 text-c-1 ui-active:text-c-1 flex cursor-pointer flex-row gap-2.5 rounded py-1.5 pr-3",
51
- value: l,
52
- onClick: (s) => k(l)
51
+ value: s,
52
+ onClick: (c) => v(s)
53
53
  }, {
54
54
  default: m(() => {
55
- var s;
55
+ var c;
56
56
  return [
57
- o("div", E, [
58
- e.config.method ? (n(), i(P, {
57
+ r("div", E, [
58
+ t.config.method ? (n(), i(P, {
59
59
  key: 0,
60
60
  class: "text-[11px] min-w-[44px]",
61
- method: e.config.method
62
- }, null, 8, ["method"])) : b("", !0),
63
- o("span", N, c(p(e.request, "origin") + p(e.request, "pathname")), 1)
61
+ method: t.config.method
62
+ }, null, 8, ["method"])) : x("", !0),
63
+ r("span", H, u(_(t.config.url)), 1)
64
64
  ]),
65
- o("div", V, [
66
- o("span", null, c(t(w)(e.duration)), 1),
67
- o("span", {
68
- class: h([t(z)(e.status).color])
69
- }, c(e.status), 3),
70
- o("span", null, c((s = t(S)[e.status]) == null ? void 0 : s.name), 1)
65
+ r("div", N, [
66
+ r("span", null, u(e(w)(t.duration)), 1),
67
+ r("span", {
68
+ class: h([e(z)(t.status).color])
69
+ }, u(t.status), 3),
70
+ r("span", null, u((c = e(B)[t.status]) == null ? void 0 : c.name), 1)
71
71
  ])
72
72
  ];
73
73
  }),
@@ -81,5 +81,5 @@ const E = { class: "font-code flex flex-1 gap-1.5 text-sm font-medium" }, N = {
81
81
  }
82
82
  });
83
83
  export {
84
- Q as default
84
+ G as default
85
85
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OAoRO,EAGL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;;kBAeb,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;oBACF,OAAO;kBACT,OAAO;;;;;;;;;;;;;;kBAlBP,OAAO;gBACT,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;WACR,MAAM;eACF,OAAO;oBACF,OAAO;kBACT,OAAO;;;;;;;;;;;;;;cAFV,OAAO;iBAEJ,OAAO;iBAlBP,OAAO;gBAGR,OAAO;sBAGD,OAAO;kBAMX,OAAO;0BACC,OAAO;mBAId,OAAO;;qBAwPG,GAAG;kBACN,GAAG;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I,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"}
@@ -2,7 +2,7 @@ import o from "./CodeInput.vue2.js";
2
2
  /* empty css */
3
3
  /* empty css */
4
4
  import t from "../../_virtual/_plugin-vue_export-helper.js";
5
- const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-93d0e1be"]]);
5
+ const f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ee1f4723"]]);
6
6
  export {
7
- _ as default
7
+ f as default
8
8
  };
@@ -1,4 +1,4 @@
1
- import { defineComponent as S, useAttrs as P, ref as b, toRef as o, watch as O, computed as $, openBlock as t, createElementBlock as s, Fragment as R, createBlock as h, mergeProps as q, unref as E, renderSlot as y, createCommentVNode as g } from "vue";
1
+ import { defineComponent as S, useAttrs as P, ref as b, toRef as o, watch as O, computed as $, openBlock as t, createElementBlock as i, Fragment as R, createBlock as h, mergeProps as q, unref as E, renderSlot as y, createCommentVNode as g } from "vue";
2
2
  import { useCodeMirror as I, colorPicker as M } from "@scalar/use-codemirror";
3
3
  import { nanoid as N } from "nanoid";
4
4
  import B from "../DataTable/DataTableInputSelect.vue.js";
@@ -38,11 +38,11 @@ const j = ["id"], z = {
38
38
  withServers: { type: Boolean, default: !1 }
39
39
  },
40
40
  emits: ["submit", "update:modelValue"],
41
- setup(v, { emit: k }) {
41
+ setup(v, { emit: V }) {
42
42
  var m;
43
- const e = v, a = k, d = P(), V = d.id || `id-${N()}`, p = b(!1), { activeWorkspace: w } = W();
43
+ const e = v, a = V, d = P(), k = d.id || `id-${N()}`, p = b(!1), { activeWorkspace: w } = W();
44
44
  function C(l) {
45
- return e.handleFieldChange ? e.handleFieldChange(l) : a("update:modelValue", l);
45
+ return l === e.modelValue ? null : e.handleFieldChange ? e.handleFieldChange(l) : a("update:modelValue", l);
46
46
  }
47
47
  function _(l) {
48
48
  return e.handleFieldSubmit ? e.handleFieldSubmit(l) : a("submit", l);
@@ -78,20 +78,20 @@ const j = ["id"], z = {
78
78
  });
79
79
  return (l, u) => {
80
80
  var f;
81
- return t(), s(R, null, [
81
+ return t(), i(R, null, [
82
82
  e.enum && e.enum.length ? (t(), h(B, {
83
83
  key: 0,
84
84
  modelValue: e.modelValue,
85
85
  value: e.enum,
86
- "onUpdate:modelValue": u[0] || (u[0] = (i) => a("update:modelValue", i))
86
+ "onUpdate:modelValue": u[0] || (u[0] = (s) => a("update:modelValue", s))
87
87
  }, null, 8, ["modelValue", "value"])) : e.type === "boolean" || (f = e.type) != null && f.includes("boolean") ? (t(), h(B, {
88
88
  key: 1,
89
89
  modelValue: e.modelValue,
90
90
  value: F.value,
91
- "onUpdate:modelValue": u[1] || (u[1] = (i) => a("update:modelValue", i))
92
- }, null, 8, ["modelValue", "value"])) : (t(), s("div", q({
91
+ "onUpdate:modelValue": u[1] || (u[1] = (s) => a("update:modelValue", s))
92
+ }, null, 8, ["modelValue", "value"])) : (t(), i("div", q({
93
93
  key: 2,
94
- id: E(V)
94
+ id: E(k)
95
95
  }, l.$attrs, {
96
96
  ref_key: "codeMirrorRef",
97
97
  ref: c,
@@ -99,11 +99,11 @@ const j = ["id"], z = {
99
99
  "flow-code-input--error": l.error
100
100
  }]
101
101
  }), null, 16, j)),
102
- l.$slots.warning ? (t(), s("div", z, [
102
+ l.$slots.warning ? (t(), i("div", z, [
103
103
  y(l.$slots, "warning", {}, void 0, !0)
104
104
  ])) : g("", !0),
105
105
  y(l.$slots, "icon", {}, void 0, !0),
106
- l.required ? (t(), s("div", D, " Required ")) : g("", !0)
106
+ l.required ? (t(), i("div", D, " Required ")) : g("", !0)
107
107
  ], 64);
108
108
  };
109
109
  }
package/dist/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './layouts/Modal/index.js';
2
2
  export * from './layouts/App/index.js';
3
3
  export { useWorkspace } from './store/workspace.js';
4
+ export { modalRouter, router } from './router.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,eAAe,CAAA;AAE7B,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAChD,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA"}
package/dist/index.js CHANGED
@@ -1,13 +1,16 @@
1
- import { useWorkspace as r } from "./store/workspace.js";
2
- import { default as a } from "./layouts/App/ApiClientApp.vue.js";
1
+ import { useWorkspace as t } from "./store/workspace.js";
2
+ import { modalRouter as a, router as i } from "./router.js";
3
+ import { default as f } from "./layouts/App/ApiClientApp.vue.js";
3
4
  /* empty css */
4
- import { default as l } from "./layouts/Modal/ApiClientModal.vue.js";
5
- import { createApiClientModal as m } from "./layouts/Modal/api-client-modal.js";
6
- import { createApiClientApp as x } from "./layouts/App/createApiClientApp.js";
5
+ import { default as x } from "./layouts/Modal/ApiClientModal.vue.js";
6
+ import { createApiClientModal as d } from "./layouts/Modal/api-client-modal.js";
7
+ import { createApiClientApp as n } from "./layouts/App/createApiClientApp.js";
7
8
  export {
8
- a as ApiClientApp,
9
- l as ApiClientModal,
10
- x as createApiClientApp,
11
- m as createApiClientModal,
12
- r as useWorkspace
9
+ f as ApiClientApp,
10
+ x as ApiClientModal,
11
+ n as createApiClientApp,
12
+ d as createApiClientModal,
13
+ a as modalRouter,
14
+ i as router,
15
+ t as useWorkspace
13
16
  };
@@ -4,7 +4,7 @@ import type { ThemeId } from '@scalar/themes';
4
4
  /** Configuration options for the Scalar API client */
5
5
  export type ClientConfiguration = {
6
6
  /** The Swagger/OpenAPI spec to render */
7
- spec: SpecConfiguration;
7
+ spec?: SpecConfiguration;
8
8
  /** Pass in a proxy to the API client */
9
9
  proxyUrl?: string;
10
10
  /** Pass in a theme API client */
@@ -1 +1 @@
1
- {"version":3,"file":"api-client-modal.d.ts","sourceRoot":"","sources":["../../../src/layouts/Modal/api-client-modal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAG/E,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,2BAA2B,CAAA;AAG3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAM7C,sDAAsD;AACtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,yCAAyC;IACzC,IAAI,EAAE,iBAAiB,CAAA;IACvB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,4DAA4D;IAE5D,mFAAmF;IACnF,YAAY,CAAC,EACT,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;CACR,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAA;AAEvE,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,OAE3B,WAAW,GAAG,IAAI,UAEd,mBAAmB;IAyEzB,+DAA+D;;IAE/D,mCAAmC;4BACX,mBAAmB;IAQ3C;;;OAGG;iCAC0B,MAAM;IAMnC;;;OAGG;uBACgB,mBAAmB;IAyEtC,uEAAuE;uBACpD,iBAAiB;IAapC,iCAAiC;qBAChB,iBAAiB;IAalC,8CAA8C;;;;;;;EAIjD,CAAA"}
1
+ {"version":3,"file":"api-client-modal.d.ts","sourceRoot":"","sources":["../../../src/layouts/Modal/api-client-modal.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAG/E,OAAO,EAAE,KAAK,aAAa,EAAe,MAAM,2BAA2B,CAAA;AAG3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAA;AAM7C,sDAAsD;AACtD,MAAM,MAAM,mBAAmB,GAAG;IAChC,yCAAyC;IACzC,IAAI,CAAC,EAAE,iBAAiB,CAAA;IACxB,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,kCAAkC;IAClC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,4DAA4D;IAE5D,mFAAmF;IACnF,YAAY,CAAC,EACT,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,GACH,GAAG,CAAA;CACR,CAAA;AAED,MAAM,MAAM,iBAAiB,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,aAAa,CAAA;CAAE,CAAA;AAEvE,yCAAyC;AACzC,eAAO,MAAM,oBAAoB,OAE3B,WAAW,GAAG,IAAI,UAEd,mBAAmB;IAyEzB,+DAA+D;;IAE/D,mCAAmC;4BACX,mBAAmB;IAQ3C;;;OAGG;iCAC0B,MAAM;IAMnC;;;OAGG;uBACgB,mBAAmB;IAyEtC,uEAAuE;uBACpD,iBAAiB;IAapC,iCAAiC;qBAChB,iBAAiB;IAalC,8CAA8C;;;;;;;EAIjD,CAAA"}
@@ -1,32 +1,32 @@
1
1
  import { modalRouter as k } from "../../router.js";
2
- import { useWorkspace as O } from "../../store/workspace.js";
3
- import { objectMerge as R } from "@scalar/oas-utils/helpers";
4
- import { getNestedValue as j } from "@scalar/object-utils/nested";
5
- import { createApp as C } from "vue";
6
- import q from "./ApiClientModal.vue.js";
7
- const L = async (A, r, b = !0) => {
8
- var h, w, v;
2
+ import { useWorkspace as j } from "../../store/workspace.js";
3
+ import { objectMerge as P } from "@scalar/oas-utils/helpers";
4
+ import { getNestedValue as R } from "@scalar/object-utils/nested";
5
+ import { createApp as q } from "vue";
6
+ import C from "./ApiClientModal.vue.js";
7
+ const L = async (b, r, A = !0) => {
8
+ var h, w, y;
9
9
  const {
10
- activeCollection: n,
10
+ activeCollection: m,
11
11
  activeWorkspace: a,
12
12
  collectionMutators: I,
13
- importSpecFile: c,
14
- importSpecFromUrl: m,
15
- modalState: p,
16
- requests: M,
17
- securitySchemeMutators: U,
18
- securitySchemes: P,
19
- serverMutators: x,
20
- workspaceMutators: d
21
- } = O();
22
- (h = r.spec) != null && h.url ? await m(r.spec.url, r.proxyUrl) : (w = r.spec) != null && w.content ? await c((v = r.spec) == null ? void 0 : v.content) : console.error(
23
- "[@scalar/api-client-modal] Could not create the API client.",
24
- "Please provide an OpenAPI document: { spec: { url: '…' } }",
25
- "Read more: https://github.com/scalar/scalar/tree/main/packages/api-client-modal"
26
- );
27
- const u = C(q, { modalState: p });
13
+ importSpecFile: p,
14
+ importSpecFromUrl: n,
15
+ modalState: d,
16
+ requests: U,
17
+ securitySchemeMutators: x,
18
+ securitySchemes: M,
19
+ serverMutators: O,
20
+ workspaceMutators: l
21
+ } = j();
22
+ (h = r.spec) != null && h.url ? await n(r.spec.url, r.proxyUrl) : (w = r.spec) != null && w.content ? await p((y = r.spec) == null ? void 0 : y.content) : l.add({
23
+ uid: "default",
24
+ name: "Workspace",
25
+ proxyUrl: "https://proxy.scalar.com"
26
+ });
27
+ const u = q(C, { modalState: d });
28
28
  u.use(k);
29
- const f = (e = A) => {
29
+ const f = (e = b) => {
30
30
  if (!e) {
31
31
  console.error(
32
32
  "[@scalar/api-client-modal] Could not create the API client.",
@@ -37,11 +37,11 @@ const L = async (A, r, b = !0) => {
37
37
  }
38
38
  u.mount(e);
39
39
  };
40
- return a.value && (b && f(), d.edit(a.value.uid, "isReadOnly", !0), r.proxyUrl && d.edit(
40
+ return a.value && (A && f(), l.edit(a.value.uid, "isReadOnly", !0), r.proxyUrl && l.edit(
41
41
  a.value.uid,
42
42
  "proxyUrl",
43
43
  r.proxyUrl
44
- ), r.themeId && d.edit(
44
+ ), r.themeId && l.edit(
45
45
  a.value.uid,
46
46
  "themeId",
47
47
  r.themeId
@@ -50,7 +50,7 @@ const L = async (A, r, b = !0) => {
50
50
  app: u,
51
51
  /** Update the API client config */
52
52
  updateConfig(e, s = !0) {
53
- s ? Object.assign(r, e) : R(r, e), e.spec && c(e.spec);
53
+ s ? Object.assign(r, e) : P(r, e), e.spec && p(e.spec);
54
54
  },
55
55
  /**
56
56
  * TODO this is just temporary for the modal, we'll put in a proper solution later
@@ -58,8 +58,8 @@ const L = async (A, r, b = !0) => {
58
58
  */
59
59
  updateServerUrl: (e) => {
60
60
  var s;
61
- return x.edit(
62
- ((s = n.value) == null ? void 0 : s.selectedServerUid) ?? "",
61
+ return O.edit(
62
+ ((s = m.value) == null ? void 0 : s.selectedServerUid) ?? "",
63
63
  "url",
64
64
  e
65
65
  );
@@ -69,9 +69,9 @@ const L = async (A, r, b = !0) => {
69
69
  * maps the references useAuthenticationStore to the client auth
70
70
  */
71
71
  updateAuth: (e) => {
72
- var l, i;
73
- if (Object.values(P).forEach((o) => {
74
- const t = (y, S = "value") => y.length && !j(o, S).length && U.edit(o.uid, S, y);
72
+ var i, c;
73
+ if (Object.values(M).forEach((o) => {
74
+ const t = (S, v = "value") => S.length && !R(o, v).length && x.edit(o.uid, v, S);
75
75
  switch (o.type) {
76
76
  case "apiKey":
77
77
  t(e.apiKey.token);
@@ -86,9 +86,9 @@ const L = async (A, r, b = !0) => {
86
86
  }), e.preferredSecurityScheme) {
87
87
  const o = {
88
88
  uid: e.preferredSecurityScheme
89
- }, t = (l = e.securitySchemes) == null ? void 0 : l[e.preferredSecurityScheme ?? ""];
90
- (t == null ? void 0 : t.type) === "oauth2" && (o.flowKey = (i = t.flows) != null && i.implicit ? "implicit" : "password"), I.edit(
91
- n.value.uid,
89
+ }, t = (i = e.securitySchemes) == null ? void 0 : i[e.preferredSecurityScheme ?? ""];
90
+ (t == null ? void 0 : t.type) === "oauth2" && (o.flowKey = (c = t.flows) != null && c.implicit ? "implicit" : "password"), I.edit(
91
+ m.value.uid,
92
92
  "selectedSecuritySchemes",
93
93
  [o]
94
94
  );
@@ -96,7 +96,7 @@ const L = async (A, r, b = !0) => {
96
96
  },
97
97
  /** Update the spec file, this will re-parse it and clear your store */
98
98
  updateSpec: (e) => {
99
- e != null && e.url ? m(e.url, r.proxyUrl) : e != null && e.content ? c(e == null ? void 0 : e.content) : console.error(
99
+ e != null && e.url ? n(e.url, r.proxyUrl) : e != null && e.content ? p(e == null ? void 0 : e.content) : console.error(
100
100
  "[@scalar/api-client-modal] Could not create the API client.",
101
101
  "Please provide an OpenAPI document: { spec: { url: '…' } }",
102
102
  "Read more: https://github.com/scalar/scalar/tree/main/packages/api-client-modal"
@@ -104,20 +104,20 @@ const L = async (A, r, b = !0) => {
104
104
  },
105
105
  /** Open the API client modal */
106
106
  open: (e) => {
107
- const s = Object.values(M).find(
108
- ({ path: l, method: i }) => e ? (
107
+ const s = Object.values(U).find(
108
+ ({ path: i, method: c }) => e ? (
109
109
  // The given operation
110
- l === e.path && i === e.method
110
+ i === e.path && c === e.method
111
111
  ) : (
112
112
  // Or the first request
113
113
  !0
114
114
  )
115
115
  );
116
- s && k.push(`/workspace/default/request/${s.uid}`), p.open = !0;
116
+ s && k.push(`/workspace/default/request/${s.uid}`), d.open = !0;
117
117
  },
118
118
  /** Mount the references to a given element */
119
119
  mount: f,
120
- modalState: p
120
+ modalState: d
121
121
  };
122
122
  };
123
123
  export {
@@ -558,7 +558,9 @@ export declare const useWorkspace: () => {
558
558
  url: string;
559
559
  description?: string | undefined;
560
560
  } | undefined;
561
- info?: {
561
+ info
562
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
563
+ ?: {
562
564
  title: string;
563
565
  version: string;
564
566
  description?: string | undefined;
@@ -807,7 +809,9 @@ export declare const useWorkspace: () => {
807
809
  url: string;
808
810
  description?: string | undefined;
809
811
  } | undefined;
810
- info?: {
812
+ info
813
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
814
+ ?: {
811
815
  title: string;
812
816
  version: string;
813
817
  description?: string | undefined;
@@ -1137,7 +1141,9 @@ export declare const useWorkspace: () => {
1137
1141
  url: string;
1138
1142
  description?: string | undefined;
1139
1143
  } | undefined;
1140
- info?: {
1144
+ info
1145
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1146
+ ?: {
1141
1147
  title: string;
1142
1148
  version: string;
1143
1149
  description?: string | undefined;
@@ -1315,7 +1321,9 @@ export declare const useWorkspace: () => {
1315
1321
  url: string;
1316
1322
  description?: string | undefined;
1317
1323
  } | undefined;
1318
- info?: {
1324
+ info
1325
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1326
+ ?: {
1319
1327
  title: string;
1320
1328
  version: string;
1321
1329
  description?: string | undefined;
@@ -1358,7 +1366,9 @@ export declare const useWorkspace: () => {
1358
1366
  url: string;
1359
1367
  description?: string | undefined;
1360
1368
  } | undefined;
1361
- info?: {
1369
+ info
1370
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1371
+ ?: {
1362
1372
  title: string;
1363
1373
  version: string;
1364
1374
  description?: string | undefined;
@@ -1402,7 +1412,9 @@ export declare const useWorkspace: () => {
1402
1412
  url: string;
1403
1413
  description?: string | undefined;
1404
1414
  } | undefined;
1405
- info?: {
1415
+ info
1416
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1417
+ ?: {
1406
1418
  title: string;
1407
1419
  version: string;
1408
1420
  description?: string | undefined;
@@ -1445,7 +1457,9 @@ export declare const useWorkspace: () => {
1445
1457
  url: string;
1446
1458
  description?: string | undefined;
1447
1459
  } | undefined;
1448
- info?: {
1460
+ info
1461
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1462
+ ?: {
1449
1463
  title: string;
1450
1464
  version: string;
1451
1465
  description?: string | undefined;
@@ -1487,7 +1501,9 @@ export declare const useWorkspace: () => {
1487
1501
  url: string;
1488
1502
  description?: string | undefined;
1489
1503
  } | undefined;
1490
- info?: {
1504
+ info
1505
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1506
+ ?: {
1491
1507
  title: string;
1492
1508
  version: string;
1493
1509
  description?: string | undefined;
@@ -1529,7 +1545,9 @@ export declare const useWorkspace: () => {
1529
1545
  url: string;
1530
1546
  description?: string | undefined;
1531
1547
  } | undefined;
1532
- info?: {
1548
+ info
1549
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1550
+ ?: {
1533
1551
  title: string;
1534
1552
  version: string;
1535
1553
  description?: string | undefined;
@@ -1572,7 +1590,9 @@ export declare const useWorkspace: () => {
1572
1590
  url: string;
1573
1591
  description?: string | undefined;
1574
1592
  } | undefined;
1575
- info?: {
1593
+ info
1594
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1595
+ ?: {
1576
1596
  title: string;
1577
1597
  version: string;
1578
1598
  description?: string | undefined;
@@ -1614,7 +1634,9 @@ export declare const useWorkspace: () => {
1614
1634
  url: string;
1615
1635
  description?: string | undefined;
1616
1636
  } | undefined;
1617
- info?: {
1637
+ info
1638
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1639
+ ?: {
1618
1640
  title: string;
1619
1641
  version: string;
1620
1642
  description?: string | undefined;
@@ -1656,7 +1678,9 @@ export declare const useWorkspace: () => {
1656
1678
  url: string;
1657
1679
  description?: string | undefined;
1658
1680
  } | undefined;
1659
- info?: {
1681
+ info
1682
+ /** Active workspace object (will be associated with an entry in the workspace collection) */
1683
+ ?: {
1660
1684
  title: string;
1661
1685
  version: string;
1662
1686
  description?: string | undefined;