@scalar/api-reference 1.24.57 → 1.24.59

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 (55) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/browser/standalone.js +5730 -5723
  3. package/dist/browser/webpack-stats.json +1 -1
  4. package/dist/components/Content/Operation/EndpointDetails.vue.js +3 -3
  5. package/dist/components/Layouts/ClassicLayout.vue.d.ts.map +1 -1
  6. package/dist/components/Layouts/ClassicLayout.vue.js +13 -13
  7. package/dist/components/Layouts/ModernLayout.vue.d.ts.map +1 -1
  8. package/dist/components/Layouts/ModernLayout.vue.js +2 -2
  9. package/dist/components/Layouts/ModernLayout.vue2.js +11 -11
  10. package/dist/components/Section/Section.vue2.js +4 -4
  11. package/dist/esm.d.ts +1 -1
  12. package/dist/esm.d.ts.map +1 -1
  13. package/dist/features/Search/Search.vue.d.ts +20 -0
  14. package/dist/features/Search/Search.vue.d.ts.map +1 -0
  15. package/dist/features/Search/Search.vue.js +18 -0
  16. package/dist/features/Search/Search.vue2.js +4 -0
  17. package/dist/features/Search/SearchButton.vue.d.ts.map +1 -0
  18. package/dist/features/Search/SearchButton.vue.js +7 -0
  19. package/dist/features/Search/SearchButton.vue2.js +59 -0
  20. package/dist/features/Search/SearchModal.vue.d.ts.map +1 -0
  21. package/dist/features/Search/SearchModal.vue.js +7 -0
  22. package/dist/features/Search/SearchModal.vue2.js +127 -0
  23. package/dist/features/Search/index.d.ts +4 -0
  24. package/dist/features/Search/index.d.ts.map +1 -0
  25. package/dist/features/Search/useKeyboardNavigation.d.ts +13 -0
  26. package/dist/features/Search/useKeyboardNavigation.d.ts.map +1 -0
  27. package/dist/features/Search/useKeyboardNavigation.js +30 -0
  28. package/dist/features/Search/useSearchIndex.d.ts +30 -0
  29. package/dist/features/Search/useSearchIndex.d.ts.map +1 -0
  30. package/dist/features/Search/useSearchIndex.js +115 -0
  31. package/dist/helpers/createEmptySpecification.d.ts +2 -1
  32. package/dist/helpers/createEmptySpecification.d.ts.map +1 -1
  33. package/dist/helpers/index.d.ts +0 -1
  34. package/dist/helpers/index.d.ts.map +1 -1
  35. package/dist/hooks/useDarkModeState.d.ts.map +1 -1
  36. package/dist/hooks/useDarkModeState.js +5 -5
  37. package/dist/hooks/useReactiveSpec.d.ts +4 -4
  38. package/dist/hooks/useReactiveSpec.d.ts.map +1 -1
  39. package/dist/hooks/useReactiveSpec.js +36 -35
  40. package/dist/index.d.ts +1 -2
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +65 -65
  43. package/dist/style.css +1 -1
  44. package/package.json +6 -6
  45. package/dist/components/SearchButton.vue.d.ts.map +0 -1
  46. package/dist/components/SearchButton.vue.js +0 -7
  47. package/dist/components/SearchButton.vue2.js +0 -59
  48. package/dist/components/SearchModal.vue.d.ts.map +0 -1
  49. package/dist/components/SearchModal.vue.js +0 -7
  50. package/dist/components/SearchModal.vue2.js +0 -219
  51. package/dist/helpers/isValidUrl.d.ts +0 -5
  52. package/dist/helpers/isValidUrl.d.ts.map +0 -1
  53. package/dist/helpers/isValidUrl.js +0 -10
  54. /package/dist/{components → features/Search}/SearchButton.vue.d.ts +0 -0
  55. /package/dist/{components → features/Search}/SearchModal.vue.d.ts +0 -0
