@scalar/api-reference 1.31.11 → 1.31.14

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,78 +1,102 @@
1
- import O from "fuse.js";
2
- import { ref as u, watch as E, computed as R } from "vue";
3
- import { useNavState as W } from "../../hooks/useNavState.js";
4
- import { useOperation as j } from "../../hooks/useOperation.js";
5
- import { getHeadingsFromMarkdown as A } from "../../libs/markdown.js";
6
- import { extractRequestBody as B, getModels as P } from "../../libs/openapi.js";
7
- import { useConfig as z } from "../../hooks/useConfig.js";
8
- function Z({
9
- specification: T
1
+ import A from "fuse.js";
2
+ import { ref as m, watch as T, computed as k } from "vue";
3
+ import { useNavState as B } from "../../hooks/useNavState.js";
4
+ import { useOperation as O } from "../../hooks/useOperation.js";
5
+ import { getHeadingsFromMarkdown as P } from "../../libs/markdown.js";
6
+ import { extractRequestBody as j, getModels as z } from "../../libs/openapi.js";
7
+ import { useConfig as G } from "../../hooks/useConfig.js";
8
+ import { isHttpMethod as J } from "@scalar/helpers/http/is-http-method";
9
+ function w({
10
+ specification: q
10
11
  }) {
11
- const { getHeadingId: V, getModelId: k, getTagId: C } = W(), L = z(), o = u([]), l = u([]), s = u(), r = u(""), d = new O(o.value, {
12
+ const { getHeadingId: H, getModelId: L, getTagId: C } = B(), F = G(), a = m([]), d = m([]), i = m(), l = m(""), y = new A(a.value, {
12
13
  keys: ["title", "description", "body"]
13
- }), c = () => {
14
- s.value = 0, l.value = d.search(r.value);
14
+ }), b = () => {
15
+ i.value = 0, d.value = y.search(l.value);
15
16
  };
16
- E(r, (e) => {
17
- e.length ? c() : l.value = [];
17
+ T(l, (e) => {
18
+ e.length ? b() : d.value = [];
18
19
  });
19
- function q() {
20
- r.value = "", s.value = void 0, l.value = [];
20
+ function N() {
21
+ l.value = "", i.value = void 0, d.value = [];
21
22
  }
22
- const f = R(() => r.value.length === 0 ? o.value.slice(0, 25).map((i) => ({
23
- item: i
24
- })) : l.value.slice(0, 25)), F = R(
25
- () => typeof s.value == "number" ? f.value[s.value] : void 0
23
+ const g = k(() => l.value.length === 0 ? a.value.slice(0, 25).map((f) => ({
24
+ item: f
25
+ })) : d.value.slice(0, 25)), W = k(
26
+ () => typeof i.value == "number" ? g.value[i.value] : void 0
26
27
  );
27
- return E(
28
- T,
28
+ return T(
29
+ q,
29
30
  (e) => {
30
- var b, I, p, M;
31
- if (o.value = [], !((b = e == null ? void 0 : e.tags) != null && b.length) && !((I = e == null ? void 0 : e.webhooks) != null && I.length)) {
32
- d.setCollection([]);
33
- return;
34
- }
35
- const i = [], m = A(((p = e == null ? void 0 : e.info) == null ? void 0 : p.description) ?? "");
36
- m.length && (m.forEach((t) => {
37
- i.push({
31
+ var E, x, V;
32
+ a.value = [];
33
+ const f = [], I = P(((E = e == null ? void 0 : e.info) == null ? void 0 : E.description) ?? "");
34
+ if (I.length && (I.forEach((t) => {
35
+ f.push({
38
36
  type: "heading",
39
37
  title: `Info > ${t.value}`,
40
38
  description: "",
41
- href: `#${V(t)}`,
39
+ href: `#${H(t)}`,
42
40
  tag: t.slug,
43
41
  body: ""
44
42
  });
45
- }), o.value = o.value.concat(i)), (M = e == null ? void 0 : e.tags) == null || M.forEach((t) => {
46
- const H = {
47
- title: t["x-displayName"] ?? t.name,
48
- href: `#${C(t)}`,
49
- description: t.description,
50
- type: "tag",
51
- tag: t.name,
52
- body: ""
53
- };
54
- o.value.push(H), t.operations && t.operations.forEach((a) => {
55
- var x;
56
- const { parameterMap: N } = j(a), D = B(a) || N.value;
57
- let n = null;
58
- typeof D != "boolean" && (n = D);
59
- const $ = {
60
- type: "req",
61
- title: a.name ?? a.path,
62
- href: `#${a.id}`,
63
- operationId: (x = a.information) == null ? void 0 : x.operationId,
64
- description: a.description ?? "",
65
- httpVerb: a.httpVerb,
66
- path: a.path,
43
+ }), a.value = a.value.concat(f)), (x = e == null ? void 0 : e.tags) != null && x.length)
44
+ (V = e == null ? void 0 : e.tags) == null || V.forEach((t) => {
45
+ const h = {
46
+ title: t["x-displayName"] ?? t.name,
47
+ href: `#${C(t)}`,
48
+ description: t.description,
49
+ type: "tag",
67
50
  tag: t.name,
68
- operation: a
51
+ body: ""
69
52
  };
70
- n && ($.body = n), o.value.push($);
53
+ a.value.push(h), t.operations && t.operations.forEach((s) => {
54
+ var n;
55
+ const { parameterMap: o } = O(s), u = j(s) || o.value;
56
+ let r = null;
57
+ typeof u != "boolean" && (r = u);
58
+ const c = {
59
+ type: "req",
60
+ title: s.name ?? s.path,
61
+ href: `#${s.id}`,
62
+ operationId: (n = s.information) == null ? void 0 : n.operationId,
63
+ description: s.description ?? "",
64
+ httpVerb: s.httpVerb,
65
+ path: s.path,
66
+ tag: t.name,
67
+ operation: s
68
+ };
69
+ r && (c.body = r), a.value.push(c);
70
+ });
71
71
  });
72
- });
73
- const v = e == null ? void 0 : e.webhooks, y = [];
74
- v && v.forEach((t) => {
75
- y.push({
72
+ else if (e != null && e.paths) {
73
+ const t = e.paths;
74
+ Object.keys(t ?? {}).forEach((h) => {
75
+ Object.keys((t == null ? void 0 : t[h]) ?? {}).forEach((s) => {
76
+ var u, r;
77
+ const o = (u = t == null ? void 0 : t[h]) == null ? void 0 : u[s];
78
+ if (J(s) && o) {
79
+ const { parameterMap: c } = O({ ...o, information: o }), n = j(o) || c.value;
80
+ let p = null;
81
+ typeof n != "boolean" && (p = n);
82
+ const R = {
83
+ type: "req",
84
+ title: o.name ?? o.path,
85
+ href: `#${o.id}`,
86
+ operationId: (r = o.information) == null ? void 0 : r.operationId,
87
+ description: o.description ?? "",
88
+ httpVerb: o.httpVerb,
89
+ path: o.path,
90
+ operation: o
91
+ };
92
+ p && (R.body = p), a.value.push(R);
93
+ }
94
+ });
95
+ });
96
+ }
97
+ const M = e == null ? void 0 : e.webhooks, D = [];
98
+ M && M.forEach((t) => {
99
+ D.push({
76
100
  type: "webhook",
77
101
  title: "Webhook",
78
102
  href: `#${t.id}`,
@@ -80,30 +104,30 @@ function Z({
80
104
  httpVerb: t.httpVerb,
81
105
  tag: t.name,
82
106
  body: ""
83
- }), o.value = o.value.concat(y);
107
+ }), a.value = a.value.concat(D);
84
108
  });
85
- const h = L.value.hideModels ? {} : P(e), g = [];
86
- h && (Object.keys(h).forEach((t) => {
87
- g.push({
109
+ const v = F.value.hideModels ? {} : z(e), $ = [];
110
+ v && (Object.keys(v).forEach((t) => {
111
+ $.push({
88
112
  type: "model",
89
113
  title: "Model",
90
- href: `#${k({ name: t })}`,
91
- description: h[t].title ?? t,
114
+ href: `#${L({ name: t })}`,
115
+ description: v[t].title ?? t,
92
116
  tag: t,
93
117
  body: ""
94
118
  });
95
- }), o.value = o.value.concat(g)), d.setCollection(o.value);
119
+ }), a.value = a.value.concat($)), y.setCollection(a.value);
96
120
  },
97
121
  { immediate: !0 }
98
122
  ), {
99
- resetSearch: q,
100
- fuseSearch: c,
101
- selectedSearchIndex: s,
102
- selectedSearchResult: F,
103
- searchResultsWithPlaceholderResults: f,
104
- searchText: r
123
+ resetSearch: N,
124
+ fuseSearch: b,
125
+ selectedSearchIndex: i,
126
+ selectedSearchResult: W,
127
+ searchResultsWithPlaceholderResults: g,
128
+ searchText: l
105
129
  };
106
130
  }
107
131
  export {
108
- Z as useSearchIndex
132
+ w as useSearchIndex
109
133
  };
@@ -58,7 +58,7 @@ const I = (s, i) => new Promise((e, b) => {
58
58
  pathParameters: (r = (a = e.paths) == null ? void 0 : a[o.path ?? ""]) == null ? void 0 : r.parameters
59
59
  });
60
60
  }
61
- "tag" in o && o.isGroup && ((f = o.children) != null && f.length) && o.children.forEach(p), "tag" in o && p(o), "isWebhooks" in o && o.isWebhooks && ((u = o.children) != null && u.length) && o.children.forEach((t) => {
61
+ "tag" in o && o.isGroup && ((f = o.children) != null && f.length) ? o.children.forEach(p) : "tag" in o && p(o), "isWebhooks" in o && o.isWebhooks && ((u = o.children) != null && u.length) && o.children.forEach((t) => {
62
62
  var n, g;
63
63
  "webhook" in t && t.name && t.method && b.push({
64
64
  id: t.id,
package/dist/index.d.ts CHANGED
@@ -4,6 +4,7 @@ export { SearchButton, SearchModal } from './features/Search';
4
4
  export { default as GettingStarted } from './components/GettingStarted.vue.js';
5
5
  export { createApiReference } from './standalone/lib/html-api.js';
6
6
  export { Sidebar } from './components/Sidebar';
7
+ export { useSidebar } from './features/sidebar';
7
8
  export { Card, CardHeader, CardContent, CardFooter, CardTabHeader, CardTab } from './components/Card';
8
9
  export { parse } from './helpers/parse.js';
9
10
  export { createEmptySpecification } from './libs/openapi.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,qCAAqC,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAE7D,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,iCAAiC,CAAA;AAE3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAA;AAE9D,OAAO,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAC9C,OAAO,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,UAAU,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAA;AAGrG,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACvC,OAAO,EAAE,wBAAwB,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAA;AAChE,YAAY,EACV,yBAAyB,EACzB,cAAc,GACf,MAAM,SAAS,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,Y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