@scalar/api-reference 1.32.1 → 1.32.5

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.
Files changed (110) hide show
  1. package/CHANGELOG.md +83 -0
  2. package/README.md +1 -1
  3. package/dist/browser/standalone.js +15738 -15439
  4. package/dist/browser/webpack-stats.json +1 -1
  5. package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
  6. package/dist/components/ApiReferenceLayout.vue.js +1 -1
  7. package/dist/components/ApiReferenceLayout.vue2.js +163 -158
  8. package/dist/components/Badge/Badge.vue.d.ts.map +1 -1
  9. package/dist/components/Badge/Badge.vue.js +1 -1
  10. package/dist/components/Card/CardHeader.vue.d.ts.map +1 -1
  11. package/dist/components/Card/CardHeader.vue.js +2 -2
  12. package/dist/components/Card/CardTab.vue.d.ts.map +1 -1
  13. package/dist/components/Card/CardTab.vue.js +3 -3
  14. package/dist/components/Card/CardTabHeader.vue.d.ts.map +1 -1
  15. package/dist/components/Card/CardTabHeader.vue.js +2 -2
  16. package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +1 -1
  17. package/dist/components/Content/ClientLibraries/ClientSelector.vue.js +1 -1
  18. package/dist/components/Content/Introduction/Introduction.vue.js +2 -2
  19. package/dist/components/Content/Lazy/Loading.vue.d.ts +1 -3
  20. package/dist/components/Content/Lazy/Loading.vue.d.ts.map +1 -1
  21. package/dist/components/Content/Lazy/Loading.vue.js +89 -89
  22. package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
  23. package/dist/components/Content/Models/Models.vue.js +2 -2
  24. package/dist/components/Content/Models/Models.vue2.js +59 -56
  25. package/dist/components/Content/Schema/RenderString.vue.d.ts +6 -0
  26. package/dist/components/Content/Schema/RenderString.vue.d.ts.map +1 -0
  27. package/dist/components/Content/Schema/RenderString.vue.js +14 -0
  28. package/dist/components/Content/Schema/RenderString.vue2.js +4 -0
  29. package/dist/components/Content/Schema/Schema.vue.d.ts +1 -1
  30. package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
  31. package/dist/components/Content/Schema/Schema.vue.js +2 -2
  32. package/dist/components/Content/Schema/Schema.vue2.js +76 -75
  33. package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
  34. package/dist/components/Content/Schema/SchemaComposition.vue.js +58 -66
  35. package/dist/components/Content/Schema/SchemaEnumValues.vue.d.ts +19 -0
  36. package/dist/components/Content/Schema/SchemaEnumValues.vue.d.ts.map +1 -0
  37. package/dist/components/Content/Schema/SchemaEnumValues.vue.js +7 -0
  38. package/dist/components/Content/Schema/SchemaEnumValues.vue2.js +125 -0
  39. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +2 -2
  40. package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
  41. package/dist/components/Content/Schema/SchemaProperty.vue.js +1 -1
  42. package/dist/components/Content/Schema/SchemaProperty.vue2.js +96 -170
  43. package/dist/components/Content/Schema/SchemaPropertyDescription.vue.d.ts +18 -0
  44. package/dist/components/Content/Schema/SchemaPropertyDescription.vue.d.ts.map +1 -0
  45. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
  46. package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +1 -1
  47. package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +155 -160
  48. package/dist/components/Content/Schema/helpers/get-schema-type.d.ts +6 -0
  49. package/dist/components/Content/Schema/helpers/get-schema-type.d.ts.map +1 -0
  50. package/dist/components/Content/Schema/helpers/get-schema-type.js +20 -0
  51. package/dist/components/Content/Schema/helpers/merge-all-of-schemas.js +1 -1
  52. package/dist/components/Content/Schema/helpers/optimizeValueForDisplay.d.ts.map +1 -1
  53. package/dist/components/Content/Schema/helpers/schema-name.d.ts.map +1 -1
  54. package/dist/components/Content/Schema/helpers/schema-name.js +20 -46
  55. package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
  56. package/dist/features/Operation/components/ContentTypeSelect.vue.js +6 -6
  57. package/dist/features/Operation/components/ParameterListItem.vue.js +3 -3
  58. package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
  59. package/dist/features/Operation/components/RequestBody.vue.js +1 -1
  60. package/dist/features/Operation/components/RequestBody.vue2.js +13 -10
  61. package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
  62. package/dist/features/Operation/layouts/ClassicLayout.vue.js +1 -1
  63. package/dist/features/Operation/layouts/ClassicLayout.vue2.js +64 -60
  64. package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
  65. package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
  66. package/dist/features/Operation/layouts/ModernLayout.vue2.js +13 -13
  67. package/dist/features/Search/SearchButton.vue.d.ts +1 -0
  68. package/dist/features/Search/SearchButton.vue.d.ts.map +1 -1
  69. package/dist/features/Search/SearchButton.vue.js +36 -34
  70. package/dist/features/Search/SearchModal.vue.d.ts +1 -0
  71. package/dist/features/Search/SearchModal.vue.d.ts.map +1 -1
  72. package/dist/features/Search/SearchModal.vue.js +1 -1
  73. package/dist/features/Search/SearchModal.vue2.js +112 -112
  74. package/dist/features/Search/useSearchIndex.d.ts +4 -3
  75. package/dist/features/Search/useSearchIndex.d.ts.map +1 -1
  76. package/dist/features/Search/useSearchIndex.js +119 -82
  77. package/dist/features/api-client-modal/ApiClientModal.vue.d.ts +2 -2
  78. package/dist/features/api-client-modal/ApiClientModal.vue.d.ts.map +1 -1
  79. package/dist/features/api-client-modal/ApiClientModal.vue.js +47 -38
  80. package/dist/features/api-client-modal/useApiClient.d.ts +334 -334
  81. package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
  82. package/dist/features/base-url/BaseUrl.vue.js +1 -1
  83. package/dist/features/example-responses/ExampleResponse.vue.js +3 -3
  84. package/dist/features/example-responses/ExampleResponse.vue2.js +7 -7
  85. package/dist/features/example-responses/ExampleResponses.vue.d.ts +1 -1
  86. package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
  87. package/dist/features/example-responses/ExampleResponses.vue.js +2 -2
  88. package/dist/features/sidebar/components/SidebarElement.vue.d.ts.map +1 -1
  89. package/dist/features/sidebar/components/SidebarElement.vue.js +1 -1
  90. package/dist/features/sidebar/components/SidebarElement.vue2.js +23 -21
  91. package/dist/features/sidebar/components/SidebarHttpBadge.vue.d.ts.map +1 -1
  92. package/dist/features/sidebar/components/SidebarHttpBadge.vue.js +2 -2
  93. package/dist/features/sidebar/components/SidebarHttpBadge.vue2.js +5 -6
  94. package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
  95. package/dist/features/traverse-schema/helpers/traverse-tags.js +26 -26
  96. package/dist/features/traverse-schema/index.d.ts +1 -1
  97. package/dist/features/traverse-schema/index.d.ts.map +1 -1
  98. package/dist/index.js +1 -1
  99. package/dist/libs/openapi.d.ts +15 -1
  100. package/dist/libs/openapi.d.ts.map +1 -1
  101. package/dist/libs/openapi.js +66 -47
  102. package/dist/standalone/lib/html-api.d.ts.map +1 -1
  103. package/dist/stores/useHttpClientStore.js +2 -2
  104. package/dist/style.css +1 -1
  105. package/dist/types.d.ts +3 -3
  106. package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts +2 -2
  107. package/package.json +18 -18
  108. package/dist/hooks/useOperation.d.ts +0 -16
  109. package/dist/hooks/useOperation.d.ts.map +0 -1
  110. package/dist/hooks/useOperation.js +0 -27
