@scalar/api-client 2.22.1 → 2.22.3
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 +71 -0
- package/dist/hooks/useClientConfig.d.ts +6 -3
- package/dist/hooks/useClientConfig.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +2 -2
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +9 -9
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +101 -98
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +2 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +43 -37
- 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 +45 -43
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +0 -6
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue2.js +50 -63
- package/dist/v2/components/layout/ValueEmitter.vue.d.ts +6 -2
- package/dist/v2/components/layout/ValueEmitter.vue.d.ts.map +1 -1
- package/dist/v2/components/layout/ValueEmitter.vue.js +10 -10
- package/dist/v2/components/server/ServerDropdown.vue.d.ts +2 -0
- package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.js +48 -42
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +0 -3
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +55 -53
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +48 -46
- package/dist/v2/features/app/app-state.d.ts +23 -12
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +204 -168
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +137 -127
- package/dist/v2/features/app/helpers/routes.d.ts +1 -1
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +7 -7
- package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue.js +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +6 -6
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +2 -2
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +60 -56
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/v2/features/search/hooks/use-search-index.d.ts +3 -7
- package/dist/v2/features/search/hooks/use-search-index.d.ts.map +1 -1
- package/dist/v2/features/search/hooks/use-search-index.js +12 -18
- package/dist/v2/features/search/index.d.ts +1 -2
- package/dist/v2/features/search/index.d.ts.map +1 -1
- package/dist/v2/features/search/index.js +2 -4
- package/dist/v2/features/search/types.d.ts +1 -1
- package/dist/v2/features/search/types.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
- package/dist/views/Request/libs/oauth2.js +54 -52
- package/package.json +17 -17
- package/dist/v2/features/search/components/SearchButton.vue.d.ts +0 -12
- package/dist/v2/features/search/components/SearchButton.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchButton.vue.js +0 -71
- package/dist/v2/features/search/components/SearchButton.vue2.js +0 -4
- package/dist/v2/features/search/components/SearchModal.vue.d.ts +0 -11
- package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchModal.vue.js +0 -7
- package/dist/v2/features/search/components/SearchModal.vue2.js +0 -102
- package/dist/v2/features/search/components/SearchResult.vue.d.ts +0 -10
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +0 -1
- package/dist/v2/features/search/components/SearchResult.vue.js +0 -80
- package/dist/v2/features/search/components/SearchResult.vue2.js +0 -4
|
@@ -1,25 +1,29 @@
|
|
|
1
|
+
import { isRelativePath as E } from "@scalar/helpers/url/is-relative-path";
|
|
1
2
|
import { makeUrlAbsolute as b } from "@scalar/helpers/url/make-url-absolute";
|
|
2
|
-
import { shouldUseProxy as
|
|
3
|
-
import { encode as
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
return
|
|
7
|
-
},
|
|
3
|
+
import { shouldUseProxy as S } from "@scalar/helpers/url/redirect-to-proxy";
|
|
4
|
+
import { encode as z, fromUint8Array as C } from "js-base64";
|
|
5
|
+
const A = (t) => {
|
|
6
|
+
const e = t?.url;
|
|
7
|
+
return e ? E(e) ? typeof window > "u" ? {} : { basePath: e } : { baseUrl: e } : {};
|
|
8
|
+
}, F = () => {
|
|
9
|
+
const t = new Uint8Array(32);
|
|
10
|
+
return crypto.getRandomValues(t), C(t, !0);
|
|
11
|
+
}, R = async (t, e) => {
|
|
8
12
|
if (e === "plain")
|
|
9
|
-
return
|
|
13
|
+
return t;
|
|
10
14
|
if (typeof crypto?.subtle?.digest != "function")
|
|
11
|
-
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."),
|
|
12
|
-
const l = new TextEncoder().encode(
|
|
15
|
+
return console.warn("SHA-256 is only supported when using https, using a plain text code challenge instead."), t;
|
|
16
|
+
const l = new TextEncoder().encode(t), f = await crypto.subtle.digest("SHA-256", l);
|
|
13
17
|
return C(new Uint8Array(f), !0);
|
|
14
|
-
},
|
|
15
|
-
const d =
|
|
18
|
+
}, W = async (t, e, g, l, f) => {
|
|
19
|
+
const d = t[e];
|
|
16
20
|
try {
|
|
17
21
|
if (!d)
|
|
18
22
|
return [new Error("Flow not found"), null];
|
|
19
23
|
const m = g.join(" ");
|
|
20
24
|
if (e === "clientCredentials" || e === "password")
|
|
21
25
|
return U(
|
|
22
|
-
|
|
26
|
+
t,
|
|
23
27
|
e,
|
|
24
28
|
m,
|
|
25
29
|
{
|
|
@@ -27,35 +31,33 @@ const S = () => {
|
|
|
27
31
|
},
|
|
28
32
|
l
|
|
29
33
|
);
|
|
30
|
-
const
|
|
31
|
-
baseUrl: l?.url
|
|
32
|
-
}), n = new URL(a);
|
|
34
|
+
const r = (Math.random() + 1).toString(36).substring(2, 10), a = b(t[e].authorizationUrl, A(l)), n = new URL(a);
|
|
33
35
|
let c = null;
|
|
34
36
|
if (e === "implicit")
|
|
35
37
|
n.searchParams.set("response_type", "token");
|
|
36
38
|
else if (e === "authorizationCode") {
|
|
37
|
-
const
|
|
38
|
-
if (n.searchParams.set("response_type", "code"),
|
|
39
|
-
const o =
|
|
39
|
+
const s = t[e];
|
|
40
|
+
if (n.searchParams.set("response_type", "code"), s["x-usePkce"] !== "no") {
|
|
41
|
+
const o = F(), u = await R(o, s["x-usePkce"]);
|
|
40
42
|
c = {
|
|
41
43
|
codeVerifier: o,
|
|
42
44
|
codeChallenge: u,
|
|
43
|
-
codeChallengeMethod:
|
|
45
|
+
codeChallengeMethod: s["x-usePkce"] === "SHA-256" ? "S256" : "plain"
|
|
44
46
|
}, n.searchParams.set("code_challenge", u), n.searchParams.set("code_challenge_method", c.codeChallengeMethod);
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
|
-
const i =
|
|
49
|
+
const i = t[e];
|
|
48
50
|
if (i["x-scalar-secret-redirect-uri"].startsWith("/")) {
|
|
49
|
-
const
|
|
51
|
+
const s = l?.url || window.location.origin + window.location.pathname, o = new URL(i["x-scalar-secret-redirect-uri"], s).toString();
|
|
50
52
|
n.searchParams.set("redirect_uri", o);
|
|
51
53
|
} else
|
|
52
54
|
n.searchParams.set("redirect_uri", i["x-scalar-secret-redirect-uri"]);
|
|
53
|
-
d["x-scalar-security-query"] && Object.keys(d["x-scalar-security-query"]).forEach((
|
|
54
|
-
const o = d["x-scalar-security-query"]?.[
|
|
55
|
-
o && n.searchParams.set(
|
|
56
|
-
}), n.searchParams.set("client_id", d["x-scalar-secret-client-id"]), n.searchParams.set("state",
|
|
55
|
+
d["x-scalar-security-query"] && Object.keys(d["x-scalar-security-query"]).forEach((s) => {
|
|
56
|
+
const o = d["x-scalar-security-query"]?.[s];
|
|
57
|
+
o && n.searchParams.set(s, o);
|
|
58
|
+
}), n.searchParams.set("client_id", d["x-scalar-secret-client-id"]), n.searchParams.set("state", r), m && n.searchParams.set("scope", m);
|
|
57
59
|
const h = window.open(n, "openAuth2Window", "left=100,top=100,width=800,height=600");
|
|
58
|
-
return h ? new Promise((
|
|
60
|
+
return h ? new Promise((s) => {
|
|
59
61
|
const o = setInterval(() => {
|
|
60
62
|
let u = null, p = null, x = null, _ = null;
|
|
61
63
|
try {
|
|
@@ -67,12 +69,12 @@ const S = () => {
|
|
|
67
69
|
}
|
|
68
70
|
if (h.closed || u || p || x)
|
|
69
71
|
if (clearInterval(o), h.close(), x)
|
|
70
|
-
|
|
72
|
+
s([new Error(`OAuth error: ${x}${_ ? ` (${_})` : ""}`), null]);
|
|
71
73
|
else if (u) {
|
|
72
74
|
const w = h.location.href.match(/state=([^&]*)/)?.[1];
|
|
73
|
-
|
|
74
|
-
} else p && e === "authorizationCode" ? new URL(h.location.href).searchParams.get("state") ===
|
|
75
|
-
|
|
75
|
+
s(w === r ? [null, u] : [new Error("State mismatch"), null]);
|
|
76
|
+
} else p && e === "authorizationCode" ? new URL(h.location.href).searchParams.get("state") === r ? U(
|
|
77
|
+
t,
|
|
76
78
|
e,
|
|
77
79
|
m,
|
|
78
80
|
{
|
|
@@ -81,48 +83,48 @@ const S = () => {
|
|
|
81
83
|
proxyUrl: f
|
|
82
84
|
},
|
|
83
85
|
l
|
|
84
|
-
).then(
|
|
86
|
+
).then(s) : s([new Error("State mismatch"), null]) : (clearInterval(o), s([new Error("Window was closed without granting authorization"), null]));
|
|
85
87
|
}, 200);
|
|
86
88
|
}) : [new Error("Failed to open auth window"), null];
|
|
87
89
|
} catch {
|
|
88
90
|
return [new Error("Failed to authorize oauth2 flow"), null];
|
|
89
91
|
}
|
|
90
|
-
}, U = async (
|
|
92
|
+
}, U = async (t, e, g, {
|
|
91
93
|
code: l,
|
|
92
94
|
pkce: f,
|
|
93
95
|
proxyUrl: d
|
|
94
96
|
} = {}, m) => {
|
|
95
|
-
const
|
|
96
|
-
if (!
|
|
97
|
+
const r = t[e];
|
|
98
|
+
if (!r)
|
|
97
99
|
return [new Error("OAuth2 flow was not defined"), null];
|
|
98
100
|
const a = new URLSearchParams();
|
|
99
101
|
g && (e === "clientCredentials" || e === "password") && a.set("scope", g);
|
|
100
|
-
const n =
|
|
101
|
-
if (n && (a.set("client_id",
|
|
102
|
+
const n = r["x-scalar-credentials-location"] === "body";
|
|
103
|
+
if (n && (a.set("client_id", r["x-scalar-secret-client-id"]), a.set("client_secret", r["x-scalar-secret-client-secret"])), "x-scalar-secret-redirect-uri" in r && r["x-scalar-secret-redirect-uri"] && a.set("redirect_uri", r["x-scalar-secret-redirect-uri"]), l)
|
|
102
104
|
a.set("code", l), a.set("grant_type", "authorization_code"), f && a.set("code_verifier", f.codeVerifier);
|
|
103
105
|
else if (e === "password") {
|
|
104
|
-
const c =
|
|
106
|
+
const c = t[e];
|
|
105
107
|
a.set("grant_type", "password"), a.set("username", c["x-scalar-secret-username"]), a.set("password", c["x-scalar-secret-password"]);
|
|
106
108
|
} else
|
|
107
109
|
a.set("grant_type", "client_credentials");
|
|
108
|
-
|
|
110
|
+
r["x-scalar-security-body"] && Object.entries(r["x-scalar-security-body"]).forEach(([c, i]) => {
|
|
109
111
|
i && a.set(c, i);
|
|
110
112
|
});
|
|
111
113
|
try {
|
|
112
114
|
const c = {
|
|
113
115
|
"Content-Type": "application/x-www-form-urlencoded"
|
|
114
116
|
};
|
|
115
|
-
n || (c.Authorization = `Basic ${
|
|
116
|
-
const i = b(
|
|
117
|
+
n || (c.Authorization = `Basic ${z(`${r["x-scalar-secret-client-id"]}:${r["x-scalar-secret-client-secret"]}`)}`);
|
|
118
|
+
const i = b(r.tokenUrl, A(m)), y = S(d, i) ? `${d}?${new URLSearchParams([["scalar_url", i]]).toString()}` : i, s = await (await fetch(y, {
|
|
117
119
|
method: "POST",
|
|
118
120
|
headers: c,
|
|
119
121
|
body: a
|
|
120
|
-
})).json(), o =
|
|
121
|
-
return [null,
|
|
122
|
+
})).json(), o = r["x-tokenName"] || "access_token";
|
|
123
|
+
return [null, s[o]];
|
|
122
124
|
} catch {
|
|
123
125
|
return [new Error("Failed to get an access token. Please check your credentials."), null];
|
|
124
126
|
}
|
|
125
127
|
};
|
|
126
128
|
export {
|
|
127
|
-
|
|
129
|
+
W as authorizeOauth2
|
|
128
130
|
};
|
|
@@ -73,8 +73,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
73
73
|
emitOnBlur?: boolean;
|
|
74
74
|
/** Enable environment variable pills */
|
|
75
75
|
withVariables?: boolean;
|
|
76
|
-
/** Detect and emit curl commands */
|
|
77
|
-
importCurl?: boolean;
|
|
78
76
|
/** Emit change event even if the value is the same */
|
|
79
77
|
alwaysEmitChange?: boolean;
|
|
80
78
|
/** Custom change handler, prevents default emit */
|
|
@@ -104,7 +102,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
104
102
|
redirectToEnvironment: () => any;
|
|
105
103
|
"update:modelValue": (value: string) => any;
|
|
106
104
|
blur: (value: string) => any;
|
|
107
|
-
curl: (value: string) => any;
|
|
108
105
|
}, string, import("vue").PublicProps, Readonly<{
|
|
109
106
|
modelValue: CodeInputModelValue;
|
|
110
107
|
/** Environment for variable substitution. Pass undefined to disable environment variables */
|
|
@@ -151,8 +148,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
151
148
|
emitOnBlur?: boolean;
|
|
152
149
|
/** Enable environment variable pills */
|
|
153
150
|
withVariables?: boolean;
|
|
154
|
-
/** Detect and emit curl commands */
|
|
155
|
-
importCurl?: boolean;
|
|
156
151
|
/** Emit change event even if the value is the same */
|
|
157
152
|
alwaysEmitChange?: boolean;
|
|
158
153
|
/** Custom change handler, prevents default emit */
|
|
@@ -166,7 +161,6 @@ declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
166
161
|
onRedirectToEnvironment?: (() => any) | undefined;
|
|
167
162
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
168
163
|
onBlur?: ((value: string) => any) | undefined;
|
|
169
|
-
onCurl?: ((value: string) => any) | undefined;
|
|
170
164
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
171
165
|
warning?: (props: {}) => any;
|
|
172
166
|
} & {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/CodeInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/code-input/CodeInput.vue"],"names":[],"mappings":"AA6pBA,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAA;AAC/B,OAAO,KAAK,EAAE,kBAAkB,EA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eInput.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
5
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-a0bd2752"]]);
|
|
6
6
|
export {
|
|
7
7
|
_ as default
|
|
8
8
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { defineComponent as W, useAttrs as H, ref as
|
|
1
|
+
import { defineComponent as W, useAttrs as H, ref as u, computed as d, toRef as r, watch as J, createElementBlock as i, openBlock as l, Fragment as Q, createBlock as m, createCommentVNode as f, normalizeClass as G, createElementVNode as V, toDisplayString as X, mergeProps as Y, unref as T, withKeys as b, withModifiers as A, createTextVNode as B, renderSlot as N } from "vue";
|
|
2
2
|
import { isDefined as Z } from "@scalar/helpers/array/is-defined";
|
|
3
3
|
import { useCodeMirror as _, useDropdown as ee, colorPicker as te } from "@scalar/use-codemirror";
|
|
4
|
-
import { nanoid as
|
|
4
|
+
import { nanoid as ne } from "nanoid";
|
|
5
5
|
import p from "../data-table/DataTableInputSelect.vue.js";
|
|
6
|
-
import
|
|
6
|
+
import le from "../../features/environments/components/EnvironmentVariablesDropdown.vue.js";
|
|
7
7
|
import { pillPlugin as oe, backspaceCommand as ae } from "./code-variable-widget.js";
|
|
8
8
|
const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
9
9
|
key: 0,
|
|
@@ -47,50 +47,37 @@ const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
|
47
47
|
disableCloseBrackets: { type: Boolean, default: !1 },
|
|
48
48
|
emitOnBlur: { type: Boolean, default: !0 },
|
|
49
49
|
withVariables: { type: Boolean, default: !0 },
|
|
50
|
-
importCurl: { type: Boolean, default: !1 },
|
|
51
50
|
alwaysEmitChange: { type: Boolean, default: !1 },
|
|
52
51
|
handleFieldChange: { type: Function },
|
|
53
52
|
handleFieldSubmit: { type: Function },
|
|
54
53
|
linethrough: { type: Boolean }
|
|
55
54
|
},
|
|
56
|
-
emits: ["update:modelValue", "submit", "blur", "
|
|
55
|
+
emits: ["update:modelValue", "submit", "blur", "redirectToEnvironment"],
|
|
57
56
|
setup(e, { expose: O, emit: $ }) {
|
|
58
|
-
const
|
|
57
|
+
const s = $, k = H(), I = k.id || `id-${ne()}`, y = u(!1), M = d(() => e.enum?.length ? !1 : e.type === "boolean" || Array.isArray(e.type) && e.type.includes("boolean")), C = d(
|
|
59
58
|
() => e.nullable ? ["true", "false", "null"] : ["true", "false"]
|
|
60
|
-
), R =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
changes: {
|
|
65
|
-
from: 0,
|
|
66
|
-
to: n.value.state.doc.length,
|
|
67
|
-
insert: c(e.modelValue)
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
return;
|
|
71
|
-
}
|
|
72
|
-
e.handleFieldChange ? e.handleFieldChange(t) : u("update:modelValue", t);
|
|
73
|
-
}
|
|
74
|
-
}, g = (t) => {
|
|
75
|
-
e.handleFieldSubmit ? e.handleFieldSubmit(t) : u("submit", t);
|
|
59
|
+
), R = d(() => Array.isArray(e.type) ? e.type.find((t) => t !== "null") ?? "string" : e.type), E = (t) => {
|
|
60
|
+
!e.alwaysEmitChange && t === v(e.modelValue) || (e.handleFieldChange ? e.handleFieldChange(t) : s("update:modelValue", t));
|
|
61
|
+
}, h = (t) => {
|
|
62
|
+
e.handleFieldSubmit ? e.handleFieldSubmit(t) : s("submit", t);
|
|
76
63
|
}, S = (t) => {
|
|
77
|
-
y.value = !1, e.emitOnBlur && e.modelValue &&
|
|
78
|
-
},
|
|
64
|
+
y.value = !1, e.emitOnBlur && e.modelValue && h(t), s("blur", t);
|
|
65
|
+
}, g = (t) => s("update:modelValue", t), q = () => {
|
|
79
66
|
const t = [...e.extensions];
|
|
80
67
|
return e.colorPicker && t.push(te), t;
|
|
81
|
-
}, z =
|
|
68
|
+
}, z = d(
|
|
82
69
|
() => oe({
|
|
83
70
|
environment: e.environment,
|
|
84
71
|
isReadOnly: e.layout === "modal"
|
|
85
72
|
})
|
|
86
|
-
), j =
|
|
73
|
+
), j = d(() => [
|
|
87
74
|
...q(),
|
|
88
75
|
z.value,
|
|
89
76
|
ae
|
|
90
|
-
]), P =
|
|
91
|
-
content: r(() =>
|
|
77
|
+
]), P = u(null), v = (t) => typeof t == "string" ? t : JSON.stringify(t), { codeMirror: o } = _({
|
|
78
|
+
content: r(() => v(e.modelValue)),
|
|
92
79
|
onChange: (t) => {
|
|
93
|
-
E(t),
|
|
80
|
+
E(t), U();
|
|
94
81
|
},
|
|
95
82
|
onFocus: () => {
|
|
96
83
|
y.value = !0;
|
|
@@ -106,20 +93,20 @@ const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
|
106
93
|
extensions: j,
|
|
107
94
|
placeholder: r(() => e.placeholder)
|
|
108
95
|
});
|
|
109
|
-
J(
|
|
110
|
-
|
|
96
|
+
J(o, () => {
|
|
97
|
+
o.value && Object.hasOwn(k, "autofocus") && o.value.focus();
|
|
111
98
|
});
|
|
112
|
-
const w =
|
|
113
|
-
codeMirror:
|
|
99
|
+
const w = u(!1), D = u(""), F = u({ left: 0, top: 0 }), x = u(null), { handleDropdownSelect: K, updateDropdownVisibility: U } = ee({
|
|
100
|
+
codeMirror: o,
|
|
114
101
|
query: D,
|
|
115
102
|
showDropdown: w,
|
|
116
103
|
dropdownPosition: F
|
|
117
|
-
}),
|
|
104
|
+
}), L = d(() => w.value && e.withVariables && e.layout !== "modal" && !!e.environment), c = (t, n) => {
|
|
118
105
|
if (w.value) {
|
|
119
|
-
t === "down" || t === "up" ? (
|
|
106
|
+
t === "down" || t === "up" ? (n.preventDefault(), x.value?.handleArrowKey(t)) : t === "enter" && (n.preventDefault(), x.value?.handleSelect());
|
|
120
107
|
return;
|
|
121
108
|
}
|
|
122
|
-
t === "escape" && !e.disableTabIndent &&
|
|
109
|
+
t === "escape" && !e.disableTabIndent && n.stopPropagation(), t === "enter" && n.target instanceof HTMLDivElement && h(n.target.textContent ?? "");
|
|
123
110
|
};
|
|
124
111
|
return O({
|
|
125
112
|
/**
|
|
@@ -128,25 +115,25 @@ const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
|
128
115
|
* @param cursorAtEnd boolean place the cursor at the end of the input
|
|
129
116
|
*/
|
|
130
117
|
focus: (t) => {
|
|
131
|
-
if (!
|
|
118
|
+
if (!o.value || (o.value.focus(), !Z(t)))
|
|
132
119
|
return;
|
|
133
|
-
const
|
|
134
|
-
|
|
135
|
-
selection: { anchor:
|
|
120
|
+
const n = t === "start" ? 0 : t === "end" ? o.value.state.doc.length : t;
|
|
121
|
+
o.value.dispatch({
|
|
122
|
+
selection: { anchor: n },
|
|
136
123
|
scrollIntoView: !0
|
|
137
124
|
});
|
|
138
125
|
},
|
|
139
126
|
isFocused: y,
|
|
140
127
|
handleChange: E,
|
|
141
|
-
handleSubmit:
|
|
128
|
+
handleSubmit: h,
|
|
142
129
|
handleBlur: S,
|
|
143
130
|
booleanOptions: C,
|
|
144
|
-
codeMirror:
|
|
131
|
+
codeMirror: o,
|
|
145
132
|
modelValue: e.modelValue,
|
|
146
|
-
cursorPosition: () =>
|
|
147
|
-
serializeValue:
|
|
148
|
-
}), (t,
|
|
149
|
-
e.disabled ? (
|
|
133
|
+
cursorPosition: () => o.value?.state.selection.main.head,
|
|
134
|
+
serializeValue: v
|
|
135
|
+
}), (t, n) => (l(), i(Q, null, [
|
|
136
|
+
e.disabled ? (l(), i("div", {
|
|
150
137
|
key: 0,
|
|
151
138
|
class: G(["text-c-2 flex cursor-default items-center justify-center", {
|
|
152
139
|
"font-code pr-2 pl-1 text-base": e.layout === "modal",
|
|
@@ -156,26 +143,26 @@ const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
|
156
143
|
"data-testid": "code-input-disabled"
|
|
157
144
|
}, [
|
|
158
145
|
V("span", re, X(e.modelValue), 1)
|
|
159
|
-
], 2)) : e.enum?.length ? (
|
|
146
|
+
], 2)) : e.enum?.length ? (l(), m(p, {
|
|
160
147
|
key: 1,
|
|
161
148
|
default: e.default,
|
|
162
149
|
modelValue: e.modelValue,
|
|
163
150
|
type: R.value,
|
|
164
151
|
value: e.enum,
|
|
165
|
-
"onUpdate:modelValue":
|
|
166
|
-
}, null, 8, ["default", "modelValue", "type", "value"])) : M.value ? (
|
|
152
|
+
"onUpdate:modelValue": g
|
|
153
|
+
}, null, 8, ["default", "modelValue", "type", "value"])) : M.value ? (l(), m(p, {
|
|
167
154
|
key: 2,
|
|
168
155
|
default: e.default,
|
|
169
156
|
modelValue: e.modelValue,
|
|
170
157
|
value: C.value,
|
|
171
|
-
"onUpdate:modelValue":
|
|
172
|
-
}, null, 8, ["default", "modelValue", "value"])) : e.examples?.length ? (
|
|
158
|
+
"onUpdate:modelValue": g
|
|
159
|
+
}, null, 8, ["default", "modelValue", "value"])) : e.examples?.length ? (l(), m(p, {
|
|
173
160
|
key: 3,
|
|
174
161
|
default: e.default,
|
|
175
162
|
modelValue: e.modelValue,
|
|
176
163
|
value: e.examples,
|
|
177
|
-
"onUpdate:modelValue":
|
|
178
|
-
}, null, 8, ["default", "modelValue", "value"])) : (
|
|
164
|
+
"onUpdate:modelValue": g
|
|
165
|
+
}, null, 8, ["default", "modelValue", "value"])) : (l(), i("div", Y({
|
|
179
166
|
key: 4,
|
|
180
167
|
id: T(I)
|
|
181
168
|
}, t.$attrs, {
|
|
@@ -187,13 +174,13 @@ const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
|
187
174
|
"line-through": e.linethrough
|
|
188
175
|
}],
|
|
189
176
|
onKeydown: [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
177
|
+
n[0] || (n[0] = b(A((a) => c("down", a), ["stop"]), ["down"])),
|
|
178
|
+
n[1] || (n[1] = b((a) => c("enter", a), ["enter"])),
|
|
179
|
+
n[2] || (n[2] = b((a) => c("escape", a), ["escape"])),
|
|
180
|
+
n[3] || (n[3] = b(A((a) => c("up", a), ["stop"]), ["up"]))
|
|
194
181
|
]
|
|
195
182
|
}), [
|
|
196
|
-
e.disableTabIndent ? f("", !0) : (
|
|
183
|
+
e.disableTabIndent ? f("", !0) : (l(), i("div", ue, [...n[5] || (n[5] = [
|
|
197
184
|
B(" Press ", -1),
|
|
198
185
|
V("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Esc", -1),
|
|
199
186
|
B(" then ", -1),
|
|
@@ -201,21 +188,21 @@ const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
|
201
188
|
B(" to exit ", -1)
|
|
202
189
|
])]))
|
|
203
190
|
], 16, ie)),
|
|
204
|
-
t.$slots.warning ? (
|
|
191
|
+
t.$slots.warning ? (l(), i("div", de, [
|
|
205
192
|
N(t.$slots, "warning", {}, void 0, !0)
|
|
206
193
|
])) : f("", !0),
|
|
207
|
-
t.$slots.icon ? (
|
|
194
|
+
t.$slots.icon ? (l(), i("div", se, [
|
|
208
195
|
N(t.$slots, "icon", {}, void 0, !0)
|
|
209
196
|
])) : f("", !0),
|
|
210
|
-
e.required ? (
|
|
211
|
-
|
|
197
|
+
e.required ? (l(), i("div", fe, " Required ")) : f("", !0),
|
|
198
|
+
L.value && e.environment ? (l(), m(le, {
|
|
212
199
|
key: 8,
|
|
213
200
|
ref_key: "dropdownRef",
|
|
214
201
|
ref: x,
|
|
215
202
|
dropdownPosition: F.value,
|
|
216
203
|
environment: e.environment,
|
|
217
204
|
query: D.value,
|
|
218
|
-
onRedirect:
|
|
205
|
+
onRedirect: n[4] || (n[4] = (a) => s("redirectToEnvironment")),
|
|
219
206
|
onSelect: T(K)
|
|
220
207
|
}, null, 8, ["dropdownPosition", "environment", "query", "onSelect"])) : f("", !0)
|
|
221
208
|
], 64));
|
|
@@ -6,13 +6,17 @@
|
|
|
6
6
|
declare const _default: <T>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
7
7
|
props: __VLS_PrettifyLocal<Pick<Partial<{}> & Omit<{
|
|
8
8
|
readonly onChange?: ((value: T) => any) | undefined;
|
|
9
|
-
|
|
9
|
+
readonly onUnmount?: (() => any) | undefined;
|
|
10
|
+
} & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, never>, "onChange" | "onUnmount"> & {
|
|
10
11
|
value: T;
|
|
11
12
|
} & Partial<{}>> & import("vue").PublicProps;
|
|
12
13
|
expose(exposed: import("vue").ShallowUnwrapRef<{}>): void;
|
|
13
14
|
attrs: any;
|
|
14
15
|
slots: {};
|
|
15
|
-
emit:
|
|
16
|
+
emit: {
|
|
17
|
+
(e: "change", value: T): void;
|
|
18
|
+
(e: "unmount"): void;
|
|
19
|
+
};
|
|
16
20
|
}>) => import("vue").VNode & {
|
|
17
21
|
__ctx?: Awaited<typeof __VLS_setup>;
|
|
18
22
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueEmitter.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/layout/ValueEmitter.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValueEmitter.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/layout/ValueEmitter.vue"],"names":[],"mappings":"AAsCA;;;;GAIG;yBACc,CAAC,EACjB,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,eAAe,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EACjE;WAoDO,mBAAmB,CAAC;;;;eAnDA,CAAC;QAmDoC,OAAO,IAAsB,CAAC,4BAA2B;oBACzG,OAAO,KAAK,EAAE,gBAAgB,CAAC,EAAE,CAAC,GAAG,IAAI;WAClD,GAAG;;;YAlDL,QAAQ,SAAS,CAAC,GAAG,IAAI;YACzB,SAAS,GAAG,IAAI;;EAqDlB,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC,OAAO,WAAW,CAAC,CAAA;CAAE;AA/DzE,wBAgEC;AACD,KAAK,mBAAmB,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG,EAAE,CAAC"}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { defineComponent as m, watch as
|
|
1
|
+
import { defineComponent as m, watch as o, onBeforeUnmount as a } from "vue";
|
|
2
2
|
const r = {
|
|
3
3
|
name: "ValueEmitter"
|
|
4
|
-
},
|
|
4
|
+
}, s = /* @__PURE__ */ m({
|
|
5
5
|
...r,
|
|
6
6
|
props: {
|
|
7
7
|
value: {}
|
|
8
8
|
},
|
|
9
|
-
emits: ["change"],
|
|
10
|
-
setup(
|
|
11
|
-
const
|
|
12
|
-
return
|
|
13
|
-
() =>
|
|
14
|
-
(
|
|
9
|
+
emits: ["change", "unmount"],
|
|
10
|
+
setup(n, { emit: u }) {
|
|
11
|
+
const e = u;
|
|
12
|
+
return o(
|
|
13
|
+
() => n.value,
|
|
14
|
+
(t) => e("change", t),
|
|
15
15
|
{ immediate: !0 }
|
|
16
|
-
), (e,
|
|
16
|
+
), a(() => e("unmount")), (t, c) => null;
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
s as default
|
|
21
21
|
};
|
|
@@ -20,6 +20,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
20
20
|
url: string;
|
|
21
21
|
}) => any;
|
|
22
22
|
"update:servers": () => any;
|
|
23
|
+
"update:open": (value: boolean) => any;
|
|
23
24
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
24
25
|
"onUpdate:variable"?: ((payload: {
|
|
25
26
|
index: number;
|
|
@@ -30,6 +31,7 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {
|
|
|
30
31
|
url: string;
|
|
31
32
|
}) => any) | undefined;
|
|
32
33
|
"onUpdate:servers"?: (() => any) | undefined;
|
|
34
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
33
35
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
34
36
|
export default _default;
|
|
35
37
|
//# sourceMappingURL=ServerDropdown.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ServerDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/server/ServerDropdown.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ServerDropdown.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/components/server/ServerDropdown.vue"],"names":[],"mappings":"AAkIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAK3C,KAAK,WAAW,GAAG;IACjB,0EAA0E;IAC1E,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,gCAAgC;IAChC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,qEAAqE;IACrE,MAAM,EAAE,MAAM,CAAA;IACd,oBAAoB;IACpB,MAAM,EAAE,YAAY,CAAA;CACrB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;AA2QF,wBAOG"}
|