@scalar/api-client 2.0.30 → 2.0.32
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 +14 -0
- package/dist/components/AddressBar/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts +2 -2
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CodeInput/CodeInput.vue.js +2 -2
- package/dist/components/CodeInput/CodeInput.vue2.js +62 -47
- package/dist/components/CodeInput/codeDropdownWidget.d.ts +9 -1
- package/dist/components/CodeInput/codeDropdownWidget.d.ts.map +1 -1
- package/dist/components/CodeInput/codeDropdownWidget.js +62 -51
- package/dist/components/CodeInput/codeVariableWidget.d.ts +10 -1
- package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
- package/dist/components/CodeInput/codeVariableWidget.js +63 -56
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +1 -1
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
- package/dist/components/TopNav/TopNav.vue.js +1 -1
- package/dist/components/TopNav/TopNav.vue2.js +65 -34
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -8
- package/dist/layouts/App/create-api-client-app.d.ts +2966 -0
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -0
- package/dist/layouts/App/create-api-client-app.js +18 -0
- package/dist/layouts/App/index.d.ts +1 -1
- package/dist/layouts/App/index.d.ts.map +1 -1
- package/dist/layouts/App/index.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts +1 -17
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue2.js +20 -24
- package/dist/layouts/Modal/api-client-modal.d.ts +5905 -57
- package/dist/layouts/Modal/api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/api-client-modal.js +27 -129
- package/dist/libs/create-client.d.ts +3026 -0
- package/dist/libs/create-client.d.ts.map +1 -0
- package/dist/libs/create-client.js +147 -0
- package/dist/libs/index.d.ts +1 -0
- package/dist/libs/index.d.ts.map +1 -1
- package/dist/libs/index.js +11 -9
- package/dist/router.d.ts +4 -20
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +28 -44
- package/dist/store/index.d.ts +2 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.js +5 -0
- package/dist/store/workspace.d.ts +3028 -603
- package/dist/store/workspace.d.ts.map +1 -1
- package/dist/store/workspace.js +454 -432
- package/dist/style.css +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +8 -0
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +32 -31
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +2 -2
- 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 +24 -23
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +26 -20
- package/package.json +8 -4
- package/dist/layouts/App/createApiClientApp.d.ts +0 -16
- package/dist/layouts/App/createApiClientApp.d.ts.map +0 -1
- package/dist/layouts/App/createApiClientApp.js +0 -62
- package/dist/store/topNav.d.ts +0 -445
- package/dist/store/topNav.d.ts.map +0 -1
- package/dist/store/topNav.js +0 -53
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @scalar/api-client
|
|
2
2
|
|
|
3
|
+
## 2.0.32
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 6123165: fix(api-client-react): loosen type for initialRequest
|
|
8
|
+
|
|
9
|
+
## 2.0.31
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 240a618: feat: allow multiple api-clients on single page
|
|
14
|
+
- Updated dependencies [240a618]
|
|
15
|
+
- @scalar/object-utils@1.1.5
|
|
16
|
+
|
|
3
17
|
## 2.0.30
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBarHistory.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"AddressBarHistory.vue.d.ts","sourceRoot":"","sources":["../../../src/components/AddressBar/AddressBarHistory.vue"],"names":[],"mappings":";UA4GQ,OAAO;;UAAP,OAAO;;AAwOf,wBAMG;AAOH,KAAK,sBAAsB,CAAC,CAAC,IAAI,CAAC,SAAS,SAAS,GAAG,KAAK,GAAG,CAAC,CAAC;AAC5D,KAAK,uBAAuB,CAAC,CAAC,IAAI;KAChC,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,SAAS,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;KAAE,GAC9D;QAAE,IAAI,EAAE,OAAO,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE;CACzD,CAAC"}
|
|
@@ -61,16 +61,16 @@ declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<__
|
|
|
61
61
|
withVariables: boolean;
|
|
62
62
|
withServers: boolean;
|
|
63
63
|
}>>> & {
|
|
64
|
-
onSubmit?: ((v: string) => any) | undefined;
|
|
65
64
|
"onUpdate:modelValue"?: ((v: string) => any) | undefined;
|
|
65
|
+
onSubmit?: ((v: string) => any) | undefined;
|
|
66
66
|
}, {
|
|
67
|
-
nullable: boolean;
|
|
68
67
|
withServers: boolean;
|
|
69
68
|
colorPicker: boolean;
|
|
70
69
|
emitOnBlur: boolean;
|
|
71
70
|
disableTabIndent: boolean;
|
|
72
71
|
disableEnter: boolean;
|
|
73
72
|
disableCloseBrackets: boolean;
|
|
73
|
+
nullable: boolean;
|
|
74
74
|
withVariables: boolean;
|
|
75
75
|
}, {}>, {
|
|
76
76
|
warning?(_: {}): any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"CodeInput.vue.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/CodeInput.vue"],"names":[],"mappings":"AAAA,OA6SO,EAGL,KAAK,kBAAkB,EAExB,MAAM,wBAAwB,CAAA;;kBAeb,OAAO;gBACT,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;WACR,MAAM;eACF,OAAO;oBACF,OAAO;kBACT,OAAO;;;;;;;;;;;;;;kBAlBP,OAAO;gBACT,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;WACR,MAAM;eACF,OAAO;oBACF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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 f = /* @__PURE__ */ t(o, [["__scopeId", "data-v-5c73f0cd"]]);
|
|
6
6
|
export {
|
|
7
|
-
|
|
7
|
+
f as default
|
|
8
8
|
};
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useCodeMirror as
|
|
3
|
-
import { nanoid as
|
|
4
|
-
import
|
|
5
|
-
import { dropdownPlugin as
|
|
6
|
-
import { pillPlugin as
|
|
7
|
-
import { useWorkspace as
|
|
8
|
-
const
|
|
1
|
+
import { defineComponent as $, useAttrs as E, ref as y, toRef as o, watch as q, computed as I, openBlock as t, createElementBlock as s, Fragment as M, createBlock as g, mergeProps as N, unref as T, renderSlot as v, createCommentVNode as B } from "vue";
|
|
2
|
+
import { useCodeMirror as A, colorPicker as U } from "@scalar/use-codemirror";
|
|
3
|
+
import { nanoid as W } from "nanoid";
|
|
4
|
+
import V from "../DataTable/DataTableInputSelect.vue.js";
|
|
5
|
+
import { dropdownPlugin as j } from "./codeDropdownWidget.js";
|
|
6
|
+
import { pillPlugin as z, backspaceCommand as D } from "./codeVariableWidget.js";
|
|
7
|
+
import { useWorkspace as G } from "../../store/workspace.js";
|
|
8
|
+
const H = ["id"], J = {
|
|
9
9
|
key: 3,
|
|
10
10
|
class: "absolute centered-y right-7 text-orange text-xs"
|
|
11
|
-
},
|
|
11
|
+
}, K = {
|
|
12
12
|
key: 4,
|
|
13
13
|
class: "required absolute centered-y right-0 pt-px pr-2 text-xxs text-c-3 bg-b-1 shadow-[-8px_0_4px_var(--scalar-background-1)] opacity-100 duration-150 transition-opacity peer-has-[.cm-focused]:opacity-0 pointer-events-none"
|
|
14
|
-
},
|
|
14
|
+
}, L = {
|
|
15
15
|
inheritAttrs: !1
|
|
16
|
-
},
|
|
17
|
-
...
|
|
16
|
+
}, te = /* @__PURE__ */ $({
|
|
17
|
+
...L,
|
|
18
18
|
__name: "CodeInput",
|
|
19
19
|
props: {
|
|
20
20
|
colorPicker: { type: Boolean, default: !1 },
|
|
@@ -38,76 +38,91 @@ const j = ["id"], z = {
|
|
|
38
38
|
withServers: { type: Boolean, default: !1 }
|
|
39
39
|
},
|
|
40
40
|
emits: ["submit", "update:modelValue"],
|
|
41
|
-
setup(
|
|
42
|
-
var
|
|
43
|
-
const e =
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
setup(k, { emit: w }) {
|
|
42
|
+
var b;
|
|
43
|
+
const e = k, n = w, d = E(), C = d.id || `id-${W()}`, p = y(!1), {
|
|
44
|
+
activeWorkspace: _,
|
|
45
|
+
activeParsedEnvironments: c,
|
|
46
|
+
isReadOnly: x,
|
|
47
|
+
environments: m,
|
|
48
|
+
router: F
|
|
49
|
+
} = G();
|
|
50
|
+
function S(l) {
|
|
51
|
+
return l === e.modelValue ? null : e.handleFieldChange ? e.handleFieldChange(l) : n("update:modelValue", l);
|
|
46
52
|
}
|
|
47
|
-
function
|
|
48
|
-
return e.handleFieldSubmit ? e.handleFieldSubmit(l) :
|
|
53
|
+
function P(l) {
|
|
54
|
+
return e.handleFieldSubmit ? e.handleFieldSubmit(l) : n("submit", l);
|
|
49
55
|
}
|
|
50
|
-
function
|
|
51
|
-
p.value = !1, e.emitOnBlur && e.modelValue &&
|
|
56
|
+
function O(l) {
|
|
57
|
+
p.value = !1, e.emitOnBlur && e.modelValue && P(l);
|
|
52
58
|
}
|
|
53
|
-
const
|
|
54
|
-
e.colorPicker &&
|
|
55
|
-
|
|
59
|
+
const a = [];
|
|
60
|
+
e.colorPicker && a.push(U), e.withVariables && !_.value.isReadOnly && a.push(
|
|
61
|
+
j({
|
|
62
|
+
withServers: e.withServers,
|
|
63
|
+
activeParsedEnvironments: c,
|
|
64
|
+
environments: m,
|
|
65
|
+
router: F
|
|
66
|
+
})
|
|
67
|
+
), a.push(
|
|
68
|
+
z({ environments: m, activeParsedEnvironments: c, isReadOnly: x })
|
|
69
|
+
), a.push(D);
|
|
70
|
+
const f = y(null), { codeMirror: r } = A({
|
|
56
71
|
content: o(
|
|
57
72
|
() => e.modelValue !== void 0 ? String(e.modelValue) : ""
|
|
58
73
|
),
|
|
59
|
-
onChange:
|
|
74
|
+
onChange: S,
|
|
60
75
|
onFocus: () => p.value = !0,
|
|
61
|
-
onBlur: (l) =>
|
|
62
|
-
codeMirrorRef:
|
|
76
|
+
onBlur: (l) => O(l),
|
|
77
|
+
codeMirrorRef: f,
|
|
63
78
|
disableTabIndent: o(() => e.disableTabIndent),
|
|
64
79
|
disableEnter: o(() => e.disableEnter),
|
|
65
80
|
disableCloseBrackets: o(() => e.disableCloseBrackets),
|
|
66
81
|
lineNumbers: o(() => e.lineNumbers),
|
|
67
82
|
language: o(() => e.language),
|
|
68
83
|
lint: o(() => e.lint),
|
|
69
|
-
extensions:
|
|
84
|
+
extensions: a,
|
|
70
85
|
placeholder: o(() => e.placeholder)
|
|
71
86
|
});
|
|
72
|
-
(
|
|
87
|
+
(b = r.value) == null || b.focus(), q(r, () => {
|
|
73
88
|
r.value && Object.prototype.hasOwnProperty.call(d, "autofocus") && r.value.focus();
|
|
74
89
|
});
|
|
75
|
-
const
|
|
90
|
+
const R = I(() => {
|
|
76
91
|
var l;
|
|
77
92
|
return e.type === "boolean" || (l = e.type) != null && l.includes("boolean") || e.nullable ? ["true", "false", "null"] : ["true", "false"];
|
|
78
93
|
});
|
|
79
94
|
return (l, u) => {
|
|
80
|
-
var
|
|
81
|
-
return t(),
|
|
82
|
-
e.enum && e.enum.length ? (t(),
|
|
95
|
+
var h;
|
|
96
|
+
return t(), s(M, null, [
|
|
97
|
+
e.enum && e.enum.length ? (t(), g(V, {
|
|
83
98
|
key: 0,
|
|
84
99
|
modelValue: e.modelValue,
|
|
85
100
|
value: e.enum,
|
|
86
|
-
"onUpdate:modelValue": u[0] || (u[0] = (
|
|
87
|
-
}, null, 8, ["modelValue", "value"])) : e.type === "boolean" || (
|
|
101
|
+
"onUpdate:modelValue": u[0] || (u[0] = (i) => n("update:modelValue", i))
|
|
102
|
+
}, null, 8, ["modelValue", "value"])) : e.type === "boolean" || (h = e.type) != null && h.includes("boolean") ? (t(), g(V, {
|
|
88
103
|
key: 1,
|
|
89
104
|
modelValue: e.modelValue,
|
|
90
|
-
value:
|
|
91
|
-
"onUpdate:modelValue": u[1] || (u[1] = (
|
|
92
|
-
}, null, 8, ["modelValue", "value"])) : (t(),
|
|
105
|
+
value: R.value,
|
|
106
|
+
"onUpdate:modelValue": u[1] || (u[1] = (i) => n("update:modelValue", i))
|
|
107
|
+
}, null, 8, ["modelValue", "value"])) : (t(), s("div", N({
|
|
93
108
|
key: 2,
|
|
94
|
-
id:
|
|
109
|
+
id: T(C)
|
|
95
110
|
}, l.$attrs, {
|
|
96
111
|
ref_key: "codeMirrorRef",
|
|
97
|
-
ref:
|
|
112
|
+
ref: f,
|
|
98
113
|
class: ["peer font-code w-full whitespace-nowrap text-xs leading-[1.44] relative", {
|
|
99
114
|
"flow-code-input--error": l.error
|
|
100
115
|
}]
|
|
101
|
-
}), null, 16,
|
|
102
|
-
l.$slots.warning ? (t(),
|
|
103
|
-
|
|
104
|
-
])) :
|
|
105
|
-
|
|
106
|
-
l.required ? (t(),
|
|
116
|
+
}), null, 16, H)),
|
|
117
|
+
l.$slots.warning ? (t(), s("div", J, [
|
|
118
|
+
v(l.$slots, "warning", {}, void 0, !0)
|
|
119
|
+
])) : B("", !0),
|
|
120
|
+
v(l.$slots, "icon", {}, void 0, !0),
|
|
121
|
+
l.required ? (t(), s("div", K, " Required ")) : B("", !0)
|
|
107
122
|
], 64);
|
|
108
123
|
};
|
|
109
124
|
}
|
|
110
125
|
});
|
|
111
126
|
export {
|
|
112
|
-
|
|
127
|
+
te as default
|
|
113
128
|
};
|
|
@@ -1,10 +1,15 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '../../store/index.js';
|
|
1
2
|
import { type DecorationSet, type EditorView, ViewPlugin, type ViewUpdate, WidgetType } from '@scalar/use-codemirror';
|
|
3
|
+
import type { Router } from 'vue-router';
|
|
2
4
|
declare class DropdownWidget extends WidgetType {
|
|
3
5
|
private queryTerm;
|
|
4
6
|
private onSelect;
|
|
5
7
|
private dropdown;
|
|
6
8
|
private withServers?;
|
|
7
|
-
|
|
9
|
+
private activeParsedEnvironments;
|
|
10
|
+
private environments;
|
|
11
|
+
private router;
|
|
12
|
+
constructor(queryTerm: string, onSelect: (item: string) => void, activeParsedEnvironments: WorkspaceStore['activeParsedEnvironments'], environments: WorkspaceStore['environments'], router: Router, withServers?: boolean);
|
|
8
13
|
updateQueryTerm(newQueryTerm: string): void;
|
|
9
14
|
getQueryTerm(): string;
|
|
10
15
|
toDOM(view: EditorView): HTMLSpanElement;
|
|
@@ -13,6 +18,9 @@ declare class DropdownWidget extends WidgetType {
|
|
|
13
18
|
}
|
|
14
19
|
export declare const dropdownPlugin: (props: {
|
|
15
20
|
withServers?: boolean;
|
|
21
|
+
activeParsedEnvironments: WorkspaceStore["activeParsedEnvironments"];
|
|
22
|
+
environments: WorkspaceStore["environments"];
|
|
23
|
+
router: Router;
|
|
16
24
|
}) => ViewPlugin<{
|
|
17
25
|
decorations: DecorationSet;
|
|
18
26
|
widget: DropdownWidget | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeDropdownWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeDropdownWidget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codeDropdownWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeDropdownWidget.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;AAC7C,OAAO,EAEL,KAAK,aAAa,EAClB,KAAK,UAAU,EAEf,UAAU,EACV,KAAK,UAAU,EACf,UAAU,EACX,MAAM,wBAAwB,CAAA;AAE/B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writable: !0, value: e }) : s[t] = e;
|
|
3
|
+
var o = (s, t, e) => f(s, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { ViewPlugin as p, Decoration as h, StateEffect as v, WidgetType as y } from "@scalar/use-codemirror";
|
|
5
|
+
import { createApp as T, h as w, Teleport as S } from "vue";
|
|
6
|
+
import q from "../../views/Environment/EnvironmentVariableDropdown.vue.js";
|
|
7
|
+
class u extends y {
|
|
8
|
+
constructor(e, i, d, n, c, r) {
|
|
10
9
|
super();
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
this
|
|
10
|
+
o(this, "queryTerm");
|
|
11
|
+
o(this, "onSelect");
|
|
12
|
+
o(this, "dropdown", null);
|
|
13
|
+
o(this, "withServers");
|
|
14
|
+
o(this, "activeParsedEnvironments");
|
|
15
|
+
o(this, "environments");
|
|
16
|
+
o(this, "router");
|
|
17
|
+
this.queryTerm = e, this.onSelect = i, this.withServers = r, this.activeParsedEnvironments = d, this.environments = n, this.router = c;
|
|
16
18
|
}
|
|
17
19
|
updateQueryTerm(e) {
|
|
18
20
|
this.queryTerm !== e && (this.queryTerm = e);
|
|
@@ -21,28 +23,31 @@ class u extends S {
|
|
|
21
23
|
return this.queryTerm;
|
|
22
24
|
}
|
|
23
25
|
toDOM(e) {
|
|
24
|
-
const
|
|
25
|
-
return
|
|
26
|
+
const i = document.createElement("span");
|
|
27
|
+
return i.style.position = "fixed", setTimeout(() => {
|
|
26
28
|
var c;
|
|
27
|
-
const
|
|
28
|
-
if (
|
|
29
|
+
const d = e.state.selection.main.head, n = e.coordsAtPos(d - this.queryTerm.length - 2);
|
|
30
|
+
if (n) {
|
|
29
31
|
const r = (c = document.querySelector(".scalar-client")) == null ? void 0 : c.getBoundingClientRect();
|
|
30
|
-
r && (this.dropdown =
|
|
31
|
-
render: () =>
|
|
32
|
-
|
|
32
|
+
r && (this.dropdown = T({
|
|
33
|
+
render: () => w(S, { to: ".scalar-client" }, [
|
|
34
|
+
w(q, {
|
|
33
35
|
query: this.queryTerm,
|
|
34
36
|
onSelect: this.onSelect,
|
|
35
37
|
withServers: this.withServers,
|
|
38
|
+
activeParsedEnvironments: this.activeParsedEnvironments,
|
|
39
|
+
environments: this.environments,
|
|
40
|
+
router: this.router,
|
|
36
41
|
style: {
|
|
37
42
|
position: "absolute",
|
|
38
|
-
left: `${
|
|
39
|
-
top: `calc(${
|
|
43
|
+
left: `${n.left - r.left}px`,
|
|
44
|
+
top: `calc(${n.bottom - r.top}px + 6px)`
|
|
40
45
|
}
|
|
41
46
|
})
|
|
42
47
|
])
|
|
43
|
-
})), this.dropdown.use(
|
|
48
|
+
})), this.dropdown.use(this.router), this.dropdown.mount(i);
|
|
44
49
|
}
|
|
45
|
-
}, 0),
|
|
50
|
+
}, 0), i;
|
|
46
51
|
}
|
|
47
52
|
destroy() {
|
|
48
53
|
this.dropdown && (this.dropdown.unmount(), this.dropdown = null);
|
|
@@ -51,54 +56,60 @@ class u extends S {
|
|
|
51
56
|
return e instanceof u && this.queryTerm === e.queryTerm;
|
|
52
57
|
}
|
|
53
58
|
}
|
|
54
|
-
const
|
|
59
|
+
const C = (s) => p.fromClass(
|
|
55
60
|
class {
|
|
56
61
|
constructor(t) {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
62
|
+
o(this, "decorations");
|
|
63
|
+
o(this, "widget", null);
|
|
64
|
+
o(this, "view");
|
|
60
65
|
this.view = t, this.decorations = h.none, this.handleDropdownSelect = this.handleDropdownSelect.bind(this);
|
|
61
66
|
}
|
|
62
67
|
handleDropdownSelect(t) {
|
|
63
|
-
var
|
|
68
|
+
var m;
|
|
64
69
|
if (!this.widget) return;
|
|
65
|
-
const { state: e, dispatch:
|
|
66
|
-
|
|
67
|
-
changes: { from:
|
|
68
|
-
}), (
|
|
69
|
-
effects:
|
|
70
|
+
const { state: e, dispatch: i } = this.view, d = e.selection.main.head, n = Math.max(0, d - this.widget.getQueryTerm().length - 2), c = d, r = `{{${t}}}`;
|
|
71
|
+
i({
|
|
72
|
+
changes: { from: n, to: c, insert: r }
|
|
73
|
+
}), (m = this.widget) == null || m.destroy(), this.widget = null, this.decorations = h.none, this.view.dispatch({
|
|
74
|
+
effects: v.appendConfig.of([])
|
|
70
75
|
});
|
|
71
|
-
const
|
|
76
|
+
const a = n + r.length, l = "";
|
|
72
77
|
this.widget = new u(
|
|
73
|
-
|
|
78
|
+
l,
|
|
74
79
|
this.handleDropdownSelect,
|
|
75
|
-
|
|
80
|
+
s.activeParsedEnvironments,
|
|
81
|
+
s.environments,
|
|
82
|
+
s.router,
|
|
83
|
+
s.withServers
|
|
76
84
|
), this.decorations = h.set([
|
|
77
85
|
h.widget({
|
|
78
86
|
widget: this.widget,
|
|
79
87
|
side: 1
|
|
80
|
-
}).range(
|
|
88
|
+
}).range(a)
|
|
81
89
|
]), this.view.dispatch({
|
|
82
|
-
selection: { anchor:
|
|
90
|
+
selection: { anchor: a }
|
|
83
91
|
}), this.view.focus();
|
|
84
92
|
}
|
|
85
93
|
update(t) {
|
|
86
|
-
var r,
|
|
87
|
-
const e = t.state.selection.main.head,
|
|
88
|
-
if (
|
|
89
|
-
const
|
|
90
|
-
!this.widget || this.widget.getQueryTerm() !==
|
|
91
|
-
|
|
92
|
-
this.handleDropdownSelect
|
|
93
|
-
|
|
94
|
+
var r, a;
|
|
95
|
+
const e = t.state.selection.main.head, i = t.state.doc.sliceString(0, e), d = [], n = i.lastIndexOf("{{"), c = i.lastIndexOf("}}");
|
|
96
|
+
if (n > c) {
|
|
97
|
+
const l = i.slice(n + 2);
|
|
98
|
+
!this.widget || this.widget.getQueryTerm() !== l ? ((r = this.widget) == null || r.destroy(), this.widget = new u(
|
|
99
|
+
l,
|
|
100
|
+
this.handleDropdownSelect,
|
|
101
|
+
s.activeParsedEnvironments,
|
|
102
|
+
s.environments,
|
|
103
|
+
s.router
|
|
104
|
+
)) : this.widget.updateQueryTerm(l), d.push(
|
|
94
105
|
h.widget({
|
|
95
106
|
widget: this.widget,
|
|
96
107
|
side: 1
|
|
97
108
|
}).range(e)
|
|
98
109
|
);
|
|
99
110
|
} else
|
|
100
|
-
(
|
|
101
|
-
this.decorations = h.set(
|
|
111
|
+
(a = this.widget) == null || a.destroy(), this.widget = null;
|
|
112
|
+
this.decorations = h.set(d);
|
|
102
113
|
}
|
|
103
114
|
},
|
|
104
115
|
{
|
|
@@ -106,5 +117,5 @@ const P = (d) => y.fromClass(
|
|
|
106
117
|
}
|
|
107
118
|
);
|
|
108
119
|
export {
|
|
109
|
-
|
|
120
|
+
C as dropdownPlugin
|
|
110
121
|
};
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '../../store/workspace.js';
|
|
2
|
+
import type { Environment } from '@scalar/oas-utils/entities/workspace/environment';
|
|
1
3
|
import { Decoration, type DecorationSet, EditorView, ViewPlugin, type ViewUpdate } from '@scalar/use-codemirror';
|
|
2
|
-
|
|
4
|
+
type ActiveParsedEnvironments = WorkspaceStore['activeParsedEnvironments'];
|
|
5
|
+
type IsReadOnly = WorkspaceStore['isReadOnly'];
|
|
6
|
+
export declare const pillPlugin: (props: {
|
|
7
|
+
environments: Record<string, Environment>;
|
|
8
|
+
activeParsedEnvironments: ActiveParsedEnvironments;
|
|
9
|
+
isReadOnly: IsReadOnly;
|
|
10
|
+
}) => ViewPlugin<{
|
|
3
11
|
decorations: DecorationSet;
|
|
4
12
|
update(update: ViewUpdate): void;
|
|
5
13
|
buildDecorations(view: EditorView): import("@codemirror/state").RangeSet<Decoration>;
|
|
6
14
|
}>;
|
|
7
15
|
export declare const backspaceCommand: import("@codemirror/state").Extension;
|
|
16
|
+
export {};
|
|
8
17
|
//# sourceMappingURL=codeVariableWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"codeVariableWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeVariableWidget.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"codeVariableWidget.d.ts","sourceRoot":"","sources":["../../../src/components/CodeInput/codeVariableWidget.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAEvD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AACnF,OAAO,EACL,UAAU,EACV,KAAK,aAAa,EAClB,UAAU,EAEV,UAAU,EACV,KAAK,UAAU,EAEhB,MAAM,wBAAwB,CAAA;AAuB/B,KAAK,wBAAwB,GAAG,cAAc,CAAC,0BAA0B,CAAC,CAAA;AAC1E,KAAK,UAAU,GAAG,cAAc,CAAC,YAAY,CAAC,CAAA;AA2G9C,eAAO,MAAM,UAAU,UAAW;IAChC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;IACzC,wBAAwB,EAAE,wBAAwB,CAAA;IAClD,UAAU,EAAE,UAAU,CAAA;CACvB;iBAGkB,aAAa;mBAMX,UAAU;2BAMF,UAAU;EAkCpC,CAAA;AAEH,eAAO,MAAM,gBAAgB,uCAmB3B,CAAA"}
|