@scalar/api-reference 1.28.21 → 1.28.22

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 +1 @@
1
- {"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ApiClientModal/ApiClientModal.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAWzE,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAC/C,CAAC;;AAwGF,wBAOG"}
1
+ {"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/ApiClientModal/ApiClientModal.vue"],"names":[],"mappings":"AA8EA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAWzE,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,OAAO,CAAC,sBAAsB,CAAC,CAAA;CAC/C,CAAC;;AAgHF,wBAOG"}
@@ -1,42 +1,47 @@
1
- import { defineComponent as m, ref as p, onMounted as f, watch as s, onBeforeUnmount as d, openBlock as v, createElementBlock as x } from "vue";
1
+ import { defineComponent as m, ref as p, onMounted as d, watch as v, onBeforeUnmount as g, openBlock as h, createElementBlock as x } from "vue";
2
2
  import { useWorkspace as E } from "@scalar/api-client/store";
3
- import { watchDebounced as g } from "@vueuse/core";
3
+ import { watchDebounced as _ } from "@vueuse/core";
4
4
  import { useApiClient as k } from "./useApiClient.js";
5
- import { useNavState as C } from "../../hooks/useNavState.js";
6
- import { useExampleStore as _ } from "../../legacy/stores/useExampleStore.js";
7
- const S = /* @__PURE__ */ m({
5
+ import { useNavState as y } from "../../hooks/useNavState.js";
6
+ import { useExampleStore as S } from "../../legacy/stores/useExampleStore.js";
7
+ const M = /* @__PURE__ */ m({
8
8
  __name: "ApiClientModal",
9
9
  props: {
10
10
  configuration: {}
11
11
  },
12
- setup(u) {
13
- const o = p(null), { client: t, init: i } = k(), { selectedExampleKey: l, operationId: a } = _(), c = E(), { isIntersectionEnabled: r } = C();
14
- return f(() => {
15
- o.value && i({
12
+ setup(n) {
13
+ const o = p(null), { client: t, init: c } = k(), { selectedExampleKey: s, operationId: r } = S(), f = E(), { isIntersectionEnabled: a } = y();
14
+ return d(() => {
15
+ o.value && c({
16
16
  el: o.value,
17
- configuration: u.configuration,
18
- store: c
17
+ configuration: n.configuration,
18
+ store: f
19
19
  });
20
- }), g(
21
- () => u.configuration,
22
- (e) => {
23
- var n;
24
- e && (r.value = !1, (n = t.value) == null || n.updateConfig(e), setTimeout(() => {
25
- r.value = !0;
20
+ }), _(
21
+ () => n.configuration,
22
+ (e, u) => {
23
+ var l;
24
+ let i = !0;
25
+ try {
26
+ i = JSON.stringify(e) !== JSON.stringify(u);
27
+ } catch {
28
+ }
29
+ e && i && (a.value = !1, (l = t.value) == null || l.updateConfig(e), setTimeout(() => {
30
+ a.value = !0;
26
31
  }, 1e3));
27
32
  },
28
33
  { deep: !0, debounce: 300 }
29
- ), s(l, (e) => {
30
- t.value && e && a.value && t.value.updateExample(e, a.value);
31
- }), d(() => {
34
+ ), v(s, (e) => {
35
+ t.value && e && r.value && t.value.updateExample(e, r.value);
36
+ }), g(() => {
32
37
  var e;
33
38
  return (e = t.value) == null ? void 0 : e.app.unmount();
34
- }), (e, n) => (v(), x("div", {
39
+ }), (e, u) => (h(), x("div", {
35
40
  ref_key: "el",
36
41
  ref: o
37
42
  }, null, 512));
38
43
  }
39
44
  });
40
45
  export {
41
- S as default
46
+ M as default
42
47
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useMultipleDocuments.d.ts","sourceRoot":"","sources":["../../src/hooks/useMultipleDocuments.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAA;AAEnD,OAAO,EACL,KAAK,4BAA4B,EACjC,KAAK,iBAAiB,EAEvB,MAAM,6BAA6B,CAAA;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C5D,2FAA2F;IAC3F,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,GAAG,QAAQ,CAAA;AAIZ;;GAEG;AACH,eAAO,MAAM,uBAAuB,kBACnB,4BAA4B,GAAG,SAAS,KACtD,iBAAiB,EA6BnB,CAAA;AA0CD,eAAO,MAAM,oBAAoB,8EAM9B,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;0CAmIgooB,GAAI;oBAAuF,GAAG;;;;yBAAiH,CAAC;;;;;;;;;;;;;yCAAymB,GAAI;2CAA6E,GAAI;6BAAgE,GAAG;qBAAwE,GAAG;uCAAyF,GAAI;2CAA6F,GAAI;;;;;gBAA0K,CAAC;WAA4B,GAAI;;gBAAyF,CAAC;WAA4B,GAAI;;gBAAuF,CAAC;WAA4B,GAAI;;;;uBAAkJ,CAAC;mBAAqC,CAAC;WAA4B,GAAI;;;kBAAmH,CAAC;WAA4B,GAAI;qCAAyE,GAAI;;2DAAgK,GAAI;4EAAgH,GAAI;;;uDApLl9sB,GAAG;;;;;;;;;mDAAH,GAAG;;;;;;;;CAmLrD,CAAA"}
@@ -1,45 +1,45 @@
1
- import { isDefined as h } from "@scalar/oas-utils/helpers";
1
+ import { isDefined as S } from "@scalar/oas-utils/helpers";
2
2
  import { isConfigurationWithSources as y } from "@scalar/types/api-reference";
3
- import S from "github-slugger";
4
- import { computed as v, ref as A, watch as b } from "vue";
5
- const w = "api", g = new S(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMap((u) => {
3
+ import R from "github-slugger";
4
+ import { computed as g, ref as b, watch as A } from "vue";
5
+ const w = "api", h = new R(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMap((u) => {
6
6
  if (y(u)) {
7
- const { sources: a, ...r } = u;
8
- return (a == null ? void 0 : a.map((m) => ({ ...r, ...m }))) ?? [];
7
+ const { sources: s, ...r } = u;
8
+ return (s == null ? void 0 : s.map((m) => ({ ...r, ...m }))) ?? [];
9
9
  }
10
10
  return [u];
11
- }).map((u, a) => u && I(u, a)).filter(h) : [], I = (t, s = 0) => {
11
+ }).map((u, s) => u && I(u, s)).filter(S) : [], I = (t, a = 0) => {
12
12
  const e = {
13
13
  ...t,
14
14
  // @ts-expect-error this is before parsing so we transform the old style
15
15
  ...t.spec ?? {}
16
16
  };
17
17
  if (!(!(e != null && e.url) && !(e != null && e.content)))
18
- return g.reset(), e.title ? {
18
+ return h.reset(), e.title ? {
19
19
  ...e,
20
- slug: e.slug || g.slug(e.title),
20
+ slug: e.slug || h.slug(e.title),
21
21
  title: e.title
22
22
  } : e.slug ? {
23
23
  ...e,
24
24
  title: e.slug
25
25
  } : {
26
26
  ...e,
27
- slug: `api-${s + 1}`,
28
- title: `API #${s + 1}`
27
+ slug: `api-${a + 1}`,
28
+ title: `API #${a + 1}`
29
29
  };
30
- }, P = ({
30
+ }, T = ({
31
31
  configuration: t,
32
- initialIndex: s,
32
+ initialIndex: a,
33
33
  isIntersectionEnabled: e,
34
34
  hash: u,
35
- hashPrefix: a
35
+ hashPrefix: s
36
36
  }) => {
37
- const r = v(() => C(t.value)), f = A((() => {
37
+ const r = g(() => C(t.value)), f = b((() => {
38
38
  if (typeof window > "u")
39
- return typeof s == "number" ? s : 0;
39
+ return typeof a == "number" ? a : 0;
40
40
  const n = new URL(window.location.href).searchParams.get(w);
41
41
  if (n) {
42
- const o = r.value.findIndex((d) => d.slug === n);
42
+ const o = r.value.findIndex((p) => p.slug === n);
43
43
  if (o !== -1)
44
44
  return o;
45
45
  const i = Number.parseInt(n, 10);
@@ -47,8 +47,8 @@ const w = "api", g = new S(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMa
47
47
  return i;
48
48
  }
49
49
  const l = r.value.findIndex((o) => "default" in o && o.default === !0);
50
- return l !== -1 ? l : typeof s == "number" ? s : 0;
51
- })()), p = v(() => {
50
+ return l !== -1 ? l : typeof a == "number" ? a : 0;
51
+ })()), c = g(() => {
52
52
  var n, l;
53
53
  return t.value && y(t.value) ? {
54
54
  ...t.value,
@@ -59,26 +59,28 @@ const w = "api", g = new S(), C = (t) => t ? (Array.isArray(t) ? t : [t]).flatMa
59
59
  ...r.value[f.value]
60
60
  };
61
61
  });
62
- return b(
62
+ return A(
63
63
  f,
64
- (c) => {
65
- var i, d;
64
+ (d) => {
65
+ var i, p, v;
66
66
  if (typeof window > "u" || r.value.length === 1)
67
67
  return;
68
- const n = new URL(window.location.href), l = r.value[c], o = (l == null ? void 0 : l.slug) ?? c.toString();
69
- n.searchParams.set(w, o), n.hash = "", window.history.replaceState({}, "", n.toString()), u.value = "", a.value = "", e.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" }), (d = (i = p.value).onDocumentSelect) == null || d.call(i);
68
+ const n = new URL(window.location.href), l = r.value[d];
69
+ c.value.pathRouting && (n.pathname = ((i = c.value.pathRouting) == null ? void 0 : i.basePath) ?? "");
70
+ const o = (l == null ? void 0 : l.slug) ?? d.toString();
71
+ n.searchParams.set(w, o), n.hash = "", window.history.replaceState({}, "", n.toString()), u.value = "", s.value = "", e.value = !1, typeof window < "u" && window.scrollTo({ top: 0, behavior: "instant" }), (v = (p = c.value).onDocumentSelect) == null || v.call(p);
70
72
  },
71
73
  { flush: "sync" }
72
74
  ), {
73
- selectedConfiguration: p,
75
+ selectedConfiguration: c,
74
76
  availableDocuments: r,
75
77
  selectedDocumentIndex: f,
76
78
  isIntersectionEnabled: e,
77
79
  hash: u,
78
- hashPrefix: a
80
+ hashPrefix: s
79
81
  };
80
82
  };
81
83
  export {
82
84
  C as normalizeConfigurations,
83
- P as useMultipleDocuments
85
+ T as useMultipleDocuments
84
86
  };