@scalar/api-reference 1.33.0 → 1.34.1
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.
- package/CHANGELOG.md +39 -0
- package/dist/browser/standalone.js +13276 -13205
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Anchor/WithBreadcrumb.vue.d.ts +24 -0
- package/dist/components/Anchor/WithBreadcrumb.vue.d.ts.map +1 -0
- package/dist/components/Anchor/WithBreadcrumb.vue.js +4 -0
- package/dist/components/Anchor/WithBreadcrumb.vue2.js +46 -0
- package/dist/components/Anchor/index.d.ts +1 -0
- package/dist/components/Anchor/index.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +1 -1
- package/dist/components/ApiReferenceLayout.vue2.js +184 -201
- package/dist/components/Content/Introduction/Introduction.vue.d.ts.map +1 -1
- package/dist/components/Content/Introduction/Introduction.vue.js +1 -1
- package/dist/components/Content/Introduction/Introduction.vue2.js +1 -0
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts +1 -0
- package/dist/components/Content/Operations/TraversedEntry.vue.d.ts.map +1 -1
- package/dist/components/Content/Operations/TraversedEntry.vue.js +34 -32
- package/dist/components/Content/Operations/TraversedEntryContainer.vue.d.ts.map +1 -1
- package/dist/components/Content/Operations/TraversedEntryContainer.vue.js +33 -29
- package/dist/components/Content/Operations/get-current-index.d.ts +4 -0
- package/dist/components/Content/Operations/get-current-index.d.ts.map +1 -0
- package/dist/components/Content/Operations/get-current-index.js +16 -0
- package/dist/components/Content/Schema/Schema.preview.d.ts +28 -0
- package/dist/components/Content/Schema/Schema.preview.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.d.ts +2 -0
- package/dist/components/Content/Schema/Schema.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/Schema.vue.js +2 -2
- package/dist/components/Content/Schema/Schema.vue2.js +164 -157
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts +1 -0
- package/dist/components/Content/Schema/SchemaComposition.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaComposition.vue.js +58 -53
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts +1 -0
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaObjectProperties.vue.js +52 -40
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts +1 -0
- package/dist/components/Content/Schema/SchemaProperty.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaProperty.vue.js +2 -2
- package/dist/components/Content/Schema/SchemaProperty.vue2.js +100 -87
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.d.ts.map +1 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue.js +3 -3
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +4 -1
- package/dist/components/Lazy/Lazy.vue.d.ts +1 -0
- package/dist/components/Lazy/Lazy.vue.d.ts.map +1 -1
- package/dist/components/Lazy/Lazy.vue2.js +12 -11
- package/dist/components/Lazy/lazyBus.d.ts +5 -3
- package/dist/components/Lazy/lazyBus.d.ts.map +1 -1
- package/dist/components/OperationsList/OperationsListItem.vue.d.ts.map +1 -1
- package/dist/components/OperationsList/OperationsListItem.vue.js +1 -1
- package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts +4 -4
- package/dist/features/Operation/components/ContentTypeSelect.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.d.ts +1 -0
- package/dist/features/Operation/components/OperationParameters.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationParameters.vue.js +49 -43
- package/dist/features/Operation/components/OperationResponses.vue.d.ts +1 -0
- package/dist/features/Operation/components/OperationResponses.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/OperationResponses.vue.js +4 -3
- package/dist/features/Operation/components/ParameterHeaders.vue.d.ts +1 -0
- package/dist/features/Operation/components/ParameterHeaders.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterHeaders.vue.js +2 -2
- package/dist/features/Operation/components/ParameterHeaders.vue2.js +28 -26
- package/dist/features/Operation/components/ParameterList.vue.d.ts +1 -0
- package/dist/features/Operation/components/ParameterList.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterList.vue.js +2 -2
- package/dist/features/Operation/components/ParameterList.vue2.js +17 -15
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts +1 -0
- package/dist/features/Operation/components/ParameterListItem.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/ParameterListItem.vue.js +2 -2
- package/dist/features/Operation/components/ParameterListItem.vue2.js +17 -16
- package/dist/features/Operation/components/RequestBody.vue.d.ts +2 -2
- package/dist/features/Operation/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/RequestBody.vue.js +2 -2
- package/dist/features/Operation/components/RequestBody.vue2.js +47 -39
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +1 -0
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +3 -3
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +12 -11
- package/dist/features/Operation/components/callbacks/Callback.vue3.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +63 -61
- package/dist/features/Search/{SearchButton.vue.d.ts → components/SearchButton.vue.d.ts} +0 -2
- package/dist/features/Search/components/SearchButton.vue.d.ts.map +1 -0
- package/dist/features/Search/components/SearchButton.vue.js +65 -0
- package/dist/features/Search/{SearchModal.vue.d.ts → components/SearchModal.vue.d.ts} +0 -2
- package/dist/features/Search/components/SearchModal.vue.d.ts.map +1 -0
- package/dist/features/Search/components/SearchModal.vue.js +7 -0
- package/dist/features/Search/components/SearchModal.vue2.js +199 -0
- package/dist/features/Search/helpers/create-fuse-instance.d.ts +9 -0
- package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -0
- package/dist/features/Search/helpers/create-fuse-instance.js +46 -0
- package/dist/features/Search/helpers/create-search-index.d.ts +7 -0
- package/dist/features/Search/helpers/create-search-index.d.ts.map +1 -0
- package/dist/features/Search/helpers/create-search-index.js +109 -0
- package/dist/features/Search/hooks/useSearchIndex.d.ts +14 -0
- package/dist/features/Search/hooks/useSearchIndex.d.ts.map +1 -0
- package/dist/features/Search/hooks/useSearchIndex.js +46 -0
- package/dist/features/Search/index.d.ts +2 -2
- package/dist/features/Search/index.d.ts.map +1 -1
- package/dist/features/Search/types.d.ts +15 -0
- package/dist/features/Search/types.d.ts.map +1 -0
- package/dist/features/api-client-modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/features/api-client-modal/ApiClientModal.vue.js +45 -45
- package/dist/features/api-client-modal/useApiClient.d.ts +14 -14
- package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +3 -1
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-schemas.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-schemas.js +18 -18
- package/dist/features/traverse-schema/helpers/traverse-tags.d.ts.map +1 -1
- package/dist/features/traverse-schema/helpers/traverse-webhooks.d.ts.map +1 -1
- package/dist/features/traverse-schema/types.d.ts +10 -6
- package/dist/features/traverse-schema/types.d.ts.map +1 -1
- package/dist/helpers/test-utils.d.ts +9 -0
- package/dist/helpers/test-utils.d.ts.map +1 -1
- package/dist/hooks/useNavState.d.ts +4 -1
- package/dist/hooks/useNavState.d.ts.map +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -19
- package/dist/libs/openapi.d.ts +11 -8
- package/dist/libs/openapi.d.ts.map +1 -1
- package/dist/libs/openapi.js +34 -55
- package/dist/style.css +1 -1
- package/dist/types.d.ts +1 -6
- package/dist/types.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +120 -111
- package/dist/v2/helpers/get-document-name.d.ts +13 -0
- package/dist/v2/helpers/get-document-name.d.ts.map +1 -0
- package/dist/v2/helpers/get-document-name.js +15 -0
- package/dist/v2/helpers/normalize-content.d.ts +3 -0
- package/dist/v2/helpers/normalize-content.d.ts.map +1 -0
- package/dist/v2/helpers/normalize-content.js +8 -0
- package/package.json +16 -10
- package/dist/features/Search/SearchButton.vue.d.ts.map +0 -1
- package/dist/features/Search/SearchButton.vue.js +0 -66
- package/dist/features/Search/SearchModal.vue.d.ts.map +0 -1
- package/dist/features/Search/SearchModal.vue.js +0 -7
- package/dist/features/Search/SearchModal.vue2.js +0 -207
- package/dist/features/Search/useSearchIndex.d.ts +0 -32
- package/dist/features/Search/useSearchIndex.d.ts.map +0 -1
- package/dist/features/Search/useSearchIndex.js +0 -170
- package/dist/helpers/parse.d.ts +0 -10
- package/dist/helpers/parse.d.ts.map +0 -1
- package/dist/helpers/parse.js +0 -81
- /package/dist/features/Search/{SearchButton.vue2.js → components/SearchButton.vue2.js} +0 -0
- /package/dist/features/Search/{SearchModal.vue3.js → components/SearchModal.vue3.js} +0 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import { defineComponent as A, ref as Y, watch as C, createBlock as T, openBlock as m, unref as n, withCtx as s, createElementVNode as a, createVNode as S, withKeys as v, withModifiers as g, isRef as _, createElementBlock as I, Fragment as b, renderList as j, createSlots as G, normalizeClass as J, createTextVNode as l, createCommentVNode as $, toDisplayString as c } from "vue";
|
|
2
|
+
import { ScalarModal as Q, ScalarSearchInput as X, ScalarSearchResultList as Z, ScalarSearchResultItem as ee } from "@scalar/components";
|
|
3
|
+
import { isDefined as te } from "@scalar/helpers/array/is-defined";
|
|
4
|
+
import { scrollToId as E } from "@scalar/helpers/dom/scroll-to-id";
|
|
5
|
+
import { ScalarIconTerminalWindow as N, ScalarIconTag as oe, ScalarIconBracketsCurly as ne, ScalarIconTextAlignLeft as ae } from "@scalar/icons";
|
|
6
|
+
import { isOperationDeprecated as V } from "@scalar/oas-utils/helpers";
|
|
7
|
+
import { nanoid as re } from "nanoid";
|
|
8
|
+
import ie from "../../sidebar/components/SidebarHttpBadge.vue.js";
|
|
9
|
+
import { useSearchIndex as se } from "../hooks/useSearchIndex.js";
|
|
10
|
+
import { useSidebar as M } from "../../sidebar/hooks/useSidebar.js";
|
|
11
|
+
import { lazyBus as le } from "../../../components/Lazy/lazyBus.js";
|
|
12
|
+
const ce = { class: "sr-only" }, de = { class: "inline-flex items-center gap-1" }, me = { class: "sr-only" }, Re = /* @__PURE__ */ A({
|
|
13
|
+
__name: "SearchModal",
|
|
14
|
+
props: {
|
|
15
|
+
modalState: {},
|
|
16
|
+
hideModels: { type: Boolean }
|
|
17
|
+
},
|
|
18
|
+
setup(L) {
|
|
19
|
+
const f = L, u = re(), w = `${u}-search-result`, R = `${u}-search-instructions`, h = (o) => `${u}${o}`, { items: D } = M(), {
|
|
20
|
+
resetSearch: F,
|
|
21
|
+
selectedIndex: i,
|
|
22
|
+
selectedSearchResult: k,
|
|
23
|
+
searchResultsWithPlaceholderResults: d,
|
|
24
|
+
query: p
|
|
25
|
+
} = se(D), H = {
|
|
26
|
+
heading: ae,
|
|
27
|
+
model: ne,
|
|
28
|
+
operation: N,
|
|
29
|
+
tag: oe,
|
|
30
|
+
webhook: N
|
|
31
|
+
}, O = {
|
|
32
|
+
heading: "Heading",
|
|
33
|
+
operation: "Operation",
|
|
34
|
+
tag: "Tag",
|
|
35
|
+
model: "Model",
|
|
36
|
+
webhook: "Webhook"
|
|
37
|
+
}, P = Y(null);
|
|
38
|
+
C(
|
|
39
|
+
() => f.modalState.open,
|
|
40
|
+
(o) => {
|
|
41
|
+
o && F();
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
const { setCollapsedSidebarItem: U } = M(), K = /#(tag\/[^/]*)/;
|
|
45
|
+
function B(o) {
|
|
46
|
+
let t = "models";
|
|
47
|
+
const e = o.item.href.match(K);
|
|
48
|
+
e != null && e.length && e.length > 1 && (t = e[1]), U(t, !0);
|
|
49
|
+
const r = o.item.href.replace("#", "");
|
|
50
|
+
if (document.getElementById(r))
|
|
51
|
+
E(r), f.modalState.hide();
|
|
52
|
+
else {
|
|
53
|
+
const y = le.on((z) => {
|
|
54
|
+
z.loaded === r && (E(r), y(), f.modalState.hide());
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
C(i, (o) => {
|
|
59
|
+
var r;
|
|
60
|
+
if (typeof o != "number")
|
|
61
|
+
return;
|
|
62
|
+
const t = d.value[o], e = h(t == null ? void 0 : t.item.href);
|
|
63
|
+
(r = document.getElementById(e)) == null || r.scrollIntoView({
|
|
64
|
+
behavior: "smooth",
|
|
65
|
+
block: "nearest"
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
const x = (o) => {
|
|
69
|
+
const t = o === "up" ? -1 : 1, e = d.value.length;
|
|
70
|
+
if (typeof i.value == "number") {
|
|
71
|
+
const r = (i.value + t + e) % e;
|
|
72
|
+
i.value = r;
|
|
73
|
+
} else
|
|
74
|
+
i.value = t === -1 ? e - 1 : 0;
|
|
75
|
+
};
|
|
76
|
+
function W(o) {
|
|
77
|
+
const t = new URL(window.location.href);
|
|
78
|
+
return t.hash = o, t.toString();
|
|
79
|
+
}
|
|
80
|
+
function q() {
|
|
81
|
+
if (!te(i.value))
|
|
82
|
+
return;
|
|
83
|
+
const o = d.value;
|
|
84
|
+
o.length !== 0 && B(o[i.value]);
|
|
85
|
+
}
|
|
86
|
+
return (o, t) => (m(), T(n(Q), {
|
|
87
|
+
"aria-label": "Reference Search",
|
|
88
|
+
state: o.modalState,
|
|
89
|
+
variant: "search"
|
|
90
|
+
}, {
|
|
91
|
+
default: s(() => [
|
|
92
|
+
a("div", {
|
|
93
|
+
ref_key: "searchModalRef",
|
|
94
|
+
ref: P,
|
|
95
|
+
class: "ref-search-container",
|
|
96
|
+
role: "search"
|
|
97
|
+
}, [
|
|
98
|
+
S(n(X), {
|
|
99
|
+
modelValue: n(p),
|
|
100
|
+
"onUpdate:modelValue": t[0] || (t[0] = (e) => _(p) ? p.value = e : null),
|
|
101
|
+
"aria-activedescendant": n(k) ? h(n(k).item.href) : void 0,
|
|
102
|
+
"aria-autocomplete": "list",
|
|
103
|
+
"aria-controls": w,
|
|
104
|
+
"aria-describedby": R,
|
|
105
|
+
role: "combobox",
|
|
106
|
+
onBlur: t[1] || (t[1] = (e) => i.value = void 0),
|
|
107
|
+
onKeydown: [
|
|
108
|
+
t[2] || (t[2] = v(g((e) => x("down"), ["stop", "prevent"]), ["down"])),
|
|
109
|
+
v(g(q, ["stop", "prevent"]), ["enter"]),
|
|
110
|
+
t[3] || (t[3] = v(g((e) => x("up"), ["stop", "prevent"]), ["up"]))
|
|
111
|
+
]
|
|
112
|
+
}, null, 8, ["modelValue", "aria-activedescendant", "onKeydown"])
|
|
113
|
+
], 512),
|
|
114
|
+
S(n(Z), {
|
|
115
|
+
id: w,
|
|
116
|
+
"aria-label": "Reference Search Results",
|
|
117
|
+
class: "ref-search-results custom-scroll",
|
|
118
|
+
noResults: !n(d).length
|
|
119
|
+
}, {
|
|
120
|
+
query: s(() => [
|
|
121
|
+
l(c(n(p)), 1)
|
|
122
|
+
]),
|
|
123
|
+
default: s(() => [
|
|
124
|
+
(m(!0), I(b, null, j(n(d), (e, r) => (m(), T(n(ee), {
|
|
125
|
+
id: h(e.item.href),
|
|
126
|
+
key: e.refIndex,
|
|
127
|
+
href: W(e.item.href),
|
|
128
|
+
icon: H[e.item.type],
|
|
129
|
+
selected: n(i) === r,
|
|
130
|
+
onClick: (y) => B(e),
|
|
131
|
+
onFocus: (y) => i.value = r
|
|
132
|
+
}, G({
|
|
133
|
+
default: s(() => [
|
|
134
|
+
a("span", {
|
|
135
|
+
class: J({
|
|
136
|
+
deprecated: "operation" in e.item.entry && n(V)(e.item.entry.operation)
|
|
137
|
+
})
|
|
138
|
+
}, [
|
|
139
|
+
a("span", ce, [
|
|
140
|
+
l(c(O[e.item.type]) + ": ", 1),
|
|
141
|
+
"operation" in e.item.entry && n(V)(e.item.entry.operation) ? (m(), I(b, { key: 0 }, [
|
|
142
|
+
l(" (Deprecated) ")
|
|
143
|
+
], 64)) : $("", !0)
|
|
144
|
+
]),
|
|
145
|
+
l(" " + c(e.item.title) + " ", 1),
|
|
146
|
+
t[4] || (t[4] = a("span", { class: "sr-only" }, ",", -1))
|
|
147
|
+
], 2)
|
|
148
|
+
]),
|
|
149
|
+
_: 2
|
|
150
|
+
}, [
|
|
151
|
+
e.item.type !== "webhook" && (e.item.method || e.item.path) && e.item.path !== e.item.title ? {
|
|
152
|
+
name: "description",
|
|
153
|
+
fn: s(() => [
|
|
154
|
+
a("span", de, [
|
|
155
|
+
e.item.type === "operation" ? (m(), I(b, { key: 0 }, [
|
|
156
|
+
S(ie, {
|
|
157
|
+
"aria-hidden": "true",
|
|
158
|
+
method: e.item.method ?? "get"
|
|
159
|
+
}, null, 8, ["method"]),
|
|
160
|
+
a("span", me, " HTTP Method: " + c(e.item.method ?? "get"), 1)
|
|
161
|
+
], 64)) : $("", !0),
|
|
162
|
+
t[5] || (t[5] = a("span", { class: "sr-only" }, "Path: ", -1)),
|
|
163
|
+
l(" " + c(e.item.path), 1)
|
|
164
|
+
])
|
|
165
|
+
]),
|
|
166
|
+
key: "0"
|
|
167
|
+
} : e.item.description ? {
|
|
168
|
+
name: "description",
|
|
169
|
+
fn: s(() => [
|
|
170
|
+
t[6] || (t[6] = a("span", { class: "sr-only" }, "Description: ", -1)),
|
|
171
|
+
l(" " + c(e.item.description), 1)
|
|
172
|
+
]),
|
|
173
|
+
key: "1"
|
|
174
|
+
} : void 0
|
|
175
|
+
]), 1032, ["id", "href", "icon", "selected", "onClick", "onFocus"]))), 128))
|
|
176
|
+
]),
|
|
177
|
+
_: 1
|
|
178
|
+
}, 8, ["noResults"]),
|
|
179
|
+
a("div", {
|
|
180
|
+
id: R,
|
|
181
|
+
class: "ref-search-meta"
|
|
182
|
+
}, t[7] || (t[7] = [
|
|
183
|
+
a("span", {
|
|
184
|
+
"aria-hidden": "true",
|
|
185
|
+
class: "contents"
|
|
186
|
+
}, [
|
|
187
|
+
a("span", null, "↑↓ Navigate"),
|
|
188
|
+
a("span", null, "⏎ Select")
|
|
189
|
+
], -1),
|
|
190
|
+
a("span", { class: "sr-only" }, " Press up arrow / down arrow to navigate, enter to select, type to filter results ", -1)
|
|
191
|
+
]))
|
|
192
|
+
]),
|
|
193
|
+
_: 1
|
|
194
|
+
}, 8, ["state"]));
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
export {
|
|
198
|
+
Re as default
|
|
199
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { FuseData } from '../../../features/Search/types';
|
|
2
|
+
import Fuse from 'fuse.js';
|
|
3
|
+
/**
|
|
4
|
+
* Create a Fuse instance for searching the API reference.
|
|
5
|
+
*
|
|
6
|
+
* Doesn't have any data yet, so it's empty.
|
|
7
|
+
*/
|
|
8
|
+
export declare function createFuseInstance(): Fuse<FuseData>;
|
|
9
|
+
//# sourceMappingURL=create-fuse-instance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-fuse-instance.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-fuse-instance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,IAAI,MAAM,SAAS,CAAA;AAE1B;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAAC,QAAQ,CAAC,CAiDnD"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import e from "fuse.js";
|
|
2
|
+
function n() {
|
|
3
|
+
return new e([], {
|
|
4
|
+
// Define searchable fields with weights to prioritize more important matches
|
|
5
|
+
keys: [
|
|
6
|
+
// Highest weight - titles are most descriptive
|
|
7
|
+
{ name: "title", weight: 0.7 },
|
|
8
|
+
// Medium weight - helpful but often verbose
|
|
9
|
+
{ name: "description", weight: 0.3 },
|
|
10
|
+
// Lowest weight - can be very long and noisy
|
|
11
|
+
{ name: "body", weight: 0.2 },
|
|
12
|
+
// High weight - unique identifiers for operations
|
|
13
|
+
{ name: "id", weight: 0.6 },
|
|
14
|
+
// Good weight - endpoint paths are searchable
|
|
15
|
+
{ name: "path", weight: 0.5 },
|
|
16
|
+
// Medium-high weight - helps with categorization
|
|
17
|
+
{ name: "tag", weight: 0.4 },
|
|
18
|
+
// Medium weight - useful for filtering by method
|
|
19
|
+
{ name: "method", weight: 0.3 }
|
|
20
|
+
],
|
|
21
|
+
// Threshold controls how strict the matching is (0.0 = perfect match, 1.0 = very loose)
|
|
22
|
+
// 0.3 allows for some typos and partial matches while maintaining relevance
|
|
23
|
+
threshold: 0.3,
|
|
24
|
+
// Maximum distance between characters that can be matched
|
|
25
|
+
// Higher values allow matches even when characters are far apart in long text
|
|
26
|
+
distance: 100,
|
|
27
|
+
// Include the match score in results for debugging and potential UI enhancements
|
|
28
|
+
includeScore: !0,
|
|
29
|
+
// Include detailed match information showing which parts of the text matched
|
|
30
|
+
includeMatches: !0,
|
|
31
|
+
// Minimum number of characters that must match to be considered a result
|
|
32
|
+
// Prevents single-character matches that are usually noise
|
|
33
|
+
minMatchCharLength: 2,
|
|
34
|
+
// Don't require matches to be at the beginning of strings
|
|
35
|
+
// Makes search more flexible and user-friendly
|
|
36
|
+
ignoreLocation: !0,
|
|
37
|
+
// Enable advanced search syntax like 'exact' for exact matches or !exclude for exclusions
|
|
38
|
+
useExtendedSearch: !0,
|
|
39
|
+
// Find all possible matches in each item, not just the first one
|
|
40
|
+
// Ensures comprehensive search results
|
|
41
|
+
findAllMatches: !0
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
n as createFuseInstance
|
|
46
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FuseData } from '../../../features/Search/types';
|
|
2
|
+
import type { TraversedEntry } from '../../../features/traverse-schema';
|
|
3
|
+
/**
|
|
4
|
+
* Create a search index from a list of entries.
|
|
5
|
+
*/
|
|
6
|
+
export declare function createSearchIndex(entries: TraversedEntry[]): FuseData[];
|
|
7
|
+
//# sourceMappingURL=create-search-index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-search-index.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/helpers/create-search-index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAA;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGhE;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,cAAc,EAAE,GAAG,QAAQ,EAAE,CAoBvE"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { extractRequestBody as p, createParameterMap as s } from "../../../libs/openapi.js";
|
|
2
|
+
function c(i) {
|
|
3
|
+
const o = [];
|
|
4
|
+
function e(d) {
|
|
5
|
+
d.forEach((t) => {
|
|
6
|
+
h(t, o), "children" in t && t.children && e(t.children);
|
|
7
|
+
});
|
|
8
|
+
}
|
|
9
|
+
return e(i), o;
|
|
10
|
+
}
|
|
11
|
+
function h(i, o) {
|
|
12
|
+
if ("operation" in i) {
|
|
13
|
+
const e = p(i.operation) || s(i.operation), d = typeof e != "boolean" ? e : null;
|
|
14
|
+
o.push({
|
|
15
|
+
type: "operation",
|
|
16
|
+
title: i.title,
|
|
17
|
+
href: `#${i.id}`,
|
|
18
|
+
id: i.operation.operationId,
|
|
19
|
+
description: i.operation.description || "",
|
|
20
|
+
method: i.method,
|
|
21
|
+
path: i.path,
|
|
22
|
+
body: d || "",
|
|
23
|
+
entry: i
|
|
24
|
+
});
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if ("webhook" in i) {
|
|
28
|
+
o.push({
|
|
29
|
+
type: "webhook",
|
|
30
|
+
title: i.title,
|
|
31
|
+
href: `#${i.id}`,
|
|
32
|
+
description: "Webhook",
|
|
33
|
+
method: i.method,
|
|
34
|
+
body: i.webhook.description || "",
|
|
35
|
+
entry: i
|
|
36
|
+
});
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
if ("schema" in i) {
|
|
40
|
+
const e = "description" in i.schema && typeof i.schema.description == "string" ? i.schema.description : "";
|
|
41
|
+
o.push({
|
|
42
|
+
type: "model",
|
|
43
|
+
title: i.title,
|
|
44
|
+
href: `#${i.id}`,
|
|
45
|
+
description: "Model",
|
|
46
|
+
body: e,
|
|
47
|
+
entry: i
|
|
48
|
+
});
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
if ("tag" in i) {
|
|
52
|
+
o.push({
|
|
53
|
+
title: i.title,
|
|
54
|
+
href: `#${i.id}`,
|
|
55
|
+
description: i.tag.description || "",
|
|
56
|
+
type: "tag",
|
|
57
|
+
body: "",
|
|
58
|
+
entry: i
|
|
59
|
+
});
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if ("isGroup" in i) {
|
|
63
|
+
o.push({
|
|
64
|
+
title: i.title,
|
|
65
|
+
href: `#${i.id}`,
|
|
66
|
+
description: "Tag Group",
|
|
67
|
+
type: "tag",
|
|
68
|
+
body: "",
|
|
69
|
+
entry: i
|
|
70
|
+
});
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if ("isWebhooks" in i) {
|
|
74
|
+
o.push({
|
|
75
|
+
type: "heading",
|
|
76
|
+
title: "Webhooks",
|
|
77
|
+
href: `#${i.id}`,
|
|
78
|
+
description: "Heading",
|
|
79
|
+
body: "",
|
|
80
|
+
entry: i
|
|
81
|
+
});
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
if (i.title === "Models") {
|
|
85
|
+
o.push({
|
|
86
|
+
type: "heading",
|
|
87
|
+
title: "Models",
|
|
88
|
+
href: `#${i.id}`,
|
|
89
|
+
description: "Heading",
|
|
90
|
+
body: "",
|
|
91
|
+
entry: i
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (i.title) {
|
|
96
|
+
o.push({
|
|
97
|
+
type: "heading",
|
|
98
|
+
title: i.title ?? "",
|
|
99
|
+
description: "Description",
|
|
100
|
+
href: `#${i.id}`,
|
|
101
|
+
body: "",
|
|
102
|
+
entry: i
|
|
103
|
+
});
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export {
|
|
108
|
+
c as createSearchIndex
|
|
109
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { createSidebar } from '../../../features/sidebar';
|
|
2
|
+
import type { FuseResult } from 'fuse.js';
|
|
3
|
+
import type { FuseData } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Creates the search index from an OpenAPI document.
|
|
6
|
+
*/
|
|
7
|
+
export declare function useSearchIndex(items: ReturnType<typeof createSidebar>['items']): {
|
|
8
|
+
resetSearch: () => void;
|
|
9
|
+
selectedIndex: import("vue").Ref<number | undefined, number | undefined>;
|
|
10
|
+
selectedSearchResult: import("vue").ComputedRef<FuseResult<FuseData> | undefined>;
|
|
11
|
+
searchResultsWithPlaceholderResults: import("vue").ComputedRef<FuseResult<FuseData>[]>;
|
|
12
|
+
query: import("vue").Ref<string, string>;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useSearchIndex.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSearchIndex.d.ts","sourceRoot":"","sources":["../../../../src/features/Search/hooks/useSearchIndex.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AAIzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAIxC;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,OAAO,CAAC;uBAgCrD,IAAI;;;;;EA0D7B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { ref as a, watch as i, toValue as S, computed as h } from "vue";
|
|
2
|
+
import { createFuseInstance as p } from "../helpers/create-fuse-instance.js";
|
|
3
|
+
import { createSearchIndex as x } from "../helpers/create-search-index.js";
|
|
4
|
+
const d = 25;
|
|
5
|
+
function _(l) {
|
|
6
|
+
const n = p(), e = a();
|
|
7
|
+
i(
|
|
8
|
+
l,
|
|
9
|
+
() => {
|
|
10
|
+
const { entries: r } = S(l), c = x(r);
|
|
11
|
+
n.setCollection(c);
|
|
12
|
+
},
|
|
13
|
+
{ immediate: !0 }
|
|
14
|
+
);
|
|
15
|
+
const t = a("");
|
|
16
|
+
i(t, (r) => {
|
|
17
|
+
if (r.length) {
|
|
18
|
+
v();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
o();
|
|
22
|
+
});
|
|
23
|
+
function o() {
|
|
24
|
+
t.value = "", e.value = void 0, s.value = [];
|
|
25
|
+
}
|
|
26
|
+
const s = a([]), v = () => {
|
|
27
|
+
e.value = 0, s.value = n.search(t.value, {
|
|
28
|
+
limit: d
|
|
29
|
+
});
|
|
30
|
+
}, u = h(() => t.value.length !== 0 ? s.value : n._docs.slice(0, d).map((c, m) => ({
|
|
31
|
+
item: c,
|
|
32
|
+
refIndex: m
|
|
33
|
+
}))), f = h(
|
|
34
|
+
() => typeof e.value == "number" ? u.value[e.value] : void 0
|
|
35
|
+
);
|
|
36
|
+
return {
|
|
37
|
+
resetSearch: o,
|
|
38
|
+
selectedIndex: e,
|
|
39
|
+
selectedSearchResult: f,
|
|
40
|
+
searchResultsWithPlaceholderResults: u,
|
|
41
|
+
query: t
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export {
|
|
45
|
+
_ as useSearchIndex
|
|
46
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { default as SearchButton } from './SearchButton.vue.js';
|
|
2
|
-
export { default as SearchModal } from './SearchModal.vue.js';
|
|
1
|
+
export { default as SearchButton } from './components/SearchButton.vue.js';
|
|
2
|
+
export { default as SearchModal } from './components/SearchModal.vue.js';
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/Search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/features/Search/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,+BAA+B,CAAA;AACvE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,8BAA8B,CAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { TraversedEntry } from '../../features/traverse-schema';
|
|
2
|
+
import type { ParameterMap } from '../../libs/openapi.js';
|
|
3
|
+
export type EntryType = 'operation' | 'webhook' | 'model' | 'heading' | 'tag';
|
|
4
|
+
export type FuseData = {
|
|
5
|
+
type: EntryType;
|
|
6
|
+
id?: string;
|
|
7
|
+
title: string;
|
|
8
|
+
description: string;
|
|
9
|
+
href: string;
|
|
10
|
+
body?: string | string[] | ParameterMap;
|
|
11
|
+
method?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
entry: TraversedEntry;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/Search/types.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAChE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD,MAAM,MAAM,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAA;AAE7E,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,SAAS,CAAA;IACf,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,EAAE,MAAM,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,YAAY,CAAA;IACvC,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,cAAc,CAAA;CACtB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/api-client-modal/ApiClientModal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiClientModal.vue.d.ts","sourceRoot":"","sources":["../../../src/features/api-client-modal/ApiClientModal.vue"],"names":[],"mappings":"AA+KA,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;;AAsMF,wBAOG"}
|
|
@@ -1,93 +1,93 @@
|
|
|
1
|
-
import { defineComponent as S, ref as g, onMounted as E, watch as B, onBeforeUnmount as b, createElementBlock as
|
|
2
|
-
import { useActiveEntities as
|
|
3
|
-
import { mutateSecuritySchemeDiff as
|
|
4
|
-
import { getServersFromOpenApiDocument as
|
|
1
|
+
import { defineComponent as S, ref as g, onMounted as E, watch as B, onBeforeUnmount as b, createElementBlock as R, openBlock as k } from "vue";
|
|
2
|
+
import { useActiveEntities as q, useWorkspace as x } from "@scalar/api-client/store";
|
|
3
|
+
import { mutateSecuritySchemeDiff as y } from "@scalar/api-client/views/Request/libs";
|
|
4
|
+
import { getServersFromOpenApiDocument as D } from "@scalar/oas-utils/transforms";
|
|
5
5
|
import { watchDebounced as d } from "@vueuse/core";
|
|
6
|
-
import
|
|
7
|
-
import { useNavState as
|
|
8
|
-
import { useApiClient as
|
|
9
|
-
import { useExampleStore as
|
|
10
|
-
const
|
|
6
|
+
import M from "microdiff";
|
|
7
|
+
import { useNavState as U } from "../../hooks/useNavState.js";
|
|
8
|
+
import { useApiClient as A } from "./useApiClient.js";
|
|
9
|
+
import { useExampleStore as C } from "../../legacy/stores/useExampleStore.js";
|
|
10
|
+
const j = /* @__PURE__ */ S({
|
|
11
11
|
__name: "ApiClientModal",
|
|
12
12
|
props: {
|
|
13
13
|
configuration: {},
|
|
14
14
|
dereferencedDocument: {}
|
|
15
15
|
},
|
|
16
|
-
setup(
|
|
17
|
-
const
|
|
16
|
+
setup(r) {
|
|
17
|
+
const s = g(null), { client: c, init: v } = A(), { selectedExampleKey: p, operationId: f } = C(), a = q(), n = x(), { isIntersectionEnabled: m } = U(), h = () => ({
|
|
18
18
|
name: "on-before-request",
|
|
19
19
|
hooks: {
|
|
20
|
-
onBeforeRequest:
|
|
20
|
+
onBeforeRequest: r.configuration.onBeforeRequest
|
|
21
21
|
}
|
|
22
22
|
});
|
|
23
23
|
return E(() => {
|
|
24
|
-
|
|
25
|
-
el:
|
|
24
|
+
s.value && v({
|
|
25
|
+
el: s.value,
|
|
26
26
|
configuration: {
|
|
27
|
-
...
|
|
27
|
+
...r.configuration,
|
|
28
28
|
// If the onBeforeRequest hook is configured, we add the plugin to the API client.
|
|
29
|
-
plugins:
|
|
29
|
+
plugins: r.configuration.onBeforeRequest ? [h] : []
|
|
30
30
|
},
|
|
31
|
-
store:
|
|
31
|
+
store: n
|
|
32
32
|
});
|
|
33
33
|
}), d(
|
|
34
|
-
() =>
|
|
35
|
-
(e) => {
|
|
36
|
-
var
|
|
37
|
-
e && (
|
|
34
|
+
() => r.dereferencedDocument,
|
|
35
|
+
(e, i) => {
|
|
36
|
+
var o, u;
|
|
37
|
+
e && JSON.stringify(e) !== JSON.stringify(i || {}) && (a.activeCollection.value && ((o = c.value) == null || o.resetStore()), n.importSpecFile(void 0, "default", {
|
|
38
38
|
dereferencedDocument: e,
|
|
39
39
|
shouldLoad: !1,
|
|
40
|
-
documentUrl: (
|
|
40
|
+
documentUrl: (u = r.configuration) == null ? void 0 : u.url,
|
|
41
41
|
useCollectionSecurity: !0,
|
|
42
|
-
...
|
|
42
|
+
...r.configuration
|
|
43
43
|
}));
|
|
44
44
|
}
|
|
45
45
|
), d(
|
|
46
|
-
() =>
|
|
47
|
-
(e,
|
|
48
|
-
if (!
|
|
46
|
+
() => r.configuration,
|
|
47
|
+
(e, i) => {
|
|
48
|
+
if (!i || !a.activeCollection.value)
|
|
49
49
|
return;
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
50
|
+
const o = a.activeCollection.value, u = M(i, e);
|
|
51
|
+
if (!u.some(
|
|
52
52
|
(t) => t.path[0] === "url" || t.path[0] === "content" || t.path[1] === "url" || t.path[1] === "content"
|
|
53
53
|
)) {
|
|
54
|
-
if (
|
|
55
|
-
t.path[0] === "authentication" &&
|
|
56
|
-
}), e.servers ||
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
if (u.forEach((t) => {
|
|
55
|
+
t.path[0] === "authentication" && y(t, a, n);
|
|
56
|
+
}), e.servers || i.servers) {
|
|
57
|
+
o.servers.forEach((l) => {
|
|
58
|
+
n.serverMutators.delete(l, o.uid);
|
|
59
59
|
});
|
|
60
|
-
const t =
|
|
61
|
-
e.servers ??
|
|
60
|
+
const t = D(
|
|
61
|
+
e.servers ?? r.dereferencedDocument.servers,
|
|
62
62
|
{
|
|
63
63
|
baseServerURL: e.baseServerURL
|
|
64
64
|
}
|
|
65
65
|
);
|
|
66
66
|
t.forEach((l) => {
|
|
67
|
-
|
|
68
|
-
}), t.length &&
|
|
69
|
-
|
|
67
|
+
n.serverMutators.add(l, o.uid);
|
|
68
|
+
}), t.length && n.collectionMutators.edit(
|
|
69
|
+
o.uid,
|
|
70
70
|
"selectedServerUid",
|
|
71
71
|
t[t.length - 1].uid
|
|
72
72
|
);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
m.value = !1, setTimeout(() => {
|
|
76
|
+
m.value = !0;
|
|
77
77
|
}, 1e3);
|
|
78
78
|
},
|
|
79
79
|
{ deep: !0, debounce: 300 }
|
|
80
80
|
), B(p, (e) => {
|
|
81
|
-
|
|
81
|
+
c.value && e && f.value && c.value.updateExample(e, f.value);
|
|
82
82
|
}), b(() => {
|
|
83
83
|
var e;
|
|
84
|
-
return (e =
|
|
85
|
-
}), (e,
|
|
84
|
+
return (e = c.value) == null ? void 0 : e.app.unmount();
|
|
85
|
+
}), (e, i) => (k(), R("div", {
|
|
86
86
|
ref_key: "el",
|
|
87
|
-
ref:
|
|
87
|
+
ref: s
|
|
88
88
|
}, null, 512));
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
export {
|
|
92
|
-
|
|
92
|
+
j as default
|
|
93
93
|
};
|