@scalar/api-client 2.17.2 → 2.17.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 +87 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +15 -10
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +70 -55
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +12 -8
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +3 -5
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js +31 -31
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +4 -6
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request.js +20 -21
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +22 -16
- package/dist/v2/blocks/operation-block/helpers/send-request.js +26 -26
- package/dist/v2/blocks/operation-block/index.d.ts +1 -0
- package/dist/v2/blocks/operation-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/index.js +4 -2
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +9 -4
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +81 -88
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +4 -4
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +1 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -0
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/index.js +11 -9
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +3 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +2 -2
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +59 -63
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +78 -74
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +3 -3
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +43 -42
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +96 -86
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts +8 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/convert-security-scheme-secrets.js +33 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-auth-config.js +13 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/index.js +8 -2
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
- package/dist/v2/components/data-table/DataTableInput.vue2.js +25 -24
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +34 -33
- package/dist/v2/features/app/helpers/routes.d.ts +2 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +29 -29
- package/dist/v2/features/collection/DocumentCollection.vue.js +4 -3
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +8 -7
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +1 -1
- package/dist/v2/features/collection/components/Authentication.vue2.js +7 -6
- package/dist/v2/features/collection/components/Cookies.vue.js +1 -0
- package/dist/v2/features/collection/components/Environment.vue.js +1 -0
- package/dist/v2/features/collection/components/Overview.vue2.js +8 -7
- package/dist/v2/features/collection/components/Servers.vue.js +25 -24
- package/dist/v2/features/collection/components/Settings.vue.js +8 -7
- package/dist/v2/features/modal/Modal.vue.d.ts +6 -0
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +2 -2
- package/dist/v2/features/modal/Modal.vue2.js +66 -62
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +16 -16
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +36 -29
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -1
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +25 -12
- package/dist/v2/features/modal/index.d.ts +2 -1
- package/dist/v2/features/modal/index.d.ts.map +1 -1
- package/dist/v2/features/modal/index.js +3 -1
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +54 -62
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.js +2 -2
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts +5 -2
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-selected-security.js +11 -11
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts +10 -0
- package/dist/v2/features/operation/helpers/get-selected-server.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/get-selected-server.js +4 -0
- package/dist/v2/features/operation/index.d.ts +3 -0
- package/dist/v2/features/operation/index.d.ts.map +1 -1
- package/dist/v2/features/operation/index.js +8 -2
- package/dist/v2/helpers/index.d.ts +3 -0
- package/dist/v2/helpers/index.d.ts.map +1 -0
- package/dist/v2/helpers/index.js +4 -0
- package/dist/v2/helpers/plugins.d.ts +7 -1
- package/dist/v2/helpers/plugins.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +22 -17
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as k, computed as
|
|
1
|
+
import { defineComponent as k, computed as y, ref as x, useTemplateRef as w, createElementBlock as i, openBlock as t, createElementVNode as o, createBlock as c, createCommentVNode as h, unref as n, withCtx as m, createVNode as d, Fragment as v, nextTick as B } from "vue";
|
|
2
2
|
import { ScalarButton as f, ScalarMarkdown as C } from "@scalar/components";
|
|
3
3
|
import { ScalarIconPencil as b } from "@scalar/icons";
|
|
4
4
|
import I from "../../../components/code-input/CodeInput.vue.js";
|
|
5
|
-
const
|
|
5
|
+
const S = { class: "flex flex-col gap-2" }, V = { class: "flex items-center justify-between gap-2 pl-1.5" }, z = { class: "has-[:focus-visible]:bg-b-1 group rounded-lg" }, N = {
|
|
6
6
|
key: 1,
|
|
7
7
|
class: "text-c-3 flex items-center justify-center rounded-lg border p-4"
|
|
8
8
|
}, j = /* @__PURE__ */ k({
|
|
@@ -16,19 +16,20 @@ const V = { class: "flex flex-col gap-2" }, z = { class: "flex items-center just
|
|
|
16
16
|
method: {},
|
|
17
17
|
exampleName: {},
|
|
18
18
|
environment: {},
|
|
19
|
+
securitySchemes: {},
|
|
19
20
|
workspaceStore: {},
|
|
20
21
|
activeWorkspace: {},
|
|
21
22
|
plugins: {},
|
|
22
23
|
collectionType: {}
|
|
23
24
|
},
|
|
24
25
|
setup(g) {
|
|
25
|
-
const u =
|
|
26
|
+
const u = y(
|
|
26
27
|
() => g.document?.info?.description ?? ""
|
|
27
|
-
), a =
|
|
28
|
+
), a = x("preview"), p = w("codeInputRef"), r = async (s) => {
|
|
28
29
|
a.value = s, s === "edit" && (await B(), p.value?.focus());
|
|
29
30
|
};
|
|
30
|
-
return (s, e) => (t(), i("div",
|
|
31
|
-
o("div",
|
|
31
|
+
return (s, e) => (t(), i("div", S, [
|
|
32
|
+
o("div", V, [
|
|
32
33
|
e[6] || (e[6] = o("h3", { class: "font-bold" }, "Description", -1)),
|
|
33
34
|
a.value === "preview" ? (t(), c(n(f), {
|
|
34
35
|
key: 0,
|
|
@@ -48,7 +49,7 @@ const V = { class: "flex flex-col gap-2" }, z = { class: "flex items-center just
|
|
|
48
49
|
_: 1
|
|
49
50
|
})) : h("", !0)
|
|
50
51
|
]),
|
|
51
|
-
o("div",
|
|
52
|
+
o("div", z, [
|
|
52
53
|
a.value === "preview" ? (t(), i(v, { key: 0 }, [
|
|
53
54
|
u.value.trim().length ? (t(), i(v, { key: 0 }, [
|
|
54
55
|
d(n(C), {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as M, ref as A, computed as x, createElementBlock as u, openBlock as c, Fragment as S, createElementVNode as
|
|
1
|
+
import { defineComponent as M, ref as A, computed as x, createElementBlock as u, openBlock as c, Fragment as S, createElementVNode as a, createVNode as l, createTextVNode as g, renderList as I, createBlock as y, unref as r, toDisplayString as T, withCtx as f, createCommentVNode as V } from "vue";
|
|
2
2
|
import { useModal as P, ScalarMarkdown as z, ScalarButton as k, ScalarModal as L } from "@scalar/components";
|
|
3
3
|
import { debounce as O } from "@scalar/helpers/general/debounce";
|
|
4
4
|
import { ScalarIconTrash as R, ScalarIconPlus as j } from "@scalar/icons";
|
|
@@ -19,6 +19,7 @@ const Y = { class: "flex flex-col gap-4" }, q = { class: "flex flex-col gap-4" }
|
|
|
19
19
|
method: {},
|
|
20
20
|
exampleName: {},
|
|
21
21
|
environment: {},
|
|
22
|
+
securitySchemes: {},
|
|
22
23
|
workspaceStore: {},
|
|
23
24
|
activeWorkspace: {},
|
|
24
25
|
plugins: {},
|
|
@@ -44,41 +45,41 @@ const Y = { class: "flex flex-col gap-4" }, q = { class: "flex flex-col gap-4" }
|
|
|
44
45
|
v.hide(), n.value = -1;
|
|
45
46
|
}, N = () => {
|
|
46
47
|
n.value < 0 || (o.eventBus.emit("server:delete:server", { index: n.value }), p());
|
|
47
|
-
}, { execute:
|
|
48
|
+
}, { execute: h } = O({ delay: 328, maxWait: 1e3 }), U = (t, e, s) => h(
|
|
48
49
|
`${t}-${e}`,
|
|
49
50
|
() => o.eventBus.emit("server:update:server", {
|
|
50
51
|
index: t,
|
|
51
|
-
server: { [e]:
|
|
52
|
+
server: { [e]: s }
|
|
52
53
|
})
|
|
53
|
-
), C = (t, e,
|
|
54
|
+
), C = (t, e, s) => h(
|
|
54
55
|
`${t}-${e}`,
|
|
55
56
|
() => o.eventBus.emit("server:update:variables", {
|
|
56
57
|
index: t,
|
|
57
58
|
key: e,
|
|
58
|
-
value:
|
|
59
|
+
value: s
|
|
59
60
|
})
|
|
60
|
-
), D = () => o.eventBus.emit("server:add:server"),
|
|
61
|
+
), D = () => o.eventBus.emit("server:add:server"), b = (t, e = 0) => t?.description || `Server ${e + 1}`;
|
|
61
62
|
return (t, e) => (c(), u(S, null, [
|
|
62
|
-
|
|
63
|
-
e[1] || (e[1] =
|
|
64
|
-
|
|
65
|
-
|
|
63
|
+
a("div", Y, [
|
|
64
|
+
e[1] || (e[1] = a("div", { class: "flex flex-col gap-2" }, [
|
|
65
|
+
a("h3", { class: "font-bold" }, "Servers"),
|
|
66
|
+
a("p", { class: "text-sm" }, [
|
|
66
67
|
g(" Add different base URLs for your API. You can use "),
|
|
67
|
-
|
|
68
|
+
a("code", { class: "font-code text-c-2" }, "{variables}"),
|
|
68
69
|
g(" for dynamic parts. ")
|
|
69
70
|
])
|
|
70
71
|
], -1)),
|
|
71
|
-
|
|
72
|
-
(c(!0), u(S, null, I($.value, (
|
|
72
|
+
a("div", q, [
|
|
73
|
+
(c(!0), u(S, null, I($.value, (s, d) => (c(), u("div", {
|
|
73
74
|
key: d,
|
|
74
75
|
class: "rounded-lg border"
|
|
75
76
|
}, [
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
a("div", G, [
|
|
78
|
+
s.description ? (c(), y(r(z), {
|
|
78
79
|
key: 0,
|
|
79
80
|
class: "self-center",
|
|
80
|
-
value:
|
|
81
|
-
}, null, 8, ["value"])) : (c(), u("span", H, T(
|
|
81
|
+
value: s.description
|
|
82
|
+
}, null, 8, ["value"])) : (c(), u("span", H, T(b(s, d)), 1)),
|
|
82
83
|
l(r(k), {
|
|
83
84
|
class: "hover:bg-b-3 hover:text-c-1 h-fit p-1.25",
|
|
84
85
|
"data-testid": "delete-server-button",
|
|
@@ -91,22 +92,22 @@ const Y = { class: "flex flex-col gap-4" }, q = { class: "flex flex-col gap-4" }
|
|
|
91
92
|
_: 1
|
|
92
93
|
}, 8, ["onClick"])
|
|
93
94
|
]),
|
|
94
|
-
|
|
95
|
+
a("div", J, [
|
|
95
96
|
l(F, {
|
|
96
|
-
data:
|
|
97
|
+
data: s,
|
|
97
98
|
environment: t.environment,
|
|
98
99
|
onUpdate: (i, m) => U(d, i, m),
|
|
99
100
|
options: B
|
|
100
101
|
}, null, 8, ["data", "environment", "onUpdate"]),
|
|
101
|
-
|
|
102
|
+
s.variables ? (c(), y(r(W), {
|
|
102
103
|
key: 0,
|
|
103
|
-
variables:
|
|
104
|
+
variables: s.variables,
|
|
104
105
|
"onUpdate:variable": (i, m) => C(d, i, m)
|
|
105
106
|
}, null, 8, ["variables", "onUpdate:variable"])) : V("", !0)
|
|
106
107
|
])
|
|
107
108
|
]))), 128))
|
|
108
109
|
]),
|
|
109
|
-
|
|
110
|
+
a("div", K, [
|
|
110
111
|
l(r(k), {
|
|
111
112
|
class: "hover:bg-b-2 hover:text-c-1 flex items-center gap-2",
|
|
112
113
|
size: "sm",
|
|
@@ -115,7 +116,7 @@ const Y = { class: "flex flex-col gap-4" }, q = { class: "flex flex-col gap-4" }
|
|
|
115
116
|
}, {
|
|
116
117
|
default: f(() => [
|
|
117
118
|
l(r(j)),
|
|
118
|
-
e[0] || (e[0] =
|
|
119
|
+
e[0] || (e[0] = a("span", null, "Add Server", -1))
|
|
119
120
|
]),
|
|
120
121
|
_: 1
|
|
121
122
|
})
|
|
@@ -124,7 +125,7 @@ const Y = { class: "flex flex-col gap-4" }, q = { class: "flex flex-col gap-4" }
|
|
|
124
125
|
l(r(L), {
|
|
125
126
|
size: "xxs",
|
|
126
127
|
state: r(v),
|
|
127
|
-
title: `Delete ${
|
|
128
|
+
title: `Delete ${b(_.value, n.value)}`
|
|
128
129
|
}, {
|
|
129
130
|
default: f(() => [
|
|
130
131
|
l(E, {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as u, createBlock as t, openBlock as a, unref as
|
|
1
|
+
import { defineComponent as u, createBlock as t, openBlock as a, unref as c } from "vue";
|
|
2
2
|
import { useRouter as i } from "vue-router";
|
|
3
3
|
import p from "../../settings/DocumentSettings.vue.js";
|
|
4
4
|
import h from "../../settings/CollectionSettings.vue.js";
|
|
5
|
-
const
|
|
5
|
+
const U = /* @__PURE__ */ u({
|
|
6
6
|
__name: "Settings",
|
|
7
7
|
props: {
|
|
8
8
|
documentSlug: {},
|
|
@@ -13,13 +13,14 @@ const y = /* @__PURE__ */ u({
|
|
|
13
13
|
method: {},
|
|
14
14
|
exampleName: {},
|
|
15
15
|
environment: {},
|
|
16
|
+
securitySchemes: {},
|
|
16
17
|
workspaceStore: {},
|
|
17
18
|
activeWorkspace: {},
|
|
18
19
|
plugins: {},
|
|
19
20
|
collectionType: {}
|
|
20
21
|
},
|
|
21
22
|
setup(o) {
|
|
22
|
-
const
|
|
23
|
+
const r = (e) => {
|
|
23
24
|
o.eventBus.emit("document:update:watch-mode", e);
|
|
24
25
|
}, n = (e) => {
|
|
25
26
|
o.eventBus.emit("workspace:update:theme", e);
|
|
@@ -35,15 +36,15 @@ const y = /* @__PURE__ */ u({
|
|
|
35
36
|
}
|
|
36
37
|
});
|
|
37
38
|
};
|
|
38
|
-
return (e, k) => e.collectionType === "document" ? (a(), t(
|
|
39
|
+
return (e, k) => e.collectionType === "document" ? (a(), t(c(p), {
|
|
39
40
|
key: 0,
|
|
40
41
|
documentUrl: e.document?.["x-scalar-original-source-url"],
|
|
41
42
|
isDraftDocument: e.documentSlug === "drafts",
|
|
42
43
|
title: e.document?.info.title ?? "",
|
|
43
44
|
watchMode: e.document?.["x-scalar-watch-mode"] ?? !0,
|
|
44
45
|
"onDelete:document": s,
|
|
45
|
-
"onUpdate:watchMode":
|
|
46
|
-
}, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (a(), t(
|
|
46
|
+
"onUpdate:watchMode": r
|
|
47
|
+
}, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (a(), t(c(h), {
|
|
47
48
|
key: 1,
|
|
48
49
|
activeProxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"],
|
|
49
50
|
activeThemeId: e.workspaceStore.workspace["x-scalar-theme"] ?? "default",
|
|
@@ -56,5 +57,5 @@ const y = /* @__PURE__ */ u({
|
|
|
56
57
|
}
|
|
57
58
|
});
|
|
58
59
|
export {
|
|
59
|
-
|
|
60
|
+
U as default
|
|
60
61
|
};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type ModalState } from '@scalar/components';
|
|
2
2
|
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
3
|
+
import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
|
|
3
4
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
5
|
+
import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
4
6
|
import type { WorkspaceDocument } from '@scalar/workspace-store/schemas';
|
|
5
7
|
import { type ComputedRef } from 'vue';
|
|
6
8
|
import { type UseModalSidebarReturn } from '../../../v2/features/modal/hooks/use-modal-sidebar.js';
|
|
@@ -12,6 +14,8 @@ export type ModalProps = {
|
|
|
12
14
|
document: ComputedRef<WorkspaceDocument | null>;
|
|
13
15
|
/** The path must be initialized and passed in */
|
|
14
16
|
path: ComputedRef<string | undefined>;
|
|
17
|
+
/** The event bus for handling all events */
|
|
18
|
+
eventBus: WorkspaceEventBus;
|
|
15
19
|
/** The method must be initialized and passed in */
|
|
16
20
|
method: ComputedRef<HttpMethod | undefined>;
|
|
17
21
|
/** The example name must be initialized and passed in */
|
|
@@ -22,6 +26,8 @@ export type ModalProps = {
|
|
|
22
26
|
sidebarState: UseModalSidebarReturn;
|
|
23
27
|
/** Api client plugins to include in the modal */
|
|
24
28
|
plugins?: ClientPlugin[];
|
|
29
|
+
/** Authentication config */
|
|
30
|
+
authenticationConfiguration: AuthenticationConfiguration;
|
|
25
31
|
};
|
|
26
32
|
/**
|
|
27
33
|
* Scalar Api Client Modal
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/Modal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/Modal.vue"],"names":[],"mappings":"AAqYA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAExE,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,KAAK,CAAA;AAKZ,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAQxD,MAAM,MAAM,UAAU,GAAG;IACvB,4DAA4D;IAC5D,cAAc,EAAE,cAAc,CAAA;IAC9B,qDAAqD;IACrD,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,iDAAiD;IACjD,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrC,4CAA4C;IAC5C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,mDAAmD;IACnD,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC3C,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5C,2CAA2C;IAC3C,UAAU,EAAE,UAAU,CAAA;IACtB,0DAA0D;IAC1D,YAAY,EAAE,qBAAqB,CAAA;IACnC,iDAAiD;IACjD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,4BAA4B;IAC5B,2BAA2B,EAAE,2BAA2B,CAAA;CACzD,CAAA;AAED;;;;GAIG;;;;;AACH,wBAuWC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Modal.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a6559241"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { addScalarClassesToHeadless as
|
|
3
|
-
import { ScalarToasts as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { defineComponent as I, ref as h, useId as N, watch as D, nextTick as E, onBeforeMount as F, onBeforeUnmount as U, computed as u, withDirectives as w, createElementBlock as d, openBlock as c, createElementVNode as i, unref as o, createVNode as l, withCtx as x, vShow as k } from "vue";
|
|
2
|
+
import { addScalarClassesToHeadless as A, ScalarTeleportRoot as V } from "@scalar/components";
|
|
3
|
+
import { ScalarToasts as $ } from "@scalar/use-toasts";
|
|
4
|
+
import { useFocusTrap as M } from "@vueuse/integrations/useFocusTrap";
|
|
5
|
+
import { mergeAuthConfig as H } from "../../blocks/scalar-auth-selector-block/helpers/merge-auth-config.js";
|
|
6
6
|
import L from "../operation/Operation.vue.js";
|
|
7
7
|
import { getActiveEnvironment as z } from "../../helpers/get-active-environment.js";
|
|
8
8
|
import { useColorMode as O } from "../../hooks/use-color-mode.js";
|
|
@@ -17,124 +17,128 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
17
17
|
}, Y = {
|
|
18
18
|
key: 1,
|
|
19
19
|
class: "flex h-full w-full items-center justify-center"
|
|
20
|
-
}, Z = {}, me = /* @__PURE__ */
|
|
20
|
+
}, Z = {}, me = /* @__PURE__ */ I({
|
|
21
21
|
...Z,
|
|
22
22
|
__name: "Modal",
|
|
23
23
|
props: {
|
|
24
24
|
workspaceStore: {},
|
|
25
25
|
document: {},
|
|
26
26
|
path: {},
|
|
27
|
+
eventBus: {},
|
|
27
28
|
method: {},
|
|
28
29
|
exampleName: {},
|
|
29
30
|
modalState: {},
|
|
30
31
|
sidebarState: {},
|
|
31
|
-
plugins: { default: () => [] }
|
|
32
|
+
plugins: { default: () => [] },
|
|
33
|
+
authenticationConfiguration: {}
|
|
32
34
|
},
|
|
33
|
-
setup(
|
|
34
|
-
typeof window < "u" && (window.dataDumpWorkspace = () =>
|
|
35
|
-
const l = M({
|
|
36
|
-
debug: !1
|
|
37
|
-
});
|
|
38
|
-
O({ workspaceStore: a.workspaceStore });
|
|
35
|
+
setup(t, { expose: b }) {
|
|
36
|
+
typeof window < "u" && (window.dataDumpWorkspace = () => t.workspaceStore), O({ workspaceStore: t.workspaceStore });
|
|
39
37
|
const m = {
|
|
40
38
|
name: "default",
|
|
41
39
|
id: "default"
|
|
42
|
-
},
|
|
40
|
+
}, s = h(!1);
|
|
43
41
|
q({
|
|
44
|
-
eventBus:
|
|
45
|
-
document:
|
|
46
|
-
workspaceStore:
|
|
47
|
-
isSidebarOpen:
|
|
48
|
-
sidebarState:
|
|
49
|
-
modalState:
|
|
50
|
-
}), R(
|
|
51
|
-
const
|
|
42
|
+
eventBus: t.eventBus,
|
|
43
|
+
document: t.document,
|
|
44
|
+
workspaceStore: t.workspaceStore,
|
|
45
|
+
isSidebarOpen: s,
|
|
46
|
+
sidebarState: t.sidebarState,
|
|
47
|
+
modalState: t.modalState
|
|
48
|
+
}), R(t.eventBus, "modal");
|
|
49
|
+
const f = h(null), v = N(), { activate: y, deactivate: B } = M(f, {
|
|
52
50
|
allowOutsideClick: !0,
|
|
53
|
-
fallbackFocus: `#${
|
|
54
|
-
}),
|
|
55
|
-
|
|
56
|
-
},
|
|
57
|
-
|
|
58
|
-
() =>
|
|
51
|
+
fallbackFocus: `#${v}`
|
|
52
|
+
}), p = () => {
|
|
53
|
+
B(), t.eventBus.emit("operation:cancel:request");
|
|
54
|
+
}, g = j(() => typeof window < "u" ? window.document.body : null);
|
|
55
|
+
D(
|
|
56
|
+
() => t.modalState.open,
|
|
59
57
|
(e) => {
|
|
60
|
-
|
|
58
|
+
g.value = e, e ? y({ checkCanFocusTrap: () => E() }) : p();
|
|
61
59
|
}
|
|
62
|
-
),
|
|
63
|
-
const
|
|
64
|
-
() =>
|
|
65
|
-
),
|
|
66
|
-
() => z(
|
|
60
|
+
), F(() => A()), U(() => p());
|
|
61
|
+
const C = 288, r = u(
|
|
62
|
+
() => t.workspaceStore?.workspace?.["x-scalar-sidebar-width"] ?? C
|
|
63
|
+
), T = (e) => t.workspaceStore?.update("x-scalar-sidebar-width", e), S = u(
|
|
64
|
+
() => z(t.workspaceStore, t.document.value)
|
|
65
|
+
), W = u(
|
|
66
|
+
() => H(
|
|
67
|
+
t.document.value?.components?.securitySchemes,
|
|
68
|
+
t.authenticationConfiguration?.securitySchemes
|
|
69
|
+
)
|
|
67
70
|
);
|
|
68
|
-
return
|
|
69
|
-
sidebarWidth:
|
|
71
|
+
return b({
|
|
72
|
+
sidebarWidth: r,
|
|
70
73
|
environment: S
|
|
71
|
-
}), (e,
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
id: o(
|
|
74
|
+
}), (e, a) => w((c(), d("div", P, [
|
|
75
|
+
i("div", J, [
|
|
76
|
+
i("div", {
|
|
77
|
+
id: o(v),
|
|
75
78
|
ref_key: "client",
|
|
76
|
-
ref:
|
|
79
|
+
ref: f,
|
|
77
80
|
"aria-label": "API Client",
|
|
78
81
|
"aria-modal": "true",
|
|
79
82
|
class: "scalar-app-layout scalar-client flex",
|
|
80
83
|
role: "dialog",
|
|
81
84
|
tabindex: "-1"
|
|
82
85
|
}, [
|
|
83
|
-
|
|
84
|
-
default:
|
|
85
|
-
|
|
86
|
-
e.document.value && e.path?.value && e.method?.value ? (c(),
|
|
87
|
-
|
|
88
|
-
modelValue:
|
|
89
|
-
"onUpdate:modelValue":
|
|
86
|
+
l(o(V), null, {
|
|
87
|
+
default: x(() => [
|
|
88
|
+
l(o($)),
|
|
89
|
+
e.document.value && e.path?.value && e.method?.value ? (c(), d("main", X, [
|
|
90
|
+
l(o(G), {
|
|
91
|
+
modelValue: s.value,
|
|
92
|
+
"onUpdate:modelValue": a[0] || (a[0] = (n) => s.value = n),
|
|
90
93
|
class: "absolute top-2 left-3 z-[10001]"
|
|
91
94
|
}, null, 8, ["modelValue"]),
|
|
92
|
-
|
|
93
|
-
sidebarWidth:
|
|
95
|
+
w(l(o(K), {
|
|
96
|
+
sidebarWidth: r.value,
|
|
94
97
|
"onUpdate:sidebarWidth": [
|
|
95
|
-
|
|
96
|
-
|
|
98
|
+
a[1] || (a[1] = (n) => r.value = n),
|
|
99
|
+
T
|
|
97
100
|
],
|
|
98
101
|
activeWorkspace: m,
|
|
99
102
|
class: "z-[10000] h-full max-md:absolute! max-md:w-full!",
|
|
100
103
|
documents: [e.document.value],
|
|
101
|
-
eventBus:
|
|
104
|
+
eventBus: e.eventBus,
|
|
102
105
|
isDroppable: () => !1,
|
|
103
106
|
layout: "modal",
|
|
104
107
|
sidebarState: e.sidebarState.state,
|
|
105
108
|
workspaces: [],
|
|
106
109
|
onSelectItem: e.sidebarState.handleSelectItem
|
|
107
110
|
}, null, 8, ["sidebarWidth", "documents", "eventBus", "sidebarState", "onSelectItem"]), [
|
|
108
|
-
[
|
|
111
|
+
[k, s.value]
|
|
109
112
|
]),
|
|
110
|
-
|
|
113
|
+
l(L, {
|
|
111
114
|
activeWorkspace: m,
|
|
112
115
|
class: "flex-1",
|
|
113
116
|
document: e.document.value,
|
|
114
117
|
documentSlug: e.document.value["x-scalar-navigation"]?.id ?? "",
|
|
115
118
|
environment: S.value,
|
|
116
|
-
eventBus:
|
|
119
|
+
eventBus: e.eventBus,
|
|
117
120
|
exampleName: e.exampleName?.value,
|
|
118
121
|
layout: "modal",
|
|
119
122
|
method: e.method?.value,
|
|
120
123
|
path: e.path?.value,
|
|
121
124
|
plugins: e.plugins,
|
|
125
|
+
securitySchemes: W.value,
|
|
122
126
|
workspaceStore: e.workspaceStore
|
|
123
|
-
}, null, 8, ["document", "documentSlug", "environment", "eventBus", "exampleName", "method", "path", "plugins", "workspaceStore"])
|
|
124
|
-
])) : (c(),
|
|
125
|
-
|
|
127
|
+
}, null, 8, ["document", "documentSlug", "environment", "eventBus", "exampleName", "method", "path", "plugins", "securitySchemes", "workspaceStore"])
|
|
128
|
+
])) : (c(), d("div", Y, [...a[3] || (a[3] = [
|
|
129
|
+
i("span", { class: "text-c-3" }, "No document selected", -1)
|
|
126
130
|
])]))
|
|
127
131
|
]),
|
|
128
132
|
_: 1
|
|
129
133
|
})
|
|
130
134
|
], 8, Q),
|
|
131
|
-
|
|
135
|
+
i("div", {
|
|
132
136
|
class: "scalar-app-exit",
|
|
133
|
-
onClick:
|
|
137
|
+
onClick: a[2] || (a[2] = (n) => e.modalState.hide())
|
|
134
138
|
})
|
|
135
139
|
])
|
|
136
140
|
], 512)), [
|
|
137
|
-
[
|
|
141
|
+
[k, e.modalState.open]
|
|
138
142
|
]);
|
|
139
143
|
}
|
|
140
144
|
});
|
|
@@ -1,4 +1,8 @@
|
|
|
1
|
+
import { type ModalState } from '@scalar/components';
|
|
2
|
+
import type { AuthenticationConfiguration } from '@scalar/types/api-reference';
|
|
1
3
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
|
+
import { type WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
5
|
+
import { type App } from 'vue';
|
|
2
6
|
import { type RoutePayload } from '../../../../v2/features/modal/helpers/resolve-route-parameters.js';
|
|
3
7
|
import type { ClientPlugin } from '../../../../v2/helpers/plugins.js';
|
|
4
8
|
export type CreateApiClientModalOptions = {
|
|
@@ -9,10 +13,21 @@ export type CreateApiClientModalOptions = {
|
|
|
9
13
|
* For SSR this may need to be disabled and handled manually on the client side.
|
|
10
14
|
*/
|
|
11
15
|
mountOnInitialize?: boolean;
|
|
16
|
+
/** You can pass in an event bus if you have one already, or we will create one */
|
|
17
|
+
eventBus?: WorkspaceEventBus;
|
|
12
18
|
/** The workspace store must be initialized and passed in. */
|
|
13
19
|
workspaceStore: WorkspaceStore;
|
|
14
20
|
/** Api client plugins to include in the modal */
|
|
15
21
|
plugins?: ClientPlugin[];
|
|
22
|
+
/** Authentication config */
|
|
23
|
+
authenticationConfiguration?: AuthenticationConfiguration | undefined;
|
|
24
|
+
};
|
|
25
|
+
export type ApiClientModal = {
|
|
26
|
+
app: App;
|
|
27
|
+
open: (payload?: RoutePayload) => void;
|
|
28
|
+
mount: (mountingEl: HTMLElement | null) => void;
|
|
29
|
+
route: (payload: RoutePayload) => void;
|
|
30
|
+
modalState: ModalState;
|
|
16
31
|
};
|
|
17
32
|
/**
|
|
18
33
|
* Creates the API Client Modal.
|
|
@@ -20,20 +35,5 @@ export type CreateApiClientModalOptions = {
|
|
|
20
35
|
* The modal does not require a router. Instead, navigation is handled by setting
|
|
21
36
|
* active entities directly through the returned `route` function.
|
|
22
37
|
*/
|
|
23
|
-
export declare const createApiClientModal: ({ el,
|
|
24
|
-
/** The Vue app instance for the modal. Use with caution. */
|
|
25
|
-
app: import("vue").App<Element>;
|
|
26
|
-
/** Open the modal and optionally navigate to a specific route. */
|
|
27
|
-
open: (payload?: RoutePayload) => void;
|
|
28
|
-
/** Mount the modal to a given element. */
|
|
29
|
-
mount: (mountingEl?: HTMLElement | null) => void;
|
|
30
|
-
/** Navigate to the specified path, method, and example. */
|
|
31
|
-
route: (payload: RoutePayload) => void;
|
|
32
|
-
/** Controls the visibility of the modal. */
|
|
33
|
-
modalState: {
|
|
34
|
-
open: boolean;
|
|
35
|
-
show: () => void;
|
|
36
|
-
hide: () => void;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
38
|
+
export declare const createApiClientModal: ({ el, eventBus, mountOnInitialize, plugins, workspaceStore, authenticationConfiguration, }: CreateApiClientModalOptions) => ApiClientModal;
|
|
39
39
|
//# sourceMappingURL=create-api-client-modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-api-client-modal.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/create-api-client-modal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-api-client-modal.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/create-api-client-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,6BAA6B,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,gCAAgC,CAAA;AAChG,OAAO,EAAE,KAAK,GAAG,EAAiC,MAAM,KAAK,CAAA;AAE7D,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,sDAAsD,CAAA;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD,MAAM,MAAM,2BAA2B,GAAG;IACxC,4CAA4C;IAC5C,EAAE,EAAE,WAAW,GAAG,IAAI,CAAA;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,6DAA6D;IAC7D,cAAc,EAAE,cAAc,CAAA;IAC9B,iDAAiD;IACjD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,4BAA4B;IAC5B,2BAA2B,CAAC,EAAE,2BAA2B,GAAG,SAAS,CAAA;CACtE,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,KAAK,EAAE,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;IAC/C,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAMD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,4FASlC,2BAA2B,KAAG,cAsFhC,CAAA"}
|
|
@@ -1,39 +1,46 @@
|
|
|
1
|
-
import { useModal as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
|
|
1
|
+
import { useModal as P } from "@scalar/components";
|
|
2
|
+
import { createWorkspaceEventBus as A } from "@scalar/workspace-store/events";
|
|
3
|
+
import { reactive as C, computed as t, createApp as I } from "vue";
|
|
4
|
+
import { resolveRouteParameters as R } from "./resolve-route-parameters.js";
|
|
5
|
+
import { useModalSidebar as S } from "../hooks/use-modal-sidebar.js";
|
|
6
|
+
import j from "../Modal.vue.js";
|
|
7
|
+
const T = ({
|
|
7
8
|
el: f,
|
|
9
|
+
eventBus: v = A({
|
|
10
|
+
debug: !1
|
|
11
|
+
}),
|
|
12
|
+
mountOnInitialize: h = !0,
|
|
13
|
+
plugins: g,
|
|
8
14
|
workspaceStore: a,
|
|
9
|
-
|
|
10
|
-
plugins: h
|
|
15
|
+
authenticationConfiguration: x = {}
|
|
11
16
|
}) => {
|
|
12
|
-
const
|
|
17
|
+
const n = {
|
|
13
18
|
path: "default",
|
|
14
19
|
method: "default",
|
|
15
20
|
example: "default",
|
|
16
21
|
documentSlug: a.workspace["x-scalar-active-document"] || "default"
|
|
17
|
-
}, m =
|
|
18
|
-
Object.assign(m,
|
|
19
|
-
}, o = t(() =>
|
|
22
|
+
}, m = C({ ...n }), r = (e) => {
|
|
23
|
+
Object.assign(m, n, e);
|
|
24
|
+
}, o = t(() => R(a, m)), s = t(() => o.value.documentSlug), u = t(() => o.value.path), d = t(() => o.value.method), i = t(() => o.value.example), M = t(() => a.workspace.documents[s.value ?? ""] ?? null), b = S({
|
|
20
25
|
workspaceStore: a,
|
|
21
26
|
documentSlug: s,
|
|
22
27
|
path: u,
|
|
23
28
|
method: d,
|
|
24
29
|
exampleName: i,
|
|
25
|
-
route:
|
|
26
|
-
}),
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
modalState: l,
|
|
30
|
-
sidebarState: x,
|
|
31
|
-
path: u,
|
|
32
|
-
method: d,
|
|
30
|
+
route: r
|
|
31
|
+
}), c = P(), l = I(j, {
|
|
32
|
+
document: M,
|
|
33
|
+
eventBus: v,
|
|
33
34
|
exampleName: i,
|
|
34
|
-
|
|
35
|
+
method: d,
|
|
36
|
+
modalState: c,
|
|
37
|
+
path: u,
|
|
38
|
+
plugins: g,
|
|
39
|
+
sidebarState: b,
|
|
40
|
+
workspaceStore: a,
|
|
41
|
+
authenticationConfiguration: x
|
|
35
42
|
});
|
|
36
|
-
|
|
43
|
+
l.config.idPrefix = "scalar-client";
|
|
37
44
|
const p = (e = f) => {
|
|
38
45
|
if (!e) {
|
|
39
46
|
console.error(
|
|
@@ -43,23 +50,23 @@ const N = ({
|
|
|
43
50
|
);
|
|
44
51
|
return;
|
|
45
52
|
}
|
|
46
|
-
|
|
53
|
+
l.mount(e);
|
|
47
54
|
};
|
|
48
|
-
return
|
|
55
|
+
return h && p(), {
|
|
49
56
|
/** The Vue app instance for the modal. Use with caution. */
|
|
50
|
-
app:
|
|
57
|
+
app: l,
|
|
51
58
|
/** Open the modal and optionally navigate to a specific route. */
|
|
52
59
|
open: (e) => {
|
|
53
|
-
|
|
60
|
+
c.open = !0, e && r(e);
|
|
54
61
|
},
|
|
55
62
|
/** Mount the modal to a given element. */
|
|
56
63
|
mount: p,
|
|
57
64
|
/** Navigate to the specified path, method, and example. */
|
|
58
|
-
route:
|
|
65
|
+
route: r,
|
|
59
66
|
/** Controls the visibility of the modal. */
|
|
60
|
-
modalState:
|
|
67
|
+
modalState: c
|
|
61
68
|
};
|
|
62
69
|
};
|
|
63
70
|
export {
|
|
64
|
-
|
|
71
|
+
T as createApiClientModal
|
|
65
72
|
};
|