@scalar/api-client 2.5.32 → 2.5.34
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 +39 -0
- package/dist/components/AddressBar/AddressBar.vue.js +1 -1
- package/dist/components/AddressBar/AddressBar.vue2.js +120 -128
- package/dist/components/AddressBar/AddressBarHistory.vue.js +1 -1
- package/dist/components/AddressBar/AddressBarHistory.vue2.js +57 -63
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +143 -150
- package/dist/components/CodeInput/codeVariableWidget.js +70 -75
- package/dist/components/CommandPalette/CommandActionInput.vue.js +17 -19
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +26 -27
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +53 -55
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +129 -133
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +1 -1
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +84 -98
- package/dist/components/CommandPalette/CommandPaletteServer.vue.js +64 -74
- package/dist/components/CommandPalette/CommandPaletteTag.vue.js +5 -11
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +1 -1
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +164 -183
- package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
- package/dist/components/DataTable/DataTableInput.vue.js +4 -4
- package/dist/components/DataTable/DataTableInput.vue2.js +31 -31
- package/dist/components/DataTable/DataTableInputSelect.vue.js +1 -2
- package/dist/components/EmptyState.vue.js +1 -1
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +75 -84
- package/dist/components/Form/LabelInput.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue2.js +11 -11
- package/dist/components/ImportCollection/DropEventListener.vue.js +42 -44
- package/dist/components/ImportCollection/ImportCollectionListener.vue.js +22 -23
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +141 -149
- package/dist/components/ImportCollection/ImportCollectionModal.vue3.js +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +22 -23
- package/dist/components/ImportCollection/IntegrationLogo.vue.js +12 -13
- package/dist/components/ImportCollection/PasteEventListener.vue.js +11 -12
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +69 -76
- package/dist/components/ImportCollection/utils/get-openapi-version.js +8 -8
- package/dist/components/ImportCollection/utils/import-collection.js +14 -14
- package/dist/components/OpenApiClientButton.vue.js +1 -1
- package/dist/components/OpenApiClientButton.vue2.js +10 -10
- package/dist/components/ScalarAsciiArt.vue.js +1 -1
- package/dist/components/ScalarAsciiArt.vue2.js +19 -22
- package/dist/components/Search/useSearch.js +51 -61
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue2.js +26 -29
- package/dist/components/Server/ServerDropdown.vue.js +70 -96
- package/dist/components/Server/ServerDropdownItem.vue.js +1 -1
- package/dist/components/Server/ServerDropdownItem.vue2.js +57 -67
- package/dist/components/Server/ServerSelector.vue.js +44 -55
- package/dist/components/Server/ServerVariablesForm.vue.js +36 -42
- package/dist/components/Server/ServerVariablesSelect.vue.js +6 -6
- package/dist/components/SideNav/DownloadAppButton.vue.js +1 -1
- package/dist/components/SideNav/SideNav.vue.js +68 -74
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +1 -1
- package/dist/components/Sidebar/Sidebar.vue.js +1 -1
- package/dist/components/Sidebar/SidebarListElement.vue.js +2 -2
- package/dist/components/TopNav/TopNav.vue.js +107 -122
- package/dist/components/TopNav/TopNavItem.vue.js +1 -1
- package/dist/hooks/useFileDialog.js +12 -12
- package/dist/hooks/useResponseBody.js +14 -16
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/layouts/App/ApiClientApp.vue.js +50 -56
- package/dist/layouts/App/ApiClientApp.vue3.js +1 -1
- package/dist/layouts/App/create-api-client-app.js +19 -20
- package/dist/layouts/App/index.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue2.js +18 -21
- package/dist/layouts/Web/ApiClientWeb.vue.js +45 -51
- package/dist/layouts/Web/ApiClientWeb.vue3.js +1 -1
- package/dist/layouts/Web/create-api-client-web.js +19 -20
- package/dist/layouts/Web/index.js +1 -1
- package/dist/libs/create-client.js +102 -109
- package/dist/libs/env-helpers.js +3 -3
- package/dist/libs/event-bus.js +15 -15
- package/dist/libs/extractAttachmentFilename.js +5 -6
- package/dist/libs/find-request.js +9 -10
- package/dist/libs/get-request-uid-by-path-method.js +12 -12
- package/dist/libs/getOpenApiDocumentDetails.js +7 -7
- package/dist/libs/importers/curl.js +3 -3
- package/dist/libs/normalize-headers.js +9 -10
- package/dist/libs/postman.js +15 -17
- package/dist/libs/send-request/build-request-security.js +9 -10
- package/dist/libs/send-request/create-fetch-body.js +11 -12
- package/dist/libs/send-request/create-fetch-query-params.js +13 -13
- package/dist/libs/send-request/create-request-operation.js +83 -84
- package/dist/libs/send-request/decode-buffer.d.ts.map +1 -1
- package/dist/libs/send-request/set-request-cookies.js +12 -12
- package/dist/libs/string-template.js +21 -21
- package/dist/libs/validate-parameters.js +5 -8
- package/dist/plugins/plugin-manager.js +11 -17
- package/dist/store/active-entities.js +90 -117
- package/dist/store/collections.js +41 -42
- package/dist/store/import-spec.js +25 -26
- package/dist/store/request-example.js +20 -24
- package/dist/store/requests.js +63 -81
- package/dist/store/router-params.js +7 -7
- package/dist/store/security-schemes.js +35 -36
- package/dist/store/store.js +2 -2
- package/dist/store/tags.js +20 -21
- package/dist/style.css +1 -1
- package/dist/views/Collection/Collection.vue2.js +21 -22
- package/dist/views/Collection/CollectionAuthentication.vue.js +1 -1
- package/dist/views/Collection/CollectionAuthentication.vue2.js +43 -47
- package/dist/views/Collection/CollectionEnvironment.vue.js +1 -1
- package/dist/views/Collection/CollectionEnvironment.vue2.js +196 -207
- package/dist/views/Collection/CollectionInfoForm.vue.js +1 -1
- package/dist/views/Collection/CollectionInfoForm.vue2.js +34 -41
- package/dist/views/Collection/CollectionNavigation.vue.js +116 -125
- package/dist/views/Collection/CollectionOverview.vue2.js +22 -25
- package/dist/views/Collection/CollectionServerForm.vue.js +39 -45
- package/dist/views/Collection/CollectionServers.vue2.js +88 -98
- package/dist/views/Collection/CollectionSettings.vue.js +1 -1
- package/dist/views/Collection/CollectionSettings.vue2.js +101 -108
- package/dist/views/Collection/components/EnvironmentForm.vue.js +1 -1
- package/dist/views/Collection/components/EnvironmentForm.vue2.js +141 -145
- package/dist/views/Collection/components/MarkdownInput.vue.js +1 -1
- package/dist/views/Collection/components/MarkdownInput.vue2.js +1 -2
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +15 -15
- package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.js +15 -16
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +61 -64
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +9 -10
- package/dist/views/Cookies/CookieModal.vue.js +1 -1
- package/dist/views/Cookies/Cookies.vue2.js +90 -93
- package/dist/views/Environment/Environment.vue2.js +267 -295
- package/dist/views/Environment/EnvironmentModal.vue.js +63 -70
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +38 -42
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +60 -67
- package/dist/views/Request/RequestRoot.vue.js +1 -1
- package/dist/views/Request/RequestRoot.vue2.js +78 -89
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +37 -44
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +44 -45
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +111 -127
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +120 -139
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +97 -97
- package/dist/views/Request/RequestSection/RequestBody.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +287 -310
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +86 -94
- package/dist/views/Request/RequestSection/RequestParams.vue.js +37 -38
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +36 -38
- package/dist/views/Request/RequestSection/RequestSection.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +28 -31
- package/dist/views/Request/RequestSection/RequestTable.vue.js +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +49 -52
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +1 -1
- package/dist/views/Request/RequestSection/helpers/filter-security-requirements.js +16 -16
- package/dist/views/Request/RequestSection/helpers/getting-started.js +7 -11
- package/dist/views/Request/RequestSection/helpers/update-scheme.js +7 -8
- package/dist/views/Request/RequestSidebar.vue.js +1 -1
- package/dist/views/Request/RequestSidebar.vue2.js +199 -211
- package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
- package/dist/views/Request/RequestSidebarItem.vue2.js +332 -349
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +210 -240
- package/dist/views/Request/RequestSubpageHeader.vue.js +1 -1
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +58 -64
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +1 -2
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +20 -23
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +29 -30
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +38 -41
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +3 -3
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +28 -29
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +128 -140
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +116 -124
- package/dist/views/Request/consts/mediaTypes.js +2 -3
- package/dist/views/Request/handle-drag.js +24 -28
- package/dist/views/Request/hooks/useOpenApiWatcher.js +26 -33
- package/dist/views/Request/libs/auth.js +37 -43
- package/dist/views/Request/libs/oauth2.js +30 -32
- package/dist/views/Request/libs/watch-mode.js +100 -103
- package/dist/views/Settings/SettingsGeneral.vue.js +206 -236
- package/package.json +22 -22
- package/dist/components/AddressBar/AddressBar.vue3.js +0 -4
- package/dist/components/AddressBar/AddressBarHistory.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue3.js +0 -4
- package/dist/components/CodeInput/CodeInput.vue4.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue3.js +0 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue3.js +0 -4
- package/dist/components/DataTable/DataTableInput.vue3.js +0 -4
- package/dist/components/EmptyState.vue3.js +0 -4
- package/dist/components/Form/LabelInput.vue3.js +0 -4
- package/dist/components/HttpMethod/HttpMethod.vue3.js +0 -4
- package/dist/components/ImportCollection/ImportCollectionModal.vue2.js +0 -4
- package/dist/components/OpenApiClientButton.vue3.js +0 -4
- package/dist/components/ScalarAsciiArt.vue3.js +0 -4
- package/dist/components/SectionFilter.vue3.js +0 -4
- package/dist/components/Server/ServerDropdownItem.vue3.js +0 -4
- package/dist/components/SideNav/DownloadAppButton.vue3.js +0 -4
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue3.js +0 -4
- package/dist/components/Sidebar/Sidebar.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue3.js +0 -4
- package/dist/components/Sidebar/SidebarListElement.vue4.js +0 -4
- package/dist/components/TopNav/TopNavItem.vue3.js +0 -4
- package/dist/layouts/App/ApiClientApp.vue2.js +0 -4
- package/dist/layouts/Modal/ApiClientModal.vue3.js +0 -4
- package/dist/layouts/Web/ApiClientWeb.vue2.js +0 -4
- package/dist/style.css.js +0 -4
- package/dist/views/Collection/CollectionAuthentication.vue3.js +0 -4
- package/dist/views/Collection/CollectionEnvironment.vue3.js +0 -4
- package/dist/views/Collection/CollectionInfoForm.vue3.js +0 -4
- package/dist/views/Collection/CollectionSettings.vue3.js +0 -4
- package/dist/views/Collection/components/EnvironmentForm.vue3.js +0 -4
- package/dist/views/Collection/components/MarkdownInput.vue3.js +0 -4
- package/dist/views/Cookies/CookieModal.vue3.js +0 -4
- package/dist/views/Request/Request.vue3.js +0 -4
- package/dist/views/Request/RequestRoot.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestBody.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestCodeExample.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestSection.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTable.vue3.js +0 -4
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue3.js +0 -4
- package/dist/views/Request/RequestSidebar.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue3.js +0 -4
- package/dist/views/Request/RequestSidebarItem.vue4.js +0 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue3.js +0 -4
- package/dist/views/Request/RequestSubpageHeader.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBody.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue3.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseSection.vue3.js +0 -4
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCodeMirror as
|
|
3
|
-
import { nanoid as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import { pillPlugin as
|
|
7
|
-
import { useLayout as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as W, useAttrs as j, ref as i, computed as d, toRef as r, watch as H, createElementBlock as u, openBlock as n, Fragment as Q, createBlock as c, createCommentVNode as p, normalizeClass as G, unref as h, createElementVNode as w, toDisplayString as J, mergeProps as X, withKeys as b, withModifiers as $, createTextVNode as V, renderSlot as q } from "vue";
|
|
2
|
+
import { useCodeMirror as Y, useDropdown as Z, colorPicker as _ } from "@scalar/use-codemirror";
|
|
3
|
+
import { nanoid as ee } from "nanoid";
|
|
4
|
+
import oe from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
|
|
5
|
+
import k from "../DataTable/DataTableInputSelect.vue.js";
|
|
6
|
+
import { pillPlugin as le, backspaceCommand as te } from "./codeVariableWidget.js";
|
|
7
|
+
import { useLayout as ne } from "../../hooks/useLayout.js";
|
|
8
|
+
const ae = { class: "whitespace-nowrap" }, re = ["id"], se = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "z-context text-c-2 absolute right-1.5 bottom-1 hidden font-sans group-has-[:focus-visible]/input:block",
|
|
11
11
|
role: "alert"
|
|
12
|
-
},
|
|
12
|
+
}, ue = {
|
|
13
13
|
key: 5,
|
|
14
14
|
class: "centered-y text-orange absolute right-7 text-xs"
|
|
15
|
-
},
|
|
15
|
+
}, ie = {
|
|
16
16
|
key: 6,
|
|
17
17
|
class: "centered-y absolute right-0 flex h-full items-center p-1.5 group-has-[.cm-focused]:z-1"
|
|
18
|
-
},
|
|
18
|
+
}, de = {
|
|
19
19
|
key: 7,
|
|
20
20
|
class: "required centered-y text-xxs text-c-3 group-[.error]:text-red bg-b-1 pointer-events-none absolute right-0 mr-0.5 pt-px pr-2 opacity-100 shadow-[-8px_0_4px_var(--scalar-background-1)] transition-opacity duration-150 group-[.alert]:bg-transparent group-[.alert]:shadow-none group-[.error]:bg-transparent group-[.error]:shadow-none peer-has-[.cm-focused]:opacity-0"
|
|
21
|
-
},
|
|
21
|
+
}, pe = {
|
|
22
22
|
inheritAttrs: !1
|
|
23
|
-
},
|
|
24
|
-
...
|
|
23
|
+
}, he = /* @__PURE__ */ W({
|
|
24
|
+
...pe,
|
|
25
25
|
__name: "CodeInput",
|
|
26
26
|
props: {
|
|
27
27
|
colorPicker: { type: Boolean, default: !1 },
|
|
@@ -53,166 +53,159 @@ const ue = { class: "whitespace-nowrap" }, ie = ["id"], de = {
|
|
|
53
53
|
lineWrapping: { type: Boolean, default: !1 }
|
|
54
54
|
},
|
|
55
55
|
emits: ["submit", "update:modelValue", "curl", "blur"],
|
|
56
|
-
setup(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
var l;
|
|
61
|
-
return e === o.modelValue ? null : o.importCurl && e.trim().toLowerCase().startsWith("curl") ? (s("curl", e), (l = a.value) == null || l.dispatch({
|
|
56
|
+
setup(R, { expose: A, emit: I }) {
|
|
57
|
+
const e = R, s = I, x = j(), M = x.id || `id-${ee()}`, B = i(!1), y = i(!1), C = i(""), S = i({ left: 0, top: 0 }), f = i(null), { layout: g } = ne();
|
|
58
|
+
function D(o) {
|
|
59
|
+
return o === e.modelValue ? null : e.importCurl && o.trim().toLowerCase().startsWith("curl") ? (s("curl", o), a.value?.dispatch({
|
|
62
60
|
changes: {
|
|
63
61
|
from: 0,
|
|
64
62
|
to: a.value.state.doc.length,
|
|
65
|
-
insert: String(
|
|
63
|
+
insert: String(e.modelValue)
|
|
66
64
|
}
|
|
67
|
-
}), null) :
|
|
65
|
+
}), null) : e.handleFieldChange ? e.handleFieldChange(o) : s("update:modelValue", o);
|
|
68
66
|
}
|
|
69
|
-
function
|
|
70
|
-
return
|
|
67
|
+
function v(o) {
|
|
68
|
+
return e.handleFieldSubmit ? e.handleFieldSubmit(o) : s("submit", o);
|
|
71
69
|
}
|
|
72
|
-
function
|
|
73
|
-
|
|
70
|
+
function P(o) {
|
|
71
|
+
B.value = !1, e.emitOnBlur && e.modelValue && v(o), s("blur", o);
|
|
74
72
|
}
|
|
75
|
-
const
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
() =>
|
|
79
|
-
environment:
|
|
80
|
-
envVariables:
|
|
81
|
-
workspace:
|
|
82
|
-
isReadOnly:
|
|
73
|
+
const E = [...e.extensions];
|
|
74
|
+
e.colorPicker && E.push(_);
|
|
75
|
+
const N = d(
|
|
76
|
+
() => le({
|
|
77
|
+
environment: e.environment,
|
|
78
|
+
envVariables: e.envVariables,
|
|
79
|
+
workspace: e.workspace,
|
|
80
|
+
isReadOnly: g === "modal"
|
|
83
81
|
})
|
|
84
|
-
),
|
|
85
|
-
...
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
]),
|
|
82
|
+
), O = d(() => [
|
|
83
|
+
...E,
|
|
84
|
+
N.value,
|
|
85
|
+
te
|
|
86
|
+
]), F = i(null), { codeMirror: a } = Y({
|
|
89
87
|
content: r(
|
|
90
|
-
() =>
|
|
88
|
+
() => e.modelValue !== void 0 ? String(e.modelValue) : ""
|
|
91
89
|
),
|
|
92
|
-
onChange: (
|
|
93
|
-
|
|
90
|
+
onChange: (o) => {
|
|
91
|
+
D(o), z();
|
|
94
92
|
},
|
|
95
|
-
onFocus: () =>
|
|
96
|
-
onBlur: (
|
|
97
|
-
codeMirrorRef:
|
|
98
|
-
disableTabIndent: r(() =>
|
|
99
|
-
disableEnter: r(() =>
|
|
100
|
-
disableCloseBrackets: r(() =>
|
|
101
|
-
lineNumbers: r(() =>
|
|
102
|
-
language: r(() =>
|
|
103
|
-
lint: r(() =>
|
|
104
|
-
extensions:
|
|
105
|
-
placeholder: r(() =>
|
|
93
|
+
onFocus: () => B.value = !0,
|
|
94
|
+
onBlur: (o) => P(o),
|
|
95
|
+
codeMirrorRef: F,
|
|
96
|
+
disableTabIndent: r(() => e.disableTabIndent),
|
|
97
|
+
disableEnter: r(() => e.disableEnter),
|
|
98
|
+
disableCloseBrackets: r(() => e.disableCloseBrackets),
|
|
99
|
+
lineNumbers: r(() => e.lineNumbers),
|
|
100
|
+
language: r(() => e.language),
|
|
101
|
+
lint: r(() => e.lint),
|
|
102
|
+
extensions: O,
|
|
103
|
+
placeholder: r(() => e.placeholder)
|
|
106
104
|
});
|
|
107
|
-
|
|
108
|
-
a.value && Object.hasOwn(
|
|
105
|
+
a.value?.focus(), H(a, () => {
|
|
106
|
+
a.value && Object.hasOwn(x, "autofocus") && a.value.focus();
|
|
109
107
|
});
|
|
110
|
-
const { handleDropdownSelect:
|
|
108
|
+
const { handleDropdownSelect: K, updateDropdownVisibility: z } = Z({
|
|
111
109
|
codeMirror: a,
|
|
112
|
-
query:
|
|
113
|
-
showDropdown:
|
|
114
|
-
dropdownPosition:
|
|
115
|
-
}),
|
|
116
|
-
() =>
|
|
117
|
-
),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
}, j = p(() => Array.isArray(o.type) ? (
|
|
110
|
+
query: C,
|
|
111
|
+
showDropdown: y,
|
|
112
|
+
dropdownPosition: S
|
|
113
|
+
}), T = d(
|
|
114
|
+
() => e.nullable ? ["true", "false", "null"] : ["true", "false"]
|
|
115
|
+
), m = (o, l) => {
|
|
116
|
+
y.value ? o === "down" ? (l.preventDefault(), f.value?.handleArrowKey("down")) : o === "up" ? (l.preventDefault(), f.value?.handleArrowKey("up")) : o === "enter" && (l.preventDefault(), f.value?.handleSelect()) : o === "escape" ? e.disableTabIndent || l.stopPropagation() : o === "enter" && l.target instanceof HTMLDivElement && v(l.target.textContent ?? "");
|
|
117
|
+
}, L = d(() => Array.isArray(e.type) ? (
|
|
121
118
|
// Find the first type, that's not 'null'
|
|
122
|
-
|
|
119
|
+
e.type.find((o) => o !== "null") ?? "string"
|
|
123
120
|
) : (
|
|
124
121
|
// If it's not an array, just return the type
|
|
125
|
-
|
|
126
|
-
)),
|
|
127
|
-
() =>
|
|
122
|
+
e.type
|
|
123
|
+
)), U = d(
|
|
124
|
+
() => y.value && e.withVariables && g !== "modal" && e.environment
|
|
128
125
|
);
|
|
129
|
-
return
|
|
126
|
+
return A({
|
|
130
127
|
/** Expose focus method */
|
|
131
128
|
focus: () => {
|
|
132
|
-
|
|
133
|
-
(e = a.value) == null || e.focus();
|
|
129
|
+
a.value?.focus();
|
|
134
130
|
},
|
|
135
131
|
// Expose these methods for testing
|
|
136
|
-
handleChange:
|
|
137
|
-
handleSubmit:
|
|
138
|
-
handleBlur:
|
|
139
|
-
booleanOptions:
|
|
132
|
+
handleChange: D,
|
|
133
|
+
handleSubmit: v,
|
|
134
|
+
handleBlur: P,
|
|
135
|
+
booleanOptions: T,
|
|
140
136
|
codeMirror: a,
|
|
141
|
-
modelValue:
|
|
142
|
-
}), (
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
}, null, 8, ["dropdownPosition", "envVariables", "environment", "query", "onSelect"])) : f("", !0)
|
|
212
|
-
], 64);
|
|
213
|
-
};
|
|
137
|
+
modelValue: e.modelValue
|
|
138
|
+
}), (o, l) => (n(), u(Q, null, [
|
|
139
|
+
o.disabled ? (n(), u("div", {
|
|
140
|
+
key: 0,
|
|
141
|
+
class: G(["text-c-2 flex cursor-default items-center justify-center", h(g) === "modal" ? "font-code pr-2 pl-1 text-base" : "px-2"]),
|
|
142
|
+
"data-testid": "code-input-disabled"
|
|
143
|
+
}, [
|
|
144
|
+
w("span", ae, J(o.modelValue), 1)
|
|
145
|
+
], 2)) : e.enum && e.enum.length ? (n(), c(k, {
|
|
146
|
+
key: 1,
|
|
147
|
+
default: e.default,
|
|
148
|
+
modelValue: o.modelValue,
|
|
149
|
+
type: L.value,
|
|
150
|
+
value: e.enum,
|
|
151
|
+
"onUpdate:modelValue": l[0] || (l[0] = (t) => s("update:modelValue", t))
|
|
152
|
+
}, null, 8, ["default", "modelValue", "type", "value"])) : o.type === "boolean" || o.type?.includes("boolean") ? (n(), c(k, {
|
|
153
|
+
key: 2,
|
|
154
|
+
default: e.default,
|
|
155
|
+
modelValue: o.modelValue,
|
|
156
|
+
value: T.value,
|
|
157
|
+
"onUpdate:modelValue": l[1] || (l[1] = (t) => s("update:modelValue", t))
|
|
158
|
+
}, null, 8, ["default", "modelValue", "value"])) : e.examples && e.examples.length ? (n(), c(k, {
|
|
159
|
+
key: 3,
|
|
160
|
+
default: e.default,
|
|
161
|
+
modelValue: e.modelValue,
|
|
162
|
+
value: e.examples,
|
|
163
|
+
"onUpdate:modelValue": l[2] || (l[2] = (t) => s("update:modelValue", t))
|
|
164
|
+
}, null, 8, ["default", "modelValue", "value"])) : (n(), u("div", X({
|
|
165
|
+
key: 4,
|
|
166
|
+
id: h(M)
|
|
167
|
+
}, o.$attrs, {
|
|
168
|
+
ref_key: "codeMirrorRef",
|
|
169
|
+
ref: F,
|
|
170
|
+
class: ["group/input group-[.alert]:outline-orange group-[.error]:outline-red font-code peer relative w-full overflow-hidden text-xs leading-[1.44] whitespace-nowrap -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline", {
|
|
171
|
+
"line-wrapping has-[:focus-visible]:bg-b-1 has-[:focus-visible]:absolute has-[:focus-visible]:z-1": o.lineWrapping,
|
|
172
|
+
"flow-code-input--error": o.error
|
|
173
|
+
}],
|
|
174
|
+
onKeydown: [
|
|
175
|
+
l[3] || (l[3] = b($((t) => m("down", t), ["stop"]), ["down"])),
|
|
176
|
+
l[4] || (l[4] = b((t) => m("enter", t), ["enter"])),
|
|
177
|
+
l[5] || (l[5] = b((t) => m("escape", t), ["escape"])),
|
|
178
|
+
l[6] || (l[6] = b($((t) => m("up", t), ["stop"]), ["up"]))
|
|
179
|
+
]
|
|
180
|
+
}), [
|
|
181
|
+
o.disableTabIndent ? p("", !0) : (n(), u("div", se, l[7] || (l[7] = [
|
|
182
|
+
V(" Press "),
|
|
183
|
+
w("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Esc", -1),
|
|
184
|
+
V(" then "),
|
|
185
|
+
w("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Tab", -1),
|
|
186
|
+
V(" to exit ")
|
|
187
|
+
])))
|
|
188
|
+
], 16, re)),
|
|
189
|
+
o.$slots.warning ? (n(), u("div", ue, [
|
|
190
|
+
q(o.$slots, "warning", {}, void 0, !0)
|
|
191
|
+
])) : p("", !0),
|
|
192
|
+
o.$slots.icon ? (n(), u("div", ie, [
|
|
193
|
+
q(o.$slots, "icon", {}, void 0, !0)
|
|
194
|
+
])) : p("", !0),
|
|
195
|
+
o.required ? (n(), u("div", de, " Required ")) : p("", !0),
|
|
196
|
+
U.value ? (n(), c(oe, {
|
|
197
|
+
key: 8,
|
|
198
|
+
ref_key: "dropdownRef",
|
|
199
|
+
ref: f,
|
|
200
|
+
dropdownPosition: S.value,
|
|
201
|
+
envVariables: o.envVariables,
|
|
202
|
+
environment: o.environment,
|
|
203
|
+
query: C.value,
|
|
204
|
+
onSelect: h(K)
|
|
205
|
+
}, null, 8, ["dropdownPosition", "envVariables", "environment", "query", "onSelect"])) : p("", !0)
|
|
206
|
+
], 64));
|
|
214
207
|
}
|
|
215
208
|
});
|
|
216
209
|
export {
|
|
217
|
-
|
|
210
|
+
he as default
|
|
218
211
|
};
|
|
@@ -1,123 +1,118 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
class p extends V {
|
|
13
|
-
constructor(e, i, n, s, a) {
|
|
14
|
-
super();
|
|
15
|
-
r(this, "app");
|
|
16
|
-
r(this, "uid");
|
|
17
|
-
r(this, "environment");
|
|
18
|
-
r(this, "envVariables");
|
|
19
|
-
r(this, "workspace");
|
|
20
|
-
r(this, "isReadOnly");
|
|
21
|
-
this.variableName = e, this.variableName = e, this.environment = i, this.envVariables = n, this.workspace = s, this.isReadOnly = a ?? !1, this.uid = D();
|
|
1
|
+
import { getEnvColor as p } from "../../libs/env-helpers.js";
|
|
2
|
+
import { ScalarTooltip as h } from "@scalar/components";
|
|
3
|
+
import { ScalarIconGlobe as u } from "@scalar/icons";
|
|
4
|
+
import { REGEX as v } from "@scalar/oas-utils/helpers";
|
|
5
|
+
import { ViewPlugin as f, EditorView as b, RangeSetBuilder as g, Decoration as w, WidgetType as y } from "@scalar/use-codemirror";
|
|
6
|
+
import { defineComponent as N, h as l, createApp as E } from "vue";
|
|
7
|
+
import { nanoid as C } from "nanoid";
|
|
8
|
+
import { parseEnvVariables as V } from "../../libs/environment-parser.js";
|
|
9
|
+
class m extends y {
|
|
10
|
+
constructor(e, n, t, o, a) {
|
|
11
|
+
super(), this.variableName = e, this.variableName = e, this.environment = n, this.envVariables = t, this.workspace = o, this.isReadOnly = a ?? !1, this.uid = C();
|
|
22
12
|
}
|
|
13
|
+
app;
|
|
14
|
+
uid;
|
|
15
|
+
environment;
|
|
16
|
+
envVariables;
|
|
17
|
+
workspace;
|
|
18
|
+
isReadOnly;
|
|
23
19
|
toDOM() {
|
|
24
20
|
const e = document.createElement("span");
|
|
25
21
|
e.className = "cm-pill", e.textContent = `${this.variableName}`;
|
|
26
|
-
const
|
|
22
|
+
const n = N({
|
|
27
23
|
props: { variableName: { type: String, default: null } },
|
|
28
24
|
render: () => {
|
|
29
|
-
var
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
(
|
|
34
|
-
m("span", this.variableName)
|
|
25
|
+
const t = this.envVariables ? V(this.envVariables).find((c) => c.key === this.variableName) : void 0, o = t?.source === "global", a = o ? "var(--scalar-color-1)" : t && this.environment && this.environment.name !== "No Environment" ? p(this.environment) : "var(--scalar-color-1)";
|
|
26
|
+
e.style.setProperty("--tw-bg-base", a), e.style.opacity = t?.value ? "1" : "0.5";
|
|
27
|
+
const r = t?.value || "No value", s = l("div", { class: "flex items-center gap-1 whitespace-nowrap" }, [
|
|
28
|
+
(o || this.environment?.name === "No Environment" && t?.value) && l(u, { class: "size-3 -ml-1", icon: "Globe" }),
|
|
29
|
+
l("span", this.variableName)
|
|
35
30
|
]);
|
|
36
|
-
return
|
|
37
|
-
|
|
31
|
+
return l(
|
|
32
|
+
h,
|
|
38
33
|
{
|
|
39
|
-
content:
|
|
34
|
+
content: r,
|
|
40
35
|
delay: 0,
|
|
41
36
|
placement: "bottom",
|
|
42
37
|
offset: 6
|
|
43
38
|
},
|
|
44
39
|
{
|
|
45
|
-
default: () =>
|
|
40
|
+
default: () => s
|
|
46
41
|
}
|
|
47
42
|
);
|
|
48
43
|
}
|
|
49
44
|
});
|
|
50
|
-
return this.app =
|
|
45
|
+
return this.app = E(n, { variableName: this.variableName }), this.app.mount(e), e;
|
|
51
46
|
}
|
|
52
47
|
destroy() {
|
|
53
48
|
this.app && this.app.unmount();
|
|
54
49
|
}
|
|
55
50
|
eq(e) {
|
|
56
|
-
return e instanceof
|
|
51
|
+
return e instanceof m && e.variableName === this.variableName && e.uid === this.uid;
|
|
57
52
|
}
|
|
58
53
|
ignoreEvent() {
|
|
59
54
|
return !1;
|
|
60
55
|
}
|
|
61
56
|
}
|
|
62
|
-
const
|
|
57
|
+
const B = (i) => f.fromClass(
|
|
63
58
|
class {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.decorations = this.buildDecorations(
|
|
59
|
+
decorations;
|
|
60
|
+
constructor(e) {
|
|
61
|
+
this.decorations = this.buildDecorations(e);
|
|
67
62
|
}
|
|
68
|
-
update(
|
|
69
|
-
(
|
|
70
|
-
this.decorations = this.buildDecorations(
|
|
63
|
+
update(e) {
|
|
64
|
+
(e.docChanged || e.viewportChanged) && requestAnimationFrame(() => {
|
|
65
|
+
this.decorations = this.buildDecorations(e.view), e.view.update([]);
|
|
71
66
|
});
|
|
72
67
|
}
|
|
73
|
-
buildDecorations(
|
|
74
|
-
const
|
|
75
|
-
for (const { from:
|
|
76
|
-
const
|
|
77
|
-
let
|
|
78
|
-
for (; (
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
widget: new
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
68
|
+
buildDecorations(e) {
|
|
69
|
+
const n = new g();
|
|
70
|
+
for (const { from: t, to: o } of e.visibleRanges) {
|
|
71
|
+
const a = e.state.doc.sliceString(t, o);
|
|
72
|
+
let r;
|
|
73
|
+
for (; (r = v.VARIABLES.exec(a)) !== null; ) {
|
|
74
|
+
const s = t + r.index, c = s + r[0].length, d = r[1] ?? "";
|
|
75
|
+
n.add(
|
|
76
|
+
s,
|
|
77
|
+
c,
|
|
78
|
+
w.widget({
|
|
79
|
+
widget: new m(
|
|
80
|
+
d,
|
|
81
|
+
i.environment,
|
|
82
|
+
i.envVariables,
|
|
83
|
+
i.workspace,
|
|
84
|
+
i.isReadOnly
|
|
90
85
|
),
|
|
91
86
|
side: 1
|
|
92
87
|
})
|
|
93
88
|
);
|
|
94
89
|
}
|
|
95
90
|
}
|
|
96
|
-
return
|
|
91
|
+
return n.finish();
|
|
97
92
|
}
|
|
98
93
|
},
|
|
99
94
|
{
|
|
100
|
-
decorations: (
|
|
95
|
+
decorations: (e) => e.decorations
|
|
101
96
|
}
|
|
102
|
-
),
|
|
103
|
-
keydown(
|
|
104
|
-
if (
|
|
105
|
-
const { state:
|
|
106
|
-
if (
|
|
107
|
-
return
|
|
108
|
-
changes: { from: 0, to:
|
|
97
|
+
), P = b.domEventHandlers({
|
|
98
|
+
keydown(i, e) {
|
|
99
|
+
if (i.key === "Backspace") {
|
|
100
|
+
const { state: n } = e, { from: t, to: o } = n.selection.main;
|
|
101
|
+
if (t === 0 && o === n.doc.length)
|
|
102
|
+
return e.dispatch({
|
|
103
|
+
changes: { from: 0, to: n.doc.length },
|
|
109
104
|
selection: { anchor: 0 }
|
|
110
|
-
}),
|
|
111
|
-
if (
|
|
112
|
-
return
|
|
113
|
-
changes: { from:
|
|
114
|
-
selection: { anchor:
|
|
115
|
-
}),
|
|
105
|
+
}), i.preventDefault(), !0;
|
|
106
|
+
if (t === o && t > 0 && n.doc.sliceString(t - 2, t) === "}}")
|
|
107
|
+
return e.dispatch({
|
|
108
|
+
changes: { from: t - 2, to: o },
|
|
109
|
+
selection: { anchor: t - 2 }
|
|
110
|
+
}), i.preventDefault(), !0;
|
|
116
111
|
}
|
|
117
112
|
return !1;
|
|
118
113
|
}
|
|
119
114
|
});
|
|
120
115
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
116
|
+
P as backspaceCommand,
|
|
117
|
+
B as pillPlugin
|
|
123
118
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
const
|
|
1
|
+
import { defineComponent as m, ref as c, onMounted as f, nextTick as h, computed as b, withDirectives as g, createElementBlock as v, openBlock as w, mergeProps as x, withKeys as u, vModelText as y } from "vue";
|
|
2
|
+
const k = ["placeholder"], E = /* @__PURE__ */ m({
|
|
3
3
|
inheritAttrs: !1,
|
|
4
4
|
__name: "CommandActionInput",
|
|
5
5
|
props: {
|
|
@@ -8,30 +8,28 @@ const D = ["placeholder"], V = /* @__PURE__ */ c({
|
|
|
8
8
|
autofocus: { type: Boolean }
|
|
9
9
|
},
|
|
10
10
|
emits: ["update:modelValue", "onDelete"],
|
|
11
|
-
setup(
|
|
12
|
-
const n =
|
|
13
|
-
|
|
14
|
-
() =>
|
|
15
|
-
|
|
16
|
-
n.autofocus || (e = a.value) == null || e.focus();
|
|
11
|
+
setup(s, { emit: i }) {
|
|
12
|
+
const n = s, r = i, a = c(null);
|
|
13
|
+
f(
|
|
14
|
+
() => h(() => {
|
|
15
|
+
n.autofocus || a.value?.focus();
|
|
17
16
|
})
|
|
18
17
|
);
|
|
19
|
-
const l =
|
|
18
|
+
const l = b({
|
|
20
19
|
get: () => n.modelValue ?? "",
|
|
21
20
|
set: (e) => r("update:modelValue", e)
|
|
22
21
|
});
|
|
23
|
-
function
|
|
24
|
-
var u;
|
|
22
|
+
function p(e) {
|
|
25
23
|
if (e.shiftKey || !e.target)
|
|
26
24
|
return;
|
|
27
25
|
e.preventDefault();
|
|
28
26
|
const t = e.target, o = new Event("submit", { cancelable: !0 });
|
|
29
|
-
|
|
27
|
+
t.form?.dispatchEvent(o);
|
|
30
28
|
}
|
|
31
|
-
function
|
|
29
|
+
function d(e) {
|
|
32
30
|
l.value === "" && (e.preventDefault(), e.stopPropagation(), r("onDelete", e));
|
|
33
31
|
}
|
|
34
|
-
return (e, t) =>
|
|
32
|
+
return (e, t) => g((w(), v("textarea", x({
|
|
35
33
|
id: "command-action-input",
|
|
36
34
|
ref_key: "input",
|
|
37
35
|
ref: a,
|
|
@@ -41,14 +39,14 @@ const D = ["placeholder"], V = /* @__PURE__ */ c({
|
|
|
41
39
|
wrap: "hard"
|
|
42
40
|
}, e.$attrs, {
|
|
43
41
|
onKeydown: [
|
|
44
|
-
t[1] || (t[1] =
|
|
45
|
-
t[2] || (t[2] =
|
|
42
|
+
t[1] || (t[1] = u((o) => d(o), ["delete"])),
|
|
43
|
+
t[2] || (t[2] = u((o) => p(o), ["enter"]))
|
|
46
44
|
]
|
|
47
|
-
}), null, 16,
|
|
48
|
-
[
|
|
45
|
+
}), null, 16, k)), [
|
|
46
|
+
[y, l.value]
|
|
49
47
|
]);
|
|
50
48
|
}
|
|
51
49
|
});
|
|
52
50
|
export {
|
|
53
|
-
|
|
51
|
+
E as default
|
|
54
52
|
};
|