@scalar/api-reference 1.28.31 → 1.28.32

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.
@@ -1,51 +1,73 @@
1
- import { defineComponent as h, ref as v, onMounted as d, watch as E, onBeforeUnmount as C, createElementBlock as g, openBlock as x } from "vue";
2
- import { useActiveEntities as S, useWorkspace as _ } from "@scalar/api-client/store";
3
- import { mutateServerDiff as k, mutateSecuritySchemeDiff as b } from "@scalar/api-client/views/Request/libs";
4
- import { watchDebounced as A } from "@vueuse/core";
5
- import B from "microdiff";
6
- import { useApiClient as D } from "./useApiClient.js";
1
+ import { defineComponent as h, ref as S, onMounted as E, watch as b, onBeforeUnmount as x, createElementBlock as M, openBlock as g } from "vue";
2
+ import { useActiveEntities as k, useWorkspace as A } from "@scalar/api-client/store";
3
+ import { mutateSecuritySchemeDiff as C } from "@scalar/api-client/views/Request/libs";
4
+ import { getServersFromOpenApiDocument as U } from "@scalar/oas-utils/transforms";
5
+ import { watchDebounced as B } from "@vueuse/core";
6
+ import D from "microdiff";
7
+ import { useApiClient as _ } from "./useApiClient.js";
7
8
  import { useNavState as y } from "../../hooks/useNavState.js";
8
9
  import { useExampleStore as I } from "../../legacy/stores/useExampleStore.js";
9
- const F = /* @__PURE__ */ h({
10
+ const G = /* @__PURE__ */ h({
10
11
  __name: "ApiClientModal",
11
12
  props: {
12
- configuration: {}
13
+ configuration: {},
14
+ parsedSpec: {}
13
15
  },
14
16
  setup(i) {
15
- const n = v(null), { client: o, init: p } = D(), { selectedExampleKey: f, operationId: u } = I(), c = S(), a = _(), { isIntersectionEnabled: l } = y();
16
- return d(() => {
17
- n.value && p({
18
- el: n.value,
17
+ const c = S(null), { client: o, init: v } = _(), { selectedExampleKey: d, operationId: l } = I(), s = k(), r = A(), { isIntersectionEnabled: m } = y();
18
+ return E(() => {
19
+ c.value && v({
20
+ el: c.value,
19
21
  configuration: i.configuration,
20
- store: a
22
+ store: r
21
23
  });
22
- }), A(
24
+ }), B(
23
25
  () => i.configuration,
24
- (e, r) => {
25
- var m;
26
- if (!r)
26
+ (e, a) => {
27
+ var f;
28
+ if (!a || !s.activeCollection.value)
27
29
  return;
28
- const s = B(r, e);
29
- s.some(
30
+ const n = s.activeCollection.value, p = D(a, e);
31
+ if (p.some(
30
32
  (t) => t.path[0] === "url" || t.path[0] === "content" || t.path[1] === "url" || t.path[1] === "content"
31
- ) ? (m = o.value) == null || m.updateConfig(e) : s.forEach((t) => {
32
- t.path[0] === "servers" ? k(t, c, a) : t.path[0] === "authentication" && b(t, c, a);
33
- }), l.value = !1, setTimeout(() => {
34
- l.value = !0;
33
+ ))
34
+ (f = o.value) == null || f.updateConfig(e);
35
+ else if (p.forEach((t) => {
36
+ t.path[0] === "authentication" && C(t, s, r);
37
+ }), e.servers || a.servers) {
38
+ n.servers.forEach((u) => {
39
+ r.serverMutators.delete(u, n.uid);
40
+ });
41
+ const t = U(
42
+ e.servers ?? i.parsedSpec.servers,
43
+ {
44
+ baseServerURL: e.baseServerURL
45
+ }
46
+ );
47
+ t.forEach((u) => {
48
+ r.serverMutators.add(u, n.uid);
49
+ }), t.length && r.collectionMutators.edit(
50
+ n.uid,
51
+ "selectedServerUid",
52
+ t[t.length - 1].uid
53
+ );
54
+ }
55
+ m.value = !1, setTimeout(() => {
56
+ m.value = !0;
35
57
  }, 1e3);
36
58
  },
37
59
  { deep: !0, debounce: 300 }
38
- ), E(f, (e) => {
39
- o.value && e && u.value && o.value.updateExample(e, u.value);
40
- }), C(() => {
60
+ ), b(d, (e) => {
61
+ o.value && e && l.value && o.value.updateExample(e, l.value);
62
+ }), x(() => {
41
63
  var e;
42
64
  return (e = o.value) == null ? void 0 : e.app.unmount();
43
- }), (e, r) => (x(), g("div", {
65
+ }), (e, a) => (g(), M("div", {
44
66
  ref_key: "el",
45
- ref: n
67
+ ref: c
46
68
  }, null, 512));
47
69
  }
48
70
  });
49
71
  export {
50
- F as default
72
+ G as default
51
73
  };