@scalar/api-client 2.31.3 → 2.33.0
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 +94 -0
- package/dist/assets/yaml.worker-CcQnAKCg.js +490 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts +0 -5
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +57 -60
- package/dist/v2/features/app/app-state.d.ts +17 -2
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +117 -105
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +1 -3
- package/dist/v2/features/app/helpers/routes.d.ts +17 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +8 -2
- package/dist/v2/features/app/hooks/use-theme.d.ts +14 -0
- package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-theme.js +42 -28
- package/dist/v2/features/collection/DocumentCollection.vue.js +8 -6
- package/dist/v2/features/collection/OperationCollection.vue.js +14 -12
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +9 -7
- package/dist/v2/features/collection/components/Authentication.vue2.js +19 -17
- package/dist/v2/features/collection/components/Cookies.vue.js +10 -8
- package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts +16 -0
- package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/Editor.vue.js +7 -0
- package/dist/v2/features/collection/components/Editor/Editor.vue2.js +333 -0
- package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.d.ts +19 -0
- package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.js +78 -0
- package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue2.js +4 -0
- package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.d.ts +16 -0
- package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.js +83 -0
- package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue2.js +4 -0
- package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts +16 -0
- package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.js +56 -0
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts +7 -0
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.js +40 -0
- package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts +6 -0
- package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.js +23 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.d.ts +12 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.js +10 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts +14 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.js +9 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.d.ts +11 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.js +5 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.d.ts +7 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.js +5 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts +19 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.js +50 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts +12 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-ast.js +24 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts +15 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.js +72 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts +7 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.js +20 -0
- package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts +14 -0
- package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.js +21 -0
- package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.d.ts +10 -0
- package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.js +21 -0
- package/dist/v2/features/collection/components/Editor/helpers/stringify-document.d.ts +10 -0
- package/dist/v2/features/collection/components/Editor/helpers/stringify-document.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/stringify-document.js +5 -0
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts +2 -0
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.js +11 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts +152 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.js +34 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +14 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.js +25 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts +39 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.js +153 -0
- package/dist/v2/features/collection/components/Editor/index.d.ts +2 -0
- package/dist/v2/features/collection/components/Editor/index.d.ts.map +1 -0
- package/dist/v2/features/collection/components/Editor/index.js +4 -0
- package/dist/v2/features/collection/components/Editor/schemas/openapi-3.1-schema.json.js +25 -0
- package/dist/v2/features/collection/components/Environment.vue.js +8 -6
- package/dist/v2/features/collection/components/Overview.vue2.js +16 -14
- package/dist/v2/features/collection/components/Servers.vue.js +18 -16
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +6 -4
- package/dist/v2/features/collection/components/Tabs.vue.js +4 -4
- package/dist/v2/features/operation/Operation.vue.js +9 -7
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +32 -25
|
@@ -10,12 +10,12 @@ import B from "./components/Tabs.vue.js";
|
|
|
10
10
|
const D = { class: "custom-scroll h-full" }, N = {
|
|
11
11
|
key: 0,
|
|
12
12
|
class: "w-full md:mx-auto md:max-w-180"
|
|
13
|
-
}, z = ["aria-label"], I = { class: "flex flex-row items-center gap-2" },
|
|
13
|
+
}, z = ["aria-label"], I = { class: "flex flex-row items-center gap-2" }, T = { class: "group relative ml-1.25" }, U = { class: "px-1.5 py-8" }, $ = {
|
|
14
14
|
key: 1,
|
|
15
15
|
class: "flex w-full flex-1 items-center justify-center"
|
|
16
16
|
}, j = {
|
|
17
17
|
name: "DocumentCollection"
|
|
18
|
-
},
|
|
18
|
+
}, G = /* @__PURE__ */ h({
|
|
19
19
|
...j,
|
|
20
20
|
props: {
|
|
21
21
|
documentSlug: {},
|
|
@@ -30,7 +30,9 @@ const D = { class: "custom-scroll h-full" }, N = {
|
|
|
30
30
|
workspaceStore: {},
|
|
31
31
|
activeWorkspace: {},
|
|
32
32
|
plugins: {},
|
|
33
|
-
customThemes: {}
|
|
33
|
+
customThemes: {},
|
|
34
|
+
currentTheme: {},
|
|
35
|
+
isDarkMode: { type: Boolean }
|
|
34
36
|
},
|
|
35
37
|
setup(a) {
|
|
36
38
|
const n = a, m = p(() => n.document?.info?.title || "Untitled Document"), d = p(
|
|
@@ -109,7 +111,7 @@ const D = { class: "custom-scroll h-full" }, N = {
|
|
|
109
111
|
]),
|
|
110
112
|
_: 1
|
|
111
113
|
}, 8, ["modelValue"]),
|
|
112
|
-
t("div",
|
|
114
|
+
t("div", T, [
|
|
113
115
|
o(V, {
|
|
114
116
|
class: "text-xl font-bold",
|
|
115
117
|
inputId: "documentName",
|
|
@@ -120,7 +122,7 @@ const D = { class: "custom-scroll h-full" }, N = {
|
|
|
120
122
|
])
|
|
121
123
|
], 8, z),
|
|
122
124
|
o(B, { type: "document" }),
|
|
123
|
-
t("div",
|
|
125
|
+
t("div", U, [
|
|
124
126
|
o(s(_), null, {
|
|
125
127
|
default: l(({ Component: r }) => [
|
|
126
128
|
(u(), f(g(r), k(n, { collectionType: "document" }), null, 16))
|
|
@@ -138,5 +140,5 @@ const D = { class: "custom-scroll h-full" }, N = {
|
|
|
138
140
|
}
|
|
139
141
|
});
|
|
140
142
|
export {
|
|
141
|
-
|
|
143
|
+
G as default
|
|
142
144
|
};
|
|
@@ -4,14 +4,14 @@ import { getResolvedRef as w } from "@scalar/workspace-store/helpers/get-resolve
|
|
|
4
4
|
import { RouterView as g } from "vue-router";
|
|
5
5
|
import k from "./components/LabelInput.vue.js";
|
|
6
6
|
import b from "./components/Tabs.vue.js";
|
|
7
|
-
const
|
|
7
|
+
const B = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "custom-scroll h-full"
|
|
10
|
-
},
|
|
10
|
+
}, S = { class: "w-full md:mx-auto md:max-w-180" }, V = ["aria-label"], T = { class: "group relative ml-1.25" }, U = { class: "px-1.5 py-8" }, $ = {
|
|
11
11
|
key: 1,
|
|
12
12
|
class: "flex w-full flex-1 items-center justify-center"
|
|
13
|
-
},
|
|
14
|
-
...
|
|
13
|
+
}, C = {}, M = /* @__PURE__ */ f({
|
|
14
|
+
...C,
|
|
15
15
|
__name: "OperationCollection",
|
|
16
16
|
props: {
|
|
17
17
|
documentSlug: {},
|
|
@@ -26,7 +26,9 @@ const S = {
|
|
|
26
26
|
workspaceStore: {},
|
|
27
27
|
activeWorkspace: {},
|
|
28
28
|
plugins: {},
|
|
29
|
-
customThemes: {}
|
|
29
|
+
customThemes: {},
|
|
30
|
+
currentTheme: {},
|
|
31
|
+
isDarkMode: { type: Boolean }
|
|
30
32
|
},
|
|
31
33
|
setup(p) {
|
|
32
34
|
const e = p, n = m(() => {
|
|
@@ -48,13 +50,13 @@ const S = {
|
|
|
48
50
|
}
|
|
49
51
|
});
|
|
50
52
|
}, c = m(() => !e.path || !e.method ? "Untitled Operation" : `${e.method.toUpperCase()} ${e.path}`);
|
|
51
|
-
return (r, t) => n.value !== void 0 ? (u(), i("div",
|
|
52
|
-
o("div",
|
|
53
|
+
return (r, t) => n.value !== void 0 ? (u(), i("div", B, [
|
|
54
|
+
o("div", S, [
|
|
53
55
|
o("div", {
|
|
54
56
|
"aria-label": `title: ${l.value}`,
|
|
55
57
|
class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-8 pb-3 md:max-w-180"
|
|
56
58
|
}, [
|
|
57
|
-
o("div",
|
|
59
|
+
o("div", T, [
|
|
58
60
|
s(k, {
|
|
59
61
|
modelValue: l.value,
|
|
60
62
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => l.value = a),
|
|
@@ -64,13 +66,13 @@ const S = {
|
|
|
64
66
|
onBlur: d
|
|
65
67
|
}, null, 8, ["modelValue", "placeholder"])
|
|
66
68
|
])
|
|
67
|
-
], 8,
|
|
69
|
+
], 8, V),
|
|
68
70
|
s(b, { type: "operation" }),
|
|
69
|
-
o("div",
|
|
71
|
+
o("div", U, [
|
|
70
72
|
s(x(g), _(e, { collectionType: "operation" }), null, 16)
|
|
71
73
|
])
|
|
72
74
|
])
|
|
73
|
-
])) : (u(), i("div",
|
|
75
|
+
])) : (u(), i("div", $, [...t[1] || (t[1] = [
|
|
74
76
|
o("div", { class: "flex h-full flex-col items-center justify-center" }, [
|
|
75
77
|
o("h1", { class: "text-2xl font-bold" }, "Operation not found"),
|
|
76
78
|
o("p", { class: "text-gray-500" }, " The operation you are looking for does not exist. ")
|
|
@@ -79,5 +81,5 @@ const S = {
|
|
|
79
81
|
}
|
|
80
82
|
});
|
|
81
83
|
export {
|
|
82
|
-
|
|
84
|
+
M as default
|
|
83
85
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as m, ref as p, watch as i, createElementBlock as u, openBlock as d, createElementVNode as a, createVNode as l, unref as f, mergeProps as v } from "vue";
|
|
2
2
|
import { RouterView as _ } from "vue-router";
|
|
3
3
|
import k from "./components/LabelInput.vue.js";
|
|
4
|
-
import
|
|
5
|
-
const
|
|
6
|
-
...
|
|
4
|
+
import h from "./components/Tabs.vue.js";
|
|
5
|
+
const w = { class: "custom-scroll h-full" }, x = { class: "w-full md:mx-auto md:max-w-180" }, b = ["aria-label"], W = { class: "group relative ml-1.25" }, y = { class: "px-1.5 py-8" }, B = {}, S = /* @__PURE__ */ m({
|
|
6
|
+
...B,
|
|
7
7
|
__name: "WorkspaceCollection",
|
|
8
8
|
props: {
|
|
9
9
|
documentSlug: {},
|
|
@@ -18,7 +18,9 @@ const h = { class: "custom-scroll h-full" }, x = { class: "w-full md:mx-auto md:
|
|
|
18
18
|
workspaceStore: {},
|
|
19
19
|
activeWorkspace: {},
|
|
20
20
|
plugins: {},
|
|
21
|
-
customThemes: {}
|
|
21
|
+
customThemes: {},
|
|
22
|
+
currentTheme: {},
|
|
23
|
+
isDarkMode: { type: Boolean }
|
|
22
24
|
},
|
|
23
25
|
setup(s) {
|
|
24
26
|
const e = s, o = p(e.activeWorkspace.label);
|
|
@@ -35,7 +37,7 @@ const h = { class: "custom-scroll h-full" }, x = { class: "w-full md:mx-auto md:
|
|
|
35
37
|
}
|
|
36
38
|
e.eventBus.emit("workspace:update:name", t);
|
|
37
39
|
};
|
|
38
|
-
return (t, c) => (d(), u("div",
|
|
40
|
+
return (t, c) => (d(), u("div", w, [
|
|
39
41
|
a("div", x, [
|
|
40
42
|
a("div", {
|
|
41
43
|
"aria-label": `title: ${s.activeWorkspace.label}`,
|
|
@@ -51,8 +53,8 @@ const h = { class: "custom-scroll h-full" }, x = { class: "w-full md:mx-auto md:
|
|
|
51
53
|
}, null, 8, ["modelValue"])
|
|
52
54
|
])
|
|
53
55
|
], 8, b),
|
|
54
|
-
l(
|
|
55
|
-
a("div",
|
|
56
|
+
l(h, { type: "workspace" }),
|
|
57
|
+
a("div", y, [
|
|
56
58
|
l(f(_), v(e, { collectionType: "workspace" }), null, 16)
|
|
57
59
|
])
|
|
58
60
|
])
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as B, computed as o, ref as A, watchEffect as N, createBlock as O, openBlock as s, createSlots as U, withCtx as c, createElementVNode as n, normalizeClass as d, createVNode as v, unref as h, createElementBlock as y, Fragment as f, createTextVNode as u } from "vue";
|
|
2
2
|
import { ScalarToggle as b } from "@scalar/components";
|
|
3
3
|
import { isHttpMethod as R } from "@scalar/helpers/http/is-http-method";
|
|
4
4
|
import { getResolvedRef as V } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
@@ -6,8 +6,8 @@ import { getDefaultOperationSecurityToggle as q } from "../helpers/get-default-o
|
|
|
6
6
|
import C from "../../settings/components/Section.vue.js";
|
|
7
7
|
import { getActiveProxyUrl as E } from "../../../helpers/get-active-proxy-url.js";
|
|
8
8
|
import { getServers as M } from "../../../helpers/get-servers.js";
|
|
9
|
-
import
|
|
10
|
-
const
|
|
9
|
+
import D from "../../../blocks/scalar-auth-selector-block/components/AuthSelector.vue.js";
|
|
10
|
+
const P = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ B({
|
|
11
11
|
__name: "Authentication",
|
|
12
12
|
props: {
|
|
13
13
|
documentSlug: {},
|
|
@@ -23,14 +23,16 @@ const $ = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ A({
|
|
|
23
23
|
activeWorkspace: {},
|
|
24
24
|
plugins: {},
|
|
25
25
|
customThemes: {},
|
|
26
|
+
currentTheme: {},
|
|
27
|
+
isDarkMode: { type: Boolean },
|
|
26
28
|
collectionType: {}
|
|
27
29
|
},
|
|
28
30
|
setup(e) {
|
|
29
|
-
const r =
|
|
31
|
+
const r = o(() => e.collectionType === "operation" ? {
|
|
30
32
|
type: "operation",
|
|
31
33
|
path: e.path ?? "",
|
|
32
34
|
method: e.method ?? "get"
|
|
33
|
-
} : { type: "document" }), i =
|
|
35
|
+
} : { type: "document" }), i = o(() => e.collectionType === "operation" ? !e.path || !R(e.method) ? null : V(e.document?.paths?.[e.path]?.[e.method]) : null), a = A(!1);
|
|
34
36
|
N(() => {
|
|
35
37
|
a.value = q({
|
|
36
38
|
authStore: e.workspaceStore.auth,
|
|
@@ -38,7 +40,7 @@ const $ = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ A({
|
|
|
38
40
|
...r.value
|
|
39
41
|
});
|
|
40
42
|
});
|
|
41
|
-
const S =
|
|
43
|
+
const S = o(() => e.collectionType === "operation" ? e.workspaceStore.auth.getAuthSelectedSchemas({
|
|
42
44
|
type: "operation",
|
|
43
45
|
documentName: e.documentSlug,
|
|
44
46
|
path: e.path ?? "",
|
|
@@ -46,14 +48,14 @@ const $ = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ A({
|
|
|
46
48
|
}) : e.workspaceStore.auth.getAuthSelectedSchemas({
|
|
47
49
|
type: "document",
|
|
48
50
|
documentName: e.documentSlug
|
|
49
|
-
})), g =
|
|
51
|
+
})), g = o(() => e.collectionType === "operation" ? i.value?.security ?? [] : e.document?.security ?? []), p = o(
|
|
50
52
|
() => E(
|
|
51
53
|
e.workspaceStore.workspace["x-scalar-active-proxy"],
|
|
52
54
|
e.layout
|
|
53
55
|
) ?? ""
|
|
54
|
-
), m =
|
|
56
|
+
), m = o(() => M(i.value?.servers ?? e.document?.servers, {
|
|
55
57
|
documentUrl: e.document?.["x-scalar-original-source-url"]
|
|
56
|
-
})), k =
|
|
58
|
+
})), k = o(() => {
|
|
57
59
|
const l = e.document?.["x-scalar-selected-server"], T = i.value?.["x-scalar-selected-server"] ?? l;
|
|
58
60
|
return m.value.find(({ url: w }) => w === T) ?? m.value[0] ?? null;
|
|
59
61
|
}), x = (l) => {
|
|
@@ -72,13 +74,13 @@ const $ = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ A({
|
|
|
72
74
|
]),
|
|
73
75
|
description: c(() => [
|
|
74
76
|
e.collectionType === "operation" ? (s(), y(f, { key: 0 }, [
|
|
75
|
-
t[1] || (t[1] =
|
|
76
|
-
t[2] || (t[2] =
|
|
77
|
-
|
|
77
|
+
t[1] || (t[1] = n("span", { class: "block" }, " Override authentication for this operation with the toggle. ", -1)),
|
|
78
|
+
t[2] || (t[2] = n("span", { class: "mt-1 block" }, [
|
|
79
|
+
n("strong", null, "On"),
|
|
78
80
|
u(" — Authentication below applies only to this operation. ")
|
|
79
81
|
], -1)),
|
|
80
|
-
t[3] || (t[3] =
|
|
81
|
-
|
|
82
|
+
t[3] || (t[3] = n("span", { class: "mt-1 block" }, [
|
|
83
|
+
n("strong", null, "Off"),
|
|
82
84
|
u(" — This operation uses document-level authentication from the OpenAPI spec. ")
|
|
83
85
|
], -1))
|
|
84
86
|
], 64)) : (s(), y(f, { key: 1 }, [
|
|
@@ -86,12 +88,12 @@ const $ = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ A({
|
|
|
86
88
|
], 64))
|
|
87
89
|
]),
|
|
88
90
|
default: c(() => [
|
|
89
|
-
|
|
91
|
+
n("div", {
|
|
90
92
|
class: d(
|
|
91
93
|
e.collectionType === "operation" && !a.value && "cursor-not-allowed"
|
|
92
94
|
)
|
|
93
95
|
}, [
|
|
94
|
-
v(h(
|
|
96
|
+
v(h(D), {
|
|
95
97
|
class: d([
|
|
96
98
|
"scalar-collection-auth border-none!",
|
|
97
99
|
e.collectionType === "operation" && !a.value && "pointer-events-none opacity-50 mix-blend-luminosity"
|
|
@@ -115,7 +117,7 @@ const $ = { class: "flex h-8 items-center" }, K = /* @__PURE__ */ A({
|
|
|
115
117
|
e.collectionType === "operation" ? {
|
|
116
118
|
name: "actions",
|
|
117
119
|
fn: c(() => [
|
|
118
|
-
|
|
120
|
+
n("div", P, [
|
|
119
121
|
v(h(b), {
|
|
120
122
|
class: "w-4",
|
|
121
123
|
modelValue: a.value,
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as s, computed as
|
|
1
|
+
import { defineComponent as s, computed as r, createBlock as i, createCommentVNode as a, openBlock as u, withCtx as t, createVNode as m, unref as d, createTextVNode as n, createElementVNode as c } from "vue";
|
|
2
2
|
import k from "../../settings/components/Section.vue.js";
|
|
3
3
|
import p from "../../global-cookies/components/CookiesTable.vue.js";
|
|
4
|
-
const
|
|
4
|
+
const y = {
|
|
5
5
|
name: "Cookies"
|
|
6
|
-
},
|
|
7
|
-
...
|
|
6
|
+
}, x = /* @__PURE__ */ s({
|
|
7
|
+
...y,
|
|
8
8
|
props: {
|
|
9
9
|
documentSlug: {},
|
|
10
10
|
document: {},
|
|
@@ -19,11 +19,13 @@ const f = {
|
|
|
19
19
|
activeWorkspace: {},
|
|
20
20
|
plugins: {},
|
|
21
21
|
customThemes: {},
|
|
22
|
+
currentTheme: {},
|
|
23
|
+
isDarkMode: { type: Boolean },
|
|
22
24
|
collectionType: {}
|
|
23
25
|
},
|
|
24
26
|
setup(e) {
|
|
25
|
-
const l =
|
|
26
|
-
return (
|
|
27
|
+
const l = r(() => (e.collectionType === "document" ? e.document["x-scalar-cookies"] : e.workspaceStore.workspace["x-scalar-cookies"]) ?? []);
|
|
28
|
+
return (f, o) => e.collectionType !== "operation" ? (u(), i(k, { key: 0 }, {
|
|
27
29
|
title: t(() => [...o[0] || (o[0] = [
|
|
28
30
|
n("Cookies", -1)
|
|
29
31
|
])]),
|
|
@@ -41,9 +43,9 @@ const f = {
|
|
|
41
43
|
}, null, 8, ["collectionType", "cookies", "eventBus"])
|
|
42
44
|
]),
|
|
43
45
|
_: 1
|
|
44
|
-
})) :
|
|
46
|
+
})) : a("", !0);
|
|
45
47
|
}
|
|
46
48
|
});
|
|
47
49
|
export {
|
|
48
|
-
|
|
50
|
+
x as default
|
|
49
51
|
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const __VLS_export: import("vue").DefineComponent<(import("../../../../../v2/features/app/helpers/routes.js").RouteProps & {
|
|
2
|
+
collectionType: "document" | "operation";
|
|
3
|
+
document: import("@scalar/workspace-store/schemas").WorkspaceDocument;
|
|
4
|
+
}) | (import("../../../../../v2/features/app/helpers/routes.js").RouteProps & {
|
|
5
|
+
collectionType: "workspace";
|
|
6
|
+
document: null;
|
|
7
|
+
}), {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<(import("../../../../../v2/features/app/helpers/routes.js").RouteProps & {
|
|
8
|
+
collectionType: "document" | "operation";
|
|
9
|
+
document: import("@scalar/workspace-store/schemas").WorkspaceDocument;
|
|
10
|
+
}) | (import("../../../../../v2/features/app/helpers/routes.js").RouteProps & {
|
|
11
|
+
collectionType: "workspace";
|
|
12
|
+
document: null;
|
|
13
|
+
})> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
14
|
+
declare const _default: typeof __VLS_export;
|
|
15
|
+
export default _default;
|
|
16
|
+
//# sourceMappingURL=Editor.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Editor.vue.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/collection/components/Editor/Editor.vue"],"names":[],"mappings":"AA8sCA,QAAA,MAAM,YAAY;;;;;;;;;;;;kGAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,333 @@
|
|
|
1
|
+
import { defineComponent as se, ref as U, computed as M, onMounted as ie, onBeforeUnmount as ne, watch as x, createElementBlock as J, unref as e, openBlock as E, normalizeClass as D, createElementVNode as a, createVNode as r, withCtx as d, createTextVNode as W, toDisplayString as G, createBlock as H } from "vue";
|
|
2
|
+
import { useLoadingState as re, ScalarButton as m, ScalarHotkey as A } from "@scalar/components";
|
|
3
|
+
import { debounce as le } from "@scalar/helpers/general/debounce";
|
|
4
|
+
import { isObject as z } from "@scalar/helpers/object/is-object";
|
|
5
|
+
import { ScalarIconArrowsIn as ce, ScalarIconArrowsOut as ue } from "@scalar/icons";
|
|
6
|
+
import * as u from "monaco-editor/esm/vs/editor/editor.api.js";
|
|
7
|
+
import { useEditorMarkers as de } from "./hooks/use-editor-markers.js";
|
|
8
|
+
import me from "./components/EditorDiagnosticsPanel.vue.js";
|
|
9
|
+
import fe from "./components/EditorSavePanel.vue.js";
|
|
10
|
+
import { getDiagnosticCounts as ve } from "./helpers/get-diagnostic-counts.js";
|
|
11
|
+
import { getOperationContext as T } from "./helpers/get-operation-context.js";
|
|
12
|
+
import { getVisibleDiagnostics as pe } from "./helpers/get-visible-diagnostics.js";
|
|
13
|
+
import { parseEditorObject as I } from "./helpers/parse-editor-object.js";
|
|
14
|
+
import { stringifyDocument as B } from "./helpers/stringify-document.js";
|
|
15
|
+
import { useEditor as ge } from "./hooks/use-editor.js";
|
|
16
|
+
import { useEditorState as he } from "./hooks/use-editor-state.js";
|
|
17
|
+
const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3" }, xe = { class: "flex min-w-0 items-center gap-1 overflow-x-auto whitespace-nowrap" }, we = { class: "text-c-3 ml-2 text-[11px]" }, Se = { class: "text-c-3 ml-2 text-[11px]" }, be = {
|
|
18
|
+
"aria-label": "Editor language",
|
|
19
|
+
class: "bg-b-1 shadow-border flex items-center justify-self-center overflow-hidden rounded-lg p-0.5",
|
|
20
|
+
role: "tablist"
|
|
21
|
+
}, ke = { class: "flex min-w-0 shrink-0 items-center gap-2 justify-self-end" }, Ee = { class: "text-c-3 ml-2 text-[11px]" }, De = { class: "text-c-3 ml-2 text-[11px]" }, Ce = { class: "flex min-h-0 w-full min-w-0 flex-1 rounded-lg border" }, Oe = { class: "pointer-events-none absolute top-2 right-2 z-10" }, Me = { key: 1 }, Ae = 6, X = "editor:replace-document", Je = /* @__PURE__ */ se({
|
|
22
|
+
__name: "Editor",
|
|
23
|
+
props: {
|
|
24
|
+
documentSlug: {},
|
|
25
|
+
document: {},
|
|
26
|
+
eventBus: {},
|
|
27
|
+
layout: {},
|
|
28
|
+
path: {},
|
|
29
|
+
method: {},
|
|
30
|
+
exampleName: {},
|
|
31
|
+
environment: {},
|
|
32
|
+
securitySchemes: {},
|
|
33
|
+
workspaceStore: {},
|
|
34
|
+
activeWorkspace: {},
|
|
35
|
+
plugins: {},
|
|
36
|
+
customThemes: {},
|
|
37
|
+
currentTheme: {},
|
|
38
|
+
isDarkMode: { type: Boolean },
|
|
39
|
+
collectionType: {}
|
|
40
|
+
},
|
|
41
|
+
setup(s) {
|
|
42
|
+
const K = U(), n = U(), w = re(), {
|
|
43
|
+
isAutoSaveEnabled: f,
|
|
44
|
+
isDirty: l,
|
|
45
|
+
editorLanguage: c,
|
|
46
|
+
isDiagnosticsPaneExpanded: S,
|
|
47
|
+
isEditorMaximized: b,
|
|
48
|
+
isYamlMode: v,
|
|
49
|
+
editorBottomPadding: q,
|
|
50
|
+
editorRootClass: Q,
|
|
51
|
+
getLanguageToggleClass: N,
|
|
52
|
+
toggleEditorMaximized: Z
|
|
53
|
+
} = he(), _ = M(() => n.value?.editor), { markers: C } = de(_), V = () => {
|
|
54
|
+
n.value?.editor.updateOptions({
|
|
55
|
+
padding: {
|
|
56
|
+
top: 0,
|
|
57
|
+
bottom: q.value
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}, ee = M(() => ve(C.value)), te = M(
|
|
61
|
+
() => pe(C.value, Ae)
|
|
62
|
+
), L = (o) => {
|
|
63
|
+
n.value?.setCursorToMarker(o);
|
|
64
|
+
}, k = () => n.value?.getValue?.() ?? null, oe = async () => {
|
|
65
|
+
const o = await s.workspaceStore.getEditableDocument(s.documentSlug);
|
|
66
|
+
return B(o, c.value);
|
|
67
|
+
}, p = le({ delay: 1500 }), P = (o) => {
|
|
68
|
+
p.cleanup(), n.value?.setValue(o, !0);
|
|
69
|
+
}, j = async () => {
|
|
70
|
+
P(await oe()), l.value = !1, await g();
|
|
71
|
+
}, F = async () => {
|
|
72
|
+
await n.value?.formatDocument();
|
|
73
|
+
}, g = async () => {
|
|
74
|
+
const o = T(s.path, s.method);
|
|
75
|
+
o && await n.value?.focusPath([
|
|
76
|
+
"paths",
|
|
77
|
+
o.path,
|
|
78
|
+
o.method
|
|
79
|
+
]);
|
|
80
|
+
}, O = async (o) => {
|
|
81
|
+
const t = I(o, c.value);
|
|
82
|
+
if (!t) {
|
|
83
|
+
const i = C.value.find(
|
|
84
|
+
(h) => h.severity === u.MarkerSeverity.Error
|
|
85
|
+
);
|
|
86
|
+
i && L(i), await w.invalidate();
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
w.start(), await s.workspaceStore.replaceDocument(s.documentSlug, t), l.value = !1, await w.validate({ duration: 900 });
|
|
90
|
+
}, R = async () => {
|
|
91
|
+
const o = k();
|
|
92
|
+
o && await O(o);
|
|
93
|
+
}, ae = (o) => {
|
|
94
|
+
l.value = !0, f.value && p.execute(
|
|
95
|
+
X,
|
|
96
|
+
() => O(o)
|
|
97
|
+
);
|
|
98
|
+
}, $ = async () => {
|
|
99
|
+
const o = T(s.path, s.method);
|
|
100
|
+
if (!o)
|
|
101
|
+
return;
|
|
102
|
+
const t = k();
|
|
103
|
+
if (!t)
|
|
104
|
+
return;
|
|
105
|
+
const i = I(t, c.value);
|
|
106
|
+
if (!i || !z(i.paths))
|
|
107
|
+
return;
|
|
108
|
+
const y = i.paths[o.path];
|
|
109
|
+
if (!z(y))
|
|
110
|
+
return;
|
|
111
|
+
const Y = y[o.method];
|
|
112
|
+
z(Y) && (Y.servers ??= [], n.value?.setValue(B(i, c.value)), await n.value?.focusPath([
|
|
113
|
+
"paths",
|
|
114
|
+
o.path,
|
|
115
|
+
o.method,
|
|
116
|
+
"servers"
|
|
117
|
+
]));
|
|
118
|
+
};
|
|
119
|
+
return ie(() => {
|
|
120
|
+
n.value = ge({
|
|
121
|
+
element: K.value ?? document.createElement("div"),
|
|
122
|
+
onChange: ae,
|
|
123
|
+
isDarkMode: s.isDarkMode,
|
|
124
|
+
theme: s.currentTheme,
|
|
125
|
+
language: c.value,
|
|
126
|
+
actions: [
|
|
127
|
+
{
|
|
128
|
+
id: "scalar.editor.focusOperation",
|
|
129
|
+
label: "Focus Operation",
|
|
130
|
+
keybindings: [u.KeyMod.Alt | u.KeyCode.KeyO],
|
|
131
|
+
run: async () => {
|
|
132
|
+
await g();
|
|
133
|
+
}
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
id: "scalar.editor.focusOperationServers",
|
|
137
|
+
label: "Focus Operation Servers",
|
|
138
|
+
keybindings: [u.KeyMod.Alt | u.KeyCode.KeyS],
|
|
139
|
+
run: async () => {
|
|
140
|
+
await $();
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
id: "scalar.editor.formatDocument",
|
|
145
|
+
label: "Format Document",
|
|
146
|
+
keybindings: [
|
|
147
|
+
u.KeyMod.Alt | u.KeyMod.Shift | u.KeyCode.KeyF
|
|
148
|
+
],
|
|
149
|
+
run: async () => {
|
|
150
|
+
await F();
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
]
|
|
154
|
+
}), V(), j();
|
|
155
|
+
}), ne(() => {
|
|
156
|
+
p.cleanup(), l.value && f.value && R(), n.value?.dispose?.();
|
|
157
|
+
}), x(() => s.documentSlug, j), x(
|
|
158
|
+
() => [s.path, s.method],
|
|
159
|
+
async () => {
|
|
160
|
+
await g();
|
|
161
|
+
}
|
|
162
|
+
), x(S, () => {
|
|
163
|
+
V();
|
|
164
|
+
}), x(c, async (o, t) => {
|
|
165
|
+
const i = l.value;
|
|
166
|
+
n.value?.setLanguage(o);
|
|
167
|
+
const h = k();
|
|
168
|
+
if (!h)
|
|
169
|
+
return;
|
|
170
|
+
const y = I(h, t);
|
|
171
|
+
y && (P(B(y, o)), l.value = i), await g();
|
|
172
|
+
}), x(
|
|
173
|
+
f,
|
|
174
|
+
(o) => {
|
|
175
|
+
if (!o) {
|
|
176
|
+
p.cleanup();
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
if (l.value) {
|
|
180
|
+
const t = k();
|
|
181
|
+
if (!t)
|
|
182
|
+
return;
|
|
183
|
+
p.execute(
|
|
184
|
+
X,
|
|
185
|
+
() => O(t)
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
},
|
|
189
|
+
{ flush: "post" }
|
|
190
|
+
), (o, t) => s.collectionType === "operation" && e(T)(s.path, s.method) !== null ? (E(), J("div", {
|
|
191
|
+
key: 0,
|
|
192
|
+
class: D(["flex w-full min-w-0 flex-1 flex-col gap-2", e(Q)])
|
|
193
|
+
}, [
|
|
194
|
+
a("div", ye, [
|
|
195
|
+
a("div", xe, [
|
|
196
|
+
t[6] || (t[6] = a("span", { class: "text-c-2 text-xs font-medium whitespace-nowrap" }, " Shortcuts ", -1)),
|
|
197
|
+
r(e(m), {
|
|
198
|
+
class: "whitespace-nowrap",
|
|
199
|
+
size: "xs",
|
|
200
|
+
variant: "ghost",
|
|
201
|
+
onClick: g
|
|
202
|
+
}, {
|
|
203
|
+
default: d(() => [
|
|
204
|
+
t[4] || (t[4] = a("span", null, "Operation", -1)),
|
|
205
|
+
a("span", we, [
|
|
206
|
+
r(e(A), {
|
|
207
|
+
hotkey: "O",
|
|
208
|
+
modifier: ["Alt"]
|
|
209
|
+
})
|
|
210
|
+
])
|
|
211
|
+
]),
|
|
212
|
+
_: 1
|
|
213
|
+
}),
|
|
214
|
+
r(e(m), {
|
|
215
|
+
class: "whitespace-nowrap",
|
|
216
|
+
size: "xs",
|
|
217
|
+
variant: "ghost",
|
|
218
|
+
onClick: $
|
|
219
|
+
}, {
|
|
220
|
+
default: d(() => [
|
|
221
|
+
t[5] || (t[5] = a("span", null, "Servers", -1)),
|
|
222
|
+
a("span", Se, [
|
|
223
|
+
r(e(A), {
|
|
224
|
+
hotkey: "S",
|
|
225
|
+
modifier: ["Alt"]
|
|
226
|
+
})
|
|
227
|
+
])
|
|
228
|
+
]),
|
|
229
|
+
_: 1
|
|
230
|
+
})
|
|
231
|
+
]),
|
|
232
|
+
a("div", be, [
|
|
233
|
+
r(e(m), {
|
|
234
|
+
"aria-selected": !e(v),
|
|
235
|
+
class: D(e(N)(!e(v))),
|
|
236
|
+
role: "tab",
|
|
237
|
+
size: "xs",
|
|
238
|
+
type: "button",
|
|
239
|
+
variant: "ghost",
|
|
240
|
+
onClick: t[0] || (t[0] = (i) => c.value = "json")
|
|
241
|
+
}, {
|
|
242
|
+
default: d(() => [...t[7] || (t[7] = [
|
|
243
|
+
W(" JSON ", -1)
|
|
244
|
+
])]),
|
|
245
|
+
_: 1
|
|
246
|
+
}, 8, ["aria-selected", "class"]),
|
|
247
|
+
r(e(m), {
|
|
248
|
+
"aria-selected": e(v),
|
|
249
|
+
class: D(e(N)(e(v))),
|
|
250
|
+
role: "tab",
|
|
251
|
+
size: "xs",
|
|
252
|
+
type: "button",
|
|
253
|
+
variant: "ghost",
|
|
254
|
+
onClick: t[1] || (t[1] = (i) => c.value = "yaml")
|
|
255
|
+
}, {
|
|
256
|
+
default: d(() => [...t[8] || (t[8] = [
|
|
257
|
+
W(" YAML ", -1)
|
|
258
|
+
])]),
|
|
259
|
+
_: 1
|
|
260
|
+
}, 8, ["aria-selected", "class"])
|
|
261
|
+
]),
|
|
262
|
+
a("div", ke, [
|
|
263
|
+
r(e(m), {
|
|
264
|
+
size: "xs",
|
|
265
|
+
variant: "ghost",
|
|
266
|
+
onClick: F
|
|
267
|
+
}, {
|
|
268
|
+
default: d(() => [
|
|
269
|
+
a("span", null, "Format " + G(e(v) ? "YAML" : "JSON"), 1),
|
|
270
|
+
a("span", Ee, [
|
|
271
|
+
r(e(A), {
|
|
272
|
+
hotkey: "F",
|
|
273
|
+
modifier: ["Alt", "Shift"]
|
|
274
|
+
})
|
|
275
|
+
])
|
|
276
|
+
]),
|
|
277
|
+
_: 1
|
|
278
|
+
}),
|
|
279
|
+
r(e(m), {
|
|
280
|
+
"aria-label": e(b) ? "Restore editor size" : "Maximize editor",
|
|
281
|
+
size: "xs",
|
|
282
|
+
variant: "ghost",
|
|
283
|
+
onClick: e(Z)
|
|
284
|
+
}, {
|
|
285
|
+
default: d(() => [
|
|
286
|
+
a("span", null, G(e(b) ? "Restore" : "Maximize"), 1),
|
|
287
|
+
a("span", De, [
|
|
288
|
+
e(b) ? (E(), H(e(ce), {
|
|
289
|
+
key: 0,
|
|
290
|
+
class: "size-3.5"
|
|
291
|
+
})) : (E(), H(e(ue), {
|
|
292
|
+
key: 1,
|
|
293
|
+
class: "size-3.5"
|
|
294
|
+
}))
|
|
295
|
+
])
|
|
296
|
+
]),
|
|
297
|
+
_: 1
|
|
298
|
+
}, 8, ["aria-label", "onClick"])
|
|
299
|
+
])
|
|
300
|
+
]),
|
|
301
|
+
a("div", Ce, [
|
|
302
|
+
a("div", {
|
|
303
|
+
class: D(["relative w-full min-w-0 flex-1", e(b) ? "h-full min-h-0" : "h-[500px]"])
|
|
304
|
+
}, [
|
|
305
|
+
a("div", Oe, [
|
|
306
|
+
r(fe, {
|
|
307
|
+
isAutoSaveEnabled: e(f),
|
|
308
|
+
isDirty: e(l),
|
|
309
|
+
saveLoader: e(w),
|
|
310
|
+
onSaveNow: R,
|
|
311
|
+
"onUpdate:isAutoSaveEnabled": t[2] || (t[2] = (i) => f.value = i)
|
|
312
|
+
}, null, 8, ["isAutoSaveEnabled", "isDirty", "saveLoader"])
|
|
313
|
+
]),
|
|
314
|
+
r(me, {
|
|
315
|
+
diagnosticCounts: ee.value,
|
|
316
|
+
expanded: e(S),
|
|
317
|
+
visibleDiagnostics: te.value,
|
|
318
|
+
onFocusDiagnostic: L,
|
|
319
|
+
onToggle: t[3] || (t[3] = (i) => S.value = !e(S))
|
|
320
|
+
}, null, 8, ["diagnosticCounts", "expanded", "visibleDiagnostics"]),
|
|
321
|
+
a("div", {
|
|
322
|
+
ref_key: "monacoEditorRef",
|
|
323
|
+
ref: K,
|
|
324
|
+
class: "h-full w-full min-w-0 flex-1"
|
|
325
|
+
}, null, 512)
|
|
326
|
+
], 2)
|
|
327
|
+
])
|
|
328
|
+
], 2)) : (E(), J("div", Me, "No operation context found"));
|
|
329
|
+
}
|
|
330
|
+
});
|
|
331
|
+
export {
|
|
332
|
+
Je as default
|
|
333
|
+
};
|