@scalar/api-reference 1.35.6 → 1.35.7
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 +32 -0
- package/dist/blocks/helpers/getPointer.d.ts.map +1 -1
- package/dist/browser/standalone.js +14400 -14218
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Lazy/Lazy.vue.d.ts.map +1 -1
- package/dist/components/Lazy/Lazy.vue2.js +2 -2
- package/dist/features/document-source/hooks/useDocumentSource.d.ts.map +1 -1
- package/dist/features/document-source/hooks/useDocumentSource.js +6 -5
- package/dist/features/sidebar/components/SidebarElement.vue.js +2 -2
- package/dist/index.js +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +59 -53
- package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue.js +1 -1
- package/dist/v2/blocks/scalar-info-block/components/DownloadLink.vue2.js +39 -30
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.js +1 -1
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +77 -71
- package/dist/v2/helpers/map-configuration.d.ts.map +1 -1
- package/package.json +16 -15
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ApiReferenceWorkspace.vue.d.ts","sourceRoot":"","sources":["../../src/v2/ApiReferenceWorkspace.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ApiReferenceWorkspace.vue.d.ts","sourceRoot":"","sources":["../../src/v2/ApiReferenceWorkspace.vue"],"names":[],"mappings":"AAqVA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAyBpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AA6TF,QAAA,IAAI,QAAQ,IAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAW,EAAE,QAAQ,IAAY,CAAE;AAC9G,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACrD;IAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACnD;IAAE,eAAe,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACrD;IAAE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,GACnD;IAAE,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AA4B/C,QAAA,MAAM,eAAe;;;;kFAOnB,CAAC;wBACkB,eAAe,CAAC,OAAO,eAAe,EAAE,WAAW,CAAC;AAAzE,wBAA0E;AAQ1E,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { safeLocalStorage as
|
|
3
|
-
import { makeUrlAbsolute as
|
|
4
|
-
import { redirectToProxy as
|
|
5
|
-
import { useColorMode as
|
|
6
|
-
import { useSeoMeta as
|
|
7
|
-
import { useFavicon as
|
|
8
|
-
import
|
|
9
|
-
import { NAV_STATE_SYMBOL as
|
|
1
|
+
import { defineComponent as R, ref as d, toRef as I, provide as N, useTemplateRef as w, onBeforeMount as L, watch as i, computed as V, createElementBlock as A, openBlock as C, createBlock as B, createCommentVNode as P, createVNode as k, unref as n, resolveDynamicComponent as U, withCtx as s, createTextVNode as _, toDisplayString as K, renderSlot as l, isRef as F } from "vue";
|
|
2
|
+
import { safeLocalStorage as O, REFERENCE_LS_KEYS as W } from "@scalar/helpers/object/local-storage";
|
|
3
|
+
import { makeUrlAbsolute as Y } from "@scalar/helpers/url/make-url-absolute";
|
|
4
|
+
import { redirectToProxy as z } from "@scalar/oas-utils/helpers";
|
|
5
|
+
import { useColorMode as H } from "@scalar/use-hooks/useColorMode";
|
|
6
|
+
import { useSeoMeta as j } from "@unhead/vue";
|
|
7
|
+
import { useFavicon as q } from "@vueuse/core";
|
|
8
|
+
import G from "../components/ApiReferenceLayout.vue.js";
|
|
9
|
+
import { NAV_STATE_SYMBOL as J } from "../hooks/useNavState.js";
|
|
10
10
|
import { isClient as D } from "./blocks/scalar-request-example-block/helpers/find-client.js";
|
|
11
|
-
import { getDocumentName as
|
|
11
|
+
import { getDocumentName as Q } from "./helpers/get-document-name.js";
|
|
12
12
|
import { mapConfiguration as g } from "./helpers/map-configuration.js";
|
|
13
|
-
import { normalizeContent as
|
|
14
|
-
import { useWorkspaceStoreEvents as
|
|
15
|
-
import { useMultipleDocuments as
|
|
16
|
-
import
|
|
17
|
-
const
|
|
13
|
+
import { normalizeContent as X } from "./helpers/normalize-content.js";
|
|
14
|
+
import { useWorkspaceStoreEvents as Z } from "./hooks/use-workspace-store-events.js";
|
|
15
|
+
import { useMultipleDocuments as ee } from "../features/multiple-documents/useMultipleDocuments.js";
|
|
16
|
+
import te from "../features/multiple-documents/DocumentSelector.vue.js";
|
|
17
|
+
const De = /* @__PURE__ */ R({
|
|
18
18
|
__name: "ApiReferenceWorkspace",
|
|
19
19
|
props: {
|
|
20
20
|
configuration: {},
|
|
@@ -28,26 +28,26 @@ const Ce = /* @__PURE__ */ $({
|
|
|
28
28
|
selectedDocumentIndex: u,
|
|
29
29
|
isIntersectionEnabled: m,
|
|
30
30
|
hash: M,
|
|
31
|
-
hashPrefix:
|
|
32
|
-
} =
|
|
33
|
-
configuration:
|
|
31
|
+
hashPrefix: h
|
|
32
|
+
} = ee({
|
|
33
|
+
configuration: I(c, "configuration"),
|
|
34
34
|
isIntersectionEnabled: d(!1),
|
|
35
35
|
hash: d(""),
|
|
36
36
|
hashPrefix: d("")
|
|
37
|
-
}),
|
|
38
|
-
|
|
37
|
+
}), x = (e, t) => fetch(
|
|
38
|
+
z(o.value.proxyUrl, e.toString()),
|
|
39
39
|
t
|
|
40
40
|
);
|
|
41
|
-
N(
|
|
41
|
+
N(J, { isIntersectionEnabled: m, hash: M, hashPrefix: h });
|
|
42
42
|
const p = w("root"), r = c.store;
|
|
43
|
-
|
|
44
|
-
const e =
|
|
45
|
-
|
|
43
|
+
L(() => {
|
|
44
|
+
const e = O().getItem(
|
|
45
|
+
W.SELECTED_CLIENT
|
|
46
46
|
);
|
|
47
47
|
D(e) && !r.workspace["x-scalar-default-client"] && r.update("x-scalar-default-client", e);
|
|
48
48
|
});
|
|
49
|
-
const
|
|
50
|
-
const t =
|
|
49
|
+
const y = async (e) => {
|
|
50
|
+
const t = X(e.content), a = Q({
|
|
51
51
|
name: e.slug || e.title,
|
|
52
52
|
url: e.url,
|
|
53
53
|
document: t
|
|
@@ -67,24 +67,24 @@ const Ce = /* @__PURE__ */ $({
|
|
|
67
67
|
if (e.url)
|
|
68
68
|
return await r.addDocument({
|
|
69
69
|
name: e.slug ?? "default",
|
|
70
|
-
url:
|
|
70
|
+
url: Y(e.url, {
|
|
71
71
|
basePath: o.value.pathRouting?.basePath
|
|
72
72
|
}),
|
|
73
|
-
fetch: e.fetch ??
|
|
73
|
+
fetch: e.fetch ?? x,
|
|
74
74
|
config: g(e)
|
|
75
75
|
});
|
|
76
76
|
};
|
|
77
|
-
|
|
77
|
+
i(
|
|
78
78
|
[
|
|
79
79
|
() => o.value.slug,
|
|
80
80
|
() => o.value.url,
|
|
81
81
|
() => o.value.content
|
|
82
82
|
],
|
|
83
83
|
([e, t, a]) => {
|
|
84
|
-
(e || t || a) &&
|
|
84
|
+
(e || t || a) && y(o.value);
|
|
85
85
|
},
|
|
86
86
|
{ immediate: !0 }
|
|
87
|
-
),
|
|
87
|
+
), Z(r, p), i(
|
|
88
88
|
() => o.value.defaultHttpClient,
|
|
89
89
|
(e) => {
|
|
90
90
|
if (e) {
|
|
@@ -94,64 +94,70 @@ const Ce = /* @__PURE__ */ $({
|
|
|
94
94
|
},
|
|
95
95
|
{ immediate: !0 }
|
|
96
96
|
);
|
|
97
|
-
|
|
98
|
-
|
|
97
|
+
function S(e) {
|
|
98
|
+
if (e === !0)
|
|
99
|
+
return "dark";
|
|
100
|
+
if (e === !1)
|
|
101
|
+
return "light";
|
|
102
|
+
}
|
|
103
|
+
const { toggleColorMode: b, isDarkMode: T } = H({
|
|
104
|
+
initialColorMode: S(o.value.darkMode),
|
|
99
105
|
overrideColorMode: o.value.forceDarkModeState
|
|
100
106
|
});
|
|
101
|
-
|
|
107
|
+
i(
|
|
102
108
|
() => o.value.darkMode,
|
|
103
109
|
(e) => r.update("x-scalar-dark-mode", !!e)
|
|
104
|
-
),
|
|
105
|
-
() =>
|
|
110
|
+
), i(
|
|
111
|
+
() => T.value,
|
|
106
112
|
(e) => r.update("x-scalar-dark-mode", e),
|
|
107
113
|
{ immediate: !0 }
|
|
108
|
-
),
|
|
114
|
+
), i(
|
|
109
115
|
() => u.value,
|
|
110
116
|
(e) => r.update(
|
|
111
117
|
"x-scalar-active-document",
|
|
112
118
|
f.value[e]?.slug
|
|
113
119
|
),
|
|
114
120
|
{ immediate: !0 }
|
|
115
|
-
), o.value.metaData &&
|
|
116
|
-
const
|
|
117
|
-
return
|
|
121
|
+
), o.value.metaData && j(o.value.metaData);
|
|
122
|
+
const $ = V(() => o.value.favicon);
|
|
123
|
+
return q($), (e, t) => (C(), A("div", {
|
|
118
124
|
ref_key: "root",
|
|
119
125
|
ref: p
|
|
120
126
|
}, [
|
|
121
|
-
n(o)?.customCss ? (
|
|
127
|
+
n(o)?.customCss ? (C(), B(U("style"), { key: 0 }, {
|
|
122
128
|
default: s(() => [
|
|
123
|
-
|
|
129
|
+
_(K(n(o).customCss), 1)
|
|
124
130
|
]),
|
|
125
131
|
_: 1
|
|
126
|
-
})) :
|
|
127
|
-
|
|
132
|
+
})) : P("", !0),
|
|
133
|
+
k(G, {
|
|
128
134
|
configuration: n(o),
|
|
129
135
|
isDark: !!n(r).workspace["x-scalar-dark-mode"],
|
|
130
136
|
store: n(r),
|
|
131
|
-
onToggleDarkMode: t[1] || (t[1] = () => n(
|
|
137
|
+
onToggleDarkMode: t[1] || (t[1] = () => n(b)()),
|
|
132
138
|
onUpdateContent: t[2] || (t[2] = (a) => e.$emit("updateContent", a))
|
|
133
139
|
}, {
|
|
134
140
|
"document-selector": s(() => [
|
|
135
|
-
|
|
141
|
+
k(n(te), {
|
|
136
142
|
modelValue: n(u),
|
|
137
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) =>
|
|
143
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => F(u) ? u.value = a : null),
|
|
138
144
|
options: n(f)
|
|
139
145
|
}, null, 8, ["modelValue", "options"])
|
|
140
146
|
]),
|
|
141
147
|
"content-start": s(() => [
|
|
142
|
-
|
|
148
|
+
l(e.$slots, "content-start")
|
|
143
149
|
]),
|
|
144
150
|
"content-end": s(() => [
|
|
145
|
-
|
|
151
|
+
l(e.$slots, "content-end")
|
|
146
152
|
]),
|
|
147
153
|
"sidebar-start": s(() => [
|
|
148
|
-
|
|
154
|
+
l(e.$slots, "sidebar-start")
|
|
149
155
|
]),
|
|
150
156
|
"sidebar-end": s(() => [
|
|
151
|
-
|
|
157
|
+
l(e.$slots, "sidebar-end")
|
|
152
158
|
]),
|
|
153
159
|
footer: s(() => [
|
|
154
|
-
|
|
160
|
+
l(e.$slots, "footer")
|
|
155
161
|
]),
|
|
156
162
|
_: 3
|
|
157
163
|
}, 8, ["configuration", "isDark", "store"])
|
|
@@ -159,5 +165,5 @@ const Ce = /* @__PURE__ */ $({
|
|
|
159
165
|
}
|
|
160
166
|
});
|
|
161
167
|
export {
|
|
162
|
-
|
|
168
|
+
De as default
|
|
163
169
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DownloadLink.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-info-block/components/DownloadLink.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DownloadLink.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-info-block/components/DownloadLink.vue"],"names":[],"mappings":"AAsNA,KAAK,WAAW,GAAG;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mBAAmB,EAAE,MAAM,MAAM,CAAA;CAClC,CAAC;;AA2KF,wBAMG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./DownloadLink.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-0adf68b9"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -1,59 +1,68 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
1
|
+
import { defineComponent as g, computed as k, createElementBlock as t, createCommentVNode as r, unref as n, openBlock as l, normalizeClass as b, withModifiers as u, createElementVNode as m, createVNode as p, withCtx as w, createTextVNode as c, Fragment as v } from "vue";
|
|
2
|
+
import C from "github-slugger";
|
|
3
3
|
import f from "../../../../components/Badge/Badge.vue.js";
|
|
4
4
|
import { useConfig as x } from "../../../../hooks/useConfig.js";
|
|
5
|
-
import { downloadDocument as
|
|
6
|
-
const
|
|
5
|
+
import { downloadDocument as T } from "../../../../libs/download.js";
|
|
6
|
+
const O = ["href"], V = /* @__PURE__ */ g({
|
|
7
7
|
__name: "DownloadLink",
|
|
8
8
|
props: {
|
|
9
9
|
title: {},
|
|
10
10
|
getOriginalDocument: { type: Function }
|
|
11
11
|
},
|
|
12
|
-
setup(
|
|
13
|
-
const
|
|
14
|
-
|
|
12
|
+
setup(a) {
|
|
13
|
+
const e = x(), y = new C(), D = k(() => y.slug(a.title ?? "")), d = (s) => {
|
|
14
|
+
T(a.getOriginalDocument(), D.value, s);
|
|
15
15
|
};
|
|
16
|
-
return (
|
|
16
|
+
return (s, o) => ["yaml", "json", "both"].includes(n(e)?.documentDownloadType) ? (l(), t("div", {
|
|
17
17
|
key: 0,
|
|
18
|
-
class:
|
|
19
|
-
"download-both": e
|
|
18
|
+
class: b(["download-container group", {
|
|
19
|
+
"download-both": n(e)?.documentDownloadType === "both"
|
|
20
20
|
}])
|
|
21
21
|
}, [
|
|
22
|
-
e
|
|
22
|
+
n(e)?.documentDownloadType === "json" || n(e)?.documentDownloadType === "both" ? (l(), t("button", {
|
|
23
23
|
key: 0,
|
|
24
24
|
class: "download-button",
|
|
25
25
|
type: "button",
|
|
26
|
-
|
|
27
|
-
onClick: o[0] || (o[0] = i((y) => u("json"), ["prevent"]))
|
|
26
|
+
onClick: o[0] || (o[0] = u((i) => d("json"), ["prevent"]))
|
|
28
27
|
}, [
|
|
29
|
-
o[
|
|
30
|
-
|
|
31
|
-
default:
|
|
32
|
-
|
|
28
|
+
o[4] || (o[4] = m("span", null, " Download OpenAPI Document ", -1)),
|
|
29
|
+
p(f, { class: "extension hidden group-hover:flex" }, {
|
|
30
|
+
default: w(() => o[3] || (o[3] = [
|
|
31
|
+
c("json")
|
|
33
32
|
])),
|
|
34
33
|
_: 1,
|
|
35
|
-
__: [
|
|
34
|
+
__: [3]
|
|
36
35
|
})
|
|
37
|
-
])) :
|
|
38
|
-
e
|
|
36
|
+
])) : r("", !0),
|
|
37
|
+
n(e)?.documentDownloadType === "yaml" || n(e)?.documentDownloadType === "both" ? (l(), t("button", {
|
|
39
38
|
key: 1,
|
|
40
39
|
class: "download-button",
|
|
41
40
|
type: "button",
|
|
42
|
-
|
|
43
|
-
onClick: o[1] || (o[1] = i((y) => u("yaml"), ["prevent"]))
|
|
41
|
+
onClick: o[1] || (o[1] = u((i) => d("yaml"), ["prevent"]))
|
|
44
42
|
}, [
|
|
45
|
-
o[
|
|
46
|
-
|
|
47
|
-
default:
|
|
48
|
-
|
|
43
|
+
o[6] || (o[6] = m("span", null, " Download OpenAPI Document ", -1)),
|
|
44
|
+
p(f, { class: "extension hidden group-hover:flex" }, {
|
|
45
|
+
default: w(() => o[5] || (o[5] = [
|
|
46
|
+
c("yaml")
|
|
49
47
|
])),
|
|
50
48
|
_: 1,
|
|
51
|
-
__: [
|
|
49
|
+
__: [5]
|
|
52
50
|
})
|
|
53
|
-
])) :
|
|
54
|
-
], 2)) :
|
|
51
|
+
])) : r("", !0)
|
|
52
|
+
], 2)) : n(e)?.documentDownloadType === "direct" ? (l(), t(v, { key: 1 }, [
|
|
53
|
+
n(e).url ? (l(), t("a", {
|
|
54
|
+
key: 0,
|
|
55
|
+
class: "download-link",
|
|
56
|
+
href: n(e).url
|
|
57
|
+
}, " Download OpenAPI Document ", 8, O)) : (l(), t("a", {
|
|
58
|
+
key: 1,
|
|
59
|
+
class: "download-link",
|
|
60
|
+
href: "#",
|
|
61
|
+
onClick: o[2] || (o[2] = u((i) => d("json"), ["prevent"]))
|
|
62
|
+
}, " Download OpenAPI Document "))
|
|
63
|
+
], 64)) : r("", !0);
|
|
55
64
|
}
|
|
56
65
|
});
|
|
57
66
|
export {
|
|
58
|
-
|
|
67
|
+
V as default
|
|
59
68
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/components/RequestExample.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/components/RequestExample.vue"],"names":[],"mappings":"AAqcA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGrF,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAGvE,OAAO,KAAK,EACV,eAAe,EACf,oBAAoB,EACpB,YAAY,EACb,MAAM,8DAA8D,CAAA;AASrE,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gDAAgD,CAAA;AAKvD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;OAEG;IACH,aAAa,EAAE,iBAAiB,EAAE,CAAA;IAClC;;;;OAIG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IACzC;;OAEG;IACH,cAAc,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACzC;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB;;OAEG;IACH,eAAe,CAAC,EAAE,oBAAoB,EAAE,CAAA;IACxC;;OAEG;IACH,MAAM,EAAE,cAAc,CAAA;IACtB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,SAAS,EAAE,eAAe,CAAA;IAC1B;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAA;CACpB,CAAA;AAED;;;;;;;;GAQG;;YAkBO,MAAM,OAAO;YACb,MAAM,OAAO;;AAlBvB,wBAuiBC;AAOD,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./RequestExample.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-8b2bccdf"]]);
|
|
5
5
|
export {
|
|
6
6
|
r as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as D, computed as u, ref as k, watch as H, useId as I, createBlock as
|
|
1
|
+
import { defineComponent as D, computed as u, ref as k, watch as H, useId as I, createBlock as h, createCommentVNode as m, openBlock as i, unref as o, withCtx as n, createVNode as s, createSlots as N, createElementVNode as y, createElementBlock as S, renderSlot as C, toDisplayString as z } from "vue";
|
|
2
2
|
import { ScalarCard as E, ScalarCardHeader as K, ScalarCombobox as M, ScalarButton as F, ScalarCardSection as q, ScalarCodeBlock as U, ScalarCardFooter as A } from "@scalar/components";
|
|
3
3
|
import { freezeElement as G } from "@scalar/helpers/dom/freeze-element";
|
|
4
4
|
import { ScalarIconCaretDown as J } from "@scalar/icons";
|
|
@@ -6,12 +6,12 @@ import { operationToHar as P } from "@scalar/oas-utils/helpers/operation-to-har"
|
|
|
6
6
|
import { emitCustomEvent as T } from "@scalar/workspace-store/events";
|
|
7
7
|
import { getResolvedRef as Q } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
8
8
|
import { getResolvedRefDeep as $ } from "../../../../features/example-responses/helpers/get-resolved-ref-deep.js";
|
|
9
|
-
import { findClient as
|
|
10
|
-
import { generateCustomId as
|
|
9
|
+
import { findClient as j } from "../helpers/find-client.js";
|
|
10
|
+
import { generateCustomId as B } from "../helpers/generate-client-options.js";
|
|
11
11
|
import { generateCodeSnippet as X } from "../helpers/generate-code-snippet.js";
|
|
12
12
|
import { getSecrets as Y } from "../helpers/get-secrets.js";
|
|
13
13
|
import Z from "./ExamplePicker.vue2.js";
|
|
14
|
-
import
|
|
14
|
+
import V from "../../../../components/HttpMethod/HttpMethod.vue.js";
|
|
15
15
|
const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], le = {
|
|
16
16
|
key: 0,
|
|
17
17
|
class: "request-card-footer-addon"
|
|
@@ -36,40 +36,40 @@ const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], l
|
|
|
36
36
|
const c = u(() => {
|
|
37
37
|
const e = Q(l.operation.requestBody)?.content ?? {}, t = l.selectedContentType || Object.keys(e)[0];
|
|
38
38
|
return e[t]?.examples ?? {};
|
|
39
|
-
}),
|
|
39
|
+
}), f = k(
|
|
40
40
|
l.selectedExample ?? Object.keys(c.value)[0]
|
|
41
|
-
),
|
|
41
|
+
), b = u(() => [
|
|
42
42
|
"x-custom-examples",
|
|
43
43
|
"x-codeSamples",
|
|
44
44
|
"x-code-samples"
|
|
45
|
-
].flatMap((t) => l.operation[t] ?? [])),
|
|
45
|
+
].flatMap((t) => l.operation[t] ?? [])), p = u(() => b.value.length ? [
|
|
46
46
|
{
|
|
47
47
|
label: "Code Examples",
|
|
48
|
-
options:
|
|
49
|
-
const a =
|
|
48
|
+
options: b.value.map((t) => {
|
|
49
|
+
const a = B(t), v = t.label || t.lang || a;
|
|
50
50
|
return {
|
|
51
51
|
id: a,
|
|
52
52
|
lang: t.lang || "plaintext",
|
|
53
|
-
title:
|
|
54
|
-
label:
|
|
53
|
+
title: v,
|
|
54
|
+
label: v
|
|
55
55
|
};
|
|
56
56
|
})
|
|
57
57
|
},
|
|
58
58
|
...l.clientOptions
|
|
59
59
|
] : l.clientOptions), r = k(
|
|
60
|
-
|
|
60
|
+
j(p.value, l.selectedClient) ?? null
|
|
61
61
|
);
|
|
62
62
|
H(
|
|
63
63
|
() => l.selectedClient,
|
|
64
64
|
(e) => {
|
|
65
|
-
const t =
|
|
65
|
+
const t = j(p.value, e);
|
|
66
66
|
t && (r.value = t);
|
|
67
67
|
}
|
|
68
68
|
);
|
|
69
|
-
const
|
|
69
|
+
const g = u(() => {
|
|
70
70
|
if (!l.isWebhook) return null;
|
|
71
71
|
try {
|
|
72
|
-
const e = c.value[
|
|
72
|
+
const e = c.value[f.value || ""], t = $(e), a = t?.value ?? t?.summary;
|
|
73
73
|
return P({ operation: l.operation, method: l.method, path: l.path, example: a });
|
|
74
74
|
} catch (e) {
|
|
75
75
|
return console.error("[webhookHar]", e), null;
|
|
@@ -77,11 +77,11 @@ const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], l
|
|
|
77
77
|
}), x = u(() => {
|
|
78
78
|
try {
|
|
79
79
|
if (r.value?.id.startsWith("custom"))
|
|
80
|
-
return
|
|
81
|
-
(
|
|
80
|
+
return b.value.find(
|
|
81
|
+
(v) => B(v) === r.value?.id
|
|
82
82
|
)?.source ?? "Custom example not found";
|
|
83
|
-
const e = c.value[
|
|
84
|
-
return l.isWebhook ?
|
|
83
|
+
const e = c.value[f.value || ""], t = $(e), a = t?.value ?? t?.summary;
|
|
84
|
+
return l.isWebhook ? g.value?.postData?.text ?? "" : X({
|
|
85
85
|
clientId: r.value?.id,
|
|
86
86
|
operation: l.operation,
|
|
87
87
|
method: l.method,
|
|
@@ -94,62 +94,63 @@ const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], l
|
|
|
94
94
|
} catch (e) {
|
|
95
95
|
return console.error("[generateSnippet]", e), "";
|
|
96
96
|
}
|
|
97
|
-
}),
|
|
98
|
-
if (!
|
|
99
|
-
const e =
|
|
97
|
+
}), w = u(() => l.isWebhook ? O.value : r.value?.lang), O = u(() => {
|
|
98
|
+
if (!g.value?.postData) return "json";
|
|
99
|
+
const e = g.value.postData.mimeType;
|
|
100
100
|
return e?.includes("json") ? "json" : e?.includes("xml") ? "xml" : e?.includes("yaml") || e?.includes("yml") ? "yaml" : e?.includes("text/plain") ? "text" : "json";
|
|
101
|
-
}),
|
|
102
|
-
if (
|
|
103
|
-
const t = G(
|
|
101
|
+
}), W = u(() => Y(l.securitySchemes)), d = k(null), L = (e) => {
|
|
102
|
+
if (d.value) {
|
|
103
|
+
const t = G(d.value.$el);
|
|
104
104
|
setTimeout(() => {
|
|
105
105
|
t();
|
|
106
106
|
}, 300);
|
|
107
107
|
}
|
|
108
|
-
r.value = e, e.id.startsWith("custom") || T(
|
|
108
|
+
r.value = e, e.id.startsWith("custom") || T(d.value?.$el, "scalar-update-selected-client", e.id);
|
|
109
109
|
}, R = I();
|
|
110
|
-
return (e, t) => x.value ? (
|
|
110
|
+
return (e, t) => x.value ? (i(), h(o(E), {
|
|
111
111
|
key: 0,
|
|
112
112
|
ref_key: "elem",
|
|
113
|
-
ref:
|
|
113
|
+
ref: d,
|
|
114
114
|
class: "request-card dark-mode"
|
|
115
115
|
}, {
|
|
116
|
-
default:
|
|
117
|
-
|
|
118
|
-
default:
|
|
119
|
-
t[3] || (t[3] =
|
|
120
|
-
|
|
116
|
+
default: n(() => [
|
|
117
|
+
s(o(K), { class: "pr-2.5" }, N({
|
|
118
|
+
default: n(() => [
|
|
119
|
+
t[3] || (t[3] = y("span", { class: "sr-only" }, "Request Example for", -1)),
|
|
120
|
+
s(o(V), {
|
|
121
121
|
as: "span",
|
|
122
122
|
class: "request-method",
|
|
123
123
|
method: e.method
|
|
124
124
|
}, null, 8, ["method"]),
|
|
125
|
-
e.generateLabel ? (
|
|
125
|
+
e.generateLabel ? (i(), S("span", {
|
|
126
126
|
key: 0,
|
|
127
127
|
innerHTML: e.generateLabel()
|
|
128
|
-
}, null, 8, _)) :
|
|
128
|
+
}, null, 8, _)) : m("", !0),
|
|
129
|
+
C(e.$slots, "header", {}, void 0, !0)
|
|
129
130
|
]),
|
|
130
131
|
_: 2
|
|
131
132
|
}, [
|
|
132
|
-
!e.isWebhook &&
|
|
133
|
+
!e.isWebhook && p.value.length ? {
|
|
133
134
|
name: "actions",
|
|
134
|
-
fn:
|
|
135
|
-
|
|
135
|
+
fn: n(() => [
|
|
136
|
+
s(o(M), {
|
|
136
137
|
class: "max-h-80",
|
|
137
138
|
modelValue: r.value,
|
|
138
|
-
options:
|
|
139
|
+
options: p.value,
|
|
139
140
|
placement: "bottom-end",
|
|
140
141
|
teleport: "",
|
|
141
|
-
"onUpdate:modelValue": t[0] || (t[0] = (a) =>
|
|
142
|
+
"onUpdate:modelValue": t[0] || (t[0] = (a) => L(a))
|
|
142
143
|
}, {
|
|
143
|
-
default:
|
|
144
|
-
|
|
144
|
+
default: n(() => [
|
|
145
|
+
s(o(F), {
|
|
145
146
|
class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5",
|
|
146
147
|
"data-testid": "client-picker",
|
|
147
148
|
fullWidth: "",
|
|
148
149
|
variant: "ghost"
|
|
149
150
|
}, {
|
|
150
|
-
default:
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
default: n(() => [
|
|
152
|
+
y("span", ee, z(r.value.title), 1),
|
|
153
|
+
s(o(J), {
|
|
153
154
|
class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100",
|
|
154
155
|
weight: "bold"
|
|
155
156
|
})
|
|
@@ -163,66 +164,71 @@ const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], l
|
|
|
163
164
|
key: "0"
|
|
164
165
|
} : void 0
|
|
165
166
|
]), 1024),
|
|
166
|
-
|
|
167
|
-
default:
|
|
168
|
-
|
|
167
|
+
s(o(q), { class: "request-editor-section custom-scroll p-0" }, {
|
|
168
|
+
default: n(() => [
|
|
169
|
+
y("div", {
|
|
169
170
|
id: `${o(R)}-example`,
|
|
170
171
|
class: "code-snippet"
|
|
171
172
|
}, [
|
|
172
|
-
|
|
173
|
+
s(o(U), {
|
|
173
174
|
class: "bg-b-2 !min-h-full -outline-offset-2",
|
|
174
175
|
content: x.value,
|
|
175
|
-
hideCredentials:
|
|
176
|
-
lang:
|
|
176
|
+
hideCredentials: W.value,
|
|
177
|
+
lang: w.value,
|
|
177
178
|
lineNumbers: ""
|
|
178
179
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
179
180
|
], 8, te)
|
|
180
181
|
]),
|
|
181
182
|
_: 1
|
|
182
183
|
}),
|
|
183
|
-
Object.keys(c.value).length || e.$slots.footer ? (
|
|
184
|
+
Object.keys(c.value).length > 1 || e.$slots.footer ? (i(), h(o(A), {
|
|
184
185
|
key: 0,
|
|
185
186
|
class: "request-card-footer bg-b-3"
|
|
186
187
|
}, {
|
|
187
|
-
default:
|
|
188
|
-
Object.keys(c.value).length ? (
|
|
189
|
-
|
|
190
|
-
|
|
188
|
+
default: n(() => [
|
|
189
|
+
Object.keys(c.value).length > 1 ? (i(), S("div", le, [
|
|
190
|
+
Object.keys(c.value).length ? (i(), h(Z, {
|
|
191
|
+
key: 0,
|
|
192
|
+
modelValue: f.value,
|
|
191
193
|
"onUpdate:modelValue": [
|
|
192
|
-
t[1] || (t[1] = (a) =>
|
|
193
|
-
t[2] || (t[2] = (a) => o(T)(
|
|
194
|
+
t[1] || (t[1] = (a) => f.value = a),
|
|
195
|
+
t[2] || (t[2] = (a) => o(T)(
|
|
196
|
+
d.value?.$el,
|
|
197
|
+
"scalar-update-selected-example",
|
|
198
|
+
a
|
|
199
|
+
))
|
|
194
200
|
],
|
|
195
201
|
examples: c.value
|
|
196
|
-
}, null, 8, ["modelValue", "examples"])
|
|
197
|
-
])) :
|
|
198
|
-
|
|
202
|
+
}, null, 8, ["modelValue", "examples"])) : m("", !0)
|
|
203
|
+
])) : m("", !0),
|
|
204
|
+
C(e.$slots, "footer", {}, void 0, !0)
|
|
199
205
|
]),
|
|
200
206
|
_: 3
|
|
201
|
-
})) :
|
|
207
|
+
})) : m("", !0)
|
|
202
208
|
]),
|
|
203
209
|
_: 3
|
|
204
|
-
}, 512)) : e.fallback ? (
|
|
210
|
+
}, 512)) : e.fallback ? (i(), h(o(E), {
|
|
205
211
|
key: 1,
|
|
206
212
|
class: "request-card dark-mode"
|
|
207
213
|
}, {
|
|
208
|
-
default:
|
|
209
|
-
|
|
210
|
-
default:
|
|
211
|
-
|
|
212
|
-
|
|
214
|
+
default: n(() => [
|
|
215
|
+
s(o(q), { class: "request-card-simple" }, {
|
|
216
|
+
default: n(() => [
|
|
217
|
+
y("div", oe, [
|
|
218
|
+
s(o(V), {
|
|
213
219
|
as: "span",
|
|
214
220
|
class: "request-method",
|
|
215
221
|
method: e.method
|
|
216
222
|
}, null, 8, ["method"]),
|
|
217
|
-
|
|
223
|
+
C(e.$slots, "header", {}, void 0, !0)
|
|
218
224
|
]),
|
|
219
|
-
|
|
225
|
+
C(e.$slots, "footer", {}, void 0, !0)
|
|
220
226
|
]),
|
|
221
227
|
_: 3
|
|
222
228
|
})
|
|
223
229
|
]),
|
|
224
230
|
_: 3
|
|
225
|
-
})) :
|
|
231
|
+
})) : m("", !0);
|
|
226
232
|
}
|
|
227
233
|
});
|
|
228
234
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map-configuration.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/map-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAG9D;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,CAAC,yBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"map-configuration.d.ts","sourceRoot":"","sources":["../../../src/v2/helpers/map-configuration.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,eAAe,CAAA;AAG9D;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,GAAI,QAAQ,OAAO,CAAC,yBAAyB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAiD0i3C,CAAC;;;gBAAyH,CAAC;;;;;mBAAsS,CAAC;uBAAyC,CAAC;;;gBAA1N,CAAC;;;;kBAA4W,CAAC;;;CADpt4C,CAAA"}
|