@scalar/api-client 2.20.2 → 2.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +29 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +56 -59
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +52 -51
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts +4 -0
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js +23 -0
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +24 -23
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +2 -8
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +2 -2
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +57 -60
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +61 -41
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +0 -3
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -34
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts +3 -3
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +26 -20
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts +4 -2
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js +39 -33
- 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 +64 -64
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +12 -11
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +152 -95
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
- package/dist/v2/components/code-input/CodeInput.vue2.js +87 -99
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +12 -12
|
@@ -12,7 +12,9 @@ export type CodeInputModelValue = string | number | boolean | Array<string | num
|
|
|
12
12
|
* - Editor mode: CodeMirror with environment variable support
|
|
13
13
|
*
|
|
14
14
|
* Type `{{` to trigger environment variable autocomplete when an environment is provided.
|
|
15
|
-
*
|
|
15
|
+
* It takes in any data but always will emit a string value,
|
|
16
|
+
* this string should then be parsed in accordance to the schema or content type.
|
|
17
|
+
*
|
|
16
18
|
* @example
|
|
17
19
|
* ```vue
|
|
18
20
|
* <!-- Basic input with environment variables -->
|
|
@@ -25,100 +27,155 @@ export type CodeInputModelValue = string | number | boolean | Array<string | num
|
|
|
25
27
|
* <CodeInput v-model="data" language="json" :lint="true" />
|
|
26
28
|
* ```
|
|
27
29
|
*/
|
|
28
|
-
declare const _default: <
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
30
|
+
declare const _default: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
31
|
+
modelValue: CodeInputModelValue;
|
|
32
|
+
/** Environment for variable substitution. Pass undefined to disable environment variables */
|
|
33
|
+
environment: XScalarEnvironment | undefined;
|
|
34
|
+
/** Type of the input value, affects rendering mode for booleans */
|
|
35
|
+
type?: string | string[];
|
|
36
|
+
/** Render as disabled text display */
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
/** Show error styling */
|
|
39
|
+
error?: boolean;
|
|
40
|
+
/** Layout context affects styling and behavior */
|
|
41
|
+
layout?: ClientLayout;
|
|
42
|
+
/** Predefined enum values, triggers select mode */
|
|
43
|
+
enum?: string[];
|
|
44
|
+
/** Example values, triggers select mode */
|
|
45
|
+
examples?: string[];
|
|
46
|
+
/** Default value to show in select mode */
|
|
47
|
+
default?: CodeInputModelValue;
|
|
48
|
+
/** Allow null in boolean select options */
|
|
49
|
+
nullable?: boolean;
|
|
50
|
+
/** Placeholder text for empty input */
|
|
51
|
+
placeholder?: string;
|
|
52
|
+
/** Show required indicator */
|
|
53
|
+
required?: boolean;
|
|
54
|
+
/** Enable color picker extension */
|
|
55
|
+
colorPicker?: boolean;
|
|
56
|
+
/** Show line numbers in editor */
|
|
57
|
+
lineNumbers?: boolean;
|
|
58
|
+
/** Enable linting */
|
|
59
|
+
lint?: boolean;
|
|
60
|
+
/** Enable line wrapping */
|
|
61
|
+
lineWrapping?: boolean;
|
|
62
|
+
/** CodeMirror language mode */
|
|
63
|
+
language?: CodeMirrorLanguage;
|
|
64
|
+
/** Additional CodeMirror extensions */
|
|
65
|
+
extensions?: Extension[];
|
|
66
|
+
/** Disable tab key for indentation */
|
|
67
|
+
disableTabIndent?: boolean;
|
|
68
|
+
/** Disable enter key */
|
|
69
|
+
disableEnter?: boolean;
|
|
70
|
+
/** Disable automatic bracket closing */
|
|
71
|
+
disableCloseBrackets?: boolean;
|
|
72
|
+
/** Emit submit event on blur */
|
|
73
|
+
emitOnBlur?: boolean;
|
|
74
|
+
/** Enable environment variable pills */
|
|
75
|
+
withVariables?: boolean;
|
|
76
|
+
/** Detect and emit curl commands */
|
|
77
|
+
importCurl?: boolean;
|
|
78
|
+
/** Emit change event even if the value is the same */
|
|
79
|
+
alwaysEmitChange?: boolean;
|
|
80
|
+
/** Custom change handler, prevents default emit */
|
|
81
|
+
handleFieldChange?: (value: string) => void;
|
|
82
|
+
/** Custom submit handler, prevents default emit */
|
|
83
|
+
handleFieldSubmit?: (value: string) => void;
|
|
84
|
+
/** Put a linethrough on the input text */
|
|
85
|
+
linethrough?: boolean;
|
|
86
|
+
}, {
|
|
87
|
+
/**
|
|
88
|
+
* Focus the codemirror element
|
|
89
|
+
*
|
|
90
|
+
* @param cursorAtEnd boolean place the cursor at the end of the input
|
|
91
|
+
*/
|
|
92
|
+
focus: (position?: "start" | "end" | number) => void;
|
|
93
|
+
isFocused: Ref<boolean, boolean>;
|
|
94
|
+
handleChange: (value: string) => void;
|
|
95
|
+
handleSubmit: (value: string) => void;
|
|
96
|
+
handleBlur: (value: string) => void;
|
|
97
|
+
booleanOptions: import("vue").ComputedRef<string[]>;
|
|
98
|
+
codeMirror: Ref<import("@codemirror/view").EditorView | null, import("@codemirror/view").EditorView | null>;
|
|
99
|
+
modelValue: CodeInputModelValue;
|
|
100
|
+
cursorPosition: () => number | undefined;
|
|
101
|
+
serializeValue: (value: CodeInputModelValue) => string;
|
|
102
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
103
|
+
submit: (value: string) => any;
|
|
104
|
+
redirectToEnvironment: () => any;
|
|
105
|
+
"update:modelValue": (value: string) => any;
|
|
106
|
+
blur: (value: string) => any;
|
|
107
|
+
curl: (value: string) => any;
|
|
108
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
109
|
+
modelValue: CodeInputModelValue;
|
|
110
|
+
/** Environment for variable substitution. Pass undefined to disable environment variables */
|
|
111
|
+
environment: XScalarEnvironment | undefined;
|
|
112
|
+
/** Type of the input value, affects rendering mode for booleans */
|
|
113
|
+
type?: string | string[];
|
|
114
|
+
/** Render as disabled text display */
|
|
115
|
+
disabled?: boolean;
|
|
116
|
+
/** Show error styling */
|
|
117
|
+
error?: boolean;
|
|
118
|
+
/** Layout context affects styling and behavior */
|
|
119
|
+
layout?: ClientLayout;
|
|
120
|
+
/** Predefined enum values, triggers select mode */
|
|
121
|
+
enum?: string[];
|
|
122
|
+
/** Example values, triggers select mode */
|
|
123
|
+
examples?: string[];
|
|
124
|
+
/** Default value to show in select mode */
|
|
125
|
+
default?: CodeInputModelValue;
|
|
126
|
+
/** Allow null in boolean select options */
|
|
127
|
+
nullable?: boolean;
|
|
128
|
+
/** Placeholder text for empty input */
|
|
129
|
+
placeholder?: string;
|
|
130
|
+
/** Show required indicator */
|
|
131
|
+
required?: boolean;
|
|
132
|
+
/** Enable color picker extension */
|
|
133
|
+
colorPicker?: boolean;
|
|
134
|
+
/** Show line numbers in editor */
|
|
135
|
+
lineNumbers?: boolean;
|
|
136
|
+
/** Enable linting */
|
|
137
|
+
lint?: boolean;
|
|
138
|
+
/** Enable line wrapping */
|
|
139
|
+
lineWrapping?: boolean;
|
|
140
|
+
/** CodeMirror language mode */
|
|
141
|
+
language?: CodeMirrorLanguage;
|
|
142
|
+
/** Additional CodeMirror extensions */
|
|
143
|
+
extensions?: Extension[];
|
|
144
|
+
/** Disable tab key for indentation */
|
|
145
|
+
disableTabIndent?: boolean;
|
|
146
|
+
/** Disable enter key */
|
|
147
|
+
disableEnter?: boolean;
|
|
148
|
+
/** Disable automatic bracket closing */
|
|
149
|
+
disableCloseBrackets?: boolean;
|
|
150
|
+
/** Emit submit event on blur */
|
|
151
|
+
emitOnBlur?: boolean;
|
|
152
|
+
/** Enable environment variable pills */
|
|
153
|
+
withVariables?: boolean;
|
|
154
|
+
/** Detect and emit curl commands */
|
|
155
|
+
importCurl?: boolean;
|
|
156
|
+
/** Emit change event even if the value is the same */
|
|
157
|
+
alwaysEmitChange?: boolean;
|
|
158
|
+
/** Custom change handler, prevents default emit */
|
|
159
|
+
handleFieldChange?: (value: string) => void;
|
|
160
|
+
/** Custom submit handler, prevents default emit */
|
|
161
|
+
handleFieldSubmit?: (value: string) => void;
|
|
162
|
+
/** Put a linethrough on the input text */
|
|
163
|
+
linethrough?: boolean;
|
|
164
|
+
}> & Readonly<{
|
|
165
|
+
onSubmit?: ((value: string) => any) | undefined;
|
|
166
|
+
onRedirectToEnvironment?: (() => any) | undefined;
|
|
167
|
+
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
168
|
+
onBlur?: ((value: string) => any) | undefined;
|
|
169
|
+
onCurl?: ((value: string) => any) | undefined;
|
|
170
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
171
|
+
warning?: (props: {}) => any;
|
|
172
|
+
} & {
|
|
173
|
+
icon?: (props: {}) => any;
|
|
174
|
+
}>;
|
|
175
|
+
export default _default;
|
|
176
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
177
|
+
new (): {
|
|
178
|
+
$slots: S;
|
|
115
179
|
};
|
|
116
|
-
emit: ((evt: "submit", value: string) => void) & ((evt: "redirectToEnvironment") => void) & ((evt: "update:modelValue", value: T) => void) & ((evt: "blur", value: string) => void) & ((evt: "curl", value: string) => void);
|
|
117
|
-
}>) => import("vue").VNode & {
|
|
118
|
-
__ctx?: Awaited<typeof __VLS_setup>;
|
|
119
180
|
};
|
|
120
|
-
export default _default;
|
|
121
|
-
type __VLS_PrettifyLocal<T> = {
|
|
122
|
-
[K in keyof T]: T[K];
|
|
123
|
-
} & {};
|
|
124
181
|
//# sourceMappingURL=CodeInput.vue.d.ts.map
|
|
@@ -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":"AAmrBA,OAAO,EAIL,KAAK,kBAAkB,EACvB,KAAK,SAAS,EACf,MAAM,wBAAwB,CAAA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,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KAEV,CAAA;CACD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import o from "./CodeInput.vue2.js";
|
|
|
2
2
|
/* empty css */
|
|
3
3
|
/* empty css */
|
|
4
4
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const
|
|
5
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-4481799e"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
_ as default
|
|
8
8
|
};
|
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { isDefined as
|
|
3
|
-
import { useCodeMirror as
|
|
4
|
-
import { nanoid as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { pillPlugin as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as W, useAttrs as H, ref as d, computed as s, toRef as r, watch as J, createElementBlock as i, openBlock as o, Fragment as Q, createBlock as b, createCommentVNode as f, normalizeClass as G, createElementVNode as V, toDisplayString as X, mergeProps as Y, unref as T, withKeys as h, withModifiers as A, createTextVNode as B, renderSlot as N } from "vue";
|
|
2
|
+
import { isDefined as Z } from "@scalar/helpers/array/is-defined";
|
|
3
|
+
import { useCodeMirror as _, useDropdown as ee, colorPicker as te } from "@scalar/use-codemirror";
|
|
4
|
+
import { nanoid as le } from "nanoid";
|
|
5
|
+
import p from "../data-table/DataTableInputSelect.vue.js";
|
|
6
|
+
import ne from "../../features/environments/components/EnvironmentVariablesDropdown.vue.js";
|
|
7
|
+
import { pillPlugin as oe, backspaceCommand as ae } from "./code-variable-widget.js";
|
|
8
|
+
const re = { class: "whitespace-nowrap" }, ie = ["id"], ue = {
|
|
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
|
+
}, de = {
|
|
13
13
|
key: 5,
|
|
14
14
|
class: "centered-y text-orange absolute right-7 text-xs"
|
|
15
|
-
},
|
|
15
|
+
}, se = {
|
|
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
|
+
}, fe = {
|
|
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
|
+
}, ce = {
|
|
22
22
|
inheritAttrs: !1
|
|
23
|
-
},
|
|
24
|
-
...
|
|
23
|
+
}, xe = /* @__PURE__ */ W({
|
|
24
|
+
...ce,
|
|
25
25
|
__name: "CodeInput",
|
|
26
26
|
props: {
|
|
27
|
-
modelValue: {},
|
|
27
|
+
modelValue: { type: [String, Number, Boolean, Array, Object] },
|
|
28
28
|
environment: {},
|
|
29
29
|
type: {},
|
|
30
30
|
disabled: { type: Boolean, default: !1 },
|
|
@@ -32,7 +32,7 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
32
32
|
layout: { default: "desktop" },
|
|
33
33
|
enum: {},
|
|
34
34
|
examples: {},
|
|
35
|
-
default: {},
|
|
35
|
+
default: { type: [String, Number, Boolean, Array, Object] },
|
|
36
36
|
nullable: { type: Boolean, default: !1 },
|
|
37
37
|
placeholder: {},
|
|
38
38
|
required: { type: Boolean },
|
|
@@ -54,57 +54,46 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
54
54
|
linethrough: { type: Boolean }
|
|
55
55
|
},
|
|
56
56
|
emits: ["update:modelValue", "submit", "blur", "curl", "redirectToEnvironment"],
|
|
57
|
-
setup(e, { expose:
|
|
58
|
-
const u =
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
57
|
+
setup(e, { expose: O, emit: $ }) {
|
|
58
|
+
const u = $, k = H(), I = k.id || `id-${le()}`, y = d(!1), M = s(() => e.enum?.length ? !1 : e.type === "boolean" || Array.isArray(e.type) && e.type.includes("boolean")), C = s(
|
|
59
|
+
() => e.nullable ? ["true", "false", "null"] : ["true", "false"]
|
|
60
|
+
), R = s(() => Array.isArray(e.type) ? e.type.find((t) => t !== "null") ?? "string" : e.type), E = (t) => {
|
|
61
|
+
if (!(!e.alwaysEmitChange && t === c(e.modelValue))) {
|
|
62
|
+
if (e.importCurl && t.trim().toLowerCase().startsWith("curl")) {
|
|
63
|
+
u("curl", t), n.value && n.value.dispatch({
|
|
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);
|
|
70
73
|
}
|
|
71
|
-
const l = T(t);
|
|
72
|
-
e.handleFieldChange ? e.handleFieldChange(l) : u("update:modelValue", l);
|
|
73
74
|
}, g = (t) => {
|
|
74
75
|
e.handleFieldSubmit ? e.handleFieldSubmit(t) : u("submit", t);
|
|
75
76
|
}, S = (t) => {
|
|
76
|
-
|
|
77
|
-
}, v = (t) => {
|
|
78
|
-
u("update:modelValue", t);
|
|
79
|
-
}, W = () => {
|
|
77
|
+
y.value = !1, e.emitOnBlur && e.modelValue && g(t), u("blur", t);
|
|
78
|
+
}, v = (t) => u("update:modelValue", t), q = () => {
|
|
80
79
|
const t = [...e.extensions];
|
|
81
|
-
return e.colorPicker && t.push(
|
|
82
|
-
},
|
|
83
|
-
() =>
|
|
80
|
+
return e.colorPicker && t.push(te), t;
|
|
81
|
+
}, z = s(
|
|
82
|
+
() => oe({
|
|
84
83
|
environment: e.environment,
|
|
85
84
|
isReadOnly: e.layout === "modal"
|
|
86
85
|
})
|
|
87
|
-
),
|
|
88
|
-
...
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
]), P = d(null),
|
|
92
|
-
|
|
93
|
-
if (Array.isArray(e.modelValue) && !o && l.includes(","))
|
|
94
|
-
return l.split(",").map((H) => H.trim());
|
|
95
|
-
if (o || F === "number" || F === "boolean")
|
|
96
|
-
try {
|
|
97
|
-
return JSON.parse(t);
|
|
98
|
-
} catch {
|
|
99
|
-
}
|
|
100
|
-
return t;
|
|
101
|
-
}, { codeMirror: n } = le({
|
|
102
|
-
content: r(() => f(e.modelValue)),
|
|
86
|
+
), j = s(() => [
|
|
87
|
+
...q(),
|
|
88
|
+
z.value,
|
|
89
|
+
ae
|
|
90
|
+
]), P = d(null), c = (t) => typeof t == "string" ? t : JSON.stringify(t), { codeMirror: n } = _({
|
|
91
|
+
content: r(() => c(e.modelValue)),
|
|
103
92
|
onChange: (t) => {
|
|
104
|
-
E(t),
|
|
93
|
+
E(t), L();
|
|
105
94
|
},
|
|
106
95
|
onFocus: () => {
|
|
107
|
-
|
|
96
|
+
y.value = !0;
|
|
108
97
|
},
|
|
109
98
|
onBlur: S,
|
|
110
99
|
codeMirrorRef: P,
|
|
@@ -114,17 +103,17 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
114
103
|
lineNumbers: r(() => e.lineNumbers),
|
|
115
104
|
language: r(() => e.language),
|
|
116
105
|
lint: r(() => e.lint),
|
|
117
|
-
extensions:
|
|
106
|
+
extensions: j,
|
|
118
107
|
placeholder: r(() => e.placeholder)
|
|
119
108
|
});
|
|
120
|
-
|
|
109
|
+
J(n, () => {
|
|
121
110
|
n.value && Object.hasOwn(k, "autofocus") && n.value.focus();
|
|
122
111
|
});
|
|
123
|
-
const w = d(!1),
|
|
112
|
+
const w = d(!1), D = d(""), F = d({ left: 0, top: 0 }), x = d(null), { handleDropdownSelect: K, updateDropdownVisibility: L } = ee({
|
|
124
113
|
codeMirror: n,
|
|
125
|
-
query:
|
|
114
|
+
query: D,
|
|
126
115
|
showDropdown: w,
|
|
127
|
-
dropdownPosition:
|
|
116
|
+
dropdownPosition: F
|
|
128
117
|
}), U = s(() => w.value && e.withVariables && e.layout !== "modal" && !!e.environment), m = (t, l) => {
|
|
129
118
|
if (w.value) {
|
|
130
119
|
t === "down" || t === "up" ? (l.preventDefault(), x.value?.handleArrowKey(t)) : t === "enter" && (l.preventDefault(), x.value?.handleSelect());
|
|
@@ -132,14 +121,14 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
132
121
|
}
|
|
133
122
|
t === "escape" && !e.disableTabIndent && l.stopPropagation(), t === "enter" && l.target instanceof HTMLDivElement && g(l.target.textContent ?? "");
|
|
134
123
|
};
|
|
135
|
-
return
|
|
124
|
+
return O({
|
|
136
125
|
/**
|
|
137
126
|
* Focus the codemirror element
|
|
138
127
|
*
|
|
139
128
|
* @param cursorAtEnd boolean place the cursor at the end of the input
|
|
140
129
|
*/
|
|
141
130
|
focus: (t) => {
|
|
142
|
-
if (!n.value || (n.value.focus(), !
|
|
131
|
+
if (!n.value || (n.value.focus(), !Z(t)))
|
|
143
132
|
return;
|
|
144
133
|
const l = t === "start" ? 0 : t === "end" ? n.value.state.doc.length : t;
|
|
145
134
|
n.value.dispatch({
|
|
@@ -147,7 +136,7 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
147
136
|
scrollIntoView: !0
|
|
148
137
|
});
|
|
149
138
|
},
|
|
150
|
-
isFocused:
|
|
139
|
+
isFocused: y,
|
|
151
140
|
handleChange: E,
|
|
152
141
|
handleSubmit: g,
|
|
153
142
|
handleBlur: S,
|
|
@@ -155,41 +144,40 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
155
144
|
codeMirror: n,
|
|
156
145
|
modelValue: e.modelValue,
|
|
157
146
|
cursorPosition: () => n.value?.state.selection.main.head,
|
|
158
|
-
serializeValue:
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
e.disabled ? (a(), i("div", {
|
|
147
|
+
serializeValue: c
|
|
148
|
+
}), (t, l) => (o(), i(Q, null, [
|
|
149
|
+
e.disabled ? (o(), i("div", {
|
|
162
150
|
key: 0,
|
|
163
|
-
class:
|
|
151
|
+
class: G(["text-c-2 flex cursor-default items-center justify-center", {
|
|
164
152
|
"font-code pr-2 pl-1 text-base": e.layout === "modal",
|
|
165
153
|
"px-2": e.layout !== "modal",
|
|
166
154
|
"line-through": e.linethrough
|
|
167
155
|
}]),
|
|
168
156
|
"data-testid": "code-input-disabled"
|
|
169
157
|
}, [
|
|
170
|
-
V("span",
|
|
171
|
-
], 2)) : e.enum?.length ? (
|
|
158
|
+
V("span", re, X(e.modelValue), 1)
|
|
159
|
+
], 2)) : e.enum?.length ? (o(), b(p, {
|
|
172
160
|
key: 1,
|
|
173
161
|
default: e.default,
|
|
174
162
|
modelValue: e.modelValue,
|
|
175
|
-
type:
|
|
163
|
+
type: R.value,
|
|
176
164
|
value: e.enum,
|
|
177
165
|
"onUpdate:modelValue": v
|
|
178
|
-
}, null, 8, ["default", "modelValue", "type", "value"])) :
|
|
166
|
+
}, null, 8, ["default", "modelValue", "type", "value"])) : M.value ? (o(), b(p, {
|
|
179
167
|
key: 2,
|
|
180
168
|
default: e.default,
|
|
181
169
|
modelValue: e.modelValue,
|
|
182
170
|
value: C.value,
|
|
183
171
|
"onUpdate:modelValue": v
|
|
184
|
-
}, null, 8, ["default", "modelValue", "value"])) : e.examples?.length ? (
|
|
172
|
+
}, null, 8, ["default", "modelValue", "value"])) : e.examples?.length ? (o(), b(p, {
|
|
185
173
|
key: 3,
|
|
186
174
|
default: e.default,
|
|
187
175
|
modelValue: e.modelValue,
|
|
188
176
|
value: e.examples,
|
|
189
177
|
"onUpdate:modelValue": v
|
|
190
|
-
}, null, 8, ["default", "modelValue", "value"])) : (
|
|
178
|
+
}, null, 8, ["default", "modelValue", "value"])) : (o(), i("div", Y({
|
|
191
179
|
key: 4,
|
|
192
|
-
id:
|
|
180
|
+
id: T(I)
|
|
193
181
|
}, t.$attrs, {
|
|
194
182
|
ref_key: "codeMirrorRef",
|
|
195
183
|
ref: P,
|
|
@@ -199,40 +187,40 @@ const de = { class: "whitespace-nowrap" }, se = ["id"], ce = {
|
|
|
199
187
|
"line-through": e.linethrough
|
|
200
188
|
}],
|
|
201
189
|
onKeydown: [
|
|
202
|
-
l[0] || (l[0] = h(
|
|
203
|
-
l[1] || (l[1] = h((
|
|
204
|
-
l[2] || (l[2] = h((
|
|
205
|
-
l[3] || (l[3] = h(
|
|
190
|
+
l[0] || (l[0] = h(A((a) => m("down", a), ["stop"]), ["down"])),
|
|
191
|
+
l[1] || (l[1] = h((a) => m("enter", a), ["enter"])),
|
|
192
|
+
l[2] || (l[2] = h((a) => m("escape", a), ["escape"])),
|
|
193
|
+
l[3] || (l[3] = h(A((a) => m("up", a), ["stop"]), ["up"]))
|
|
206
194
|
]
|
|
207
195
|
}), [
|
|
208
|
-
e.disableTabIndent ?
|
|
209
|
-
|
|
196
|
+
e.disableTabIndent ? f("", !0) : (o(), i("div", ue, [...l[5] || (l[5] = [
|
|
197
|
+
B(" Press ", -1),
|
|
210
198
|
V("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Esc", -1),
|
|
211
|
-
|
|
199
|
+
B(" then ", -1),
|
|
212
200
|
V("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Tab", -1),
|
|
213
|
-
|
|
201
|
+
B(" to exit ", -1)
|
|
214
202
|
])]))
|
|
215
|
-
], 16,
|
|
216
|
-
t.$slots.warning ? (
|
|
217
|
-
|
|
218
|
-
])) :
|
|
219
|
-
t.$slots.icon ? (
|
|
220
|
-
|
|
221
|
-
])) :
|
|
222
|
-
e.required ? (
|
|
223
|
-
U.value && e.environment ? (
|
|
203
|
+
], 16, ie)),
|
|
204
|
+
t.$slots.warning ? (o(), i("div", de, [
|
|
205
|
+
N(t.$slots, "warning", {}, void 0, !0)
|
|
206
|
+
])) : f("", !0),
|
|
207
|
+
t.$slots.icon ? (o(), i("div", se, [
|
|
208
|
+
N(t.$slots, "icon", {}, void 0, !0)
|
|
209
|
+
])) : f("", !0),
|
|
210
|
+
e.required ? (o(), i("div", fe, " Required ")) : f("", !0),
|
|
211
|
+
U.value && e.environment ? (o(), b(ne, {
|
|
224
212
|
key: 8,
|
|
225
213
|
ref_key: "dropdownRef",
|
|
226
214
|
ref: x,
|
|
227
|
-
dropdownPosition:
|
|
215
|
+
dropdownPosition: F.value,
|
|
228
216
|
environment: e.environment,
|
|
229
|
-
query:
|
|
230
|
-
onRedirect: l[4] || (l[4] = (
|
|
231
|
-
onSelect:
|
|
232
|
-
}, null, 8, ["dropdownPosition", "environment", "query", "onSelect"])) :
|
|
217
|
+
query: D.value,
|
|
218
|
+
onRedirect: l[4] || (l[4] = (a) => u("redirectToEnvironment")),
|
|
219
|
+
onSelect: T(K)
|
|
220
|
+
}, null, 8, ["dropdownPosition", "environment", "query", "onSelect"])) : f("", !0)
|
|
233
221
|
], 64));
|
|
234
222
|
}
|
|
235
223
|
});
|
|
236
224
|
export {
|
|
237
|
-
|
|
225
|
+
xe as default
|
|
238
226
|
};
|
|
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
|
|
|
33
33
|
}));
|
|
34
34
|
}, f = (u) => {
|
|
35
35
|
u?.createNew && g.name === "request" && p();
|
|
36
|
-
}, v = "2.
|
|
36
|
+
}, v = "2.21.0";
|
|
37
37
|
return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
|
|
38
38
|
s("div", {
|
|
39
39
|
class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|