@scalar/api-reference 1.25.130 → 1.26.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.
@@ -1,34 +1,34 @@
1
- import { useConfig as p } from "./useConfig.js";
2
- import { ssrState as m, combineUrlAndPath as f } from "@scalar/oas-utils/helpers";
1
+ import { useConfig as f } from "./useConfig.js";
2
+ import { ssrState as p, combineUrlAndPath as v } from "@scalar/oas-utils/helpers";
3
3
  import { slug as c } from "github-slugger";
4
- import { ref as l } from "vue";
5
- const s = l(""), u = l(m.hash ?? ""), o = l(), w = l(!1), h = (e) => {
4
+ import { ref as s } from "vue";
5
+ const u = s(""), l = s(p.hash ?? ""), r = s(), m = s(!1), h = (t) => {
6
6
  var n;
7
- if (!o.value) return "";
8
- const r = new RegExp("^" + ((n = o.value) == null ? void 0 : n.basePath) + "/?");
9
- return decodeURIComponent(e.replace(r, ""));
10
- }, I = (e = u.value) => {
7
+ if (!r.value) return "";
8
+ const a = new RegExp("^" + ((n = r.value) == null ? void 0 : n.basePath) + "/?");
9
+ return decodeURIComponent(t.replace(a, ""));
10
+ }, w = (t = l.value) => {
11
11
  var i;
12
- const r = (i = e.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = e.startsWith("model") ? "models" : "", a = e.startsWith("webhook") ? "webhooks" : "";
13
- return r || n || a;
14
- }, v = () => {
15
- u.value = o.value ? h(window.location.pathname) : (
12
+ const a = (i = t.match(/(tag\/[^/]+)/)) == null ? void 0 : i[0], n = t.startsWith("model") ? "models" : "", o = t.startsWith("webhook") ? "webhooks" : "";
13
+ return a || n || o;
14
+ }, I = () => {
15
+ l.value = r.value ? h(window.location.pathname) : (
16
16
  // Must remove the prefix from the hash as the internal hash value should be pure
17
- decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(s.value.length)
17
+ decodeURIComponent(window.location.hash.replace(/^#/, "")).slice(u.value.length)
18
18
  );
19
- }, $ = (e, r = window.location.href) => {
20
- const n = new URL(r);
21
- o.value ? n.pathname = f(o.value.basePath, e) : n.hash = s.value + e, u.value = e, window.history.replaceState({}, "", n);
22
- }, S = (e, r = window.location.href, n = window.location.search) => {
23
- const a = new URL(r);
24
- return a.hash = s.value + e, a.search = n, a.toString();
25
- }, U = (e = u.value) => `${s.value}${e}`, b = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(s.value.length)), x = () => {
26
- const e = p(), r = (t) => typeof (e == null ? void 0 : e.generateHeadingSlug) == "function" ? `${e.generateHeadingSlug(t)}` : t.slug ? `description/${t.slug}` : "", n = (t) => t != null && t.name ? typeof (e == null ? void 0 : e.generateModelSlug) == "function" ? `model/${e.generateModelSlug(t)}` : `model/${c(t.name)}` : "models", a = (t) => typeof (e == null ? void 0 : e.generateTagSlug) == "function" ? `tag/${e.generateTagSlug(t)}` : `tag/${c(t.name)}`;
19
+ }, $ = (t, a = window.location.href) => {
20
+ const n = new URL(a);
21
+ r.value ? n.pathname = v(r.value.basePath, t) : n.hash = u.value + t, l.value = t, window.history.replaceState({}, "", n);
22
+ }, S = (t, a = window.location.href, n = window.location.search) => {
23
+ const o = new URL(a);
24
+ return o.hash = u.value + t, o.search = n, o.toString();
25
+ }, U = (t = l.value) => `${u.value}${t}`, b = () => decodeURIComponent(window.location.hash.replace(/^#/, "").slice(u.value.length)), x = () => {
26
+ const t = f(), a = (e) => typeof t.value.generateHeadingSlug == "function" ? `${t.value.generateHeadingSlug(e)}` : e.slug ? `description/${e.slug}` : "", n = (e) => e != null && e.name ? typeof t.value.generateModelSlug == "function" ? `model/${t.value.generateModelSlug(e)}` : `model/${c(e.name)}` : "models", o = (e) => typeof t.value.generateTagSlug == "function" ? `tag/${t.value.generateTagSlug(e)}` : `tag/${c(e.name)}`;
27
27
  return {
28
- hash: u,
28
+ hash: l,
29
29
  /** Sets the prefix for the hash */
30
- setHashPrefix: (t) => {
31
- s.value = t;
30
+ setHashPrefix: (e) => {
31
+ u.value = e;
32
32
  },
33
33
  /**
34
34
  * Gets the full hash with the prefix
@@ -50,24 +50,24 @@ const s = l(""), u = l(m.hash ?? ""), o = l(), w = l(!1), h = (e) => {
50
50
  replaceUrlState: $,
51
51
  /** Gets the portion of the hash used by the references */
52
52
  getReferenceHash: b,
53
- getWebhookId: (t) => t != null && t.name ? typeof (e == null ? void 0 : e.generateWebhookSlug) == "function" ? `webhook/${e.generateWebhookSlug(t)}` : `webhook/${t.method}/${c(t.name)}` : "webhooks",
53
+ getWebhookId: (e) => e != null && e.name ? typeof t.value.generateWebhookSlug == "function" ? `webhook/${t.value.generateWebhookSlug(e)}` : `webhook/${e.method}/${c(e.name)}` : "webhooks",
54
54
  getModelId: n,
55
- getHeadingId: r,
56
- getOperationId: (t, g) => {
55
+ getHeadingId: a,
56
+ getOperationId: (e, g) => {
57
57
  var d;
58
- return typeof (e == null ? void 0 : e.generateOperationSlug) == "function" ? `${a(g)}/${e.generateOperationSlug({
59
- path: t.path,
60
- operationId: t.operationId,
61
- method: t.httpVerb,
62
- summary: (d = t.information) == null ? void 0 : d.summary
63
- })}` : `${a(g)}/${t.httpVerb}${t.path}`;
58
+ return typeof t.value.generateOperationSlug == "function" ? `${o(g)}/${t.value.generateOperationSlug({
59
+ path: e.path,
60
+ operationId: e.operationId,
61
+ method: e.httpVerb,
62
+ summary: (d = e.information) == null ? void 0 : d.summary
63
+ })}` : `${o(g)}/${e.httpVerb}${e.path}`;
64
64
  },
65
65
  getPathRoutingId: h,
66
- getSectionId: I,
67
- getTagId: a,
68
- isIntersectionEnabled: w,
69
- pathRouting: o,
70
- updateHash: v
66
+ getSectionId: w,
67
+ getTagId: o,
68
+ isIntersectionEnabled: m,
69
+ pathRouting: r,
70
+ updateHash: I
71
71
  };
72
72
  };
73
73
  export {