@scalar/api-reference 1.34.2 → 1.34.4
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 +93 -0
- package/README.md +1 -1
- package/dist/browser/standalone.js +13120 -12730
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Badge/Badge.vue.d.ts +4 -1
- package/dist/components/Badge/Badge.vue.d.ts.map +1 -1
- package/dist/components/Badge/Badge.vue.js +5 -11
- package/dist/components/Badge/Badge.vue2.js +22 -2
- package/dist/components/Badge/Badge.vue3.js +4 -0
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts +1 -1
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.d.ts.map +1 -1
- package/dist/components/Content/ClientLibraries/ClientLibraries.vue.js +1 -1
- package/dist/components/Content/Models/Models.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/Models.vue.js +30 -31
- package/dist/components/Content/Models/ModernLayout.vue.d.ts +2 -0
- package/dist/components/Content/Models/ModernLayout.vue.d.ts.map +1 -1
- package/dist/components/Content/Models/ModernLayout.vue.js +2 -2
- package/dist/components/Content/Models/ModernLayout.vue2.js +39 -37
- package/dist/components/Content/Operations/TraversedEntry.vue.js +12 -12
- package/dist/components/Content/Tags/TagSection.vue.js +6 -6
- package/dist/components/GettingStarted.vue.js +3 -3
- package/dist/components/GettingStarted.vue2.js +21 -21
- package/dist/components/MobileHeader.vue.d.ts.map +1 -1
- package/dist/components/MobileHeader.vue.js +3 -3
- package/dist/components/Section/CompactSection.vue.d.ts +2 -0
- package/dist/components/Section/CompactSection.vue.d.ts.map +1 -1
- package/dist/components/Section/CompactSection.vue.js +1 -1
- package/dist/components/Section/CompactSection.vue2.js +30 -29
- package/dist/features/Operation/Operation.vue.d.ts +2 -1
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +53 -52
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +1 -2
- 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.vue3.js +2 -2
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.js +16 -16
- package/dist/features/Operation/helpers/combine-params.d.ts +5 -0
- package/dist/features/Operation/helpers/combine-params.d.ts.map +1 -0
- package/dist/features/Operation/helpers/combine-params.js +13 -0
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +3 -4
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ClassicLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ClassicLayout.vue2.js +59 -50
- package/dist/features/Operation/layouts/ClassicLayout.vue3.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +3 -4
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts.map +1 -1
- package/dist/features/Operation/layouts/ModernLayout.vue.js +2 -2
- package/dist/features/Operation/layouts/ModernLayout.vue2.js +94 -78
- package/dist/features/Search/helpers/create-fuse-instance.d.ts.map +1 -1
- package/dist/features/Search/helpers/create-fuse-instance.js +0 -3
- package/dist/features/api-client-modal/ApiClientModal.vue.js +9 -9
- package/dist/features/api-client-modal/useApiClient.d.ts +100 -100
- package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
- package/dist/features/document-source/hooks/useDocumentFetcher.d.ts.map +1 -1
- package/dist/features/document-source/hooks/useDocumentFetcher.js +16 -18
- package/dist/features/document-source/hooks/useDocumentSource.d.ts.map +1 -1
- package/dist/features/document-source/hooks/useDocumentSource.js +30 -33
- package/dist/features/example-responses/ExampleResponse.vue.d.ts +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponse.vue.js +2 -2
- package/dist/features/example-responses/ExampleResponse.vue2.js +15 -13
- package/dist/features/example-responses/ExampleResponses.vue.d.ts +2 -3
- package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +2 -2
- package/dist/features/example-responses/ExampleResponses.vue2.js +73 -69
- package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts +26 -0
- package/dist/features/example-responses/helpers/get-resolved-ref-deep.d.ts.map +1 -0
- package/dist/features/example-responses/helpers/get-resolved-ref-deep.js +29 -0
- package/dist/features/sidebar/components/SidebarElement.vue.d.ts.map +1 -1
- package/dist/features/sidebar/components/SidebarElement.vue.js +1 -1
- package/dist/features/sidebar/components/SidebarElement.vue2.js +6 -6
- package/dist/features/sidebar/helpers/create-sidebar.d.ts.map +1 -1
- package/dist/features/sidebar/helpers/create-sidebar.js +13 -14
- package/dist/features/traverse-schema/helpers/traverse-paths.d.ts +1 -2
- 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-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 +11 -12
- package/dist/features/traverse-schema/types.d.ts.map +1 -1
- package/dist/features/x-badges/XBadges.vue.d.ts +8 -0
- package/dist/features/x-badges/XBadges.vue.d.ts.map +1 -0
- package/dist/features/x-badges/XBadges.vue.js +26 -0
- package/dist/features/x-badges/XBadges.vue2.js +4 -0
- package/dist/features/x-badges/index.d.ts +2 -0
- package/dist/features/x-badges/index.d.ts.map +1 -0
- package/dist/helpers/test-utils.d.ts +1 -1
- package/dist/helpers/test-utils.d.ts.map +1 -1
- package/dist/hooks/useNavState.d.ts +1 -2
- package/dist/hooks/useNavState.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/libs/openapi.d.ts +4 -14
- package/dist/libs/openapi.d.ts.map +1 -1
- package/dist/libs/openapi.js +55 -36
- package/dist/style.css +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +64 -64
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue.d.ts +1 -2
- 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 +2 -2
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +97 -100
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.d.ts +1 -2
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +17 -20
- package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.d.ts.map +1 -1
- package/dist/v2/helpers/map-configuration.d.ts +66 -0
- package/dist/v2/helpers/map-configuration.d.ts.map +1 -0
- package/dist/v2/helpers/map-configuration.js +53 -0
- package/dist/vitest.setup.d.ts +2 -0
- package/dist/vitest.setup.d.ts.map +1 -0
- package/package.json +24 -20
|
@@ -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":"AAgVA,OAAO,KAAK,EACV,4BAA4B,EAE7B,MAAM,eAAe,CAAA;AAEtB,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AA2BpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AA4NF,iBAAS,cAAc;WA8GT,OAAO,IAA6B;;wBAXrB,GAAG;wBACH,GAAG;iCACM,GAAG;;;;;;EAcxC;AAgBD,KAAK,oBAAoB,GAAG,UAAU,CAAC,OAAO,cAAc,CAAC,CAAC;AAC9D,QAAA,MAAM,eAAe,kSAMnB,CAAC;wBACkB,uBAAuB,CAAC,OAAO,eAAe,EAAE,oBAAoB,CAAC,OAAO,CAAC,CAAC;AAAnG,wBAAoG;AAWpG,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as R, ref as c, toRef as _, provide as $, useTemplateRef as w, onBeforeMount as V, watch as u, computed as A, createElementBlock as B, openBlock as
|
|
2
|
-
import { safeLocalStorage as
|
|
1
|
+
import { defineComponent as R, ref as c, toRef as _, provide as $, useTemplateRef as w, onBeforeMount as V, watch as u, computed as A, createElementBlock as B, openBlock as k, createBlock as P, createCommentVNode as U, createVNode as D, unref as n, resolveDynamicComponent as K, withCtx as i, createTextVNode as F, toDisplayString as O, renderSlot as f, isRef as Y } from "vue";
|
|
2
|
+
import { safeLocalStorage as E, REFERENCE_LS_KEYS as x } from "@scalar/helpers/object/local-storage";
|
|
3
3
|
import { makeUrlAbsolute as z } from "@scalar/helpers/url/make-url-absolute";
|
|
4
4
|
import { redirectToProxy as H } from "@scalar/oas-utils/helpers";
|
|
5
5
|
import { useColorMode as W } from "@scalar/use-hooks/useColorMode";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import J from "../
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { normalizeContent as
|
|
14
|
-
import { useMultipleDocuments as
|
|
15
|
-
import { onCustomEvent as
|
|
16
|
-
import
|
|
17
|
-
const
|
|
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
|
+
import { isClient as g } from "./blocks/scalar-request-example-block/helpers/find-client.js";
|
|
11
|
+
import { getDocumentName as Q } from "./helpers/get-document-name.js";
|
|
12
|
+
import { mapConfiguration as M } from "./helpers/map-configuration.js";
|
|
13
|
+
import { normalizeContent as X } from "./helpers/normalize-content.js";
|
|
14
|
+
import { useMultipleDocuments as Z } from "../features/multiple-documents/useMultipleDocuments.js";
|
|
15
|
+
import { onCustomEvent as p } from "./events/listeners.js";
|
|
16
|
+
import ee from "../features/multiple-documents/DocumentSelector.vue.js";
|
|
17
|
+
const ke = /* @__PURE__ */ R({
|
|
18
18
|
__name: "ApiReferenceWorkspace",
|
|
19
19
|
props: {
|
|
20
20
|
configuration: {},
|
|
@@ -24,11 +24,11 @@ const De = /* @__PURE__ */ R({
|
|
|
24
24
|
const v = y, {
|
|
25
25
|
availableDocuments: C,
|
|
26
26
|
selectedConfiguration: o,
|
|
27
|
-
selectedDocumentIndex:
|
|
27
|
+
selectedDocumentIndex: s,
|
|
28
28
|
isIntersectionEnabled: m,
|
|
29
29
|
hash: S,
|
|
30
30
|
hashPrefix: T
|
|
31
|
-
} =
|
|
31
|
+
} = Z({
|
|
32
32
|
configuration: _(v, "configuration"),
|
|
33
33
|
isIntersectionEnabled: c(!1),
|
|
34
34
|
hash: c(""),
|
|
@@ -37,35 +37,32 @@ const De = /* @__PURE__ */ R({
|
|
|
37
37
|
H(o.value.proxyUrl, e.toString()),
|
|
38
38
|
t
|
|
39
39
|
);
|
|
40
|
-
$(
|
|
40
|
+
$(J, { isIntersectionEnabled: m, hash: S, hashPrefix: T });
|
|
41
41
|
const d = w("root"), a = v.store;
|
|
42
42
|
V(() => {
|
|
43
|
-
const e =
|
|
44
|
-
|
|
43
|
+
const e = E().getItem(
|
|
44
|
+
x.SELECTED_CLIENT
|
|
45
45
|
);
|
|
46
|
-
|
|
46
|
+
g(e) && !a.workspace["x-scalar-default-client"] && a.update("x-scalar-default-client", e);
|
|
47
47
|
});
|
|
48
|
-
const
|
|
48
|
+
const b = async (e) => {
|
|
49
49
|
var l;
|
|
50
|
-
const t =
|
|
50
|
+
const t = X(e.content), r = Q({
|
|
51
51
|
name: e.slug || e.title,
|
|
52
52
|
url: e.url,
|
|
53
53
|
document: t
|
|
54
54
|
});
|
|
55
55
|
if (a.workspace.documents[r]) {
|
|
56
|
-
|
|
57
|
-
m.value = !
|
|
58
|
-
|
|
59
|
-
a.replaceDocument(r, N), a.update("x-scalar-active-document", r), setTimeout(() => {
|
|
60
|
-
m.value = !0;
|
|
61
|
-
}, 300);
|
|
62
|
-
}
|
|
56
|
+
t && (m.value = !1, a.replaceDocument(r, t), a.update("x-scalar-active-document", r), setTimeout(() => {
|
|
57
|
+
m.value = !0;
|
|
58
|
+
}, 300));
|
|
63
59
|
return;
|
|
64
60
|
}
|
|
65
61
|
if (t)
|
|
66
62
|
return await a.addDocument({
|
|
67
63
|
name: r,
|
|
68
|
-
document: t
|
|
64
|
+
document: t,
|
|
65
|
+
config: M(e)
|
|
69
66
|
});
|
|
70
67
|
if (e.url)
|
|
71
68
|
return await a.addDocument({
|
|
@@ -73,34 +70,37 @@ const De = /* @__PURE__ */ R({
|
|
|
73
70
|
url: z(e.url, {
|
|
74
71
|
basePath: (l = o.value.pathRouting) == null ? void 0 : l.basePath
|
|
75
72
|
}),
|
|
76
|
-
fetch: h
|
|
73
|
+
fetch: h,
|
|
74
|
+
config: M(e)
|
|
77
75
|
});
|
|
78
76
|
};
|
|
79
77
|
u(
|
|
80
|
-
|
|
81
|
-
|
|
78
|
+
[
|
|
79
|
+
() => o.value.slug,
|
|
80
|
+
() => o.value.url,
|
|
81
|
+
() => o.value.content
|
|
82
|
+
],
|
|
83
|
+
([e, t, r]) => {
|
|
84
|
+
(e || t || r) && b(o.value);
|
|
85
|
+
},
|
|
82
86
|
{ immediate: !0 }
|
|
83
|
-
),
|
|
84
|
-
() => o.value.content,
|
|
85
|
-
(e) => e && k(o.value),
|
|
86
|
-
{ immediate: !0, deep: !0 }
|
|
87
|
-
), f(d, "scalar-update-dark-mode", (e) => {
|
|
87
|
+
), p(d, "scalar-update-dark-mode", (e) => {
|
|
88
88
|
a.update("x-scalar-dark-mode", e.detail.value);
|
|
89
|
-
}),
|
|
89
|
+
}), p(d, "scalar-update-active-document", (e) => {
|
|
90
90
|
a.update("x-scalar-active-document", e.detail.value);
|
|
91
|
-
}),
|
|
92
|
-
a.update("x-scalar-default-client", e.detail),
|
|
91
|
+
}), p(d, "scalar-update-selected-client", (e) => {
|
|
92
|
+
a.update("x-scalar-default-client", e.detail), E().setItem(x.SELECTED_CLIENT, e.detail);
|
|
93
93
|
}), u(
|
|
94
94
|
() => o.value.defaultHttpClient,
|
|
95
95
|
(e) => {
|
|
96
96
|
if (e) {
|
|
97
97
|
const { targetKey: t, clientKey: r } = e, l = `${t}/${r}`;
|
|
98
|
-
|
|
98
|
+
g(l) && a.update("x-scalar-default-client", l);
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
{ immediate: !0 }
|
|
102
102
|
);
|
|
103
|
-
const { toggleColorMode:
|
|
103
|
+
const { toggleColorMode: I, isDarkMode: L } = W({
|
|
104
104
|
initialColorMode: o.value.darkMode ? "dark" : void 0,
|
|
105
105
|
overrideColorMode: o.value.forceDarkModeState
|
|
106
106
|
});
|
|
@@ -108,11 +108,11 @@ const De = /* @__PURE__ */ R({
|
|
|
108
108
|
() => o.value.darkMode,
|
|
109
109
|
(e) => a.update("x-scalar-dark-mode", !!e)
|
|
110
110
|
), u(
|
|
111
|
-
() =>
|
|
111
|
+
() => L.value,
|
|
112
112
|
(e) => a.update("x-scalar-dark-mode", e),
|
|
113
113
|
{ immediate: !0 }
|
|
114
114
|
), u(
|
|
115
|
-
() =>
|
|
115
|
+
() => s.value,
|
|
116
116
|
(e) => {
|
|
117
117
|
var t;
|
|
118
118
|
return a.update(
|
|
@@ -121,42 +121,42 @@ const De = /* @__PURE__ */ R({
|
|
|
121
121
|
);
|
|
122
122
|
},
|
|
123
123
|
{ immediate: !0 }
|
|
124
|
-
), o.value.metaData &&
|
|
125
|
-
const
|
|
126
|
-
return
|
|
124
|
+
), o.value.metaData && j(o.value.metaData);
|
|
125
|
+
const N = A(() => o.value.favicon);
|
|
126
|
+
return q(N), (e, t) => {
|
|
127
127
|
var r;
|
|
128
|
-
return
|
|
128
|
+
return k(), B("div", {
|
|
129
129
|
ref_key: "root",
|
|
130
130
|
ref: d
|
|
131
131
|
}, [
|
|
132
|
-
(r = n(o)) != null && r.customCss ? (
|
|
133
|
-
default:
|
|
132
|
+
(r = n(o)) != null && r.customCss ? (k(), P(K("style"), { key: 0 }, {
|
|
133
|
+
default: i(() => [
|
|
134
134
|
F(O(n(o).customCss), 1)
|
|
135
135
|
]),
|
|
136
136
|
_: 1
|
|
137
137
|
})) : U("", !0),
|
|
138
|
-
|
|
138
|
+
D(G, {
|
|
139
139
|
configuration: n(o),
|
|
140
140
|
isDark: !!n(a).workspace["x-scalar-dark-mode"],
|
|
141
141
|
store: n(a),
|
|
142
|
-
onToggleDarkMode: t[1] || (t[1] = () => n(
|
|
142
|
+
onToggleDarkMode: t[1] || (t[1] = () => n(I)()),
|
|
143
143
|
onUpdateContent: t[2] || (t[2] = (l) => e.$emit("updateContent", l))
|
|
144
144
|
}, {
|
|
145
|
-
footer:
|
|
146
|
-
|
|
145
|
+
footer: i(() => [
|
|
146
|
+
f(e.$slots, "footer")
|
|
147
147
|
]),
|
|
148
|
-
"content-end":
|
|
149
|
-
|
|
148
|
+
"content-end": i(() => [
|
|
149
|
+
f(e.$slots, "footer")
|
|
150
150
|
]),
|
|
151
|
-
"document-selector":
|
|
152
|
-
|
|
153
|
-
modelValue: n(
|
|
154
|
-
"onUpdate:modelValue": t[0] || (t[0] = (l) => Y(
|
|
151
|
+
"document-selector": i(() => [
|
|
152
|
+
D(n(ee), {
|
|
153
|
+
modelValue: n(s),
|
|
154
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => Y(s) ? s.value = l : null),
|
|
155
155
|
options: n(C)
|
|
156
156
|
}, null, 8, ["modelValue", "options"])
|
|
157
157
|
]),
|
|
158
|
-
"sidebar-start":
|
|
159
|
-
|
|
158
|
+
"sidebar-start": i(() => [
|
|
159
|
+
f(e.$slots, "sidebar-start")
|
|
160
160
|
]),
|
|
161
161
|
_: 3
|
|
162
162
|
}, 8, ["configuration", "isDark", "store"])
|
|
@@ -165,5 +165,5 @@ const De = /* @__PURE__ */ R({
|
|
|
165
165
|
}
|
|
166
166
|
});
|
|
167
167
|
export {
|
|
168
|
-
|
|
168
|
+
ke as default
|
|
169
169
|
};
|
|
@@ -3,7 +3,6 @@ import { type AvailableClients } from '@scalar/snippetz';
|
|
|
3
3
|
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/path-operations';
|
|
4
4
|
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/security-scheme';
|
|
5
5
|
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server';
|
|
6
|
-
import { type Dereference } from '@scalar/workspace-store/schemas/v3.1/type-guard';
|
|
7
6
|
import type { ClientOptionGroup } from '../../../../v2/blocks/scalar-request-example-block/types';
|
|
8
7
|
export type RequestExampleProps = {
|
|
9
8
|
/**
|
|
@@ -46,7 +45,7 @@ export type RequestExampleProps = {
|
|
|
46
45
|
/**
|
|
47
46
|
* De-referenced OpenAPI Operation object
|
|
48
47
|
*/
|
|
49
|
-
operation:
|
|
48
|
+
operation: OperationObject;
|
|
50
49
|
/**
|
|
51
50
|
* If true and there's no example, we will display a small card with the method and path only
|
|
52
51
|
*/
|
|
@@ -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":"AA6YA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAErF,OAAO,EAAE,KAAK,gBAAgB,EAAiB,MAAM,kBAAkB,CAAA;AAEvE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAStF,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gDAAgD,CAAA;AAOvD,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;CAC7B,CAAA;AAED;;;;;;;;GAQG;;YAmBO,MAAM,OAAO;YACb,MAAM,OAAO;;YADb,MAAM,OAAO;YACb,MAAM,OAAO;;AAnBvB,wBA2bC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./RequestExample.vue2.js";
|
|
2
2
|
import "./RequestExample.vue3.js";
|
|
3
3
|
import t from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const r = /* @__PURE__ */ t(o, [["__scopeId", "data-v-9b79701d"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
r as default
|
|
7
7
|
};
|
|
@@ -1,20 +1,21 @@
|
|
|
1
|
-
import { defineComponent as N, computed as
|
|
2
|
-
import { ScalarCard as $, ScalarCardHeader as M, ScalarCombobox as W, ScalarButton as
|
|
3
|
-
import { freezeElement as
|
|
4
|
-
import { ScalarIconCaretDown as
|
|
5
|
-
import {
|
|
1
|
+
import { defineComponent as N, computed as m, ref as g, watch as z, useId as D, createBlock as S, createCommentVNode as b, openBlock as f, unref as o, withCtx as c, createVNode as n, createSlots as H, createElementVNode as v, createElementBlock as q, renderSlot as h, toDisplayString as K } from "vue";
|
|
2
|
+
import { ScalarCard as $, ScalarCardHeader as M, ScalarCombobox as W, ScalarButton as F, ScalarCardSection as E, ScalarCodeBlock as U, ScalarCardFooter as A } from "@scalar/components";
|
|
3
|
+
import { freezeElement as G } from "@scalar/helpers/dom/freeze-element";
|
|
4
|
+
import { ScalarIconCaretDown as J } from "@scalar/icons";
|
|
5
|
+
import { getResolvedRef as P } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
6
|
+
import { getResolvedRefDeep as Q } from "../../../../features/example-responses/helpers/get-resolved-ref-deep.js";
|
|
6
7
|
import { findClient as V } from "../helpers/find-client.js";
|
|
7
|
-
import { generateCustomId as
|
|
8
|
-
import { generateCodeSnippet as
|
|
9
|
-
import { getSecrets as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
8
|
+
import { generateCustomId as T } from "../helpers/generate-client-options.js";
|
|
9
|
+
import { generateCodeSnippet as X } from "../helpers/generate-code-snippet.js";
|
|
10
|
+
import { getSecrets as Y } from "../helpers/get-secrets.js";
|
|
11
|
+
import Z from "./ExamplePicker.vue2.js";
|
|
12
|
+
import B from "../../../../components/HttpMethod/HttpMethod.vue.js";
|
|
12
13
|
import { emitCustomEvent as O } from "../../../events/definitions.js";
|
|
13
|
-
const
|
|
14
|
+
const _ = ["innerHTML"], ee = { class: "text-base font-normal" }, te = ["id"], le = {
|
|
14
15
|
key: 0,
|
|
15
16
|
class: "request-card-footer-addon"
|
|
16
|
-
},
|
|
17
|
-
...
|
|
17
|
+
}, ae = { class: "request-header" }, oe = {}, ye = /* @__PURE__ */ N({
|
|
18
|
+
...oe,
|
|
18
19
|
__name: "RequestExample",
|
|
19
20
|
props: {
|
|
20
21
|
clientOptions: {},
|
|
@@ -29,122 +30,118 @@ const Y = ["innerHTML"], Z = { class: "text-base font-normal" }, _ = ["id"], ee
|
|
|
29
30
|
fallback: { type: Boolean },
|
|
30
31
|
generateLabel: { type: Function }
|
|
31
32
|
},
|
|
32
|
-
setup(
|
|
33
|
-
const
|
|
34
|
-
var
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
o.selectedExample ?? Object.keys(c.value)[0]
|
|
41
|
-
), C = i(() => [
|
|
33
|
+
setup(a) {
|
|
34
|
+
const u = m(() => {
|
|
35
|
+
var s, r;
|
|
36
|
+
const t = ((s = P(a.operation.requestBody)) == null ? void 0 : s.content) ?? {}, e = a.selectedContentType || Object.keys(t)[0];
|
|
37
|
+
return ((r = t[e]) == null ? void 0 : r.examples) ?? {};
|
|
38
|
+
}), C = g(
|
|
39
|
+
a.selectedExample ?? Object.keys(u.value)[0]
|
|
40
|
+
), y = m(() => [
|
|
42
41
|
"x-custom-examples",
|
|
43
42
|
"x-codeSamples",
|
|
44
43
|
"x-code-samples"
|
|
45
|
-
].flatMap(
|
|
46
|
-
(e) => o.operation[e] ?? []
|
|
47
|
-
)), f = i(() => C.value.length ? [
|
|
44
|
+
].flatMap((e) => a.operation[e] ?? [])), p = m(() => y.value.length ? [
|
|
48
45
|
{
|
|
49
46
|
label: "Code Examples",
|
|
50
|
-
options:
|
|
51
|
-
const l =
|
|
47
|
+
options: y.value.map((e) => {
|
|
48
|
+
const l = T(e), s = e.label || e.lang || l;
|
|
52
49
|
return {
|
|
53
50
|
id: l,
|
|
54
51
|
lang: e.lang || "plaintext",
|
|
55
|
-
title:
|
|
56
|
-
label:
|
|
52
|
+
title: s,
|
|
53
|
+
label: s
|
|
57
54
|
};
|
|
58
55
|
})
|
|
59
56
|
},
|
|
60
|
-
...
|
|
61
|
-
] :
|
|
62
|
-
V(
|
|
57
|
+
...a.clientOptions
|
|
58
|
+
] : a.clientOptions), d = g(
|
|
59
|
+
V(p.value, a.selectedClient) ?? null
|
|
63
60
|
);
|
|
64
|
-
|
|
65
|
-
() =>
|
|
61
|
+
z(
|
|
62
|
+
() => a.selectedClient,
|
|
66
63
|
(t) => {
|
|
67
|
-
const e = V(
|
|
68
|
-
e && (
|
|
64
|
+
const e = V(p.value, t);
|
|
65
|
+
e && (d.value = e);
|
|
69
66
|
}
|
|
70
67
|
);
|
|
71
|
-
const k =
|
|
68
|
+
const k = m(() => {
|
|
72
69
|
var t, e, l;
|
|
73
70
|
try {
|
|
74
|
-
if ((t =
|
|
75
|
-
return ((e =
|
|
71
|
+
if ((t = d.value) != null && t.id.startsWith("custom"))
|
|
72
|
+
return ((e = y.value.find(
|
|
76
73
|
(I) => {
|
|
77
74
|
var x;
|
|
78
|
-
return
|
|
75
|
+
return T(I) === ((x = d.value) == null ? void 0 : x.id);
|
|
79
76
|
}
|
|
80
77
|
)) == null ? void 0 : e.source) ?? "Custom example not found";
|
|
81
|
-
const
|
|
82
|
-
return
|
|
83
|
-
clientId: (l =
|
|
84
|
-
operation:
|
|
85
|
-
method:
|
|
86
|
-
server:
|
|
87
|
-
securitySchemes:
|
|
88
|
-
contentType:
|
|
89
|
-
path:
|
|
90
|
-
example:
|
|
78
|
+
const s = u.value[C.value || ""], r = Q(s), j = (r == null ? void 0 : r.value) ?? (r == null ? void 0 : r.summary);
|
|
79
|
+
return X({
|
|
80
|
+
clientId: (l = d.value) == null ? void 0 : l.id,
|
|
81
|
+
operation: a.operation,
|
|
82
|
+
method: a.method,
|
|
83
|
+
server: a.selectedServer,
|
|
84
|
+
securitySchemes: a.securitySchemes,
|
|
85
|
+
contentType: a.selectedContentType,
|
|
86
|
+
path: a.path,
|
|
87
|
+
example: j
|
|
91
88
|
});
|
|
92
|
-
} catch (
|
|
93
|
-
return console.error("[generateSnippet]",
|
|
89
|
+
} catch (s) {
|
|
90
|
+
return console.error("[generateSnippet]", s), "";
|
|
94
91
|
}
|
|
95
|
-
}),
|
|
92
|
+
}), R = m(() => Y(a.securitySchemes)), i = g(null), w = (t) => {
|
|
96
93
|
var e;
|
|
97
|
-
if (
|
|
98
|
-
const l =
|
|
94
|
+
if (i.value) {
|
|
95
|
+
const l = G(i.value.$el);
|
|
99
96
|
setTimeout(() => {
|
|
100
97
|
l();
|
|
101
98
|
}, 300);
|
|
102
99
|
}
|
|
103
|
-
|
|
104
|
-
},
|
|
105
|
-
return (t, e) => k.value ? (
|
|
100
|
+
d.value = t, t.id.startsWith("custom") || O((e = i.value) == null ? void 0 : e.$el, "scalar-update-selected-client", t.id);
|
|
101
|
+
}, L = D();
|
|
102
|
+
return (t, e) => k.value ? (f(), S(o($), {
|
|
106
103
|
key: 0,
|
|
107
104
|
class: "request-card dark-mode",
|
|
108
105
|
ref_key: "elem",
|
|
109
|
-
ref:
|
|
106
|
+
ref: i
|
|
110
107
|
}, {
|
|
111
|
-
default:
|
|
112
|
-
n(
|
|
113
|
-
default:
|
|
108
|
+
default: c(() => [
|
|
109
|
+
n(o(M), { class: "pr-2.5" }, H({
|
|
110
|
+
default: c(() => [
|
|
114
111
|
e[3] || (e[3] = v("span", { class: "sr-only" }, "Request Example for", -1)),
|
|
115
|
-
n(
|
|
112
|
+
n(o(B), {
|
|
116
113
|
as: "span",
|
|
117
114
|
class: "request-method",
|
|
118
115
|
method: t.method
|
|
119
116
|
}, null, 8, ["method"]),
|
|
120
|
-
t.generateLabel ? (
|
|
117
|
+
t.generateLabel ? (f(), q("span", {
|
|
121
118
|
key: 0,
|
|
122
119
|
innerHTML: t.generateLabel()
|
|
123
|
-
}, null, 8,
|
|
120
|
+
}, null, 8, _)) : h(t.$slots, "header", { key: 1 }, void 0, !0)
|
|
124
121
|
]),
|
|
125
122
|
_: 2
|
|
126
123
|
}, [
|
|
127
|
-
|
|
124
|
+
p.value.length ? {
|
|
128
125
|
name: "actions",
|
|
129
|
-
fn:
|
|
130
|
-
n(
|
|
126
|
+
fn: c(() => [
|
|
127
|
+
n(o(W), {
|
|
131
128
|
class: "max-h-80",
|
|
132
|
-
modelValue:
|
|
133
|
-
options:
|
|
129
|
+
modelValue: d.value,
|
|
130
|
+
options: p.value,
|
|
134
131
|
teleport: "",
|
|
135
132
|
placement: "bottom-end",
|
|
136
|
-
"onUpdate:modelValue": e[0] || (e[0] = (l) =>
|
|
133
|
+
"onUpdate:modelValue": e[0] || (e[0] = (l) => w(l))
|
|
137
134
|
}, {
|
|
138
|
-
default:
|
|
139
|
-
n(
|
|
135
|
+
default: c(() => [
|
|
136
|
+
n(o(F), {
|
|
140
137
|
"data-testid": "client-picker",
|
|
141
138
|
class: "text-c-2 hover:text-c-1 flex h-full w-fit gap-1.5 px-0.5",
|
|
142
139
|
fullWidth: "",
|
|
143
140
|
variant: "ghost"
|
|
144
141
|
}, {
|
|
145
|
-
default:
|
|
146
|
-
v("span",
|
|
147
|
-
n(
|
|
142
|
+
default: c(() => [
|
|
143
|
+
v("span", ee, K(d.value.title), 1),
|
|
144
|
+
n(o(J), {
|
|
148
145
|
weight: "bold",
|
|
149
146
|
class: "ui-open:rotate-180 mt-0.25 size-3 transition-transform duration-100"
|
|
150
147
|
})
|
|
@@ -158,40 +155,40 @@ const Y = ["innerHTML"], Z = { class: "text-base font-normal" }, _ = ["id"], ee
|
|
|
158
155
|
key: "0"
|
|
159
156
|
} : void 0
|
|
160
157
|
]), 1024),
|
|
161
|
-
n(
|
|
162
|
-
default:
|
|
158
|
+
n(o(E), { class: "request-editor-section custom-scroll p-0" }, {
|
|
159
|
+
default: c(() => {
|
|
163
160
|
var l;
|
|
164
161
|
return [
|
|
165
162
|
v("div", {
|
|
166
|
-
id: `${
|
|
163
|
+
id: `${o(L)}-example`,
|
|
167
164
|
class: "code-snippet"
|
|
168
165
|
}, [
|
|
169
|
-
n(
|
|
166
|
+
n(o(U), {
|
|
170
167
|
class: "bg-b-2 !min-h-full -outline-offset-2",
|
|
171
168
|
content: k.value,
|
|
172
|
-
hideCredentials:
|
|
173
|
-
lang: (l =
|
|
169
|
+
hideCredentials: R.value,
|
|
170
|
+
lang: (l = d.value) == null ? void 0 : l.lang,
|
|
174
171
|
lineNumbers: ""
|
|
175
172
|
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
176
|
-
], 8,
|
|
173
|
+
], 8, te)
|
|
177
174
|
];
|
|
178
175
|
}),
|
|
179
176
|
_: 1
|
|
180
177
|
}),
|
|
181
|
-
Object.keys(
|
|
178
|
+
Object.keys(u.value).length || t.$slots.footer ? (f(), S(o(A), {
|
|
182
179
|
key: 0,
|
|
183
180
|
class: "request-card-footer bg-b-3"
|
|
184
181
|
}, {
|
|
185
|
-
default:
|
|
186
|
-
Object.keys(
|
|
187
|
-
n(
|
|
188
|
-
examples:
|
|
189
|
-
modelValue:
|
|
182
|
+
default: c(() => [
|
|
183
|
+
Object.keys(u.value).length ? (f(), q("div", le, [
|
|
184
|
+
n(Z, {
|
|
185
|
+
examples: u.value,
|
|
186
|
+
modelValue: C.value,
|
|
190
187
|
"onUpdate:modelValue": [
|
|
191
|
-
e[1] || (e[1] = (l) =>
|
|
188
|
+
e[1] || (e[1] = (l) => C.value = l),
|
|
192
189
|
e[2] || (e[2] = (l) => {
|
|
193
|
-
var
|
|
194
|
-
return
|
|
190
|
+
var s;
|
|
191
|
+
return o(O)((s = i.value) == null ? void 0 : s.$el, "scalar-update-selected-example", l);
|
|
195
192
|
})
|
|
196
193
|
]
|
|
197
194
|
}, null, 8, ["examples", "modelValue"])
|
|
@@ -202,15 +199,15 @@ const Y = ["innerHTML"], Z = { class: "text-base font-normal" }, _ = ["id"], ee
|
|
|
202
199
|
})) : b("", !0)
|
|
203
200
|
]),
|
|
204
201
|
_: 3
|
|
205
|
-
}, 512)) : t.fallback ? (
|
|
202
|
+
}, 512)) : t.fallback ? (f(), S(o($), {
|
|
206
203
|
key: 1,
|
|
207
204
|
class: "request-card dark-mode"
|
|
208
205
|
}, {
|
|
209
|
-
default:
|
|
210
|
-
n(
|
|
211
|
-
default:
|
|
212
|
-
v("div",
|
|
213
|
-
n(
|
|
206
|
+
default: c(() => [
|
|
207
|
+
n(o(E), { class: "request-card-simple" }, {
|
|
208
|
+
default: c(() => [
|
|
209
|
+
v("div", ae, [
|
|
210
|
+
n(o(B), {
|
|
214
211
|
as: "span",
|
|
215
212
|
class: "request-method",
|
|
216
213
|
method: t.method
|
|
@@ -227,5 +224,5 @@ const Y = ["innerHTML"], Z = { class: "text-base font-normal" }, _ = ["id"], ee
|
|
|
227
224
|
}
|
|
228
225
|
});
|
|
229
226
|
export {
|
|
230
|
-
|
|
227
|
+
ye as default
|
|
231
228
|
};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type { AvailableClients } from '@scalar/snippetz';
|
|
2
2
|
import type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/path-operations';
|
|
3
|
-
import { type Dereference } from '@scalar/workspace-store/schemas/v3.1/type-guard';
|
|
4
3
|
import type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/server';
|
|
5
4
|
import type { SecuritySchemeObject } from '@scalar/workspace-store/schemas/v3.1/strict/security-scheme';
|
|
6
5
|
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
7
6
|
type Props = {
|
|
8
7
|
clientId: AvailableClients[number];
|
|
9
|
-
operation:
|
|
8
|
+
operation: OperationObject;
|
|
10
9
|
example: unknown;
|
|
11
10
|
method: HttpMethod;
|
|
12
11
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,
|
|
1
|
+
{"version":3,"file":"generate-code-snippet.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAA;AAE5E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6DAA6D,CAAA;AAClG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAA;AAEtF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,6DAA6D,CAAA;AACvG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,KAAK,KAAK,GAAG;IACX,QAAQ,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAClC,SAAS,EAAE,eAAe,CAAA;IAC1B,OAAO,EAAE,OAAO,CAAA;IAChB,MAAM,EAAE,UAAU,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAA;IAChC,MAAM,CAAC,EAAE,YAAY,GAAG,SAAS,CAAA;IACjC,eAAe,CAAC,EAAE,oBAAoB,EAAE,GAAG,SAAS,CAAA;CACrD,CAAA;AAED,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,0FAS7B,KAAK,KAAG,MAmBV,CAAA"}
|