@@ -1,154 +1,156 @@
1
- import { defineComponent as Y, toRef as A, ref as W, watch as x, createBlock as $, openBlock as h, unref as s, withCtx as l, createElementVNode as n, createVNode as g, withKeys as b, withModifiers as R, isRef as j, createElementBlock as y, Fragment as E, renderList as G, createSlots as J, normalizeClass as Q, createTextVNode as d, createCommentVNode as X, toDisplayString as c } from "vue";
2
- import { ScalarModal as Z, ScalarSearchInput as _, ScalarSearchResultList as ee, ScalarSearchResultItem as te } from "@scalar/components";
1
+ import { defineComponent as Y, toRef as _, ref as j, watch as M, createBlock as $, openBlock as p, unref as n, withCtx as i, createElementVNode as a, createVNode as g, withKeys as I, withModifiers as b, isRef as G, createElementBlock as R, Fragment as w, renderList as J, createSlots as Q, normalizeClass as X, createTextVNode as c, createCommentVNode as E, toDisplayString as d } from "vue";
2
+ import { ScalarModal as Z, ScalarSearchInput as ee, ScalarSearchResultList as te, ScalarSearchResultItem as oe } from "@scalar/components";
3
+ import { isDefined as ae } from "@scalar/helpers/array/is-defined";
3
4
  import { scrollToId as N } from "@scalar/helpers/dom/scroll-to-id";
