@scalar/api-client 2.2.57 → 2.2.60
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 +51 -0
- package/dist/components/AddressBar/AddressBar.vue.d.ts.map +1 -1
- package/dist/components/AddressBar/AddressBar.vue.js +2 -2
- package/dist/components/AddressBar/AddressBar.vue2.js +88 -80
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +1 -1
- package/dist/components/CodeInput/CodeInput.vue2.js +93 -81
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +2 -0
- package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
- package/dist/components/IconSelector.vue.d.ts.map +1 -1
- package/dist/components/IconSelector.vue.js +1 -0
- package/dist/components/SectionFilter.vue.d.ts +23 -0
- package/dist/components/SectionFilter.vue.d.ts.map +1 -0
- package/dist/components/SectionFilter.vue.js +7 -0
- package/dist/components/SectionFilter.vue2.js +67 -0
- package/dist/components/SectionFilterButton.vue.d.ts +22 -0
- package/dist/components/SectionFilterButton.vue.d.ts.map +1 -0
- package/dist/components/SectionFilterButton.vue.js +23 -0
- package/dist/components/SectionFilterButton.vue2.js +4 -0
- package/dist/components/Server/ServerDropdown.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerDropdown.vue.js +1 -0
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.d.ts.map +1 -1
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +62 -44
- package/dist/layouts/App/create-api-client-app.d.ts +16 -5
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.d.ts +32 -10
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.d.ts +16 -5
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/libs/create-client.d.ts +15 -4
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/find-request.d.ts +1 -0
- package/dist/libs/find-request.d.ts.map +1 -1
- package/dist/libs/send-request/create-request-operation.test.d.ts +1 -0
- package/dist/libs/send-request/create-request-operation.test.d.ts.map +1 -1
- package/dist/store/active-entities.d.ts +1 -0
- package/dist/store/active-entities.d.ts.map +1 -1
- package/dist/store/events.d.ts +4 -0
- package/dist/store/events.d.ts.map +1 -1
- package/dist/store/events.js +4 -0
- package/dist/store/requests.d.ts +15 -4
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/store.d.ts +15 -4
- package/dist/store/store.d.ts.map +1 -1
- package/dist/style.css +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +10 -10
- package/dist/views/Request/RequestSection/RequestBody.vue.js +3 -3
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.test.d.ts +2 -0
- package/dist/views/Request/RequestSection/RequestCodeExample.test.d.ts.map +1 -0
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +36 -36
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue.js +2 -2
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +103 -83
- package/dist/views/Request/RequestSidebarItem.vue.d.ts +2 -1
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +81 -81
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +9 -9
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +26 -21
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +80 -65
- package/package.json +15 -15
- package/dist/components/ContextBar.vue.d.ts +0 -11
- package/dist/components/ContextBar.vue.d.ts.map +0 -1
- package/dist/components/ContextBar.vue.js +0 -7
- package/dist/components/ContextBar.vue2.js +0 -47
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.2.60
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- df4dee8: fix(api-client): improve api client request and response area a11y
|
|
8
|
+
- 23bac9d: fix: use operation security scheme if available in request
|
|
9
|
+
- Updated dependencies [df4dee8]
|
|
10
|
+
- Updated dependencies [8c5b0c6]
|
|
11
|
+
- Updated dependencies [fb22645]
|
|
12
|
+
- @scalar/components@0.13.32
|
|
13
|
+
- @scalar/oas-utils@0.2.114
|
|
14
|
+
- @scalar/use-codemirror@0.11.77
|
|
15
|
+
- @scalar/import@0.2.34
|
|
16
|
+
- @scalar/postman-to-openapi@0.1.37
|
|
17
|
+
|
|
18
|
+
## 2.2.59
|
|
19
|
+
|
|
20
|
+
### Patch Changes
|
|
21
|
+
|
|
22
|
+
- 168e609: fix: body showing none instead of json
|
|
23
|
+
- Updated dependencies [3f99afc]
|
|
24
|
+
- Updated dependencies [bab7990]
|
|
25
|
+
- Updated dependencies [2c621d4]
|
|
26
|
+
- Updated dependencies [a31973c]
|
|
27
|
+
- @scalar/components@0.13.31
|
|
28
|
+
- @scalar/types@0.0.39
|
|
29
|
+
- @scalar/snippetz@0.2.16
|
|
30
|
+
- @scalar/oas-utils@0.2.113
|
|
31
|
+
- @scalar/use-codemirror@0.11.76
|
|
32
|
+
- @scalar/openapi-parser@0.10.9
|
|
33
|
+
- @scalar/themes@0.9.74
|
|
34
|
+
- @scalar/import@0.2.33
|
|
35
|
+
- @scalar/postman-to-openapi@0.1.36
|
|
36
|
+
- @scalar/use-hooks@0.1.28
|
|
37
|
+
|
|
38
|
+
## 2.2.58
|
|
39
|
+
|
|
40
|
+
### Patch Changes
|
|
41
|
+
|
|
42
|
+
- 4682a6f: fix: add keyboard instructions for code inputs
|
|
43
|
+
- Updated dependencies [7f1a40e]
|
|
44
|
+
- @scalar/types@0.0.38
|
|
45
|
+
- @scalar/oas-utils@0.2.112
|
|
46
|
+
- @scalar/openapi-parser@0.10.9
|
|
47
|
+
- @scalar/themes@0.9.73
|
|
48
|
+
- @scalar/import@0.2.32
|
|
49
|
+
- @scalar/postman-to-openapi@0.1.35
|
|
50
|
+
- @scalar/components@0.13.30
|
|
51
|
+
- @scalar/use-codemirror@0.11.75
|
|
52
|
+
- @scalar/use-hooks@0.1.27
|
|
53
|
+
|
|
3
54
|
## 2.2.57
|
|
4
55
|
|
|
5
56
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddressBar.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBar.vue"],"names":[],"mappings":"AAiWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AACzE,OAAO,KAAK,EACV,UAAU,EACV,SAAS,EAET,MAAM,EACP,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sCAAsC,CAAA;AAQrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAO1D,KAAK,WAAW,GAAG;IACf,UAAU,EAAE,UAAU,CAAA;IACtB,SAAS,EAAE,SAAS,CAAA;IACpB,MAAM,EAAE,MAAM,GAAG,SAAS,CAAA;IAC1B,WAAW,EAAE,WAAW,CAAA;IACxB,YAAY,EAAE,WAAW,EAAE,CAAA;IAC3B,SAAS,EAAE,SAAS,CAAA;CACrB,CAAC;;;;;;AAibJ,wBAQG"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./AddressBar.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import r from "../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const
|
|
4
|
+
const e = /* @__PURE__ */ r(o, [["__scopeId", "data-v-5e5a3c5f"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarButton as
|
|
3
|
-
import { REQUEST_METHODS as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useWorkspace as
|
|
9
|
-
import { useLayout as
|
|
10
|
-
const
|
|
1
|
+
import { defineComponent as z, useId as I, ref as i, watch as A, openBlock as k, createElementBlock as L, unref as r, createElementVNode as l, normalizeClass as U, normalizeStyle as M, createVNode as u, createBlock as $, createCommentVNode as H, withCtx as N, toDisplayString as x } from "vue";
|
|
2
|
+
import { ScalarButton as T, ScalarIcon as D } from "@scalar/components";
|
|
3
|
+
import { REQUEST_METHODS as O } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import P from "../CodeInput/CodeInput.vue.js";
|
|
5
|
+
import K from "../HttpMethod/HttpMethod.vue.js";
|
|
6
|
+
import Q from "./AddressBarHistory.vue.js";
|
|
7
|
+
import W from "../Server/ServerDropdown.vue.js";
|
|
8
|
+
import { useWorkspace as j } from "../../store/store.js";
|
|
9
|
+
import { useLayout as F } from "../../hooks/useLayout.js";
|
|
10
|
+
const G = ["id"], J = { class: "m-auto flex flex-row items-center" }, X = { class: "address-bar-bg-states text-xxs p-0.75 group relative order-last flex w-full max-w-[calc(100dvw-24px)] flex-1 flex-row items-stretch rounded-lg lg:order-none lg:min-w-[580px] lg:max-w-[580px] xl:min-w-[720px] xl:max-w-[720px]" }, Y = { class: "pointer-events-none absolute left-0 top-0 block h-full w-full overflow-hidden rounded-lg border" }, Z = { class: "z-context-plus flex gap-1" }, _ = { class: "scroll-timeline-x scroll-timeline-x-hidden z-context-plus relative flex w-full bg-blend-normal" }, ee = {
|
|
11
11
|
"aria-hidden": "true",
|
|
12
12
|
class: "inline-flex items-center gap-1"
|
|
13
|
-
},
|
|
13
|
+
}, oe = { class: "sr-only" }, ce = /* @__PURE__ */ z({
|
|
14
14
|
__name: "AddressBar",
|
|
15
15
|
props: {
|
|
16
16
|
collection: {},
|
|
@@ -22,88 +22,91 @@ const j = ["id"], F = { class: "m-auto flex flex-row items-center" }, G = { clas
|
|
|
22
22
|
},
|
|
23
23
|
emits: ["importCurl"],
|
|
24
24
|
setup(n) {
|
|
25
|
-
const
|
|
26
|
-
n.operation.path !== e &&
|
|
25
|
+
const p = I(), { requestMutators: v, events: c } = j(), { layout: h } = F(), f = i(null), g = i(null), B = (e) => {
|
|
26
|
+
n.operation.path !== e && v.edit(n.operation.uid, "path", e);
|
|
27
27
|
};
|
|
28
|
-
|
|
28
|
+
A(
|
|
29
29
|
() => n.operation.path,
|
|
30
30
|
(e) => {
|
|
31
|
-
e &&
|
|
31
|
+
e && B(e);
|
|
32
32
|
}
|
|
33
33
|
);
|
|
34
|
-
const
|
|
35
|
-
function w() {
|
|
36
|
-
a.value ? o.value -= (o.value - 15) / 60 : o.value -= h.value / 20, o.value <= 0 && (clearInterval(s.value), s.value = void 0, o.value = 100, a.value = !1);
|
|
37
|
-
}
|
|
38
|
-
function k() {
|
|
39
|
-
s.value || (a.value = !0, s.value = setInterval(w, 20));
|
|
40
|
-
}
|
|
34
|
+
const t = i(100), w = i(0), a = i(!1), s = i();
|
|
41
35
|
function C() {
|
|
42
|
-
|
|
36
|
+
a.value ? t.value -= (t.value - 15) / 60 : t.value -= w.value / 20, t.value <= 0 && (clearInterval(s.value), s.value = void 0, t.value = 100, a.value = !1);
|
|
43
37
|
}
|
|
44
38
|
function y() {
|
|
45
|
-
|
|
39
|
+
s.value || (a.value = !0, s.value = setInterval(C, 20));
|
|
46
40
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
});
|
|
50
|
-
function B(e) {
|
|
51
|
-
c.edit(n.operation.uid, "method", e);
|
|
41
|
+
function R() {
|
|
42
|
+
w.value = t.value, a.value = !1;
|
|
52
43
|
}
|
|
53
44
|
function q() {
|
|
45
|
+
clearInterval(s.value), s.value = void 0, t.value = 100, a.value = !1;
|
|
46
|
+
}
|
|
47
|
+
c.requestStatus.on((e) => {
|
|
48
|
+
e === "start" && y(), e === "stop" && R(), e === "abort" && q();
|
|
49
|
+
}), c.focusAddressBar.on(() => {
|
|
50
|
+
var e, o, d;
|
|
51
|
+
console.log("focusAddressBar", g.value, f.value), h === "modal" ? (o = (e = g.value) == null ? void 0 : e.$el) == null || o.focus() : (d = f.value) == null || d.focus();
|
|
52
|
+
});
|
|
53
|
+
function S(e) {
|
|
54
|
+
v.edit(n.operation.uid, "method", e);
|
|
55
|
+
}
|
|
56
|
+
function E() {
|
|
54
57
|
const { method: e } = n.operation;
|
|
55
|
-
return
|
|
58
|
+
return O[e].backgroundColor;
|
|
56
59
|
}
|
|
57
|
-
function
|
|
58
|
-
a.value || (a.value = !0,
|
|
60
|
+
function b() {
|
|
61
|
+
a.value || (a.value = !0, c.executeRequest.emit({ requestUid: n.operation.uid }));
|
|
59
62
|
}
|
|
60
|
-
|
|
61
|
-
var
|
|
62
|
-
e != null && e.focusAddressBar && ((
|
|
63
|
+
c.hotKeys.on((e) => {
|
|
64
|
+
var o;
|
|
65
|
+
e != null && e.focusAddressBar && ((o = f.value) == null || o.focus()), e != null && e.executeRequest && b();
|
|
63
66
|
});
|
|
64
|
-
function
|
|
65
|
-
|
|
67
|
+
function V(e) {
|
|
68
|
+
v.edit(n.operation.uid, "path", e);
|
|
66
69
|
}
|
|
67
|
-
return (e,
|
|
68
|
-
var
|
|
69
|
-
return
|
|
70
|
-
id: r(
|
|
70
|
+
return (e, o) => {
|
|
71
|
+
var d;
|
|
72
|
+
return k(), L("div", {
|
|
73
|
+
id: r(p),
|
|
71
74
|
class: "scalar-address-bar order-last h-[--scalar-address-bar-height] w-full [--scalar-address-bar-height:32px] lg:order-none lg:w-auto"
|
|
72
75
|
}, [
|
|
73
|
-
l("div",
|
|
74
|
-
l("div",
|
|
75
|
-
l("div",
|
|
76
|
+
l("div", J, [
|
|
77
|
+
l("div", X, [
|
|
78
|
+
l("div", Y, [
|
|
76
79
|
l("div", {
|
|
77
|
-
class:
|
|
78
|
-
style:
|
|
80
|
+
class: U(["bg-mix-transparent bg-mix-amount-90 absolute left-0 top-0 z-[1002] h-full w-full", E()]),
|
|
81
|
+
style: M({ transform: `translate3d(-${t.value}%,0,0)` })
|
|
79
82
|
}, null, 6)
|
|
80
83
|
]),
|
|
81
|
-
l("div",
|
|
82
|
-
|
|
83
|
-
isEditable: r(
|
|
84
|
+
l("div", Z, [
|
|
85
|
+
u(K, {
|
|
86
|
+
isEditable: r(h) !== "modal",
|
|
84
87
|
isSquare: "",
|
|
85
88
|
method: e.operation.method,
|
|
86
89
|
teleport: "",
|
|
87
|
-
onChange:
|
|
90
|
+
onChange: S
|
|
88
91
|
}, null, 8, ["isEditable", "method"])
|
|
89
92
|
]),
|
|
90
|
-
l("div",
|
|
91
|
-
e.collection.servers.length ? (
|
|
93
|
+
l("div", _, [
|
|
94
|
+
e.collection.servers.length ? (k(), $(r(W), {
|
|
92
95
|
key: 0,
|
|
93
96
|
collection: e.collection,
|
|
94
97
|
layout: "client",
|
|
95
98
|
operation: e.operation,
|
|
96
99
|
server: e.server,
|
|
97
|
-
target: r(
|
|
98
|
-
}, null, 8, ["collection", "operation", "server", "target"])) :
|
|
99
|
-
|
|
100
|
-
|
|
100
|
+
target: r(p)
|
|
101
|
+
}, null, 8, ["collection", "operation", "server", "target"])) : H("", !0),
|
|
102
|
+
o[1] || (o[1] = l("div", { class: "fade-left" }, null, -1)),
|
|
103
|
+
u(P, {
|
|
101
104
|
ref_key: "addressBarRef",
|
|
102
|
-
ref:
|
|
105
|
+
ref: f,
|
|
103
106
|
"aria-label": "Path",
|
|
104
107
|
class: "min-w-fit outline-none",
|
|
105
108
|
disableCloseBrackets: "",
|
|
106
|
-
disabled: r(
|
|
109
|
+
disabled: r(h) === "modal",
|
|
107
110
|
disableEnter: "",
|
|
108
111
|
disableTabIndent: "",
|
|
109
112
|
emitOnBlur: !1,
|
|
@@ -111,43 +114,48 @@ const j = ["id"], F = { class: "m-auto flex flex-row items-center" }, G = { clas
|
|
|
111
114
|
environment: e.environment,
|
|
112
115
|
importCurl: "",
|
|
113
116
|
modelValue: e.operation.path,
|
|
114
|
-
placeholder: (
|
|
117
|
+
placeholder: (d = e.server) != null && d.uid && e.collection.servers.includes(e.server.uid) ? "" : "Enter a URL or cURL command",
|
|
115
118
|
server: "",
|
|
116
119
|
workspace: e.workspace,
|
|
117
|
-
onCurl:
|
|
118
|
-
onSubmit:
|
|
119
|
-
"onUpdate:modelValue":
|
|
120
|
+
onCurl: o[0] || (o[0] = (m) => e.$emit("importCurl", m)),
|
|
121
|
+
onSubmit: b,
|
|
122
|
+
"onUpdate:modelValue": V
|
|
120
123
|
}, null, 8, ["disabled", "envVariables", "environment", "modelValue", "placeholder", "workspace"]),
|
|
121
|
-
|
|
124
|
+
o[2] || (o[2] = l("div", { class: "fade-right" }, null, -1))
|
|
122
125
|
]),
|
|
123
|
-
|
|
126
|
+
u(Q, {
|
|
124
127
|
operation: e.operation,
|
|
125
|
-
target: r(
|
|
128
|
+
target: r(p)
|
|
126
129
|
}, null, 8, ["operation", "target"]),
|
|
127
|
-
|
|
130
|
+
u(r(T), {
|
|
131
|
+
ref_key: "sendButtonRef",
|
|
132
|
+
ref: g,
|
|
128
133
|
class: "z-context-plus relative h-auto shrink-0 overflow-hidden py-1 pl-2 pr-2.5 font-bold",
|
|
129
134
|
disabled: a.value,
|
|
130
|
-
onClick:
|
|
135
|
+
onClick: b
|
|
131
136
|
}, {
|
|
132
|
-
default:
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
137
|
+
default: N(() => {
|
|
138
|
+
var m;
|
|
139
|
+
return [
|
|
140
|
+
l("span", ee, [
|
|
141
|
+
u(r(D), {
|
|
142
|
+
class: "relative shrink-0 fill-current",
|
|
143
|
+
icon: "Play",
|
|
144
|
+
size: "xs"
|
|
145
|
+
}),
|
|
146
|
+
o[3] || (o[3] = l("span", { class: "text-xxs hidden lg:flex" }, "Send", -1))
|
|
147
|
+
]),
|
|
148
|
+
l("span", oe, " Send " + x(e.operation.method) + " request to " + x(((m = e.server) == null ? void 0 : m.url) ?? "") + x(e.operation.path), 1)
|
|
149
|
+
];
|
|
150
|
+
}),
|
|
143
151
|
_: 1
|
|
144
152
|
}, 8, ["disabled"])
|
|
145
153
|
])
|
|
146
154
|
])
|
|
147
|
-
], 8,
|
|
155
|
+
], 8, G);
|
|
148
156
|
};
|
|
149
157
|
}
|
|
150
158
|
});
|
|
151
159
|
export {
|
|
152
|
-
|
|
160
|
+
ce as default
|
|
153
161
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AA6fA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wCAAwC,CAAA;AAEzE,OAAO,EAIL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;AAM/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;;kBAYxC,OAAO;eACV,OAAO;gBACN,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;eACJ,MAAM,EAAE;WACZ,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;eACzB,OAAO;oBACF,OAAO;iBACV,OAAO;iBACP,OAAO;cACV,MAAM,GAAG,MAAM;iBACZ,WAAW;kBACV,WAAW,EAAE;eAChB,SAAS;;;;;;;;;kBAzBN,OAAO;eACV,OAAO;gBACN,MAAM,GAAG,MAAM;YACnB,OAAO;iBACF,OAAO;kBACN,OAAO;WACd,OAAO;uBACK,OAAO;eACf,kBAAkB;wBACT,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;wBACnB,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;kBACzB,MAAM;eACT,OAAO;mBACH,OAAO;2BACC,OAAO;WACvB,MAAM,EAAE;eACJ,MAAM,EAAE;WACZ,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS;eACzB,OAAO;oBACF,OAAO;iBACV,OAAO;iBACP,OAAO;cACV,MAAM,GAAG,MAAM;iBACZ,WAAW;kBACV,WAAW,EAAE;eAChB,SAAS;;;;;;;cAPT,OAAO;cAjBP,OAAO;iBADJ,OAAO;gBAIR,OAAO;sBAGD,OAAO;kBAMX,OAAO;0BACC,OAAO;mBAKd,OAAO;gBAEV,OAAO;;qBA4fM,GAAG;kBACN,GAAG;;AArhB9B,wBAglBC;AAeD,KAAK,uBAAuB,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IACxC,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 _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
5
|
+
const _ = /* @__PURE__ */ t(o, [["__scopeId", "data-v-082b146a"]]);
|
|
6
6
|
export {
|
|
7
7
|
_ as default
|
|
8
8
|
};
|
|
@@ -1,26 +1,30 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarIcon as
|
|
3
|
-
import { prettyPrintJson as
|
|
4
|
-
import { useCodeMirror as
|
|
5
|
-
import { useClipboard as
|
|
6
|
-
import { nanoid as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import { pillPlugin as
|
|
10
|
-
import { useLayout as
|
|
11
|
-
const
|
|
1
|
+
import { defineComponent as H, useAttrs as J, ref as i, toRef as r, watch as Q, computed as $, openBlock as n, createElementBlock as u, Fragment as W, normalizeClass as G, unref as d, createElementVNode as m, toDisplayString as X, createBlock as y, mergeProps as Y, withKeys as g, withModifiers as q, createVNode as Z, createCommentVNode as f, createTextVNode as V, renderSlot as E } from "vue";
|
|
2
|
+
import { ScalarIcon as _ } from "@scalar/components";
|
|
3
|
+
import { prettyPrintJson as ee } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { useCodeMirror as oe, useDropdown as te, colorPicker as le } from "@scalar/use-codemirror";
|
|
5
|
+
import { useClipboard as ne } from "@scalar/use-hooks/useClipboard";
|
|
6
|
+
import { nanoid as ae } from "nanoid";
|
|
7
|
+
import re from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
|
|
8
|
+
import k from "../DataTable/DataTableInputSelect.vue.js";
|
|
9
|
+
import { pillPlugin as se, backspaceCommand as ue } from "./codeVariableWidget.js";
|
|
10
|
+
import { useLayout as de } from "../../hooks/useLayout.js";
|
|
11
|
+
const ie = { class: "whitespace-nowrap" }, pe = ["id"], me = {
|
|
12
12
|
key: 0,
|
|
13
13
|
class: "scalar-code-copy z-context"
|
|
14
|
-
},
|
|
14
|
+
}, fe = {
|
|
15
|
+
key: 1,
|
|
16
|
+
class: "z-context text-c-2 absolute bottom-1 right-1.5 hidden font-sans group-has-[:focus-visible]/input:block",
|
|
17
|
+
role: "alert"
|
|
18
|
+
}, ce = {
|
|
15
19
|
key: 5,
|
|
16
20
|
class: "centered-y text-orange absolute right-7 text-xs"
|
|
17
|
-
},
|
|
21
|
+
}, be = {
|
|
18
22
|
key: 6,
|
|
19
23
|
class: "required centered-y text-xxs text-c-3 group-[.error]:text-red bg-b-1 pointer-events-none absolute right-0 pr-2 pt-px opacity-100 shadow-[-8px_0_4px_var(--scalar-background-1)] transition-opacity duration-150 group-[.alert]:bg-transparent group-[.error]:bg-transparent group-[.alert]:shadow-none group-[.error]:shadow-none peer-has-[.cm-focused]:opacity-0"
|
|
20
|
-
},
|
|
24
|
+
}, ye = {
|
|
21
25
|
inheritAttrs: !1
|
|
22
|
-
},
|
|
23
|
-
...
|
|
26
|
+
}, Pe = /* @__PURE__ */ H({
|
|
27
|
+
...ye,
|
|
24
28
|
__name: "CodeInput",
|
|
25
29
|
props: {
|
|
26
30
|
colorPicker: { type: Boolean, default: !1 },
|
|
@@ -51,12 +55,12 @@ const de = { class: "whitespace-nowrap" }, ie = ["id"], pe = {
|
|
|
51
55
|
workspace: {}
|
|
52
56
|
},
|
|
53
57
|
emits: ["submit", "update:modelValue", "curl", "blur"],
|
|
54
|
-
setup(
|
|
55
|
-
var
|
|
56
|
-
const o =
|
|
57
|
-
function
|
|
58
|
-
var
|
|
59
|
-
return e === o.modelValue ? null : o.importCurl && e.trim().toLowerCase().startsWith("curl") ? (s("curl", e), (
|
|
58
|
+
setup(I, { expose: N, emit: R }) {
|
|
59
|
+
var T;
|
|
60
|
+
const o = I, s = R, C = J(), A = C.id || `id-${ae()}`, B = i(!1), v = i(!1), x = i(""), S = i({ left: 0, top: 0 }), c = i(null), { layout: w } = de(), { copyToClipboard: M } = ne();
|
|
61
|
+
function O(e) {
|
|
62
|
+
var t;
|
|
63
|
+
return e === o.modelValue ? null : o.importCurl && e.trim().toLowerCase().startsWith("curl") ? (s("curl", e), (t = a.value) == null || t.dispatch({
|
|
60
64
|
changes: {
|
|
61
65
|
from: 0,
|
|
62
66
|
to: a.value.state.doc.length,
|
|
@@ -64,31 +68,31 @@ const de = { class: "whitespace-nowrap" }, ie = ["id"], pe = {
|
|
|
64
68
|
}
|
|
65
69
|
}), null) : o.handleFieldChange ? o.handleFieldChange(e) : s("update:modelValue", e);
|
|
66
70
|
}
|
|
67
|
-
function
|
|
71
|
+
function P(e) {
|
|
68
72
|
return o.handleFieldSubmit ? o.handleFieldSubmit(e) : s("submit", e);
|
|
69
73
|
}
|
|
70
|
-
function
|
|
71
|
-
B.value = !1, o.emitOnBlur && o.modelValue &&
|
|
74
|
+
function K(e) {
|
|
75
|
+
B.value = !1, o.emitOnBlur && o.modelValue && P(e), s("blur", e);
|
|
72
76
|
}
|
|
73
|
-
const
|
|
74
|
-
o.colorPicker &&
|
|
75
|
-
|
|
77
|
+
const h = [];
|
|
78
|
+
o.colorPicker && h.push(le), h.push(
|
|
79
|
+
se({
|
|
76
80
|
environment: o.environment,
|
|
77
81
|
envVariables: o.envVariables,
|
|
78
82
|
workspace: o.workspace,
|
|
79
|
-
isReadOnly:
|
|
83
|
+
isReadOnly: w === "modal"
|
|
80
84
|
}),
|
|
81
|
-
|
|
85
|
+
ue
|
|
82
86
|
);
|
|
83
|
-
const D =
|
|
87
|
+
const D = i(null), { codeMirror: a } = oe({
|
|
84
88
|
content: r(
|
|
85
89
|
() => o.modelValue !== void 0 ? String(o.modelValue) : ""
|
|
86
90
|
),
|
|
87
91
|
onChange: (e) => {
|
|
88
|
-
|
|
92
|
+
O(e), L();
|
|
89
93
|
},
|
|
90
94
|
onFocus: () => B.value = !0,
|
|
91
|
-
onBlur: (e) =>
|
|
95
|
+
onBlur: (e) => K(e),
|
|
92
96
|
codeMirrorRef: D,
|
|
93
97
|
disableTabIndent: r(() => o.disableTabIndent),
|
|
94
98
|
disableEnter: r(() => o.disableEnter),
|
|
@@ -96,112 +100,120 @@ const de = { class: "whitespace-nowrap" }, ie = ["id"], pe = {
|
|
|
96
100
|
lineNumbers: r(() => o.lineNumbers),
|
|
97
101
|
language: r(() => o.language),
|
|
98
102
|
lint: r(() => o.lint),
|
|
99
|
-
extensions:
|
|
103
|
+
extensions: h,
|
|
100
104
|
placeholder: r(() => o.placeholder)
|
|
101
105
|
});
|
|
102
|
-
(
|
|
106
|
+
(T = a.value) == null || T.focus(), Q(a, () => {
|
|
103
107
|
a.value && Object.prototype.hasOwnProperty.call(C, "autofocus") && a.value.focus();
|
|
104
108
|
});
|
|
105
|
-
const { handleDropdownSelect:
|
|
109
|
+
const { handleDropdownSelect: z, updateDropdownVisibility: L } = te({
|
|
106
110
|
codeMirror: a,
|
|
107
|
-
query:
|
|
108
|
-
showDropdown:
|
|
111
|
+
query: x,
|
|
112
|
+
showDropdown: v,
|
|
109
113
|
dropdownPosition: S
|
|
110
|
-
}),
|
|
114
|
+
}), U = $(() => {
|
|
111
115
|
var e;
|
|
112
116
|
return o.type === "boolean" || (e = o.type) != null && e.includes("boolean") || o.nullable ? ["true", "false", "null"] : ["true", "false"];
|
|
113
117
|
});
|
|
114
|
-
|
|
118
|
+
N({
|
|
115
119
|
focus: () => {
|
|
116
120
|
var e;
|
|
117
121
|
(e = a.value) == null || e.focus();
|
|
118
122
|
}
|
|
119
123
|
});
|
|
120
|
-
const
|
|
121
|
-
var p,
|
|
122
|
-
|
|
123
|
-
},
|
|
124
|
+
const b = (e, t) => {
|
|
125
|
+
var p, l, F;
|
|
126
|
+
v.value ? e === "down" ? (t.preventDefault(), (p = c.value) == null || p.handleArrowKey("down")) : e === "up" ? (t.preventDefault(), (l = c.value) == null || l.handleArrowKey("up")) : e === "enter" && (t.preventDefault(), (F = c.value) == null || F.handleSelect()) : e === "escape" ? o.disableTabIndent || t.stopPropagation() : e === "enter" && t.target instanceof HTMLDivElement && P(t.target.textContent ?? "");
|
|
127
|
+
}, j = $(() => Array.isArray(o.type) ? (
|
|
124
128
|
// Find the first type, that’s not 'null'
|
|
125
129
|
o.type.find((e) => e !== "null") ?? "string"
|
|
126
130
|
) : (
|
|
127
131
|
// If it’s not an array, just return the type
|
|
128
132
|
o.type
|
|
129
133
|
));
|
|
130
|
-
return (e,
|
|
134
|
+
return (e, t) => {
|
|
131
135
|
var p;
|
|
132
|
-
return n(),
|
|
133
|
-
e.disabled ? (n(),
|
|
136
|
+
return n(), u(W, null, [
|
|
137
|
+
e.disabled ? (n(), u("div", {
|
|
134
138
|
key: 0,
|
|
135
|
-
class:
|
|
139
|
+
class: G(["text-c-2 flex cursor-default items-center justify-center", d(w) === "modal" ? "font-code pl-1 pr-2 text-sm" : "px-2"])
|
|
136
140
|
}, [
|
|
137
|
-
|
|
138
|
-
], 2)) : o.enum && o.enum.length ? (n(),
|
|
141
|
+
m("span", ie, X(e.modelValue), 1)
|
|
142
|
+
], 2)) : o.enum && o.enum.length ? (n(), y(k, {
|
|
139
143
|
key: 1,
|
|
140
144
|
default: o.default,
|
|
141
145
|
modelValue: e.modelValue,
|
|
142
|
-
type:
|
|
146
|
+
type: j.value,
|
|
143
147
|
value: o.enum,
|
|
144
|
-
"onUpdate:modelValue":
|
|
145
|
-
}, null, 8, ["default", "modelValue", "type", "value"])) : e.type === "boolean" || (p = e.type) != null && p.includes("boolean") ? (n(),
|
|
148
|
+
"onUpdate:modelValue": t[0] || (t[0] = (l) => s("update:modelValue", l))
|
|
149
|
+
}, null, 8, ["default", "modelValue", "type", "value"])) : e.type === "boolean" || (p = e.type) != null && p.includes("boolean") ? (n(), y(k, {
|
|
146
150
|
key: 2,
|
|
147
151
|
default: o.default,
|
|
148
152
|
modelValue: e.modelValue,
|
|
149
|
-
value:
|
|
150
|
-
"onUpdate:modelValue":
|
|
151
|
-
}, null, 8, ["default", "modelValue", "value"])) : o.examples && o.examples.length ? (n(),
|
|
153
|
+
value: U.value,
|
|
154
|
+
"onUpdate:modelValue": t[1] || (t[1] = (l) => s("update:modelValue", l))
|
|
155
|
+
}, null, 8, ["default", "modelValue", "value"])) : o.examples && o.examples.length ? (n(), y(k, {
|
|
152
156
|
key: 3,
|
|
153
157
|
default: o.default,
|
|
154
158
|
modelValue: o.modelValue,
|
|
155
159
|
value: o.examples,
|
|
156
|
-
"onUpdate:modelValue":
|
|
157
|
-
}, null, 8, ["default", "modelValue", "value"])) : (n(),
|
|
160
|
+
"onUpdate:modelValue": t[2] || (t[2] = (l) => s("update:modelValue", l))
|
|
161
|
+
}, null, 8, ["default", "modelValue", "value"])) : (n(), u("div", Y({
|
|
158
162
|
key: 4,
|
|
159
|
-
id:
|
|
163
|
+
id: d(A)
|
|
160
164
|
}, e.$attrs, {
|
|
161
165
|
ref_key: "codeMirrorRef",
|
|
162
166
|
ref: D,
|
|
163
|
-
class: ["group-[.alert]:outline-orange group-[.error]:outline-red font-code peer relative w-full overflow-hidden whitespace-nowrap text-xs leading-[1.44] -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline", {
|
|
167
|
+
class: ["group/input group-[.alert]:outline-orange group-[.error]:outline-red font-code peer relative w-full overflow-hidden whitespace-nowrap text-xs leading-[1.44] -outline-offset-1 has-[:focus-visible]:rounded-[4px] has-[:focus-visible]:outline", {
|
|
164
168
|
"flow-code-input--error": e.error
|
|
165
169
|
}],
|
|
166
170
|
onKeydown: [
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
171
|
+
t[4] || (t[4] = g(q((l) => b("down", l), ["stop"]), ["down"])),
|
|
172
|
+
t[5] || (t[5] = g((l) => b("enter", l), ["enter"])),
|
|
173
|
+
t[6] || (t[6] = g((l) => b("escape", l), ["escape"])),
|
|
174
|
+
t[7] || (t[7] = g(q((l) => b("up", l), ["stop"]), ["up"]))
|
|
170
175
|
]
|
|
171
176
|
}), [
|
|
172
|
-
e.isCopyable ? (n(),
|
|
173
|
-
|
|
177
|
+
e.isCopyable ? (n(), u("div", me, [
|
|
178
|
+
m("button", {
|
|
174
179
|
class: "copy-button",
|
|
175
180
|
type: "button",
|
|
176
|
-
onClick:
|
|
181
|
+
onClick: t[3] || (t[3] = (l) => d(M)(d(ee)(e.modelValue)))
|
|
177
182
|
}, [
|
|
178
|
-
|
|
179
|
-
|
|
183
|
+
t[8] || (t[8] = m("span", { class: "sr-only" }, "Copy content", -1)),
|
|
184
|
+
Z(d(_), {
|
|
180
185
|
icon: "Clipboard",
|
|
181
186
|
size: "md"
|
|
182
187
|
})
|
|
183
188
|
])
|
|
184
|
-
])) :
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
])) : f("", !0),
|
|
190
|
+
e.disableTabIndent ? f("", !0) : (n(), u("div", fe, t[9] || (t[9] = [
|
|
191
|
+
V(" Press "),
|
|
192
|
+
m("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Esc", -1),
|
|
193
|
+
V(" then "),
|
|
194
|
+
m("kbd", { class: "-mx-0.25 rounded border px-0.5 font-mono" }, "Tab", -1),
|
|
195
|
+
V(" to exit ")
|
|
196
|
+
])))
|
|
197
|
+
], 16, pe)),
|
|
198
|
+
e.$slots.warning ? (n(), u("div", ce, [
|
|
199
|
+
E(e.$slots, "warning", {}, void 0, !0)
|
|
200
|
+
])) : f("", !0),
|
|
201
|
+
E(e.$slots, "icon", {}, void 0, !0),
|
|
202
|
+
e.required ? (n(), u("div", be, " Required ")) : f("", !0),
|
|
203
|
+
v.value && e.withVariables && d(w) !== "modal" && e.environment ? (n(), y(re, {
|
|
192
204
|
key: 7,
|
|
193
205
|
ref_key: "dropdownRef",
|
|
194
|
-
ref:
|
|
206
|
+
ref: c,
|
|
195
207
|
dropdownPosition: S.value,
|
|
196
208
|
envVariables: e.envVariables,
|
|
197
209
|
environment: e.environment,
|
|
198
|
-
query:
|
|
199
|
-
onSelect:
|
|
200
|
-
}, null, 8, ["dropdownPosition", "envVariables", "environment", "query", "onSelect"])) :
|
|
210
|
+
query: x.value,
|
|
211
|
+
onSelect: d(z)
|
|
212
|
+
}, null, 8, ["dropdownPosition", "envVariables", "environment", "query", "onSelect"])) : f("", !0)
|
|
201
213
|
], 64);
|
|
202
214
|
};
|
|
203
215
|
}
|
|
204
216
|
});
|
|
205
217
|
export {
|
|
206
|
-
|
|
218
|
+
Pe as default
|
|
207
219
|
};
|
|
@@ -106,6 +106,7 @@ export declare const PaletteComponents: {
|
|
|
106
106
|
}[] | undefined;
|
|
107
107
|
requestBody?: any;
|
|
108
108
|
responses?: Record<string, any> | undefined;
|
|
109
|
+
'x-scalar-stability'?: unknown;
|
|
109
110
|
method?: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace" | undefined;
|
|
110
111
|
} & {
|
|
111
112
|
url?: string;
|
|
@@ -154,6 +155,7 @@ export declare const PaletteComponents: {
|
|
|
154
155
|
}[] | undefined;
|
|
155
156
|
requestBody?: any;
|
|
156
157
|
responses?: Record<string, any> | undefined;
|
|
158
|
+
'x-scalar-stability'?: unknown;
|
|
157
159
|
method?: "options" | "connect" | "delete" | "get" | "head" | "patch" | "post" | "put" | "trace" | undefined;
|
|
158
160
|
} & {
|
|
159
161
|
url?: string;
|