@scalar/api-reference 1.32.7 → 1.32.8
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/browser/standalone.js +16286 -16092
- package/dist/browser/webpack-stats.json +1 -1
- package/dist/components/Anchor/Anchor.vue2.js +2 -1
- package/dist/components/ApiReferenceLayout.vue.d.ts.map +1 -1
- package/dist/components/ApiReferenceLayout.vue.js +2 -2
- package/dist/components/ApiReferenceLayout.vue2.js +164 -176
- package/dist/components/Content/Content.vue.d.ts.map +1 -1
- package/dist/components/Content/Content.vue.js +2 -2
- package/dist/components/Content/Content.vue2.js +20 -20
- package/dist/components/Content/Models/Models.vue2.js +5 -4
- package/dist/components/Content/Models/ModelsAccordion.vue2.js +2 -1
- package/dist/components/Content/Schema/Schema.vue2.js +2 -1
- package/dist/components/Content/Schema/SchemaPropertyHeading.vue2.js +14 -7
- package/dist/components/Content/Tag/OperationsList.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/OperationsList.vue.js +1 -1
- package/dist/components/Content/Tag/OperationsList.vue2.js +18 -22
- package/dist/components/Content/Tag/OperationsListItem.vue.d.ts.map +1 -1
- package/dist/components/Content/Tag/OperationsListItem.vue.js +2 -2
- package/dist/components/Content/Tag/OperationsListItem.vue2.js +33 -34
- package/dist/components/Content/Tag/Tag.vue.js +2 -1
- package/dist/components/Content/Tag/TagSection.vue.d.ts.map +1 -1
- package/dist/components/GettingStarted.vue2.js +8 -6
- package/dist/components/Section/SectionAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionAccordion.vue.js +1 -1
- package/dist/components/Section/SectionAccordion.vue2.js +28 -29
- package/dist/components/Section/SectionContainerAccordion.vue.d.ts.map +1 -1
- package/dist/components/Section/SectionContainerAccordion.vue.js +2 -2
- package/dist/components/Section/SectionContainerAccordion.vue2.js +17 -18
- package/dist/features/Operation/Operation.vue.d.ts +6 -6
- package/dist/features/Operation/Operation.vue.d.ts.map +1 -1
- package/dist/features/Operation/Operation.vue.js +50 -49
- package/dist/features/Operation/components/ContentTypeSelect.vue.js +8 -7
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts +8 -6
- package/dist/features/Operation/components/callbacks/Callback.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue.js +1 -1
- package/dist/features/Operation/components/callbacks/Callback.vue2.js +21 -28
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts +5 -3
- package/dist/features/Operation/components/callbacks/Callbacks.vue.d.ts.map +1 -1
- package/dist/features/Operation/components/callbacks/Callbacks.vue.js +33 -18
- package/dist/features/Operation/layouts/ClassicLayout.vue.d.ts +11 -12
- 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 +168 -154
- package/dist/features/Operation/layouts/ModernLayout.vue.d.ts +12 -13
- 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 +113 -117
- package/dist/features/Search/SearchButton.vue.js +2 -1
- package/dist/features/Search/SearchModal.vue.d.ts.map +1 -1
- package/dist/features/Search/SearchModal.vue.js +2 -2
- package/dist/features/Search/SearchModal.vue2.js +16 -16
- package/dist/features/api-client-modal/useApiClient.d.ts +5338 -5258
- package/dist/features/api-client-modal/useApiClient.d.ts.map +1 -1
- package/dist/features/download-link/DownloadLink.vue2.js +4 -2
- package/dist/{components/Card/CardTab.vue.d.ts → features/example-responses/ExampleResponseTab.vue.d.ts} +1 -1
- package/dist/features/example-responses/ExampleResponseTab.vue.d.ts.map +1 -0
- package/dist/features/example-responses/ExampleResponseTab.vue.js +7 -0
- package/dist/{components/Card/CardTab.vue2.js → features/example-responses/ExampleResponseTab.vue2.js} +6 -6
- package/dist/{components/Card/CardTabHeader.vue.d.ts → features/example-responses/ExampleResponseTabList.vue.d.ts} +3 -3
- package/dist/features/example-responses/ExampleResponseTabList.vue.d.ts.map +1 -0
- package/dist/features/example-responses/ExampleResponseTabList.vue.js +7 -0
- package/dist/{components/Card/CardTabHeader.vue2.js → features/example-responses/ExampleResponseTabList.vue2.js} +9 -9
- package/dist/features/example-responses/ExampleResponses.vue.d.ts.map +1 -1
- package/dist/features/example-responses/ExampleResponses.vue.js +1 -1
- package/dist/features/example-responses/ExampleResponses.vue2.js +89 -96
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts +3 -2
- package/dist/features/test-request-button/TestRequestButton.vue.d.ts.map +1 -1
- package/dist/features/test-request-button/TestRequestButton.vue.js +2 -2
- package/dist/features/test-request-button/TestRequestButton.vue2.js +26 -24
- package/dist/helpers/convert-security-scheme.js +23 -0
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -29
- package/dist/style.css +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts +3 -1
- package/dist/v2/ApiReferenceWorkspace.vue.d.ts.map +1 -1
- package/dist/v2/ApiReferenceWorkspace.vue.js +113 -86
- package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue.js +4 -0
- package/dist/v2/blocks/scalar-request-example-block/components/ExamplePicker.vue2.js +64 -0
- 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 +7 -0
- package/dist/v2/blocks/scalar-request-example-block/components/RequestExample.vue2.js +212 -0
- package/dist/v2/blocks/scalar-request-example-block/helpers/find-client.js +20 -3
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-client-options.js +35 -0
- package/dist/v2/blocks/scalar-request-example-block/helpers/generate-code-snippet.js +29 -0
- package/dist/v2/blocks/scalar-request-example-block/helpers/get-secrets.js +10 -0
- package/dist/v2/blocks/scalar-request-example-block/index.d.ts +2 -2
- package/dist/v2/events/definitions.js +7 -0
- package/dist/v2/events/index.d.ts +1 -1
- package/dist/v2/events/listeners.d.ts +1 -1
- package/dist/v2/hooks/useStore.js +14 -0
- package/package.json +26 -26
- package/dist/blocks/constants.js +0 -6
- package/dist/blocks/helpers/getPointer.js +0 -12
- package/dist/blocks/hooks/useBlockProps.d.ts +0 -31
- package/dist/blocks/hooks/useBlockProps.d.ts.map +0 -1
- package/dist/blocks/hooks/useBlockProps.js +0 -24
- package/dist/components/Card/Card.vue.d.ts +0 -18
- package/dist/components/Card/Card.vue.d.ts.map +0 -1
- package/dist/components/Card/Card.vue.js +0 -13
- package/dist/components/Card/CardContent.vue.d.ts +0 -19
- package/dist/components/Card/CardContent.vue.d.ts.map +0 -1
- package/dist/components/Card/CardContent.vue.js +0 -7
- package/dist/components/Card/CardContent.vue2.js +0 -27
- package/dist/components/Card/CardFooter.vue.d.ts +0 -19
- package/dist/components/Card/CardFooter.vue.d.ts.map +0 -1
- package/dist/components/Card/CardFooter.vue.js +0 -7
- package/dist/components/Card/CardFooter.vue2.js +0 -24
- package/dist/components/Card/CardHeader.vue.d.ts +0 -20
- package/dist/components/Card/CardHeader.vue.d.ts.map +0 -1
- package/dist/components/Card/CardHeader.vue.js +0 -7
- package/dist/components/Card/CardHeader.vue2.js +0 -31
- package/dist/components/Card/CardTab.vue.d.ts.map +0 -1
- package/dist/components/Card/CardTab.vue.js +0 -7
- package/dist/components/Card/CardTabHeader.vue.d.ts.map +0 -1
- package/dist/components/Card/CardTabHeader.vue.js +0 -7
- package/dist/components/Card/index.d.ts +0 -7
- package/dist/components/Card/index.d.ts.map +0 -1
- package/dist/components/Card/types.d.ts +0 -8
- package/dist/components/Card/types.d.ts.map +0 -1
- package/dist/features/example-request/ExamplePicker.vue.d.ts +0 -13
- package/dist/features/example-request/ExamplePicker.vue.d.ts.map +0 -1
- package/dist/features/example-request/ExamplePicker.vue.js +0 -7
- package/dist/features/example-request/ExamplePicker.vue2.js +0 -56
- package/dist/features/example-request/ExampleRequest.vue.d.ts +0 -79
- package/dist/features/example-request/ExampleRequest.vue.d.ts.map +0 -1
- package/dist/features/example-request/ExampleRequest.vue.js +0 -7
- package/dist/features/example-request/ExampleRequest.vue2.js +0 -361
- package/dist/features/example-request/TextSelect.vue.d.ts +0 -34
- package/dist/features/example-request/TextSelect.vue.d.ts.map +0 -1
- package/dist/features/example-request/TextSelect.vue.js +0 -48
- package/dist/features/example-request/TextSelect.vue3.js +0 -5
- package/dist/features/example-request/index.d.ts +0 -3
- package/dist/features/example-request/index.d.ts.map +0 -1
|
@@ -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":"AAuXA,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAA;AAGjE,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,gCAAgC,CAAA;AA2BpE,KAAK,WAAW,GAAG;IACjB,aAAa,CAAC,EAAE,4BAA4B,CAAA;IAC5C,iBAAiB,EAAE,MAAM,cAAc,CAAA;CACxC,CAAC;AAwQF,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,43 +1,47 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { safeLocalStorage as
|
|
3
|
-
import { parseJsonOrYaml as
|
|
4
|
-
import { useColorMode as
|
|
5
|
-
import { useSeoMeta as
|
|
6
|
-
import { useFavicon as
|
|
7
|
-
import
|
|
8
|
-
import { NAV_STATE_SYMBOL as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import
|
|
13
|
-
|
|
1
|
+
import { defineComponent as b, ref as p, toRef as A, provide as B, useTemplateRef as P, onServerPrefetch as V, onMounted as F, watch as n, computed as H, createElementBlock as U, openBlock as y, createBlock as W, createCommentVNode as Y, createVNode as D, unref as l, resolveDynamicComponent as O, withCtx as i, createTextVNode as j, toDisplayString as w, renderSlot as v, isRef as J } from "vue";
|
|
2
|
+
import { safeLocalStorage as S, REFERENCE_LS_KEYS as g } from "@scalar/helpers/object/local-storage";
|
|
3
|
+
import { parseJsonOrYaml as q, redirectToProxy as z } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { useColorMode as G } from "@scalar/use-hooks/useColorMode";
|
|
5
|
+
import { useSeoMeta as Q } from "@unhead/vue";
|
|
6
|
+
import { useFavicon as X } from "@vueuse/core";
|
|
7
|
+
import Z from "../components/ApiReferenceLayout.vue.js";
|
|
8
|
+
import { NAV_STATE_SYMBOL as ee } from "../hooks/useNavState.js";
|
|
9
|
+
import { useHttpClientStore as te } from "../stores/useHttpClientStore.js";
|
|
10
|
+
import { isClient as k } from "./blocks/scalar-request-example-block/helpers/find-client.js";
|
|
11
|
+
import { useStore as oe } from "./hooks/useStore.js";
|
|
12
|
+
import { useMultipleDocuments as ae } from "../features/multiple-documents/useMultipleDocuments.js";
|
|
13
|
+
import { onCustomEvent as C } from "./events/listeners.js";
|
|
14
|
+
import re from "../features/multiple-documents/DocumentSelector.vue.js";
|
|
15
|
+
const xe = /* @__PURE__ */ b({
|
|
14
16
|
__name: "ApiReferenceWorkspace",
|
|
15
17
|
props: {
|
|
16
18
|
configuration: {},
|
|
17
19
|
getWorkspaceStore: { type: Function }
|
|
18
20
|
},
|
|
19
|
-
setup(
|
|
20
|
-
const
|
|
21
|
-
availableDocuments:
|
|
21
|
+
setup(h) {
|
|
22
|
+
const E = h, {
|
|
23
|
+
availableDocuments: u,
|
|
22
24
|
selectedConfiguration: a,
|
|
23
|
-
selectedDocumentIndex:
|
|
24
|
-
isIntersectionEnabled:
|
|
25
|
-
hash:
|
|
26
|
-
hashPrefix:
|
|
27
|
-
} =
|
|
28
|
-
configuration:
|
|
29
|
-
isIntersectionEnabled:
|
|
30
|
-
hash:
|
|
31
|
-
hashPrefix:
|
|
32
|
-
}), L = (e, t) => fetch(
|
|
33
|
-
|
|
25
|
+
selectedDocumentIndex: d,
|
|
26
|
+
isIntersectionEnabled: M,
|
|
27
|
+
hash: T,
|
|
28
|
+
hashPrefix: I
|
|
29
|
+
} = ae({
|
|
30
|
+
configuration: A(E, "configuration"),
|
|
31
|
+
isIntersectionEnabled: p(!1),
|
|
32
|
+
hash: p(""),
|
|
33
|
+
hashPrefix: p("")
|
|
34
|
+
}), { httpClient: $, setExcludedClients: L, setDefaultHttpClient: x } = te(), K = (e, t) => fetch(
|
|
35
|
+
z(a.value.proxyUrl, e.toString()),
|
|
34
36
|
t
|
|
35
37
|
);
|
|
36
|
-
|
|
37
|
-
const
|
|
38
|
+
B(ee, { isIntersectionEnabled: M, hash: T, hashPrefix: I });
|
|
39
|
+
const c = P("root"), o = E.getWorkspaceStore();
|
|
40
|
+
oe(o);
|
|
41
|
+
const f = u, m = (e) => {
|
|
38
42
|
if (o.workspace.documents[e.slug ?? "default"] === void 0) {
|
|
39
43
|
if (e.content) {
|
|
40
|
-
const t = typeof e.content == "string" ?
|
|
44
|
+
const t = typeof e.content == "string" ? q(e.content) : e.content;
|
|
41
45
|
return o.addDocumentSync({
|
|
42
46
|
name: e.slug ?? "default",
|
|
43
47
|
document: typeof t == "function" ? t() : t
|
|
@@ -47,97 +51,120 @@ const fe = /* @__PURE__ */ V({
|
|
|
47
51
|
return o.addDocument({
|
|
48
52
|
name: e.slug ?? "default",
|
|
49
53
|
url: e.url,
|
|
50
|
-
fetch:
|
|
54
|
+
fetch: K
|
|
51
55
|
});
|
|
52
56
|
}
|
|
53
57
|
};
|
|
54
|
-
|
|
55
|
-
e.content &&
|
|
56
|
-
}),
|
|
57
|
-
|
|
58
|
-
e.url &&
|
|
58
|
+
f.value.forEach((e) => {
|
|
59
|
+
e.content && m(e);
|
|
60
|
+
}), V(() => {
|
|
61
|
+
f.value.forEach((e) => {
|
|
62
|
+
e.url && m(e);
|
|
59
63
|
});
|
|
60
|
-
}),
|
|
61
|
-
|
|
62
|
-
|
|
64
|
+
}), F(() => {
|
|
65
|
+
f.value.forEach((t) => {
|
|
66
|
+
t.url && m(t);
|
|
63
67
|
});
|
|
64
|
-
|
|
68
|
+
const e = S().getItem(
|
|
69
|
+
g.SELECTED_CLIENT
|
|
70
|
+
);
|
|
71
|
+
k(e) && !o.workspace["x-scalar-default-client"] && o.update("x-scalar-default-client", e);
|
|
72
|
+
}), C(c, "scalar-update-dark-mode", (e) => {
|
|
65
73
|
o.update("x-scalar-dark-mode", e.detail.value);
|
|
66
|
-
}),
|
|
74
|
+
}), C(c, "scalar-update-active-document", (e) => {
|
|
67
75
|
o.update("x-scalar-active-document", e.detail.value);
|
|
68
|
-
}),
|
|
69
|
-
o.update("x-scalar-default-client", e.detail),
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
})
|
|
76
|
-
|
|
76
|
+
}), C(c, "scalar-update-selected-client", (e) => {
|
|
77
|
+
o.update("x-scalar-default-client", e.detail), S().setItem(g.SELECTED_CLIENT, e.detail);
|
|
78
|
+
const [t, r] = e.detail.split("/");
|
|
79
|
+
x({
|
|
80
|
+
targetKey: t,
|
|
81
|
+
clientKey: r
|
|
82
|
+
});
|
|
83
|
+
}), n(
|
|
84
|
+
() => a.value.hiddenClients,
|
|
85
|
+
(e) => e && L(e)
|
|
86
|
+
), n($, (e) => {
|
|
87
|
+
var r;
|
|
88
|
+
const t = `${e.targetKey}/${e.clientKey}`;
|
|
89
|
+
e && ((r = o.workspace.activeDocument) == null ? void 0 : r["x-scalar-default-client"]) !== t && k(t) && o.update("x-scalar-default-client", t);
|
|
90
|
+
}), n(
|
|
91
|
+
() => a.value.defaultHttpClient,
|
|
92
|
+
(e) => {
|
|
93
|
+
if (e) {
|
|
94
|
+
const { targetKey: t, clientKey: r } = e, s = `${t}/${r}`;
|
|
95
|
+
k(s) && o.update("x-scalar-default-client", s), x(e);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
98
|
+
{ immediate: !0 }
|
|
99
|
+
);
|
|
100
|
+
const { toggleColorMode: N, isDarkMode: R } = G({
|
|
77
101
|
initialColorMode: a.value.darkMode ? "dark" : void 0,
|
|
78
102
|
overrideColorMode: a.value.forceDarkModeState
|
|
79
103
|
});
|
|
80
|
-
|
|
104
|
+
n(
|
|
81
105
|
() => a.value.darkMode,
|
|
82
106
|
(e) => o.update("x-scalar-dark-mode", !!e)
|
|
83
|
-
),
|
|
84
|
-
() =>
|
|
107
|
+
), n(
|
|
108
|
+
() => R.value,
|
|
85
109
|
(e) => o.update("x-scalar-dark-mode", e),
|
|
86
110
|
{ immediate: !0 }
|
|
87
|
-
),
|
|
88
|
-
() =>
|
|
111
|
+
), n(
|
|
112
|
+
() => d.value,
|
|
89
113
|
(e) => {
|
|
90
114
|
var t;
|
|
91
115
|
return o.update(
|
|
92
116
|
"x-scalar-active-document",
|
|
93
|
-
(t =
|
|
117
|
+
(t = u.value[e]) == null ? void 0 : t.slug
|
|
94
118
|
);
|
|
95
119
|
},
|
|
96
120
|
{ immediate: !0 }
|
|
97
|
-
),
|
|
98
|
-
() =>
|
|
121
|
+
), n(
|
|
122
|
+
() => u.value,
|
|
99
123
|
(e) => {
|
|
100
|
-
e.forEach(
|
|
124
|
+
e.forEach(m);
|
|
101
125
|
}
|
|
102
|
-
), a.value.metaData &&
|
|
103
|
-
const
|
|
104
|
-
return
|
|
105
|
-
var
|
|
106
|
-
return
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
126
|
+
), a.value.metaData && Q(a.value.metaData);
|
|
127
|
+
const _ = H(() => a.value.favicon);
|
|
128
|
+
return X(_), (e, t) => {
|
|
129
|
+
var r;
|
|
130
|
+
return y(), U("div", {
|
|
131
|
+
ref_key: "root",
|
|
132
|
+
ref: c
|
|
133
|
+
}, [
|
|
134
|
+
(r = l(a)) != null && r.customCss ? (y(), W(O("style"), { key: 0 }, {
|
|
135
|
+
default: i(() => [
|
|
136
|
+
j(w(l(a).customCss), 1)
|
|
110
137
|
]),
|
|
111
138
|
_: 1
|
|
112
|
-
})) :
|
|
113
|
-
|
|
114
|
-
configuration:
|
|
115
|
-
isDark: !!
|
|
116
|
-
onToggleDarkMode: t[1] || (t[1] = () =>
|
|
117
|
-
onUpdateContent: t[2] || (t[2] = (
|
|
139
|
+
})) : Y("", !0),
|
|
140
|
+
D(Z, {
|
|
141
|
+
configuration: l(a),
|
|
142
|
+
isDark: !!l(o).workspace["x-scalar-dark-mode"],
|
|
143
|
+
onToggleDarkMode: t[1] || (t[1] = () => l(N)()),
|
|
144
|
+
onUpdateContent: t[2] || (t[2] = (s) => e.$emit("updateContent", s))
|
|
118
145
|
}, {
|
|
119
|
-
footer:
|
|
120
|
-
|
|
146
|
+
footer: i(() => [
|
|
147
|
+
v(e.$slots, "footer")
|
|
121
148
|
]),
|
|
122
|
-
"content-end":
|
|
123
|
-
|
|
149
|
+
"content-end": i(() => [
|
|
150
|
+
v(e.$slots, "footer")
|
|
124
151
|
]),
|
|
125
|
-
"document-selector":
|
|
126
|
-
|
|
127
|
-
modelValue:
|
|
128
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
129
|
-
options:
|
|
152
|
+
"document-selector": i(() => [
|
|
153
|
+
D(l(re), {
|
|
154
|
+
modelValue: l(d),
|
|
155
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => J(d) ? d.value = s : null),
|
|
156
|
+
options: l(u)
|
|
130
157
|
}, null, 8, ["modelValue", "options"])
|
|
131
158
|
]),
|
|
132
|
-
"sidebar-start":
|
|
133
|
-
|
|
159
|
+
"sidebar-start": i(() => [
|
|
160
|
+
v(e.$slots, "sidebar-start")
|
|
134
161
|
]),
|
|
135
162
|
_: 3
|
|
136
163
|
}, 8, ["configuration", "isDark"])
|
|
137
|
-
],
|
|
164
|
+
], 512);
|
|
138
165
|
};
|
|
139
166
|
}
|
|
140
167
|
});
|
|
141
168
|
export {
|
|
142
|
-
|
|
169
|
+
xe as default
|
|
143
170
|
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { defineComponent as f, mergeModels as b, useModel as v, computed as c, createBlock as V, openBlock as h, unref as r, withCtx as u, createVNode as d, createElementVNode as g, toDisplayString as S } from "vue";
|
|
2
|
+
import { ScalarCombobox as _, ScalarButton as E } from "@scalar/components";
|
|
3
|
+
import { ScalarIconCaretDown as C } from "@scalar/icons";
|
|
4
|
+
const k = /* @__PURE__ */ f({
|
|
5
|
+
__name: "ExamplePicker",
|
|
6
|
+
props: /* @__PURE__ */ b({
|
|
7
|
+
examples: {}
|
|
8
|
+
}, {
|
|
9
|
+
modelValue: { required: !0 },
|
|
10
|
+
modelModifiers: {}
|
|
11
|
+
}),
|
|
12
|
+
emits: ["update:modelValue"],
|
|
13
|
+
setup(m, { expose: i }) {
|
|
14
|
+
const n = m, l = v(m, "modelValue"), a = c(() => Object.keys(n.examples).map((e) => ({
|
|
15
|
+
id: e,
|
|
16
|
+
label: s(e)
|
|
17
|
+
}))), o = c(
|
|
18
|
+
() => a.value.find(
|
|
19
|
+
(e) => e.id === l.value
|
|
20
|
+
) ?? a.value[0]
|
|
21
|
+
), s = (e) => {
|
|
22
|
+
if (!e)
|
|
23
|
+
return "Select an example";
|
|
24
|
+
const t = n.examples[e];
|
|
25
|
+
return (t == null ? void 0 : t.summary) ?? e;
|
|
26
|
+
}, x = (e) => {
|
|
27
|
+
l.value = e.id;
|
|
28
|
+
};
|
|
29
|
+
return i({
|
|
30
|
+
getLabel: s,
|
|
31
|
+
selectedExample: o,
|
|
32
|
+
selectedExampleKey: l
|
|
33
|
+
}), (e, t) => (h(), V(r(_), {
|
|
34
|
+
class: "max-h-80",
|
|
35
|
+
modelValue: o.value,
|
|
36
|
+
options: a.value,
|
|
37
|
+
teleport: "",
|
|
38
|
+
placement: "bottom-start",
|
|
39
|
+
"onUpdate:modelValue": x
|
|
40
|
+
}, {
|
|
41
|
+
default: u(() => [
|
|
42
|
+
d(r(E), {
|
|
43
|
+
"data-testid": "example-picker",
|
|
44
|
+
class: "text-c-1 hover:bg-b-2 flex h-full w-fit gap-1.5 px-1.5 py-0.75 font-normal",
|
|
45
|
+
fullWidth: "",
|
|
46
|
+
variant: "ghost"
|
|
47
|
+
}, {
|
|
48
|
+
default: u(() => {
|
|
49
|
+
var p;
|
|
50
|
+
return [
|
|
51
|
+
g("span", null, S(((p = o.value) == null ? void 0 : p.label) || "Select an example"), 1),
|
|
52
|
+
d(r(C))
|
|
53
|
+
];
|
|
54
|
+
}),
|
|
55
|
+
_: 1
|
|
56
|
+
})
|
|
57
|
+
]),
|
|
58
|
+
_: 1
|
|
59
|
+
}, 8, ["modelValue", "options"]));
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
export {
|
|
63
|
+
k as default
|
|
64
|
+
};
|
|
@@ -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":"AAqYA,OAAO,KAAK,EAAE,UAAU,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAA;AAGrF,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,kBAAkB,CAAA;AACxD,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;AACtF,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,iDAAiD,CAAA;AAkBxD,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,EAAE,CAAA;IAC3C;;;;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,WAAW,CAAC,eAAe,CAAC,CAAA;IACvC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAA;IAC5B;;;OAGG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAA;CAC7B,CAAA;AAED;;;;;;;;GAQG;;YAoBO,MAAM,OAAO;YACb,MAAM,OAAO;;YADb,MAAM,OAAO;YACb,MAAM,OAAO;;AApBvB,wBAmaC;AAWD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
import { defineComponent as O, computed as i, ref as C, watch as j, useId as I, createBlock as y, createCommentVNode as S, openBlock as m, unref as a, withCtx as s, createVNode as o, createSlots as N, createElementVNode as p, createElementBlock as b, renderSlot as v, toDisplayString as R } from "vue";
|
|
2
|
+
import { ScalarCard as x, ScalarCardHeader as H, ScalarCombobox as K, ScalarButton as M, ScalarCardSection as q, ScalarCodeBlock as W, ScalarCardFooter as z } from "@scalar/components";
|
|
3
|
+
import { freezeElement as D } from "@scalar/helpers/dom/freeze-element";
|
|
4
|
+
import { ScalarIconCaretDown as F } from "@scalar/icons";
|
|
5
|
+
import { isReference as U } from "@scalar/workspace-store/schemas/v3.1/type-guard";
|
|
6
|
+
import { findClient as E } from "../helpers/find-client.js";
|
|
7
|
+
import { generateClientOptions as A, generateCustomId as G } from "../helpers/generate-client-options.js";
|
|
8
|
+
import { generateCodeSnippet as J } from "../helpers/generate-code-snippet.js";
|
|
9
|
+
import { getSecrets as P } from "../helpers/get-secrets.js";
|
|
10
|
+
import Q from "./ExamplePicker.vue2.js";
|
|
11
|
+
import $ from "../../../../components/HttpMethod/HttpMethod.vue.js";
|
|
12
|
+
import { emitCustomEvent as B } from "../../../events/definitions.js";
|
|
13
|
+
const X = ["innerHTML"], Y = ["id"], Z = {
|
|
14
|
+
key: 0,
|
|
15
|
+
class: "request-card-footer-addon"
|
|
16
|
+
}, _ = { class: "request-header" }, ee = {}, fe = /* @__PURE__ */ O({
|
|
17
|
+
...ee,
|
|
18
|
+
__name: "RequestExample",
|
|
19
|
+
props: {
|
|
20
|
+
allowedClients: {},
|
|
21
|
+
selectedClient: {},
|
|
22
|
+
selectedServer: { default: () => ({ url: "/" }) },
|
|
23
|
+
selectedContentType: {},
|
|
24
|
+
selectedExample: {},
|
|
25
|
+
securitySchemes: { default: () => [] },
|
|
26
|
+
method: {},
|
|
27
|
+
path: {},
|
|
28
|
+
operation: {},
|
|
29
|
+
fallback: { type: Boolean },
|
|
30
|
+
generateLabel: { type: Function },
|
|
31
|
+
hideClientSelector: { type: Boolean, default: !1 }
|
|
32
|
+
},
|
|
33
|
+
setup(l) {
|
|
34
|
+
const d = i(() => {
|
|
35
|
+
var c, k;
|
|
36
|
+
if (U(l.operation.requestBody))
|
|
37
|
+
return {};
|
|
38
|
+
const e = ((c = l.operation.requestBody) == null ? void 0 : c.content) ?? {}, t = l.selectedContentType || Object.keys(e)[0];
|
|
39
|
+
return ((k = e[t]) == null ? void 0 : k.examples) ?? {};
|
|
40
|
+
}), h = C(
|
|
41
|
+
l.selectedExample ?? Object.keys(d.value)[0]
|
|
42
|
+
), g = i(() => [
|
|
43
|
+
"x-custom-examples",
|
|
44
|
+
"x-codeSamples",
|
|
45
|
+
"x-code-samples"
|
|
46
|
+
].flatMap(
|
|
47
|
+
(t) => l.operation[t] ?? []
|
|
48
|
+
)), f = i(
|
|
49
|
+
() => A(g.value, l.allowedClients)
|
|
50
|
+
), n = C(
|
|
51
|
+
E(f.value, l.selectedClient)
|
|
52
|
+
);
|
|
53
|
+
j(
|
|
54
|
+
() => l.selectedClient,
|
|
55
|
+
(e) => {
|
|
56
|
+
const t = E(f.value, e);
|
|
57
|
+
t && (n.value = t);
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
const V = i(() => {
|
|
61
|
+
var e;
|
|
62
|
+
try {
|
|
63
|
+
return n.value.id.startsWith("custom") ? ((e = g.value.find(
|
|
64
|
+
(t) => G(t) === n.value.id
|
|
65
|
+
)) == null ? void 0 : e.source) ?? "Custom example not found" : J({
|
|
66
|
+
clientId: n.value.id,
|
|
67
|
+
operation: l.operation,
|
|
68
|
+
method: l.method,
|
|
69
|
+
server: l.selectedServer,
|
|
70
|
+
securitySchemes: l.securitySchemes,
|
|
71
|
+
contentType: l.selectedContentType,
|
|
72
|
+
path: l.path,
|
|
73
|
+
example: d.value[h.value || ""]
|
|
74
|
+
});
|
|
75
|
+
} catch (t) {
|
|
76
|
+
return console.error("[generateSnippet]", t), "";
|
|
77
|
+
}
|
|
78
|
+
}), T = i(() => P(l.securitySchemes)), u = C(null), w = (e) => {
|
|
79
|
+
var t;
|
|
80
|
+
if (u.value) {
|
|
81
|
+
const r = D(u.value.$el);
|
|
82
|
+
setTimeout(() => {
|
|
83
|
+
r();
|
|
84
|
+
}, 300);
|
|
85
|
+
}
|
|
86
|
+
n.value = e, e.id.startsWith("custom") || B(
|
|
87
|
+
(t = u.value) == null ? void 0 : t.$el,
|
|
88
|
+
"scalar-update-selected-client",
|
|
89
|
+
e.id
|
|
90
|
+
);
|
|
91
|
+
}, L = I();
|
|
92
|
+
return (e, t) => f.value.length ? (m(), y(a(x), {
|
|
93
|
+
key: 0,
|
|
94
|
+
class: "request-card dark-mode",
|
|
95
|
+
ref_key: "elem",
|
|
96
|
+
ref: u
|
|
97
|
+
}, {
|
|
98
|
+
default: s(() => [
|
|
99
|
+
o(a(H), { class: "pr-0.75" }, N({
|
|
100
|
+
default: s(() => [
|
|
101
|
+
t[3] || (t[3] = p("span", { class: "sr-only" }, "Request Example for", -1)),
|
|
102
|
+
o(a($), {
|
|
103
|
+
as: "span",
|
|
104
|
+
class: "request-method",
|
|
105
|
+
method: e.method
|
|
106
|
+
}, null, 8, ["method"]),
|
|
107
|
+
e.generateLabel ? (m(), b("span", {
|
|
108
|
+
key: 0,
|
|
109
|
+
innerHTML: e.generateLabel()
|
|
110
|
+
}, null, 8, X)) : v(e.$slots, "header", { key: 1 }, void 0, !0)
|
|
111
|
+
]),
|
|
112
|
+
_: 2
|
|
113
|
+
}, [
|
|
114
|
+
e.hideClientSelector ? void 0 : {
|
|
115
|
+
name: "actions",
|
|
116
|
+
fn: s(() => [
|
|
117
|
+
o(a(K), {
|
|
118
|
+
class: "max-h-80",
|
|
119
|
+
modelValue: n.value,
|
|
120
|
+
options: f.value,
|
|
121
|
+
teleport: "",
|
|
122
|
+
placement: "bottom-end",
|
|
123
|
+
"onUpdate:modelValue": t[0] || (t[0] = (r) => w(r))
|
|
124
|
+
}, {
|
|
125
|
+
default: s(() => [
|
|
126
|
+
o(a(M), {
|
|
127
|
+
"data-testid": "client-picker",
|
|
128
|
+
class: "text-c-1 hover:bg-b-3 flex h-full w-fit gap-1.5 px-1.5 py-0.75 font-normal",
|
|
129
|
+
fullWidth: "",
|
|
130
|
+
variant: "ghost"
|
|
131
|
+
}, {
|
|
132
|
+
default: s(() => [
|
|
133
|
+
p("span", null, R(n.value.title), 1),
|
|
134
|
+
o(a(F))
|
|
135
|
+
]),
|
|
136
|
+
_: 1
|
|
137
|
+
})
|
|
138
|
+
]),
|
|
139
|
+
_: 1
|
|
140
|
+
}, 8, ["modelValue", "options"])
|
|
141
|
+
]),
|
|
142
|
+
key: "0"
|
|
143
|
+
}
|
|
144
|
+
]), 1024),
|
|
145
|
+
o(a(q), { class: "request-editor-section custom-scroll p-0" }, {
|
|
146
|
+
default: s(() => [
|
|
147
|
+
p("div", {
|
|
148
|
+
id: `${a(L)}-example`,
|
|
149
|
+
class: "code-snippet"
|
|
150
|
+
}, [
|
|
151
|
+
o(a(W), {
|
|
152
|
+
class: "bg-b-2 !min-h-full -outline-offset-2",
|
|
153
|
+
content: V.value,
|
|
154
|
+
hideCredentials: T.value,
|
|
155
|
+
lang: n.value.lang,
|
|
156
|
+
lineNumbers: ""
|
|
157
|
+
}, null, 8, ["content", "hideCredentials", "lang"])
|
|
158
|
+
], 8, Y)
|
|
159
|
+
]),
|
|
160
|
+
_: 1
|
|
161
|
+
}),
|
|
162
|
+
Object.keys(d.value).length || e.$slots.footer ? (m(), y(a(z), {
|
|
163
|
+
key: 0,
|
|
164
|
+
class: "request-card-footer bg-b-3"
|
|
165
|
+
}, {
|
|
166
|
+
default: s(() => [
|
|
167
|
+
Object.keys(d.value).length ? (m(), b("div", Z, [
|
|
168
|
+
o(Q, {
|
|
169
|
+
examples: d.value,
|
|
170
|
+
modelValue: h.value,
|
|
171
|
+
"onUpdate:modelValue": [
|
|
172
|
+
t[1] || (t[1] = (r) => h.value = r),
|
|
173
|
+
t[2] || (t[2] = (r) => {
|
|
174
|
+
var c;
|
|
175
|
+
return a(B)((c = u.value) == null ? void 0 : c.$el, "scalar-update-selected-example", r);
|
|
176
|
+
})
|
|
177
|
+
]
|
|
178
|
+
}, null, 8, ["examples", "modelValue"])
|
|
179
|
+
])) : S("", !0),
|
|
180
|
+
v(e.$slots, "footer", {}, void 0, !0)
|
|
181
|
+
]),
|
|
182
|
+
_: 3
|
|
183
|
+
})) : S("", !0)
|
|
184
|
+
]),
|
|
185
|
+
_: 3
|
|
186
|
+
}, 512)) : e.fallback ? (m(), y(a(x), {
|
|
187
|
+
key: 1,
|
|
188
|
+
class: "request-card dark-mode"
|
|
189
|
+
}, {
|
|
190
|
+
default: s(() => [
|
|
191
|
+
o(a(q), { class: "request-card-simple" }, {
|
|
192
|
+
default: s(() => [
|
|
193
|
+
p("div", _, [
|
|
194
|
+
o(a($), {
|
|
195
|
+
as: "span",
|
|
196
|
+
class: "request-method",
|
|
197
|
+
method: e.method
|
|
198
|
+
}, null, 8, ["method"]),
|
|
199
|
+
v(e.$slots, "header", {}, void 0, !0)
|
|
200
|
+
]),
|
|
201
|
+
v(e.$slots, "footer", {}, void 0, !0)
|
|
202
|
+
]),
|
|
203
|
+
_: 3
|
|
204
|
+
})
|
|
205
|
+
]),
|
|
206
|
+
_: 3
|
|
207
|
+
})) : S("", !0);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
export {
|
|
211
|
+
fe as default
|
|
212
|
+
};
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
import { AVAILABLE_CLIENTS as
|
|
2
|
-
const
|
|
1
|
+
import { AVAILABLE_CLIENTS as c } from "@scalar/snippetz";
|
|
2
|
+
const d = "shell/curl", u = (o) => c.includes(o), e = (o, r) => {
|
|
3
|
+
var f;
|
|
4
|
+
const n = (f = o[0]) == null ? void 0 : f.options[0];
|
|
5
|
+
if (r)
|
|
6
|
+
for (const i of o) {
|
|
7
|
+
const t = i.options.find((s) => s.id === r);
|
|
8
|
+
if (t)
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
if (!(n != null && n.id.startsWith("custom")))
|
|
12
|
+
for (const i of o) {
|
|
13
|
+
const t = i.options.find((s) => s.id === d);
|
|
14
|
+
if (t)
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
return n;
|
|
18
|
+
};
|
|
3
19
|
export {
|
|
4
|
-
e as
|
|
20
|
+
e as findClient,
|
|
21
|
+
u as isClient
|
|
5
22
|
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { snippetz as a } from "@scalar/snippetz";
|
|
2
|
+
import { capitalize as r } from "vue";
|
|
3
|
+
const f = (l) => `custom/${l.lang}`, u = (l, i) => {
|
|
4
|
+
const o = a().clients().flatMap((t) => {
|
|
5
|
+
const n = t.clients.flatMap((e) => {
|
|
6
|
+
const c = `${t.key}/${e.client}`;
|
|
7
|
+
return i && !i.includes(c) ? [] : {
|
|
8
|
+
id: c,
|
|
9
|
+
lang: e.client === "curl" ? "curl" : t.key,
|
|
10
|
+
title: `${r(t.title)} ${e.title}`,
|
|
11
|
+
label: e.title
|
|
12
|
+
};
|
|
13
|
+
});
|
|
14
|
+
return n.length === 0 ? [] : {
|
|
15
|
+
label: t.title,
|
|
16
|
+
options: n
|
|
17
|
+
};
|
|
18
|
+
}), s = l.map((t) => {
|
|
19
|
+
const n = f(t), e = t.label || t.lang || n;
|
|
20
|
+
return {
|
|
21
|
+
id: n,
|
|
22
|
+
lang: t.lang || "plaintext",
|
|
23
|
+
title: e,
|
|
24
|
+
label: e
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
return s.length > 0 && o.unshift({
|
|
28
|
+
label: "Code Examples",
|
|
29
|
+
options: s
|
|
30
|
+
}), o;
|
|
31
|
+
};
|
|
32
|
+
export {
|
|
33
|
+
u as generateClientOptions,
|
|
34
|
+
f as generateCustomId
|
|
35
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { operationToHar as u } from "@scalar/oas-utils/helpers/operation-to-har";
|
|
2
|
+
import { isReference as d } from "@scalar/workspace-store/schemas/v3.1/type-guard";
|
|
3
|
+
import { getSnippet as l } from "@scalar/api-client/views/Components/CodeSnippet";
|
|
4
|
+
const S = ({
|
|
5
|
+
clientId: t,
|
|
6
|
+
operation: e,
|
|
7
|
+
method: o,
|
|
8
|
+
path: n,
|
|
9
|
+
example: i,
|
|
10
|
+
contentType: p,
|
|
11
|
+
server: s,
|
|
12
|
+
securitySchemes: a
|
|
13
|
+
}) => {
|
|
14
|
+
if (d(e))
|
|
15
|
+
return "";
|
|
16
|
+
const c = u({
|
|
17
|
+
operation: e,
|
|
18
|
+
contentType: p,
|
|
19
|
+
method: o,
|
|
20
|
+
path: n,
|
|
21
|
+
server: s,
|
|
22
|
+
securitySchemes: a,
|
|
23
|
+
example: i
|
|
24
|
+
}), [m, f] = t.split("/"), [r, g] = l(m, f, c);
|
|
25
|
+
return r ? r.message ?? "Error generating code snippet" : g;
|
|
26
|
+
};
|
|
27
|
+
export {
|
|
28
|
+
S as generateCodeSnippet
|
|
29
|
+
};
|