4
- import { nanoid as oe } from "nanoid";
5
- import { lazyBus as ae } from "../../components/Content/Lazy/lazyBus.js";
6
- import { useSearchIndex as se } from "./useSearchIndex.js";
7
- import ne from "../sidebar/components/SidebarHttpBadge.vue.js";
8
- import { useSidebar as re } from "../sidebar/hooks/useSidebar.js";
9
- const le = { class: "sr-only" }, ie = { class: "sr-only" }, ve = /* @__PURE__ */ Y({
5
+ import { ScalarIconTerminalWindow as L, ScalarIconTag as se, ScalarIconBracketsCurly as ne, ScalarIconTextAlignLeft as re } from "@scalar/icons";
6
+ import { nanoid as le } from "nanoid";
7
+ import { lazyBus as ie } from "../../components/Content/Lazy/lazyBus.js";
8
+ import { useSearchIndex as ce } from "./useSearchIndex.js";
9
+ import de from "../sidebar/components/SidebarHttpBadge.vue.js";
10
+ import { useSidebar as me } from "../sidebar/hooks/useSidebar.js";
11
+ const ue = { class: "sr-only" }, pe = { class: "inline-flex items-center gap-1" }, fe = { class: "sr-only" }, Be = /* @__PURE__ */ Y({
10
12
  __name: "SearchModal",
11
13
  props: {
12
14
  parsedSpec: {},
13
- modalState: {}
15
+ modalState: {},
16
+ hideModels: { type: Boolean }
14
17
  },
15
- setup(F) {
16
- const m = F, q = A(m, "parsedSpec"), S = oe(), I = `${S}-search-result`, w = `${S}-search-instructions`, v = (o) => `${S}${o}`, {
17
- resetSearch: D,
18
- fuseSearch: L,
18
+ setup(q) {
19
+ const m = q, D = _(m, "parsedSpec"), S = le(), k = `${S}-search-result`, x = `${S}-search-instructions`, v = (o) => `${S}${o}`, {
20
+ resetSearch: F,
21
+ fuseSearch: H,
19
22
  selectedSearchIndex: r,
20
- selectedSearchResult: k,
23
+ selectedSearchResult: B,
21
24
  searchResultsWithPlaceholderResults: u,
22
- searchText: p
23
- } = se({
24
- specification: q
25
- }), M = {
26
- heading: "DocsPage",
27
- model: "Brackets",
28
- req: "Terminal",
29
- tag: "CodeFolder",
30
- webhook: "Terminal"
31
- }, P = {
25
+ searchText: f
26
+ } = ce({
27
+ specification: D,
28
+ hideModels: m.hideModels
29
+ }), P = {
30
+ heading: re,
31
+ model: ne,
32
+ req: L,
33
+ tag: se,
34
+ webhook: L
35
+ }, U = {
32
36
  heading: "Document Heading",
33
37
  req: "Request",
34
38
  tag: "Tag",
35
- model: "",
36
- // The title of the entry is already "Model"
37
- webhook: ""
38
- // The title of the entry is already "Webhook"
39
- }, H = W(null);
40
- x(
39
+ model: "Model",
40
+ webhook: "Webhook"
41
+ }, K = j(null);
42
+ M(
41
43
  () => m.modalState.open,
42
44
  (o) => {
43
- o && D();
45
+ o && F();
44
46
  }
45
47
  );
46
- const { setCollapsedSidebarItem: U } = re(), K = /#(tag\/[^/]*)/;
47
- function V(o) {
48
+ const { setCollapsedSidebarItem: W } = me(), z = /#(tag\/[^/]*)/;
49
+ function T(o) {
48
50
  let t = "models";
49
- const e = o.item.href.match(K);
50
- e != null && e.length && e.length > 1 && (t = e[1]), U(t, !0);
51
- const a = o.item.href.replace("#", "");
52
- if (document.getElementById(a))
53
- N(a), m.modalState.hide();
51
+ const e = o.item.href.match(z);
52
+ e != null && e.length && e.length > 1 && (t = e[1]), W(t, !0);
53
+ const s = o.item.href.replace("#", "");
54
+ if (document.getElementById(s))
55
+ N(s), m.modalState.hide();
54
56
  else {
55
- const i = ae.on((f) => {
56
- f.id === a && (N(a), i(), m.modalState.hide());
57
+ const l = ie.on((h) => {
58
+ h.id === s && (N(s), l(), m.modalState.hide());
57
59
  });
58
60
  }
59
61
  }
60
- x(r, (o) => {
61
- var a;
62
+ M(r, (o) => {
63
+ var s;
62
64
  if (typeof o != "number")
63
65
  return;
64
66
  const t = u.value[o], e = v(t == null ? void 0 : t.item.href);
65
- (a = document.getElementById(e)) == null || a.scrollIntoView({
67
+ (s = document.getElementById(e)) == null || s.scrollIntoView({
66
68
  behavior: "smooth",
67
69
  block: "nearest"
68
70
  });
69
71
  });
70
- const B = (o) => {
72
+ const V = (o) => {
71
73
  const t = o === "up" ? -1 : 1, e = u.value.length;
72
74
  if (typeof r.value == "number") {
73
- const a = (r.value + t + e) % e;
74
- r.value = a;
75
+ const s = (r.value + t + e) % e;
76
+ r.value = s;
75
77
  } else
76
78
  r.value = t === -1 ? e - 1 : 0;
77
79
  };
78
- function z(o) {
80
+ function A(o) {
79
81
  const t = new URL(window.location.href);
80
82
  return t.hash = o, t.toString();
81
83
  }
82
84
  function O() {
83
- if (!r.value)
85
+ if (!ae(r.value))
84
86
  return;
85
87
  const o = u.value;
86
- V(o[r.value]);
88
+ T(o[r.value]);
87
89
  }
88
- return (o, t) => (h(), $(s(Z), {
90
+ return (o, t) => (p(), $(n(Z), {
89
91
  "aria-label": "Reference Search",
90
92
  state: o.modalState,
91
93
  variant: "search"
92
94
  }, {
93
- default: l(() => [
94
- n("div", {
95
+ default: i(() => [
96
+ a("div", {
95
97
  ref_key: "searchModalRef",
96
- ref: H,
98
+ ref: K,
97
99
  class: "ref-search-container",
98
100
  role: "search"
99
101
  }, [
100
- g(s(_), {
101
- modelValue: s(p),
102
- "onUpdate:modelValue": t[0] || (t[0] = (e) => j(p) ? p.value = e : null),
103
- "aria-activedescendant": s(k) ? v(s(k).item.href) : void 0,
102
+ g(n(ee), {
103
+ modelValue: n(f),
104
+ "onUpdate:modelValue": t[0] || (t[0] = (e) => G(f) ? f.value = e : null),
105
+ "aria-activedescendant": n(B) ? v(n(B).item.href) : void 0,
104
106
  "aria-autocomplete": "list",
105
- "aria-controls": I,
106
- "aria-describedby": w,
107
+ "aria-controls": k,
108
+ "aria-describedby": x,
107
109
  role: "combobox",
108
110
  onBlur: t[1] || (t[1] = (e) => r.value = void 0),
109
- onInput: s(L),
111
+ onInput: n(H),
110
112
  onKeydown: [
111
- t[2] || (t[2] = b(R((e) => B("down"), ["stop", "prevent"]), ["down"])),
112
- b(R(O, ["stop", "prevent"]), ["enter"]),
113
- t[3] || (t[3] = b(R((e) => B("up"), ["stop", "prevent"]), ["up"]))
113
+ t[2] || (t[2] = I(b((e) => V("down"), ["stop", "prevent"]), ["down"])),
114
+ I(b(O, ["stop", "prevent"]), ["enter"]),
115
+ t[3] || (t[3] = I(b((e) => V("up"), ["stop", "prevent"]), ["up"]))
114
116
  ]
115
117
  }, null, 8, ["modelValue", "aria-activedescendant", "onInput", "onKeydown"])
116
118
  ], 512),
117
- g(s(ee), {
118
- id: I,
119
+ g(n(te), {
120
+ id: k,
119
121
  "aria-label": "Reference Search Results",
120
122
  class: "ref-search-results custom-scroll",
121
- noResults: !s(u).length
123
+ noResults: !n(u).length
122
124
  }, {
123
- query: l(() => [
124
- d(c(s(p)), 1)
125
+ query: i(() => [
126
+ c(d(n(f)), 1)
125
127
  ]),
126
- default: l(() => [
127
- (h(!0), y(E, null, G(s(u), (e, a) => (h(), $(s(te), {
128
+ default: i(() => [
129
+ (p(!0), R(w, null, J(n(u), (e, s) => (p(), $(n(oe), {
128
130
  id: v(e.item.href),
129
131
  key: e.refIndex,
130
- href: z(e.item.href),
131
- icon: M[e.item.type],
132
- selected: s(r) === a,
133
- onClick: (i) => V(e),
134
- onFocus: (i) => r.value = a
135
- }, J({
136
- default: l(() => {
137
- var i, f, C, T;
132
+ href: A(e.item.href),
133
+ icon: P[e.item.type],
134
+ selected: n(r) === s,
135
+ onClick: (l) => T(e),
136
+ onFocus: (l) => r.value = s
137
+ }, Q({
138
+ default: i(() => {
139
+ var l, h, y, C;
138
140
  return [
139
- n("span", {
140
- class: Q({
141
- deprecated: (f = (i = e.item.operation) == null ? void 0 : i.information) == null ? void 0 : f.deprecated
141
+ a("span", {
142
+ class: X({
143
+ deprecated: (h = (l = e.item.operation) == null ? void 0 : l.information) == null ? void 0 : h.deprecated
142
144
  })
143
145
  }, [
144
- n("span", le, [
145
- d(c(P[e.item.type]) + ":  ", 1),
146
- (T = (C = e.item.operation) == null ? void 0 : C.information) != null && T.deprecated ? (h(), y(E, { key: 0 }, [
147
- d(" (Deprecated)  ")
148
- ], 64)) : X("", !0)
146
+ a("span", ue, [
147
+ c(d(U[e.item.type]) + ":  ", 1),
148
+ (C = (y = e.item.operation) == null ? void 0 : y.information) != null && C.deprecated ? (p(), R(w, { key: 0 }, [
149
+ c(" (Deprecated)  ")
150
+ ], 64)) : E("", !0)
149
151
  ]),
150
- d(" " + c(e.item.title) + " ", 1),
151
- t[4] || (t[4] = n("span", { class: "sr-only" }, ",", -1))
152
+ c(" " + d(e.item.title) + " ", 1),
153
+ t[4] || (t[4] = a("span", { class: "sr-only" }, ",", -1))
152
154
  ], 2)
153
155
  ];
154
156
  }),
@@ -156,46 +158,44 @@ const le = { class: "sr-only" }, ie = { class: "sr-only" }, ve = /* @__PURE__ */
156
158
  }, [
157
159
  e.item.type !== "webhook" && (e.item.httpVerb || e.item.path) && e.item.path !== e.item.title ? {
158
160
  name: "description",
159
- fn: l(() => [
160
- t[5] || (t[5] = n("span", { class: "sr-only" }, "Path: ", -1)),
161
- d(" " + c(e.item.path), 1)
161
+ fn: i(() => [
162
+ a("span", pe, [
163
+ e.item.type === "req" ? (p(), R(w, { key: 0 }, [
164
+ g(de, {
165
+ "aria-hidden": "true",
166
+ method: e.item.httpVerb ?? "get"
167
+ }, null, 8, ["method"]),
168
+ a("span", fe, " HTTP Method: " + d(e.item.httpVerb ?? "get"), 1)
169
+ ], 64)) : E("", !0),
170
+ t[5] || (t[5] = a("span", { class: "sr-only" }, "Path: ", -1)),
171
+ c(" " + d(e.item.path), 1)
172
+ ])
162
173
  ]),
163
174
  key: "0"
164
175
  } : e.item.description ? {
165
176
  name: "description",
166
- fn: l(() => [
167
- t[6] || (t[6] = n("span", { class: "sr-only" }, "Description: ", -1)),
168
- d(" " + c(e.item.description), 1)
177
+ fn: i(() => [
178
+ t[6] || (t[6] = a("span", { class: "sr-only" }, "Description: ", -1)),
179
+ c(" " + d(e.item.description), 1)
169
180
  ]),
170
181
  key: "1"
171
- } : void 0,
172
- e.item.type === "req" ? {
173
- name: "addon",
174
- fn: l(() => [
175
- g(ne, {
176
- "aria-hidden": "true",
177
- method: e.item.httpVerb ?? "get"
178
- }, null, 8, ["method"]),
179
- n("span", ie, " HTTP Method: " + c(e.item.httpVerb ?? "get") + ", ", 1)
180
- ]),
181
- key: "2"
182
182
  } : void 0
183
183
  ]), 1032, ["id", "href", "icon", "selected", "onClick", "onFocus"]))), 128))
184
184
  ]),
185
185
  _: 1
186
186
  }, 8, ["noResults"]),
187
- n("div", {
188
- id: w,
187
+ a("div", {
188
+ id: x,
189
189
  class: "ref-search-meta"
190
190
  }, t[7] || (t[7] = [
191
- n("span", {
191
+ a("span", {
192
192
  "aria-hidden": "true",
193
193
  class: "contents"
194
194
  }, [
195
- n("span", null, "↑↓ Navigate"),
196
- n("span", null, "⏎ Select")
195
+ a("span", null, "↑↓ Navigate"),
196
+ a("span", null, "⏎ Select")
197
197
  ], -1),
198
- n("span", { class: "sr-only" }, " Press up arrow / down arrow to navigate, enter to select, type to filter results ", -1)
198
+ a("span", { class: "sr-only" }, " Press up arrow / down arrow to navigate, enter to select, type to filter results ", -1)
199
199
  ]))
200
200
  ]),
201
201
  _: 1
@@ -203,5 +203,5 @@ const le = { class: "sr-only" }, ie = { class: "sr-only" }, ve = /* @__PURE__ */
203
203
  }
204
204
  });
205
205
  export {
206
- ve as default
206
+ Be as default
207
207
  };
@@ -1,7 +1,7 @@
1
+ import { type ParameterMap } from '../../libs/openapi.js';
1
2
  import type { Spec, TransformedOperation } from '@scalar/types/legacy';
2
3
  import { type FuseResult } from 'fuse.js';
3
4
  import { type Ref } from 'vue';
4
- import { type ParamMap } from '../../hooks/useOperation.js';
5
5
  export type EntryType = 'req' | 'webhook' | 'model' | 'heading' | 'tag';
6
6
  export type FuseData = {
7
7
  title: string;
@@ -9,7 +9,7 @@ export type FuseData = {
9
9
  type: EntryType;
10
10
  operationId?: string;
11
11
  description: string;
12
- body?: string | string[] | ParamMap;
12
+ body?: string | string[] | ParameterMap;
13
13
  httpVerb?: string;
14
14
  path?: string;
15
15
  tag?: string;
@@ -18,8 +18,9 @@ export type FuseData = {
18
18
  /**
19
19
  * Creates the search index from an OpenAPI document.
20
20
  */
21
- export declare function useSearchIndex({ specification, }: {
21
+ export declare function useSearchIndex({ specification, hideModels, }: {
22
22
  specification: Ref<Spec>;
23
+ hideModels?: boolean;
23
24
  }): {
24
25
  resetSearch: () => void;
25
26
  fuseSearch: () => void;
@@ -1 +1 @@
1
- {"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../src/features/Search/useSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,IAAI,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACnF,OAAa,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAIpD,OAAO,EAAE,KAAK,QAAQ,EAAgB,MAAM,sBAAsB,CAAA;AAKlE,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAA;AAEvE,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,QAAQ,CAAA;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,oBAAoB,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC7B,aAAa,GACd,EAAE;IACD,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;CACzB;uBA0ByB,IAAI;sBAbL,IAAI;;;;;EAsM5B"}
1
+ {"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../src/features/Search/useSearchIndex.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,YAAY,EAAqD,MAAM,gBAAgB,CAAA;AAErG,OAAO,KAAK,EAAe,IAAI,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AACnF,OAAa,EAAE,KAAK,UAAU,EAAE,MAAM,SAAS,CAAA;AAC/C,OAAO,EAAE,KAAK,GAAG,EAAwB,MAAM,KAAK,CAAA;AAIpD,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAA;AAEvE,MAAM,MAAM,QAAQ,GAAG;IACrB,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,SAAS,CAAA;IACf,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,CAAA;IACvC,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,SAAS,CAAC,EAAE,oBAAoB,CAAA;CACjC,CAAA;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,EAC7B,aAAa,EACb,UAAkB,GACnB,EAAE;IACD,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC,CAAA;IACxB,UAAU,CAAC,EAAE,OAAO,CAAA;CACrB;uBAsEyB,IAAI;sBAbL,IAAI;;;;;EAoM5B"}
@@ -1,133 +1,170 @@
1
- import A from "fuse.js";
2
- import { ref as m, watch as T, computed as k } from "vue";
3
- import { useConfig as B } from "../../hooks/useConfig.js";
4
- import { useNavState as P } from "../../hooks/useNavState.js";
5
- import { useOperation as O } from "../../hooks/useOperation.js";
6
- import { getHeadingsFromMarkdown as z } from "../../libs/markdown.js";
7
- import { extractRequestBody as j, getModels as G } from "../../libs/openapi.js";
8
- import { isHttpMethod as J } from "@scalar/helpers/http/is-http-method";
9
- function w({
10
- specification: q
1
+ import { useNavState as W } from "../../hooks/useNavState.js";
2
+ import { getHeadingsFromMarkdown as _ } from "../../libs/markdown.js";
3
+ import { createParameterMap as k, extractRequestBody as A, getModels as B } from "../../libs/openapi.js";
4
+ import { isHttpMethod as U } from "@scalar/helpers/http/is-http-method";
5
+ import X from "fuse.js";
6
+ import { ref as f, watch as H, computed as j } from "vue";
7
+ const q = 25;
8
+ function Z({
9
+ specification: C,
10
+ hideModels: L = !1
11
11
  }) {
12
- const { getHeadingId: H, getModelId: L, getTagId: C } = P(), F = B(), a = m([]), d = m([]), i = m(), l = m(""), y = new A(a.value, {
13
- keys: ["title", "description", "body"]
14
- }), b = () => {
15
- i.value = 0, d.value = y.search(l.value);
12
+ const { getHeadingId: O, getModelId: T, getTagId: F } = W(), a = f([]), u = f([]), s = f(), n = f(""), v = new X(a.value, {
13
+ // Define searchable fields with weights to prioritize more important matches
14
+ keys: [
15
+ // Highest weight - titles are most descriptive
16
+ { name: "title", weight: 0.7 },
17
+ // Medium weight - helpful but often verbose
18
+ { name: "description", weight: 0.3 },
19
+ // Lowest weight - can be very long and noisy
20
+ { name: "body", weight: 0.2 },
21
+ // High weight - unique identifiers for operations
22
+ { name: "operationId", weight: 0.6 },
23
+ // Good weight - endpoint paths are searchable
24
+ { name: "path", weight: 0.5 },
25
+ // Medium-high weight - helps with categorization
26
+ { name: "tag", weight: 0.4 },
27
+ // Medium weight - useful for filtering by method
28
+ { name: "httpVerb", weight: 0.3 }
29
+ ],
30
+ // Threshold controls how strict the matching is (0.0 = perfect match, 1.0 = very loose)
31
+ // 0.3 allows for some typos and partial matches while maintaining relevance
32
+ threshold: 0.3,
33
+ // Maximum distance between characters that can be matched
34
+ // Higher values allow matches even when characters are far apart in long text
35
+ distance: 100,
36
+ // Include the match score in results for debugging and potential UI enhancements
37
+ includeScore: !0,
38
+ // Include detailed match information showing which parts of the text matched
39
+ includeMatches: !0,
40
+ // Minimum number of characters that must match to be considered a result
41
+ // Prevents single-character matches that are usually noise
42
+ minMatchCharLength: 2,
43
+ // Don't require matches to be at the beginning of strings
44
+ // Makes search more flexible and user-friendly
45
+ ignoreLocation: !0,
46
+ // Enable advanced search syntax like 'exact' for exact matches or !exclude for exclusions
47
+ useExtendedSearch: !0,
48
+ // Find all possible matches in each item, not just the first one
49
+ // Ensures comprehensive search results
50
+ findAllMatches: !0
51
+ }), y = () => {
52
+ s.value = 0, u.value = v.search(n.value);
16
53
  };
17
- T(l, (e) => {
18
- e.length ? b() : d.value = [];
54
+ H(n, (e) => {
55
+ e.length ? y() : u.value = [];
19
56
  });
20
57
  function N() {
21
- l.value = "", i.value = void 0, d.value = [];
58
+ n.value = "", s.value = void 0, u.value = [];
22
59
  }
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
60
+ const b = j(() => n.value.length === 0 ? a.value.slice(0, q).map((e) => ({
61
+ item: e
62
+ })) : u.value.slice(0, q)), P = j(
63
+ () => typeof s.value == "number" ? b.value[s.value] : void 0
27
64
  );
28
- return T(
29
- q,
65
+ return H(
66
+ C,
30
67
  (e) => {
31
- var E, x, V;
68
+ var $, x, R;
32
69
  a.value = [];
33
- const f = [], I = z(((E = e == null ? void 0 : e.info) == null ? void 0 : E.description) ?? "");
34
- if (I.length && (I.forEach((t) => {
35
- f.push({
70
+ const g = [], M = _((($ = e == null ? void 0 : e.info) == null ? void 0 : $.description) ?? "");
71
+ if (M.length && (M.forEach((t) => {
72
+ g.push({
36
73
  type: "heading",
37
- title: `Info > ${t.value}`,
38
- description: "",
39
- href: `#${H(t)}`,
74
+ title: t.value,
75
+ description: "Introduction",
76
+ href: `#${O(t)}`,
40
77
  tag: t.slug,
41
78
  body: ""
42
79
  });
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 = {
80
+ }), a.value = a.value.concat(g)), (x = e == null ? void 0 : e.tags) != null && x.length)
81
+ (R = e == null ? void 0 : e.tags) == null || R.forEach((t) => {
82
+ const d = {
46
83
  title: t["x-displayName"] ?? t.name,
47
- href: `#${C(t)}`,
84
+ href: `#${F(t)}`,
48
85
  description: t.description,
49
86
  type: "tag",
50
87
  tag: t.name,
51
88
  body: ""
52
89
  };
53
- a.value.push(h), t.operations && t.operations.forEach((s) => {
54
- var u;
55
- const { parameterMap: o } = O(s), n = j(s.information) || o.value;
56
- let r = null;
57
- typeof n != "boolean" && (r = n);
90
+ a.value.push(d), t.operations && t.operations.forEach((o) => {
91
+ var h;
92
+ const r = k(o.information), l = A(o.information) || r;
93
+ let i = null;
94
+ typeof l != "boolean" && (i = l);
58
95
  const c = {
59
96
  type: "req",
60
- title: s.name ?? s.path,
61
- href: `#${s.id}`,
62
- operationId: (u = s.information) == null ? void 0 : u.operationId,
63
- description: s.description ?? "",
64
- httpVerb: s.httpVerb,
65
- path: s.path,
97
+ title: o.name ?? o.path,
98
+ href: `#${o.id}`,
99
+ operationId: (h = o.information) == null ? void 0 : h.operationId,
100
+ description: o.description ?? "",
101
+ httpVerb: o.httpVerb,
102
+ path: o.path,
66
103
  tag: t.name,
67
- operation: s
104
+ operation: o
68
105
  };
69
- r && (c.body = r), a.value.push(c);
106
+ i && (c.body = i), a.value.push(c);
70
107
  });
71
108
  });
72
109
  else if (e != null && e.paths) {
73
110
  const t = e.paths;
74
- Object.keys(t ?? {}).forEach((h) => {
75
- Object.keys((t == null ? void 0 : t[h]) ?? {}).forEach((s) => {
76
- var n, r;
77
- const o = (n = t == null ? void 0 : t[h]) == null ? void 0 : n[s];
78
- if (J(s) && o) {
79
- const { parameterMap: c } = O({ ...o, information: o }), u = j(o) || c.value;
111
+ Object.keys(t ?? {}).forEach((d) => {
112
+ Object.keys((t == null ? void 0 : t[d]) ?? {}).forEach((o) => {
113
+ var l, i;
114
+ const r = (l = t == null ? void 0 : t[d]) == null ? void 0 : l[o];
115
+ if (U(o) && r) {
116
+ const c = k(r), h = A(r) || c;
80
117
  let p = null;
81
- typeof u != "boolean" && (p = u);
82
- const R = {
118
+ typeof h != "boolean" && (p = h);
119
+ const V = {
83
120
  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
121
+ title: r.name ?? r.path,
122
+ href: `#${r.id}`,
123
+ operationId: (i = r.information) == null ? void 0 : i.operationId,
124
+ description: r.description ?? "",
125
+ httpVerb: r.httpVerb,
126
+ path: r.path,
127
+ operation: r
91
128
  };
92
- p && (R.body = p), a.value.push(R);
129
+ p && (V.body = p), a.value.push(V);
93
130
  }
94
131
  });
95
132
  });
96
133
  }
97
- const M = e == null ? void 0 : e.webhooks, D = [];
98
- M && M.forEach((t) => {
99
- D.push({
134
+ const I = e == null ? void 0 : e.webhooks, E = [];
135
+ I && I.forEach((t) => {
136
+ E.push({
100
137
  type: "webhook",
101
- title: "Webhook",
138
+ title: `${t.name}`,
102
139
  href: `#${t.id}`,
103
- description: `${t.name}`,
140
+ description: "Webhook",
104
141
  httpVerb: t.httpVerb,
105
142
  tag: t.name,
106
143
  body: ""
107
- }), a.value = a.value.concat(D);
144
+ }), a.value = a.value.concat(E);
108
145
  });
109
- const v = F.value.hideModels ? {} : G(e), $ = [];
110
- v && (Object.keys(v).forEach((t) => {
111
- $.push({
146
+ const m = L ? {} : B(e), D = [];
147
+ m && (Object.keys(m).forEach((t) => {
148
+ D.push({
112
149
  type: "model",
113
- title: "Model",
114
- href: `#${L({ name: t })}`,
115
- description: v[t].title ?? t,
150
+ title: `${m[t].title ?? t}`,
151
+ href: `#${T({ name: t })}`,
152
+ description: "Model",
116
153
  tag: t,
117
154
  body: ""
118
155
  });
119
- }), a.value = a.value.concat($)), y.setCollection(a.value);
156
+ }), a.value = a.value.concat(D)), v.setCollection(a.value);
120
157
  },
121
158
  { immediate: !0 }
122
159
  ), {
123
160
  resetSearch: N,
124
- fuseSearch: b,
125
- selectedSearchIndex: i,
126
- selectedSearchResult: W,
127
- searchResultsWithPlaceholderResults: g,
128
- searchText: l
161
+ fuseSearch: y,
162
+ selectedSearchIndex: s,
163
+ selectedSearchResult: P,
164
+ searchResultsWithPlaceholderResults: b,
165
+ searchText: n
129
166
  };
130
167
  }
131
168
  export {
132
- w as useSearchIndex
169
+ Z as useSearchIndex
133
170
  };
@@ -1,7 +1,7 @@
1
1
  import type { OpenAPIV3_1 } from '@scalar/openapi-types';
2
- import type { ApiClientConfiguration } from '@scalar/types/api-reference';
2
+ import type { ApiClientConfiguration, ApiReferenceConfiguration } from '@scalar/types/api-reference';
3
3
  type __VLS_Props = {
4
- configuration: Partial<Omit<ApiClientConfiguration, 'plugins'>>;
4
+ configuration: Partial<Omit<ApiClientConfiguration, 'plugins'>> & Pick<ApiReferenceConfiguration, 'onBeforeRequest'>;
5
5
  dereferencedDocument: OpenAPIV3_1.Document;
6
6
  };
7
7
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
@@ -1 +1 @@
1
- {"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/api-client-modal/ApiClientModal.vue"],"names":[],"mappings":"AAiKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AACxD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAYzE,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC,CAAA;IAC/D,oBAAoB,EAAE,WAAW,CAAC,QAAQ,CAAA;CAC3C,CAAC;;AAuLF,wBAOG"}
1
+ {"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/api-client-modal/ApiClientModal.vue"],"names":[],"mappings":"AAiLA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAA;AAExD,OAAO,KAAK,EACV,sBAAsB,EACtB,yBAAyB,EAC1B,MAAM,6BAA6B,CAAA;AAYpC,KAAK,WAAW,GAAG;IAEjB,aAAa,EAAE,OAAO,CAAC,IAAI,CAAC,sBAAsB,EAAE,SAAS,CAAC,CAAC,GAC7D,IAAI,CAAC,yBAAyB,EAAE,iBAAiB,CAAC,CAAA;IACpD,oBAAoB,EAAE,WAAW,CAAC,QAAQ,CAAA;CAC3C,CAAC;;AAkMF,wBAOG"}