package/package.json CHANGED
@@ -20,7 +20,7 @@
20
20
  "vue",
21
21
  "vue3"
22
22
  ],
23
- "version": "1.24.57",
23
+ "version": "1.24.59",
24
24
  "engines": {
25
25
  "node": ">=18"
26
26
  },
@@ -59,12 +59,12 @@
59
59
  "unhead": "^1.8.3",
60
60
  "unified": "^11.0.4",
61
61
  "vue": "^3.4.29",
62
- "@scalar/components": "0.12.19",
63
- "@scalar/api-client": "2.0.32",
64
- "@scalar/themes": "0.9.16",
65
- "@scalar/oas-utils": "0.2.17",
62
+ "@scalar/api-client": "2.0.34",
63
+ "@scalar/oas-utils": "0.2.18",
64
+ "@scalar/components": "0.12.21",
66
65
  "@scalar/use-toasts": "0.7.4",
67
- "@scalar/use-tooltip": "1.0.2"
66
+ "@scalar/use-tooltip": "1.0.2",
67
+ "@scalar/themes": "0.9.16"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@etchteam/storybook-addon-css-variables-theme": "^1.5.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchButton.vue.d.ts","sourceRoot":"","sources":["../../src/components/SearchButton.vue"],"names":[],"mappings":"AAkIA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAA;;UAWnC,IAAI;mBACK,MAAM;;;;UADf,IAAI;mBACK,MAAM;;;;kBAAN,MAAM;;AA4HzB,wBAMG;AAOH,KAAK,kBAAkB,CAAC,CAAC,EAAE,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,IAAI,CAAC,CAAC,EAAE,MAAM,CAAC,CAAC,GAAG,CAAC,SAAS,MAAM,CAAC,GAC7C,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC,CAAA;KAAC,CAAC,GACvC,CAAC,CAAC,CAAC,CAAC;CACP,CAAC;AAEN,KAAK,cAAc,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC;AAExD,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,7 +0,0 @@
1
- import o from "./SearchButton.vue2.js";
2
- /* empty css */
3
- import t from "../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ t(o, [["__scopeId", "data-v-45e2b1ac"]]);
5
- export {
6
- e as default
7
- };
@@ -1,59 +0,0 @@
1
- import { defineComponent as m, ref as u, onMounted as S, openBlock as f, createElementBlock as y, Fragment as _, createElementVNode as t, normalizeClass as b, unref as a, createVNode as p, toDisplayString as i, pushScopeId as k, popScopeId as v } from "vue";
2
- import { useModal as K, ScalarIcon as M } from "@scalar/components";
3
- import { isMacOS as r } from "@scalar/use-tooltip";
4
- import { useMagicKeys as w, whenever as g } from "@vueuse/core";
5
- import B from "./SearchModal.vue.js";
6
- import { modalStateBus as C } from "./api-client-bus.js";
7
- const H = (o) => (k("data-v-45e2b1ac"), o = o(), v(), o), I = { class: "sidebar-search-input" }, E = /* @__PURE__ */ H(() => /* @__PURE__ */ t("span", { class: "sidebar-search-placeholder" }, "Search", -1)), $ = { class: "sidebar-search-shortcut" }, z = { class: "sidebar-search-key" }, j = /* @__PURE__ */ m({
8
- __name: "SearchButton",
9
- props: {
10
- spec: {},
11
- searchHotKey: { default: "k" }
12
- },
13
- setup(o) {
14
- const c = o, s = K(), n = u(null), d = w({
15
- passive: !1,
16
- onEventFired(e) {
17
- !r() && e.ctrlKey && e.key === c.searchHotKey && (e.preventDefault(), e.stopPropagation());
18
- }
19
- });
20
- return S(() => {
21
- C.on((e) => {
22
- n.value = e;
23
- });
24
- }), g(
25
- d[`${r() ? "meta" : "control"}_${c.searchHotKey}`],
26
- () => {
27
- var e;
28
- (e = n.value) != null && e.open || (s.open ? s.hide() : s.show());
29
- }
30
- ), (e, l) => (f(), y(_, null, [
31
- t("button", {
32
- class: b(["sidebar-search", e.$attrs.class]),
33
- type: "button",
34
- onClick: l[0] || (l[0] = //@ts-ignore
35
- (...h) => a(s).show && a(s).show(...h))
36
- }, [
37
- p(a(M), {
38
- class: "search-icon",
39
- icon: "Search",
40
- size: "sm",
41
- thickness: "2.5"
42
- }),
43
- t("div", I, [
44
- E,
45
- t("span", $, [
46
- t("span", z, i(a(r)() ? "⌘" : "⌃") + i(e.searchHotKey), 1)
47
- ])
48
- ])
49
- ], 2),
50
- p(B, {
51
- modalState: a(s),
52
- parsedSpec: e.spec
53
- }, null, 8, ["modalState", "parsedSpec"])
54
- ], 64));
55
- }
56
- });
57
- export {
58
- j as default
59
- };
@@ -1 +0,0 @@
1
- {"version":3,"file":"SearchModal.vue.d.ts","sourceRoot":"","sources":["../../src/components/SearchModal.vue"],"names":[],"mappings":"AAgYA,OAAO,EAEL,KAAK,UAAU,EAKhB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,IAAI,EAAwB,MAAM,mBAAmB,CAAA;;gBAgBrD,IAAI;gBACJ,UAAU;;gBADV,IAAI;gBACJ,UAAU;;AAwexB,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
@@ -1,7 +0,0 @@
1
- import o from "./SearchModal.vue2.js";
2
- /* empty css */
3
- import r from "../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-241cc7e9"]]);
5
- export {
6
- e as default
7
- };
@@ -1,219 +0,0 @@
1
- import { defineComponent as ee, toRef as te, ref as m, computed as q, watch as U, openBlock as E, createBlock as H, unref as S, withCtx as n, createElementVNode as w, createVNode as V, createTextVNode as g, toDisplayString as b, createElementBlock as oe, Fragment as ae, renderList as le, createSlots as re, pushScopeId as se, popScopeId as ce } from "vue";
2
- import { ScalarModal as ne, ScalarSearchInput as ie, ScalarSearchResultList as de, ScalarSearchResultItem as ue } from "@scalar/components";
3
- import { useMagicKeys as pe, whenever as _ } from "@vueuse/core";
4
- import he from "fuse.js";
5
- import { extractRequestBody as me } from "../helpers/specHelpers.js";
6
- import fe from "./Sidebar/SidebarHttpBadge.vue.js";
7
- import { useSidebar as ve } from "../hooks/useSidebar.js";
8
- import { getHeadingsFromMarkdown as Se } from "../helpers/getHeadingsFromMarkdown.js";
9
- import { useOperation as ge } from "../hooks/useOperation.js";
10
- import { getModels as be } from "../helpers/getModels.js";
11
- import { useNavState as we } from "../hooks/useNavState.js";
12
- const ke = (d) => (se("data-v-241cc7e9"), d = d(), ce(), d), ye = /* @__PURE__ */ ke(() => /* @__PURE__ */ w("div", { class: "ref-search-meta" }, [
13
- /* @__PURE__ */ w("span", null, "↑↓ Navigate"),
14
- /* @__PURE__ */ w("span", null, "⏎ Select")
15
- ], -1)), Ne = /* @__PURE__ */ ee({
16
- __name: "SearchModal",
17
- props: {
18
- parsedSpec: {},
19
- modalState: {}
20
- },
21
- setup(d) {
22
- const l = d, j = te(l, "parsedSpec"), A = {
23
- heading: "DocsPage",
24
- model: "Brackets",
25
- req: "Terminal",
26
- tag: "CodeFolder",
27
- webhook: "Terminal"
28
- }, k = pe(), r = m([]), y = m([]), s = m(0), i = m(""), L = m(null), I = new he(r.value, {
29
- keys: ["title", "description", "body"]
30
- }), W = () => {
31
- s.value = 0, y.value = I.search(i.value);
32
- }, f = q(
33
- () => u.value[s.value]
34
- ), { getHeadingId: P, getWebhookId: K, getModelId: Y, getOperationId: z, getTagId: G } = we();
35
- U(
36
- () => l.modalState.open,
37
- (o) => {
38
- o && (i.value = "", s.value = 0, y.value = []);
39
- }
40
- );
41
- const { setCollapsedSidebarItem: J, hideModels: Q } = ve();
42
- U(
43
- j.value,
44
- async () => {
45
- var M, $, B, F, N;
46
- if (r.value = [], !(($ = (M = l.parsedSpec) == null ? void 0 : M.tags) != null && $.length) && !((B = l.parsedSpec) != null && B.webhooks)) {
47
- I.setCollection([]);
48
- return;
49
- }
50
- const o = [], c = Se(
51
- ((F = l.parsedSpec.info) == null ? void 0 : F.description) ?? ""
52
- );
53
- c.length && (c.forEach((t) => {
54
- o.push({
55
- type: "heading",
56
- title: `Info > ${t.value}`,
57
- description: "",
58
- href: `#${P(t)}`,
59
- tag: t.slug,
60
- body: ""
61
- });
62
- }), r.value = r.value.concat(o)), (N = l.parsedSpec.tags) == null || N.forEach((t) => {
63
- const x = {
64
- title: t["x-displayName"] ?? t.name,
65
- href: `#${G(t)}`,
66
- description: t.description,
67
- type: "tag",
68
- tag: t.name,
69
- body: ""
70
- };
71
- r.value.push(x), t.operations && t.operations.forEach((a) => {
72
- const { parameterMap: v } = ge({ operation: a }), O = me(a) || v.value;
73
- let R = null;
74
- typeof O != "boolean" && (R = O);
75
- const T = {
76
- type: "req",
77
- title: a.name ?? a.path,
78
- href: `#${z(a, t)}`,
79
- operationId: a.operationId,
80
- description: a.description ?? "",
81
- httpVerb: a.httpVerb,
82
- path: a.path,
83
- tag: t.name,
84
- operation: a
85
- };
86
- R && (T.body = R), r.value.push(T);
87
- });
88
- });
89
- const e = l.parsedSpec.webhooks, p = [];
90
- e && Object.keys(e).forEach((t) => {
91
- Object.keys(
92
- e[t]
93
- ).forEach((a) => {
94
- var v;
95
- p.push({
96
- type: "webhook",
97
- title: `Webhook: ${(v = e[t][a]) == null ? void 0 : v.name}`,
98
- href: `#${K(t, a)}`,
99
- description: t,
100
- httpVerb: a,
101
- tag: t,
102
- body: ""
103
- });
104
- }), r.value = r.value.concat(p);
105
- });
106
- const h = Q.value ? {} : be(l.parsedSpec), D = [];
107
- h && (Object.keys(h).forEach((t) => {
108
- D.push({
109
- type: "model",
110
- title: "Model",
111
- href: `#${Y(t)}`,
112
- description: h[t].title ?? t,
113
- tag: t,
114
- body: ""
115
- });
116
- }), r.value = r.value.concat(D)), I.setCollection(r.value);
117
- },
118
- { immediate: !0 }
119
- ), _(k.enter, () => {
120
- l.modalState.open && window && (C(f.value), window.location.hash = f.value.item.href, l.modalState.hide());
121
- }), _(k.ArrowDown, () => {
122
- var o;
123
- l.modalState.open && window && (s.value < u.value.length - 1 ? s.value++ : s.value = 0, (o = document.getElementById(f.value.item.href)) == null || o.scrollIntoView({
124
- behavior: "smooth",
125
- block: "center"
126
- }));
127
- }), _(k.ArrowUp, () => {
128
- var o;
129
- l.modalState.open && window && (s.value > 0 ? s.value-- : s.value = u.value.length - 1, (o = document.getElementById(f.value.item.href)) == null || o.scrollIntoView({
130
- behavior: "smooth",
131
- block: "center"
132
- }));
133
- });
134
- const u = q(
135
- () => i.value.length === 0 ? r.value.map((o) => ({
136
- item: o
137
- })) : y.value
138
- ), X = /#(tag\/[^/]*)/, C = (o) => {
139
- let c = "models";
140
- const e = o.item.href.match(X);
141
- e != null && e.length && e.length > 1 && (c = e[1]), J(c, !0), l.modalState.hide();
142
- };
143
- function Z(o) {
144
- const c = new URL(window.location.href);
145
- return c.hash = o, c.toString();
146
- }
147
- return (o, c) => (E(), H(S(ne), {
148
- state: o.modalState,
149
- variant: "search"
150
- }, {
151
- default: n(() => [
152
- w("div", {
153
- ref_key: "searchModalRef",
154
- ref: L,
155
- class: "ref-search-container"
156
- }, [
157
- V(S(ie), {
158
- modelValue: i.value,
159
- "onUpdate:modelValue": c[0] || (c[0] = (e) => i.value = e),
160
- onInput: W
161
- }, null, 8, ["modelValue"])
162
- ], 512),
163
- V(S(de), {
164
- class: "ref-search-results custom-scroll",
165
- noResults: !u.value.length
166
- }, {
167
- query: n(() => [
168
- g(b(i.value), 1)
169
- ]),
170
- default: n(() => [
171
- (E(!0), oe(ae, null, le(u.value, (e, p) => (E(), H(S(ue), {
172
- id: e.item.href,
173
- key: e.refIndex,
174
- active: s.value === p,
175
- href: Z(e.item.href),
176
- icon: A[e.item.type],
177
- onClick: (h) => C(e),
178
- onFocus: (h) => s.value = p
179
- }, re({
180
- default: n(() => [
181
- g(b(e.item.title) + " ", 1)
182
- ]),
183
- _: 2
184
- }, [
185
- (e.item.httpVerb || e.item.path) && e.item.path !== e.item.title ? {
186
- name: "description",
187
- fn: n(() => [
188
- g(b(e.item.path), 1)
189
- ]),
190
- key: "0"
191
- } : e.item.description ? {
192
- name: "description",
193
- fn: n(() => [
194
- g(b(e.item.description), 1)
195
- ]),
196
- key: "1"
197
- } : void 0,
198
- e.item.type === "req" ? {
199
- name: "addon",
200
- fn: n(() => [
201
- V(fe, {
202
- method: e.item.httpVerb ?? "get"
203
- }, null, 8, ["method"])
204
- ]),
205
- key: "2"
206
- } : void 0
207
- ]), 1032, ["id", "active", "href", "icon", "onClick", "onFocus"]))), 128))
208
- ]),
209
- _: 1
210
- }, 8, ["noResults"]),
211
- ye
212
- ]),
213
- _: 1
214
- }, 8, ["state"]));
215
- }
216
- });
217
- export {
218
- Ne as default
219
- };
@@ -1,5 +0,0 @@
1
- /**
2
- * Checks if the given string is a valid URL
3
- */
4
- export declare function isValidUrl(url: string): boolean;
5
- //# sourceMappingURL=isValidUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"isValidUrl.d.ts","sourceRoot":"","sources":["../../src/helpers/isValidUrl.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,WAMrC"}
@@ -1,10 +0,0 @@
1
- function e(r) {
2
- try {
3
- return !!new URL(r);
4
- } catch {
5
- return !1;
6
- }
7
- }
8
- export {
9
- e as isValidUrl
10
- };