@scalar/api-client 2.36.0 → 2.36.2
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 +65 -0
- package/dist/monacoeditorwork/editor.worker.bundle.js +14463 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +22211 -0
- package/dist/monacoeditorwork/yaml.worker.bundle.js +46771 -0
- package/dist/style.css +1 -1
- 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 +28 -27
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +12 -11
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +47 -42
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- 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 +65 -59
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +57 -42
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +44 -41
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
- package/dist/v2/components/resize/index.d.ts +1 -0
- package/dist/v2/components/resize/index.d.ts.map +1 -1
- package/dist/v2/components/resize/index.js +4 -2
- package/dist/v2/components/resize/use-split-resize.d.ts +27 -0
- package/dist/v2/components/resize/use-split-resize.d.ts.map +1 -0
- package/dist/v2/components/resize/use-split-resize.js +57 -0
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +38 -34
- package/dist/v2/features/app/App.vue.d.ts +5 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +71 -63
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +34 -30
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +7 -1
- 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 +15 -10
- package/dist/v2/features/app/helpers/routes.d.ts +6 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +3 -2
- package/dist/v2/features/app/hooks/use-document-watcher.js +13 -13
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +292 -100
- package/dist/v2/features/collection/DocumentCollection.vue3.js +5 -0
- package/dist/v2/features/collection/OperationCollection.vue.js +20 -19
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +6 -5
- package/dist/v2/features/collection/components/Authentication.vue2.js +16 -15
- package/dist/v2/features/collection/components/Cookies.vue.js +7 -6
- package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Editor/Editor.vue.js +3 -3
- package/dist/v2/features/collection/components/Editor/Editor.vue2.js +182 -171
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +2 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +13 -12
- package/dist/v2/features/collection/components/Overview.vue2.js +7 -6
- package/dist/v2/features/collection/components/Servers.vue.js +64 -63
- package/dist/v2/features/collection/components/Settings.vue.js +8 -7
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts +18 -0
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.js +7 -0
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue2.js +136 -0
- package/dist/v2/features/editor/config.d.ts +16 -0
- package/dist/v2/features/editor/config.d.ts.map +1 -0
- package/dist/v2/features/editor/config.js +16 -0
- package/dist/v2/features/editor/helpers/configure-language-support.d.ts +13 -0
- package/dist/v2/features/editor/helpers/configure-language-support.d.ts.map +1 -0
- package/dist/v2/features/{collection/components/Editor → editor}/helpers/configure-language-support.js +6 -7
- package/dist/v2/features/editor/helpers/ensure-monaco-environment.d.ts.map +1 -0
- package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.js +9 -12
- package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +12 -0
- package/dist/v2/features/editor/helpers/json/create-json-model.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/create-json-model.js +19 -0
- package/dist/v2/features/editor/helpers/json/get-json-ast-node-from-path.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-ast.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-pointer-links.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-pointer-path.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-pointer-path.js +21 -0
- package/dist/v2/features/editor/helpers/model.d.ts +9 -0
- package/dist/v2/features/editor/helpers/model.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts +14 -0
- package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/range-to-whole-line.js +8 -0
- package/dist/v2/features/editor/helpers/theme/apply-scalar-theme.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/theme/load-css-variables.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +13 -0
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.js +19 -0
- package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.d.ts +2 -2
- package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-editor-markers.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-editor.d.ts +39 -0
- package/dist/v2/features/editor/hooks/use-editor.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-editor.js +107 -0
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +16 -0
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.js +27 -0
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts +77 -0
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +316 -0
- package/dist/v2/features/editor/index.d.ts +5 -0
- package/dist/v2/features/editor/index.d.ts.map +1 -0
- package/dist/v2/features/editor/index.js +10 -0
- package/dist/v2/features/operation/Operation.vue.js +18 -17
- package/dist/v2/types/configuration.d.ts +11 -0
- package/dist/v2/types/configuration.d.ts.map +1 -0
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +44 -45
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +24 -18
- package/dist/assets/yaml.worker-CcQnAKCg.js +0 -490
- package/dist/v2/features/collection/DocumentCollection.vue2.js +0 -4
- package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts +0 -7
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.js +0 -20
- package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts +0 -2
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.js +0 -11
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts +0 -39
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.js +0 -153
- /package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-path.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.js +0 -0
- /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.js +0 -0
- /package/dist/v2/features/{collection/components/Editor → editor}/schemas/openapi-3.1-schema.json.js +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as l, computed as r, createBlock as i, createCommentVNode as u, openBlock as a, 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
4
|
const y = {
|
|
5
5
|
name: "Cookies"
|
|
6
|
-
}, x = /* @__PURE__ */
|
|
6
|
+
}, x = /* @__PURE__ */ l({
|
|
7
7
|
...y,
|
|
8
8
|
props: {
|
|
9
9
|
documentSlug: {},
|
|
@@ -21,11 +21,12 @@ const y = {
|
|
|
21
21
|
customThemes: {},
|
|
22
22
|
currentTheme: {},
|
|
23
23
|
isDarkMode: { type: Boolean },
|
|
24
|
+
fetchRegistryDocument: { type: Function },
|
|
24
25
|
collectionType: {}
|
|
25
26
|
},
|
|
26
27
|
setup(e) {
|
|
27
|
-
const
|
|
28
|
-
return (f, o) => e.collectionType !== "operation" ? (
|
|
28
|
+
const s = r(() => (e.collectionType === "document" ? e.document["x-scalar-cookies"] : e.workspaceStore.workspace["x-scalar-cookies"]) ?? []);
|
|
29
|
+
return (f, o) => e.collectionType !== "operation" ? (a(), i(k, { key: 0 }, {
|
|
29
30
|
title: t(() => [...o[0] || (o[0] = [
|
|
30
31
|
n("Cookies", -1)
|
|
31
32
|
])]),
|
|
@@ -38,12 +39,12 @@ const y = {
|
|
|
38
39
|
default: t(() => [
|
|
39
40
|
m(d(p), {
|
|
40
41
|
collectionType: e.collectionType,
|
|
41
|
-
cookies:
|
|
42
|
+
cookies: s.value,
|
|
42
43
|
eventBus: e.eventBus
|
|
43
44
|
}, null, 8, ["collectionType", "cookies", "eventBus"])
|
|
44
45
|
]),
|
|
45
46
|
_: 1
|
|
46
|
-
})) :
|
|
47
|
+
})) : u("", !0);
|
|
47
48
|
}
|
|
48
49
|
});
|
|
49
50
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.vue.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/collection/components/Editor/Editor.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Editor.vue.d.ts","sourceRoot":"","sources":["../../../../../../src/v2/features/collection/components/Editor/Editor.vue"],"names":[],"mappings":"AA0xCA,QAAA,MAAM,YAAY;;;;;;;;;;;;kGAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Editor.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import f from "../../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const p = /* @__PURE__ */ f(o, [["__scopeId", "data-v-850fff8f"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
p as default
|
|
7
7
|
};
|
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useLoadingState as
|
|
3
|
-
import { debounce as
|
|
4
|
-
import { isObject as
|
|
5
|
-
import { ScalarIconArrowsIn as
|
|
6
|
-
import * as
|
|
7
|
-
import {
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import {
|
|
1
|
+
import { defineComponent as ue, ref as G, shallowRef as de, computed as C, onMounted as me, onBeforeUnmount as fe, watch as x, nextTick as H, createElementBlock as X, unref as o, openBlock as k, normalizeClass as D, createElementVNode as a, createVNode as r, withCtx as m, createTextVNode as q, toDisplayString as Q, createBlock as Z } from "vue";
|
|
2
|
+
import { useLoadingState as pe, ScalarButton as f, ScalarHotkey as j } from "@scalar/components";
|
|
3
|
+
import { debounce as ve } from "@scalar/helpers/general/debounce";
|
|
4
|
+
import { isObject as I } from "@scalar/helpers/object/is-object";
|
|
5
|
+
import { ScalarIconArrowsIn as ge, ScalarIconArrowsOut as ye } from "@scalar/icons";
|
|
6
|
+
import * as c from "monaco-editor/esm/vs/editor/editor.api.js";
|
|
7
|
+
import { createJsonModel as he } from "../../../editor/helpers/json/create-json-model.js";
|
|
8
|
+
import { createYamlModel as xe } from "../../../editor/helpers/yaml/create-yaml-model.js";
|
|
9
|
+
import { useEditorMarkers as we } from "../../../editor/hooks/use-editor-markers.js";
|
|
10
|
+
import be from "./components/EditorDiagnosticsPanel.vue.js";
|
|
11
|
+
import Se from "./components/EditorSavePanel.vue.js";
|
|
12
|
+
import { getDiagnosticCounts as Ee } from "./helpers/get-diagnostic-counts.js";
|
|
13
|
+
import { getOperationContext as V } from "./helpers/get-operation-context.js";
|
|
14
|
+
import { getVisibleDiagnostics as Ce } from "./helpers/get-visible-diagnostics.js";
|
|
15
|
+
import { parseEditorObject as T } from "./helpers/parse-editor-object.js";
|
|
14
16
|
import { stringifyDocument as B } from "./helpers/stringify-document.js";
|
|
15
|
-
import {
|
|
16
|
-
import {
|
|
17
|
-
|
|
17
|
+
import { useEditorState as ke } from "./hooks/use-editor-state.js";
|
|
18
|
+
import { useJsonPointerLinkSupport as De } from "../../../editor/hooks/use-json-pointer-link-support.js";
|
|
19
|
+
import { useEditor as Me } from "../../../editor/hooks/use-editor.js";
|
|
20
|
+
const Oe = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-center gap-3" }, Ae = { class: "flex min-w-0 items-center gap-1 overflow-x-auto whitespace-nowrap" }, Ne = { class: "text-c-3 ml-2 text-[11px]" }, ze = { class: "text-c-3 ml-2 text-[11px]" }, Le = {
|
|
18
21
|
"aria-label": "Editor language",
|
|
19
22
|
class: "bg-b-1 shadow-border flex items-center justify-self-center overflow-hidden rounded-lg p-0.5",
|
|
20
23
|
role: "tablist"
|
|
21
|
-
},
|
|
24
|
+
}, je = { class: "flex min-w-0 shrink-0 items-center gap-2 justify-self-end" }, Ie = { class: "text-c-3 ml-2 text-[11px]" }, Ve = { class: "text-c-3 ml-2 text-[11px]" }, Te = { class: "flex min-h-0 w-full min-w-0 flex-1 rounded-lg border" }, Be = { class: "pointer-events-none absolute top-2 right-2 z-10" }, Ke = { key: 1 }, Pe = 6, ee = "editor:replace-document", st = /* @__PURE__ */ ue({
|
|
22
25
|
__name: "Editor",
|
|
23
26
|
props: {
|
|
24
27
|
documentSlug: {},
|
|
@@ -36,174 +39,182 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
|
|
|
36
39
|
customThemes: {},
|
|
37
40
|
currentTheme: {},
|
|
38
41
|
isDarkMode: { type: Boolean },
|
|
42
|
+
fetchRegistryDocument: { type: Function },
|
|
39
43
|
collectionType: {}
|
|
40
44
|
},
|
|
41
45
|
setup(s) {
|
|
42
|
-
const K =
|
|
43
|
-
isAutoSaveEnabled:
|
|
46
|
+
const K = G(), i = de(), w = pe(), {
|
|
47
|
+
isAutoSaveEnabled: p,
|
|
44
48
|
isDirty: l,
|
|
45
|
-
editorLanguage:
|
|
46
|
-
isDiagnosticsPaneExpanded:
|
|
47
|
-
isEditorMaximized:
|
|
49
|
+
editorLanguage: u,
|
|
50
|
+
isDiagnosticsPaneExpanded: b,
|
|
51
|
+
isEditorMaximized: S,
|
|
48
52
|
isYamlMode: v,
|
|
49
|
-
editorBottomPadding:
|
|
50
|
-
editorRootClass:
|
|
51
|
-
getLanguageToggleClass:
|
|
52
|
-
toggleEditorMaximized:
|
|
53
|
-
} = he(),
|
|
54
|
-
|
|
53
|
+
editorBottomPadding: te,
|
|
54
|
+
editorRootClass: oe,
|
|
55
|
+
getLanguageToggleClass: P,
|
|
56
|
+
toggleEditorMaximized: ae
|
|
57
|
+
} = ke(), M = he(), O = xe(), E = G("json"), A = C(() => E.value === "json" ? M : O), se = C(() => i.value?.editor), { markers: N } = we(se), F = () => {
|
|
58
|
+
i.value?.editor.updateOptions({
|
|
55
59
|
padding: {
|
|
56
60
|
top: 0,
|
|
57
|
-
bottom:
|
|
61
|
+
bottom: te.value
|
|
58
62
|
}
|
|
59
63
|
});
|
|
60
|
-
},
|
|
61
|
-
() =>
|
|
62
|
-
),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
},
|
|
74
|
-
const
|
|
75
|
-
|
|
64
|
+
}, ne = C(() => Ee(N.value)), ie = C(
|
|
65
|
+
() => Ce(N.value, Pe)
|
|
66
|
+
), R = (t) => {
|
|
67
|
+
const e = i.value?.editor;
|
|
68
|
+
e && (e.setSelection({
|
|
69
|
+
startLineNumber: t.startLineNumber,
|
|
70
|
+
startColumn: t.startColumn,
|
|
71
|
+
endLineNumber: t.endLineNumber,
|
|
72
|
+
endColumn: t.endColumn
|
|
73
|
+
}), e.revealPositionInCenter({
|
|
74
|
+
lineNumber: t.startLineNumber,
|
|
75
|
+
column: t.startColumn
|
|
76
|
+
}));
|
|
77
|
+
}, z = () => A.value.model.getValue(), re = (t) => (t === "json" ? M : O).model.getValue(), le = async (t) => {
|
|
78
|
+
const e = await s.workspaceStore.getEditableDocument(s.documentSlug);
|
|
79
|
+
return B(e, E.value);
|
|
80
|
+
}, g = ve({ delay: 1500 }), Y = (t) => {
|
|
81
|
+
g.cleanup(), i.value?.setValue(t, !0);
|
|
82
|
+
}, $ = async () => {
|
|
83
|
+
Y(await le()), l.value = !1, await d();
|
|
84
|
+
}, J = async () => {
|
|
85
|
+
await i.value?.formatDocument();
|
|
86
|
+
}, d = async () => {
|
|
87
|
+
const t = V(s.path, s.method);
|
|
88
|
+
t && await i.value?.focusPath([
|
|
76
89
|
"paths",
|
|
77
|
-
|
|
78
|
-
|
|
90
|
+
t.path,
|
|
91
|
+
t.method
|
|
79
92
|
]);
|
|
80
|
-
},
|
|
81
|
-
const
|
|
82
|
-
if (!
|
|
83
|
-
const
|
|
84
|
-
(
|
|
93
|
+
}, L = async (t) => {
|
|
94
|
+
const e = T(t, u.value);
|
|
95
|
+
if (!e) {
|
|
96
|
+
const n = N.value.find(
|
|
97
|
+
(y) => y.severity === c.MarkerSeverity.Error
|
|
85
98
|
);
|
|
86
|
-
|
|
99
|
+
n && R(n), await w.invalidate();
|
|
87
100
|
return;
|
|
88
101
|
}
|
|
89
|
-
w.start(), await s.workspaceStore.replaceDocument(s.documentSlug,
|
|
90
|
-
},
|
|
91
|
-
const
|
|
92
|
-
|
|
93
|
-
},
|
|
94
|
-
l.value = !0,
|
|
95
|
-
|
|
96
|
-
() =>
|
|
102
|
+
w.start(), await s.workspaceStore.replaceDocument(s.documentSlug, e), l.value = !1, await w.validate({ duration: 900 });
|
|
103
|
+
}, U = async () => {
|
|
104
|
+
const t = z();
|
|
105
|
+
t && await L(t);
|
|
106
|
+
}, ce = (t) => {
|
|
107
|
+
l.value = !0, p.value && g.execute(
|
|
108
|
+
ee,
|
|
109
|
+
() => L(t)
|
|
97
110
|
);
|
|
98
|
-
},
|
|
99
|
-
const
|
|
100
|
-
if (!o)
|
|
101
|
-
return;
|
|
102
|
-
const t = k();
|
|
111
|
+
}, W = async () => {
|
|
112
|
+
const t = V(s.path, s.method);
|
|
103
113
|
if (!t)
|
|
104
114
|
return;
|
|
105
|
-
const
|
|
106
|
-
if (!
|
|
115
|
+
const e = z();
|
|
116
|
+
if (!e)
|
|
107
117
|
return;
|
|
108
|
-
const
|
|
109
|
-
if (!
|
|
118
|
+
const n = T(e, u.value);
|
|
119
|
+
if (!n || !I(n.paths))
|
|
110
120
|
return;
|
|
111
|
-
const
|
|
112
|
-
|
|
121
|
+
const h = n.paths[t.path];
|
|
122
|
+
if (!I(h))
|
|
123
|
+
return;
|
|
124
|
+
const _ = h[t.method];
|
|
125
|
+
I(_) && (_.servers ??= [], i.value?.setValue(B(n, u.value)), await i.value?.focusPath([
|
|
113
126
|
"paths",
|
|
114
|
-
|
|
115
|
-
|
|
127
|
+
t.path,
|
|
128
|
+
t.method,
|
|
116
129
|
"servers"
|
|
117
130
|
]));
|
|
118
131
|
};
|
|
119
|
-
return
|
|
120
|
-
|
|
132
|
+
return De(i, A), me(() => {
|
|
133
|
+
i.value = Me({
|
|
121
134
|
element: K.value ?? document.createElement("div"),
|
|
122
|
-
onChange:
|
|
123
|
-
|
|
124
|
-
theme: s.currentTheme,
|
|
125
|
-
language: c.value,
|
|
135
|
+
onChange: ce,
|
|
136
|
+
model: A,
|
|
126
137
|
actions: [
|
|
127
138
|
{
|
|
128
139
|
id: "scalar.editor.focusOperation",
|
|
129
140
|
label: "Focus Operation",
|
|
130
|
-
keybindings: [
|
|
141
|
+
keybindings: [c.KeyMod.Alt | c.KeyCode.KeyO],
|
|
131
142
|
run: async () => {
|
|
132
|
-
await
|
|
143
|
+
await d();
|
|
133
144
|
}
|
|
134
145
|
},
|
|
135
146
|
{
|
|
136
147
|
id: "scalar.editor.focusOperationServers",
|
|
137
148
|
label: "Focus Operation Servers",
|
|
138
|
-
keybindings: [
|
|
149
|
+
keybindings: [c.KeyMod.Alt | c.KeyCode.KeyS],
|
|
139
150
|
run: async () => {
|
|
140
|
-
await
|
|
151
|
+
await W();
|
|
141
152
|
}
|
|
142
153
|
},
|
|
143
154
|
{
|
|
144
155
|
id: "scalar.editor.formatDocument",
|
|
145
156
|
label: "Format Document",
|
|
146
157
|
keybindings: [
|
|
147
|
-
|
|
158
|
+
c.KeyMod.Alt | c.KeyMod.Shift | c.KeyCode.KeyF
|
|
148
159
|
],
|
|
149
160
|
run: async () => {
|
|
150
|
-
await
|
|
161
|
+
await J();
|
|
151
162
|
}
|
|
152
163
|
}
|
|
153
164
|
]
|
|
154
|
-
}),
|
|
155
|
-
}),
|
|
156
|
-
|
|
157
|
-
}), x(() => s.documentSlug,
|
|
165
|
+
}), F(), $();
|
|
166
|
+
}), fe(() => {
|
|
167
|
+
g.cleanup(), l.value && p.value && U(), i.value?.dispose?.(), M.model.dispose(), O.model.dispose();
|
|
168
|
+
}), x(() => s.documentSlug, $), x(
|
|
158
169
|
() => [s.path, s.method],
|
|
159
170
|
async () => {
|
|
160
|
-
await
|
|
171
|
+
await d();
|
|
161
172
|
}
|
|
162
|
-
), x(
|
|
163
|
-
|
|
164
|
-
}), x(
|
|
165
|
-
const
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
if (!h)
|
|
173
|
+
), x(b, () => {
|
|
174
|
+
F();
|
|
175
|
+
}), x(u, async (t, e) => {
|
|
176
|
+
const n = l.value, y = re(e ?? "json");
|
|
177
|
+
if (!y) {
|
|
178
|
+
E.value = t, await H(), await d();
|
|
169
179
|
return;
|
|
170
|
-
|
|
171
|
-
|
|
180
|
+
}
|
|
181
|
+
const h = T(y, e ?? "json");
|
|
182
|
+
E.value = t, await H(), h && (Y(B(h, t)), l.value = n), await d();
|
|
172
183
|
}), x(
|
|
173
|
-
|
|
174
|
-
(
|
|
175
|
-
if (!
|
|
176
|
-
|
|
184
|
+
p,
|
|
185
|
+
(t) => {
|
|
186
|
+
if (!t) {
|
|
187
|
+
g.cleanup();
|
|
177
188
|
return;
|
|
178
189
|
}
|
|
179
190
|
if (l.value) {
|
|
180
|
-
const
|
|
181
|
-
if (!
|
|
191
|
+
const e = z();
|
|
192
|
+
if (!e)
|
|
182
193
|
return;
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
() =>
|
|
194
|
+
g.execute(
|
|
195
|
+
ee,
|
|
196
|
+
() => L(e)
|
|
186
197
|
);
|
|
187
198
|
}
|
|
188
199
|
},
|
|
189
200
|
{ flush: "post" }
|
|
190
|
-
), (
|
|
201
|
+
), (t, e) => s.collectionType === "operation" && o(V)(s.path, s.method) !== null ? (k(), X("div", {
|
|
191
202
|
key: 0,
|
|
192
|
-
class: D(["flex w-full min-w-0 flex-1 flex-col gap-2",
|
|
203
|
+
class: D(["flex w-full min-w-0 flex-1 flex-col gap-2", o(oe)])
|
|
193
204
|
}, [
|
|
194
|
-
a("div",
|
|
195
|
-
a("div",
|
|
196
|
-
|
|
197
|
-
r(
|
|
205
|
+
a("div", Oe, [
|
|
206
|
+
a("div", Ae, [
|
|
207
|
+
e[6] || (e[6] = a("span", { class: "text-c-2 text-xs font-medium whitespace-nowrap" }, " Shortcuts ", -1)),
|
|
208
|
+
r(o(f), {
|
|
198
209
|
class: "whitespace-nowrap",
|
|
199
210
|
size: "xs",
|
|
200
211
|
variant: "ghost",
|
|
201
|
-
onClick:
|
|
212
|
+
onClick: d
|
|
202
213
|
}, {
|
|
203
|
-
default:
|
|
204
|
-
|
|
205
|
-
a("span",
|
|
206
|
-
r(
|
|
214
|
+
default: m(() => [
|
|
215
|
+
e[4] || (e[4] = a("span", null, "Operation", -1)),
|
|
216
|
+
a("span", Ne, [
|
|
217
|
+
r(o(j), {
|
|
207
218
|
hotkey: "O",
|
|
208
219
|
modifier: ["Alt"]
|
|
209
220
|
})
|
|
@@ -211,16 +222,16 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
|
|
|
211
222
|
]),
|
|
212
223
|
_: 1
|
|
213
224
|
}),
|
|
214
|
-
r(
|
|
225
|
+
r(o(f), {
|
|
215
226
|
class: "whitespace-nowrap",
|
|
216
227
|
size: "xs",
|
|
217
228
|
variant: "ghost",
|
|
218
|
-
onClick:
|
|
229
|
+
onClick: W
|
|
219
230
|
}, {
|
|
220
|
-
default:
|
|
221
|
-
|
|
222
|
-
a("span",
|
|
223
|
-
r(
|
|
231
|
+
default: m(() => [
|
|
232
|
+
e[5] || (e[5] = a("span", null, "Servers", -1)),
|
|
233
|
+
a("span", ze, [
|
|
234
|
+
r(o(j), {
|
|
224
235
|
hotkey: "S",
|
|
225
236
|
modifier: ["Alt"]
|
|
226
237
|
})
|
|
@@ -229,46 +240,46 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
|
|
|
229
240
|
_: 1
|
|
230
241
|
})
|
|
231
242
|
]),
|
|
232
|
-
a("div",
|
|
233
|
-
r(
|
|
234
|
-
"aria-selected": !
|
|
235
|
-
class: D(
|
|
243
|
+
a("div", Le, [
|
|
244
|
+
r(o(f), {
|
|
245
|
+
"aria-selected": !o(v),
|
|
246
|
+
class: D(o(P)(!o(v))),
|
|
236
247
|
role: "tab",
|
|
237
248
|
size: "xs",
|
|
238
249
|
type: "button",
|
|
239
250
|
variant: "ghost",
|
|
240
|
-
onClick:
|
|
251
|
+
onClick: e[0] || (e[0] = (n) => u.value = "json")
|
|
241
252
|
}, {
|
|
242
|
-
default:
|
|
243
|
-
|
|
253
|
+
default: m(() => [...e[7] || (e[7] = [
|
|
254
|
+
q(" JSON ", -1)
|
|
244
255
|
])]),
|
|
245
256
|
_: 1
|
|
246
257
|
}, 8, ["aria-selected", "class"]),
|
|
247
|
-
r(
|
|
248
|
-
"aria-selected":
|
|
249
|
-
class: D(
|
|
258
|
+
r(o(f), {
|
|
259
|
+
"aria-selected": o(v),
|
|
260
|
+
class: D(o(P)(o(v))),
|
|
250
261
|
role: "tab",
|
|
251
262
|
size: "xs",
|
|
252
263
|
type: "button",
|
|
253
264
|
variant: "ghost",
|
|
254
|
-
onClick:
|
|
265
|
+
onClick: e[1] || (e[1] = (n) => u.value = "yaml")
|
|
255
266
|
}, {
|
|
256
|
-
default:
|
|
257
|
-
|
|
267
|
+
default: m(() => [...e[8] || (e[8] = [
|
|
268
|
+
q(" YAML ", -1)
|
|
258
269
|
])]),
|
|
259
270
|
_: 1
|
|
260
271
|
}, 8, ["aria-selected", "class"])
|
|
261
272
|
]),
|
|
262
|
-
a("div",
|
|
263
|
-
r(
|
|
273
|
+
a("div", je, [
|
|
274
|
+
r(o(f), {
|
|
264
275
|
size: "xs",
|
|
265
276
|
variant: "ghost",
|
|
266
|
-
onClick:
|
|
277
|
+
onClick: J
|
|
267
278
|
}, {
|
|
268
|
-
default:
|
|
269
|
-
a("span", null, "Format " +
|
|
270
|
-
a("span",
|
|
271
|
-
r(
|
|
279
|
+
default: m(() => [
|
|
280
|
+
a("span", null, "Format " + Q(o(v) ? "YAML" : "JSON"), 1),
|
|
281
|
+
a("span", Ie, [
|
|
282
|
+
r(o(j), {
|
|
272
283
|
hotkey: "F",
|
|
273
284
|
modifier: ["Alt", "Shift"]
|
|
274
285
|
})
|
|
@@ -276,19 +287,19 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
|
|
|
276
287
|
]),
|
|
277
288
|
_: 1
|
|
278
289
|
}),
|
|
279
|
-
r(
|
|
280
|
-
"aria-label":
|
|
290
|
+
r(o(f), {
|
|
291
|
+
"aria-label": o(S) ? "Restore editor size" : "Maximize editor",
|
|
281
292
|
size: "xs",
|
|
282
293
|
variant: "ghost",
|
|
283
|
-
onClick:
|
|
294
|
+
onClick: o(ae)
|
|
284
295
|
}, {
|
|
285
|
-
default:
|
|
286
|
-
a("span", null,
|
|
287
|
-
a("span",
|
|
288
|
-
|
|
296
|
+
default: m(() => [
|
|
297
|
+
a("span", null, Q(o(S) ? "Restore" : "Maximize"), 1),
|
|
298
|
+
a("span", Ve, [
|
|
299
|
+
o(S) ? (k(), Z(o(ge), {
|
|
289
300
|
key: 0,
|
|
290
301
|
class: "size-3.5"
|
|
291
|
-
})) : (
|
|
302
|
+
})) : (k(), Z(o(ye), {
|
|
292
303
|
key: 1,
|
|
293
304
|
class: "size-3.5"
|
|
294
305
|
}))
|
|
@@ -298,25 +309,25 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
|
|
|
298
309
|
}, 8, ["aria-label", "onClick"])
|
|
299
310
|
])
|
|
300
311
|
]),
|
|
301
|
-
a("div",
|
|
312
|
+
a("div", Te, [
|
|
302
313
|
a("div", {
|
|
303
|
-
class: D(["relative w-full min-w-0 flex-1",
|
|
314
|
+
class: D(["relative w-full min-w-0 flex-1", o(S) ? "h-full min-h-0" : "h-[500px]"])
|
|
304
315
|
}, [
|
|
305
|
-
a("div",
|
|
306
|
-
r(
|
|
307
|
-
isAutoSaveEnabled:
|
|
308
|
-
isDirty:
|
|
309
|
-
saveLoader:
|
|
310
|
-
onSaveNow:
|
|
311
|
-
"onUpdate:isAutoSaveEnabled":
|
|
316
|
+
a("div", Be, [
|
|
317
|
+
r(Se, {
|
|
318
|
+
isAutoSaveEnabled: o(p),
|
|
319
|
+
isDirty: o(l),
|
|
320
|
+
saveLoader: o(w),
|
|
321
|
+
onSaveNow: U,
|
|
322
|
+
"onUpdate:isAutoSaveEnabled": e[2] || (e[2] = (n) => p.value = n)
|
|
312
323
|
}, null, 8, ["isAutoSaveEnabled", "isDirty", "saveLoader"])
|
|
313
324
|
]),
|
|
314
|
-
r(
|
|
315
|
-
diagnosticCounts:
|
|
316
|
-
expanded:
|
|
317
|
-
visibleDiagnostics:
|
|
318
|
-
onFocusDiagnostic:
|
|
319
|
-
onToggle:
|
|
325
|
+
r(be, {
|
|
326
|
+
diagnosticCounts: ne.value,
|
|
327
|
+
expanded: o(b),
|
|
328
|
+
visibleDiagnostics: ie.value,
|
|
329
|
+
onFocusDiagnostic: R,
|
|
330
|
+
onToggle: e[3] || (e[3] = (n) => b.value = !o(b))
|
|
320
331
|
}, null, 8, ["diagnosticCounts", "expanded", "visibleDiagnostics"]),
|
|
321
332
|
a("div", {
|
|
322
333
|
ref_key: "monacoEditorRef",
|
|
@@ -325,9 +336,9 @@ const ye = { class: "grid grid-cols-[minmax(0,1fr)_auto_minmax(0,1fr)] items-cen
|
|
|
325
336
|
}, null, 512)
|
|
326
337
|
], 2)
|
|
327
338
|
])
|
|
328
|
-
], 2)) : (
|
|
339
|
+
], 2)) : (k(), X("div", Ke, "No operation context found"));
|
|
329
340
|
}
|
|
330
341
|
});
|
|
331
342
|
export {
|
|
332
|
-
|
|
343
|
+
st as default
|
|
333
344
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
1
|
+
type MonacoEditorLanguage = 'json' | 'yaml';
|
|
2
2
|
export declare const useEditorState: () => {
|
|
3
3
|
isAutoSaveEnabled: import("vue").Ref<boolean, boolean>;
|
|
4
4
|
isDirty: import("vue").Ref<boolean, boolean>;
|
|
@@ -11,4 +11,5 @@ export declare const useEditorState: () => {
|
|
|
11
11
|
getLanguageToggleClass: (isActive: boolean) => string;
|
|
12
12
|
toggleEditorMaximized: () => void;
|
|
13
13
|
};
|
|
14
|
+
export {};
|
|
14
15
|
//# sourceMappingURL=use-editor-state.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-editor-state.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/hooks/use-editor-state.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"use-editor-state.d.ts","sourceRoot":"","sources":["../../../../../../../src/v2/features/collection/components/Editor/hooks/use-editor-state.ts"],"names":[],"mappings":"AAEA,KAAK,oBAAoB,GAAG,MAAM,GAAG,MAAM,CAAA;AAK3C,eAAO,MAAM,cAAc;;;;;;;;;uCAeiB,OAAO,KAAG,MAAM;iCAQxB,IAAI;CAgBvC,CAAA"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { defineComponent as i, computed as
|
|
1
|
+
import { defineComponent as i, computed as c, createBlock as m, createCommentVNode as l, openBlock as s, withCtx as n, createVNode as u, unref as v, createTextVNode as o, createElementVNode as d } from "vue";
|
|
2
2
|
import p from "../../settings/components/Section.vue.js";
|
|
3
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import y from "../../environments/EnvironmentsList.vue.js";
|
|
4
|
+
const f = {
|
|
5
5
|
name: "Environment"
|
|
6
|
-
},
|
|
7
|
-
...
|
|
6
|
+
}, h = /* @__PURE__ */ i({
|
|
7
|
+
...f,
|
|
8
8
|
props: {
|
|
9
9
|
documentSlug: {},
|
|
10
10
|
document: {},
|
|
@@ -21,13 +21,14 @@ const y = {
|
|
|
21
21
|
customThemes: {},
|
|
22
22
|
currentTheme: {},
|
|
23
23
|
isDarkMode: { type: Boolean },
|
|
24
|
+
fetchRegistryDocument: { type: Function },
|
|
24
25
|
collectionType: {}
|
|
25
26
|
},
|
|
26
27
|
setup(e) {
|
|
27
|
-
const
|
|
28
|
+
const r = c(
|
|
28
29
|
() => (e.collectionType === "document" ? e.document["x-scalar-environments"] : e.workspaceStore.workspace["x-scalar-environments"]) ?? {}
|
|
29
|
-
), a =
|
|
30
|
-
return (k, t) => e.collectionType !== "operation" ? (s(),
|
|
30
|
+
), a = c(() => e.workspaceStore.workspace["x-scalar-active-environment"]);
|
|
31
|
+
return (k, t) => e.collectionType !== "operation" ? (s(), m(p, { key: 0 }, {
|
|
31
32
|
title: n(() => [...t[0] || (t[0] = [
|
|
32
33
|
o("Environment Variables", -1)
|
|
33
34
|
])]),
|
|
@@ -37,17 +38,17 @@ const y = {
|
|
|
37
38
|
o(" to add / search among the selected environment's variables in your request inputs. ", -1)
|
|
38
39
|
])]),
|
|
39
40
|
default: n(() => [
|
|
40
|
-
u(v(
|
|
41
|
+
u(v(y), {
|
|
41
42
|
activeEnvironment: a.value,
|
|
42
43
|
collectionType: e.collectionType,
|
|
43
|
-
environments:
|
|
44
|
+
environments: r.value,
|
|
44
45
|
eventBus: e.eventBus
|
|
45
46
|
}, null, 8, ["activeEnvironment", "collectionType", "environments", "eventBus"])
|
|
46
47
|
]),
|
|
47
48
|
_: 1
|
|
48
|
-
})) :
|
|
49
|
+
})) : l("", !0);
|
|
49
50
|
}
|
|
50
51
|
});
|
|
51
52
|
export {
|
|
52
|
-
|
|
53
|
+
h as default
|
|
53
54
|
};
|