@scalar/api-client 2.23.3 → 2.24.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 +55 -0
- package/dist/layouts/Modal/ApiClientModal.vue.d.ts.map +1 -1
- package/dist/layouts/Modal/ApiClientModal.vue.js +2 -2
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +8 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +33 -29
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +6 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +46 -29
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts +15 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +125 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts +5 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +61 -61
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +6 -6
- package/dist/v2/features/app/App.vue.d.ts +5 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +89 -108
- package/dist/v2/features/app/app-state.d.ts +5 -7
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +210 -205
- package/dist/v2/features/app/hooks/use-document-watcher.js +8 -8
- package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +12 -11
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +17 -25
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +115 -118
- package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +14 -4
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +5 -6
- package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts +16 -0
- package/dist/v2/features/command-palette/helpers/load-document-from-source.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js +34 -0
- package/dist/v2/features/command-palette/index.d.ts +4 -0
- package/dist/v2/features/command-palette/index.d.ts.map +1 -0
- package/dist/v2/features/command-palette/index.js +8 -0
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts +4 -0
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.js +29 -27
- package/dist/v2/features/environments/components/Environment.vue.d.ts +1 -0
- package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.js +37 -24
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +1 -1
- package/dist/v2/features/modal/Modal.vue2.js +35 -36
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +58 -41
- package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts +18 -0
- package/dist/v2/features/modal/helpers/restore-workspace-state.d.ts.map +1 -0
- package/dist/v2/features/modal/helpers/restore-workspace-state.js +36 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +35 -26
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +7 -0
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +20 -20
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts +0 -52
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/ImportListener.vue.js +0 -91
- package/dist/v2/features/import-listener/ImportListener.vue2.js +0 -4
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +0 -7
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/DropEventListener.vue.js +0 -81
- package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +0 -4
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +0 -40
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/ImportModal.vue.js +0 -170
- package/dist/v2/features/import-listener/components/ImportModal.vue3.js +0 -5
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +0 -29
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +0 -1
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +0 -83
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +0 -4
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +0 -8
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +0 -4
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +0 -15
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/load-document-from-source.js +0 -28
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +0 -15
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +0 -1
- package/dist/v2/features/import-listener/helpers/wait-for-condition.js +0 -16
- package/dist/v2/features/import-listener/index.d.ts +0 -2
- package/dist/v2/features/import-listener/index.d.ts.map +0 -1
- package/dist/v2/features/import-listener/index.js +0 -4
- /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.d.ts +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/generate-unique-slug.js +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.d.ts +0 -0
- /package/dist/v2/features/{import-listener → command-palette}/helpers/import-document-to-workspace.js +0 -0
|
@@ -1,66 +1,68 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as y, ref as p, createElementBlock as v, openBlock as c, Fragment as u, createElementVNode as T, createVNode as i, renderList as x, createBlock as b, unref as r, withCtx as g, createTextVNode as h } from "vue";
|
|
2
2
|
import { useModal as d, ScalarButton as k } from "@scalar/components";
|
|
3
3
|
import { ScalarIconPlus as M } from "@scalar/icons";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import S from "./components/EnvironmentCreateModal.vue.js";
|
|
5
|
+
import N from "./components/EnvironmentDeleteModal.vue.js";
|
|
6
6
|
import w from "./components/Environment.vue.js";
|
|
7
|
-
const
|
|
7
|
+
const A = { class: "text-c-3 flex h-full items-center justify-center rounded-lg border p-4" }, z = /* @__PURE__ */ y({
|
|
8
8
|
__name: "EnvironmentsList",
|
|
9
9
|
props: {
|
|
10
10
|
environments: {},
|
|
11
11
|
eventBus: {},
|
|
12
|
+
activeEnvironment: {},
|
|
12
13
|
collectionType: {}
|
|
13
14
|
},
|
|
14
15
|
setup(e) {
|
|
15
|
-
const s = d(), m = d(), t =
|
|
16
|
-
t.value =
|
|
17
|
-
},
|
|
16
|
+
const s = d(), m = d(), t = p(null), f = (o) => {
|
|
17
|
+
t.value = o, m.show();
|
|
18
|
+
}, E = () => {
|
|
18
19
|
t.value && e.eventBus.emit("environment:delete:environment", {
|
|
19
20
|
environmentName: t.value,
|
|
20
21
|
collectionType: e.collectionType
|
|
21
22
|
});
|
|
22
|
-
}, a = (
|
|
23
|
-
t.value =
|
|
23
|
+
}, a = (o) => {
|
|
24
|
+
t.value = o ?? null, s.show();
|
|
24
25
|
};
|
|
25
|
-
return (
|
|
26
|
-
(c(!0), u
|
|
27
|
-
key:
|
|
26
|
+
return (o, l) => (c(), v(u, null, [
|
|
27
|
+
(c(!0), v(u, null, x(Object.entries(e.environments), ([n, B]) => (c(), b(w, {
|
|
28
|
+
key: n,
|
|
28
29
|
collectionType: e.collectionType,
|
|
29
30
|
environment: B,
|
|
30
|
-
environmentName:
|
|
31
|
+
environmentName: n,
|
|
31
32
|
eventBus: e.eventBus,
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
33
|
+
isActive: e.activeEnvironment === n,
|
|
34
|
+
onDelete: () => f(n),
|
|
35
|
+
onEdit: () => a(n)
|
|
36
|
+
}, null, 8, ["collectionType", "environment", "environmentName", "eventBus", "isActive", "onDelete", "onEdit"]))), 128)),
|
|
37
|
+
T("div", A, [
|
|
38
|
+
i(r(k), {
|
|
37
39
|
class: "hover:bg-b-2 hover:text-c-1 flex items-center gap-2",
|
|
38
40
|
size: "sm",
|
|
39
41
|
variant: "ghost",
|
|
40
|
-
onClick:
|
|
42
|
+
onClick: l[0] || (l[0] = () => a())
|
|
41
43
|
}, {
|
|
42
44
|
default: g(() => [
|
|
43
|
-
r(
|
|
44
|
-
|
|
45
|
+
i(r(M)),
|
|
46
|
+
l[1] || (l[1] = h(" Add Environment ", -1))
|
|
45
47
|
]),
|
|
46
48
|
_: 1
|
|
47
49
|
})
|
|
48
50
|
]),
|
|
49
|
-
|
|
51
|
+
i(S, {
|
|
50
52
|
collectionType: e.collectionType,
|
|
51
53
|
environments: e.environments,
|
|
52
54
|
eventBus: e.eventBus,
|
|
53
55
|
selectedEnvironmentName: t.value,
|
|
54
|
-
state:
|
|
56
|
+
state: r(s)
|
|
55
57
|
}, null, 8, ["collectionType", "environments", "eventBus", "selectedEnvironmentName", "state"]),
|
|
56
|
-
|
|
58
|
+
i(N, {
|
|
57
59
|
name: t.value,
|
|
58
|
-
state:
|
|
59
|
-
onSubmit:
|
|
60
|
+
state: r(m),
|
|
61
|
+
onSubmit: E
|
|
60
62
|
}, null, 8, ["name", "state"])
|
|
61
63
|
], 64));
|
|
62
64
|
}
|
|
63
65
|
});
|
|
64
66
|
export {
|
|
65
|
-
|
|
67
|
+
z as default
|
|
66
68
|
};
|
|
@@ -4,6 +4,7 @@ type __VLS_Props = {
|
|
|
4
4
|
environment: XScalarEnvironment;
|
|
5
5
|
environmentName: string;
|
|
6
6
|
eventBus: WorkspaceEventBus;
|
|
7
|
+
isActive?: boolean;
|
|
7
8
|
} & CollectionType;
|
|
8
9
|
declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
9
10
|
delete: () => any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Environment.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/environments/components/Environment.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Environment.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/environments/components/Environment.vue"],"names":[],"mappings":"AAsFA,OAAO,KAAK,EACV,cAAc,EACd,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAInH,KAAK,WAAW,GAAG;IACf,WAAW,EAAE,kBAAkB,CAAA;IAC/B,eAAe,EAAE,MAAM,CAAA;IACvB,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,cAAc,CAAC;;;;;;;;AA6LrB,wBAOG"}
|
|
@@ -1,53 +1,66 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarIconButton as
|
|
3
|
-
import { ScalarIconNotePencil as
|
|
4
|
-
import
|
|
5
|
-
const
|
|
1
|
+
import { defineComponent as v, createElementBlock as s, openBlock as c, normalizeClass as r, createElementVNode as n, createVNode as i, createCommentVNode as u, normalizeStyle as f, toDisplayString as x, createTextVNode as p, unref as o } from "vue";
|
|
2
|
+
import { ScalarIconButton as a } from "@scalar/components";
|
|
3
|
+
import { ScalarIconNotePencil as b, ScalarIconTrash as g } from "@scalar/icons";
|
|
4
|
+
import y from "./EnvironmentVariablesTable.vue.js";
|
|
5
|
+
const N = { class: "flex items-center gap-1.5" }, B = { class: "flex h-6 w-6 items-center justify-center p-1" }, T = { class: "px-1 py-0.5 text-sm font-medium" }, h = {
|
|
6
|
+
key: 0,
|
|
7
|
+
class: "bg-c-accent text-b-1 flex items-center gap-1 rounded px-1.5 py-0.5 text-xs font-medium",
|
|
8
|
+
title: "This is the active environment"
|
|
9
|
+
}, E = { class: "hidden flex-row items-center gap-1 group-hover:flex" }, V = /* @__PURE__ */ v({
|
|
6
10
|
__name: "Environment",
|
|
7
11
|
props: {
|
|
8
12
|
environment: {},
|
|
9
13
|
environmentName: {},
|
|
10
14
|
eventBus: {},
|
|
15
|
+
isActive: { type: Boolean, default: !1 },
|
|
11
16
|
collectionType: {}
|
|
12
17
|
},
|
|
13
18
|
emits: ["edit", "delete"],
|
|
14
|
-
setup(e, { emit:
|
|
15
|
-
const l =
|
|
16
|
-
return (
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
setup(e, { emit: m }) {
|
|
20
|
+
const l = m;
|
|
21
|
+
return (k, t) => (c(), s("div", {
|
|
22
|
+
class: r(["group relative rounded-lg border transition-colors", e.isActive ? "border-c-accent bg-c-accent/5" : ""])
|
|
23
|
+
}, [
|
|
24
|
+
n("div", {
|
|
25
|
+
class: r(["flex justify-between rounded-t-lg px-1 py-1 text-sm", e.isActive ? "bg-c-accent/10" : "bg-b-2"])
|
|
26
|
+
}, [
|
|
27
|
+
n("div", N, [
|
|
28
|
+
n("div", B, [
|
|
20
29
|
n("span", {
|
|
21
30
|
class: "h-2.5 w-2.5 rounded-full",
|
|
22
|
-
style:
|
|
31
|
+
style: f({ backgroundColor: e.environment.color })
|
|
23
32
|
}, null, 4)
|
|
24
33
|
]),
|
|
25
|
-
n("span",
|
|
34
|
+
n("span", T, x(e.environmentName), 1),
|
|
35
|
+
e.isActive ? (c(), s("span", h, [...t[2] || (t[2] = [
|
|
36
|
+
n("span", { class: "size-1.5 rounded-full bg-current" }, null, -1),
|
|
37
|
+
p(" Active ", -1)
|
|
38
|
+
])])) : u("", !0)
|
|
26
39
|
]),
|
|
27
|
-
n("div",
|
|
28
|
-
i(o(
|
|
29
|
-
icon: o(
|
|
40
|
+
n("div", E, [
|
|
41
|
+
i(o(a), {
|
|
42
|
+
icon: o(b),
|
|
30
43
|
label: "Edit Environment",
|
|
31
44
|
size: "sm",
|
|
32
|
-
onClick: t[0] || (t[0] = (
|
|
45
|
+
onClick: t[0] || (t[0] = (d) => l("edit"))
|
|
33
46
|
}, null, 8, ["icon"]),
|
|
34
|
-
i(o(
|
|
35
|
-
icon: o(
|
|
47
|
+
i(o(a), {
|
|
48
|
+
icon: o(g),
|
|
36
49
|
label: "Delete Environment",
|
|
37
50
|
size: "sm",
|
|
38
|
-
onClick: t[1] || (t[1] = (
|
|
51
|
+
onClick: t[1] || (t[1] = (d) => l("delete"))
|
|
39
52
|
}, null, 8, ["icon"])
|
|
40
53
|
])
|
|
41
|
-
]),
|
|
42
|
-
i(
|
|
54
|
+
], 2),
|
|
55
|
+
i(y, {
|
|
43
56
|
collectionType: e.collectionType,
|
|
44
57
|
environment: e.environment,
|
|
45
58
|
environmentName: e.environmentName,
|
|
46
59
|
eventBus: e.eventBus
|
|
47
60
|
}, null, 8, ["collectionType", "environment", "environmentName", "eventBus"])
|
|
48
|
-
]));
|
|
61
|
+
], 2));
|
|
49
62
|
}
|
|
50
63
|
});
|
|
51
64
|
export {
|
|
52
|
-
|
|
65
|
+
V as default
|
|
53
66
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/Modal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/Modal.vue"],"names":[],"mappings":"AAsWA,OAAO,EAGL,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,6BAA6B,CAAA;AAE/E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAExE,OAAO,EASL,KAAK,WAAW,EAChB,KAAK,gBAAgB,EACtB,MAAM,KAAK,CAAA;AAIZ,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAIxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD,MAAM,MAAM,UAAU,GAAG;IACvB,4DAA4D;IAC5D,cAAc,EAAE,cAAc,CAAA;IAC9B,qDAAqD;IACrD,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,iDAAiD;IACjD,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrC,4CAA4C;IAC5C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,mDAAmD;IACnD,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC3C,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5C,2CAA2C;IAC3C,UAAU,EAAE,UAAU,CAAA;IACtB,0DAA0D;IAC1D,YAAY,EAAE,qBAAqB,CAAA;IACnC,iDAAiD;IACjD,OAAO,EAAE,YAAY,EAAE,CAAA;IACvB,wDAAwD;IACxD,OAAO,EAAE,gBAAgB,CACvB,OAAO,CACL,IAAI,CACF,4BAA4B,EAC1B,gBAAgB,GAChB,eAAe,GACf,kBAAkB,GAClB,eAAe,GACf,SAAS,CACZ,CACF,CACF,CAAA;CACF,CAAA;AAED;;;;GAIG;;;;;AACH,wBAwVC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Modal.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-07c87e38"]]);
|
|
5
5
|
export {
|
|
6
6
|
p as default
|
|
7
7
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as I, ref as w, useId as N, watch as W, nextTick as E, onBeforeMount as F, onBeforeUnmount as U, computed as u, toValue as V, withDirectives as d, createElementBlock as m, openBlock as r, createElementVNode as i, unref as o, createVNode as l, withCtx as D, vShow as v } from "vue";
|
|
2
2
|
import { addScalarClassesToHeadless as $, ScalarTeleportRoot as A } from "@scalar/components";
|
|
3
3
|
import { ScalarToasts as z } from "@scalar/use-toasts";
|
|
4
4
|
import { useFocusTrap as H } from "@vueuse/integrations/useFocusTrap";
|
|
@@ -16,7 +16,7 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
16
16
|
}, Y = {
|
|
17
17
|
key: 1,
|
|
18
18
|
class: "flex h-full w-full items-center justify-center"
|
|
19
|
-
}, Z = {}, me = /* @__PURE__ */
|
|
19
|
+
}, Z = {}, me = /* @__PURE__ */ I({
|
|
20
20
|
...Z,
|
|
21
21
|
__name: "Modal",
|
|
22
22
|
props: {
|
|
@@ -32,8 +32,7 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
32
32
|
options: {}
|
|
33
33
|
},
|
|
34
34
|
setup(e, { expose: x }) {
|
|
35
|
-
|
|
36
|
-
const r = {
|
|
35
|
+
const f = {
|
|
37
36
|
label: "default",
|
|
38
37
|
id: "default"
|
|
39
38
|
}, n = w(!1);
|
|
@@ -44,41 +43,39 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
44
43
|
modalState: e.modalState,
|
|
45
44
|
store: e.workspaceStore
|
|
46
45
|
}), j(e.eventBus, "modal");
|
|
47
|
-
const
|
|
46
|
+
const S = w(null), h = N(), { activate: y, deactivate: B } = H(S, {
|
|
48
47
|
allowOutsideClick: !0,
|
|
49
|
-
fallbackFocus: `#${
|
|
50
|
-
}),
|
|
51
|
-
B(), e.eventBus.emit("operation:cancel:request")
|
|
52
|
-
e.document.value?.["x-scalar-navigation"]?.name ?? ""
|
|
53
|
-
);
|
|
48
|
+
fallbackFocus: `#${h}`
|
|
49
|
+
}), b = () => {
|
|
50
|
+
B(), e.eventBus.emit("operation:cancel:request");
|
|
54
51
|
}, g = q(() => typeof window < "u" ? window.document.body : null);
|
|
55
|
-
|
|
52
|
+
W(
|
|
56
53
|
() => e.modalState.open,
|
|
57
54
|
(a) => {
|
|
58
|
-
g.value = a, a ? y({ checkCanFocusTrap: () =>
|
|
55
|
+
g.value = a, a ? y({ checkCanFocusTrap: () => E() }) : b();
|
|
59
56
|
}
|
|
60
|
-
),
|
|
57
|
+
), F(() => $()), U(() => b());
|
|
61
58
|
const p = 288, c = u(
|
|
62
59
|
() => e.workspaceStore?.workspace?.["x-scalar-sidebar-width"] ?? p
|
|
63
|
-
), T = (a) => e.workspaceStore?.update("x-scalar-sidebar-width", a),
|
|
60
|
+
), T = (a) => e.workspaceStore?.update("x-scalar-sidebar-width", a), k = u(
|
|
64
61
|
() => R(e.workspaceStore, e.document.value)
|
|
65
62
|
), C = u(
|
|
66
63
|
() => L(
|
|
67
64
|
e.document.value?.components?.securitySchemes,
|
|
68
|
-
|
|
65
|
+
V(e.options)?.authentication?.securitySchemes,
|
|
69
66
|
e.workspaceStore.auth,
|
|
70
67
|
e.document.value?.["x-scalar-navigation"]?.name ?? ""
|
|
71
68
|
)
|
|
72
69
|
);
|
|
73
70
|
return x({
|
|
74
71
|
sidebarWidth: c,
|
|
75
|
-
environment:
|
|
76
|
-
}), (a, t) =>
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
id: o(
|
|
72
|
+
environment: k
|
|
73
|
+
}), (a, t) => d((r(), m("div", P, [
|
|
74
|
+
i("div", J, [
|
|
75
|
+
d(i("div", {
|
|
76
|
+
id: o(h),
|
|
80
77
|
ref_key: "client",
|
|
81
|
-
ref:
|
|
78
|
+
ref: S,
|
|
82
79
|
"aria-label": "API Client",
|
|
83
80
|
"aria-modal": "true",
|
|
84
81
|
class: "scalar-app-layout scalar-client flex",
|
|
@@ -86,21 +83,21 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
86
83
|
tabindex: "-1"
|
|
87
84
|
}, [
|
|
88
85
|
l(o(A), null, {
|
|
89
|
-
default:
|
|
86
|
+
default: D(() => [
|
|
90
87
|
l(o(z)),
|
|
91
|
-
e.document.value && e.path?.value && e.method?.value ? (
|
|
88
|
+
e.document.value && e.path?.value && e.method?.value ? (r(), m("main", X, [
|
|
92
89
|
l(o(G), {
|
|
93
90
|
modelValue: n.value,
|
|
94
|
-
"onUpdate:modelValue": t[0] || (t[0] = (
|
|
91
|
+
"onUpdate:modelValue": t[0] || (t[0] = (s) => n.value = s),
|
|
95
92
|
class: "absolute top-2 left-3 z-[10001]"
|
|
96
93
|
}, null, 8, ["modelValue"]),
|
|
97
|
-
|
|
94
|
+
d(l(o(K), {
|
|
98
95
|
sidebarWidth: c.value,
|
|
99
96
|
"onUpdate:sidebarWidth": [
|
|
100
|
-
t[1] || (t[1] = (
|
|
97
|
+
t[1] || (t[1] = (s) => c.value = s),
|
|
101
98
|
T
|
|
102
99
|
],
|
|
103
|
-
activeWorkspace:
|
|
100
|
+
activeWorkspace: f,
|
|
104
101
|
class: "z-[10000] h-full max-md:absolute! max-md:w-full!",
|
|
105
102
|
documents: [e.document.value],
|
|
106
103
|
eventBus: e.eventBus,
|
|
@@ -110,14 +107,14 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
110
107
|
workspaces: [],
|
|
111
108
|
onSelectItem: e.sidebarState.handleSelectItem
|
|
112
109
|
}, null, 8, ["sidebarWidth", "documents", "eventBus", "sidebarState", "onSelectItem"]), [
|
|
113
|
-
[
|
|
110
|
+
[v, n.value]
|
|
114
111
|
]),
|
|
115
112
|
l(O, {
|
|
116
|
-
activeWorkspace:
|
|
113
|
+
activeWorkspace: f,
|
|
117
114
|
class: "flex-1",
|
|
118
115
|
document: e.document.value,
|
|
119
116
|
documentSlug: e.document.value["x-scalar-navigation"]?.id ?? "",
|
|
120
|
-
environment:
|
|
117
|
+
environment: k.value,
|
|
121
118
|
eventBus: e.eventBus,
|
|
122
119
|
exampleName: e.exampleName?.value,
|
|
123
120
|
layout: "modal",
|
|
@@ -128,20 +125,22 @@ const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q =
|
|
|
128
125
|
securitySchemes: C.value,
|
|
129
126
|
workspaceStore: e.workspaceStore
|
|
130
127
|
}, null, 8, ["document", "documentSlug", "environment", "eventBus", "exampleName", "method", "options", "path", "plugins", "securitySchemes", "workspaceStore"])
|
|
131
|
-
])) : (
|
|
132
|
-
|
|
128
|
+
])) : (r(), m("div", Y, [...t[3] || (t[3] = [
|
|
129
|
+
i("span", { class: "text-c-3" }, "No document selected", -1)
|
|
133
130
|
])]))
|
|
134
131
|
]),
|
|
135
132
|
_: 1
|
|
136
133
|
})
|
|
137
|
-
], 8, Q),
|
|
138
|
-
|
|
134
|
+
], 8, Q), [
|
|
135
|
+
[v, e.modalState.open]
|
|
136
|
+
]),
|
|
137
|
+
i("div", {
|
|
139
138
|
class: "scalar-app-exit",
|
|
140
|
-
onClick: t[2] || (t[2] = (
|
|
139
|
+
onClick: t[2] || (t[2] = (s) => e.modalState.hide())
|
|
141
140
|
})
|
|
142
141
|
])
|
|
143
142
|
], 512)), [
|
|
144
|
-
[
|
|
143
|
+
[v, e.modalState.open]
|
|
145
144
|
]);
|
|
146
145
|
}
|
|
147
146
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-api-client-modal.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/create-api-client-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"create-api-client-modal.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/create-api-client-modal.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAY,MAAM,oBAAoB,CAAA;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,iBAAiB,EAA2B,MAAM,gCAAgC,CAAA;AAEhG,OAAO,EAAE,KAAK,GAAG,EAA6C,MAAM,KAAK,CAAA;AAEzE,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,sDAAsD,CAAA;AAG7D,OAAc,EAAE,KAAK,UAAU,EAAE,MAAM,+BAA+B,CAAA;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,KAAK,2BAA2B,GAAG;IACjC,4CAA4C;IAC5C,EAAE,EAAE,WAAW,GAAG,IAAI,CAAA;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,kFAAkF;IAClF,QAAQ,CAAC,EAAE,iBAAiB,CAAA;IAC5B,6DAA6D;IAC7D,cAAc,EAAE,cAAc,CAAA;IAC9B,iDAAiD;IACjD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB,wGAAwG;IACxG,OAAO,CAAC,EAAE,UAAU,CAAC,SAAS,CAAC,CAAA;CAChC,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,GAAG,EAAE,GAAG,CAAA;IACR,IAAI,EAAE,CAAC,OAAO,CAAC,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,KAAK,EAAE,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAA;IAC/C,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;IACtC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,wEASlC,2BAA2B,KAAG,cAqHhC,CAAA"}
|
|
@@ -1,47 +1,64 @@
|
|
|
1
1
|
import { useModal as P } from "@scalar/components";
|
|
2
|
-
import { createWorkspaceEventBus as
|
|
3
|
-
import { reactive as
|
|
4
|
-
import { resolveRouteParameters as
|
|
5
|
-
import {
|
|
6
|
-
import j from "../
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
import { createWorkspaceEventBus as S } from "@scalar/workspace-store/events";
|
|
3
|
+
import { ref as A, reactive as W, computed as o, createApp as I, watch as N } from "vue";
|
|
4
|
+
import { resolveRouteParameters as O } from "./resolve-route-parameters.js";
|
|
5
|
+
import { restoreWorkspaceState as R } from "./restore-workspace-state.js";
|
|
6
|
+
import { useModalSidebar as j } from "../hooks/use-modal-sidebar.js";
|
|
7
|
+
import B from "../Modal.vue.js";
|
|
8
|
+
const D = ({
|
|
9
|
+
el: v,
|
|
10
|
+
eventBus: h = S({
|
|
10
11
|
debug: !1
|
|
11
12
|
}),
|
|
12
|
-
mountOnInitialize:
|
|
13
|
+
mountOnInitialize: M = !0,
|
|
13
14
|
plugins: g = [],
|
|
14
|
-
workspaceStore:
|
|
15
|
+
workspaceStore: t,
|
|
15
16
|
options: x = {}
|
|
16
17
|
}) => {
|
|
17
|
-
const
|
|
18
|
+
const u = {
|
|
18
19
|
path: "default",
|
|
19
20
|
method: "default",
|
|
20
21
|
example: "default",
|
|
21
|
-
documentSlug:
|
|
22
|
-
}, m =
|
|
23
|
-
Object.assign(m,
|
|
24
|
-
},
|
|
25
|
-
workspaceStore:
|
|
26
|
-
documentSlug:
|
|
27
|
-
path:
|
|
28
|
-
method:
|
|
29
|
-
exampleName:
|
|
30
|
-
route:
|
|
31
|
-
}),
|
|
32
|
-
document:
|
|
33
|
-
eventBus:
|
|
34
|
-
exampleName:
|
|
35
|
-
method:
|
|
36
|
-
modalState:
|
|
37
|
-
path:
|
|
22
|
+
documentSlug: t.workspace["x-scalar-active-document"] || "default"
|
|
23
|
+
}, n = A(null), m = W({ ...u }), s = (e) => {
|
|
24
|
+
Object.assign(m, u, e);
|
|
25
|
+
}, a = o(() => O(t, m)), l = o(() => a.value.documentSlug), d = o(() => a.value.path), i = o(() => a.value.method), p = o(() => a.value.example), b = o(() => t.workspace.documents[l.value ?? ""] ?? null), k = j({
|
|
26
|
+
workspaceStore: t,
|
|
27
|
+
documentSlug: l,
|
|
28
|
+
path: d,
|
|
29
|
+
method: i,
|
|
30
|
+
exampleName: p,
|
|
31
|
+
route: s
|
|
32
|
+
}), r = P(), c = I(B, {
|
|
33
|
+
document: b,
|
|
34
|
+
eventBus: h,
|
|
35
|
+
exampleName: p,
|
|
36
|
+
method: i,
|
|
37
|
+
modalState: r,
|
|
38
|
+
path: d,
|
|
38
39
|
plugins: g,
|
|
39
|
-
sidebarState:
|
|
40
|
-
workspaceStore:
|
|
40
|
+
sidebarState: k,
|
|
41
|
+
workspaceStore: t,
|
|
41
42
|
options: x
|
|
42
|
-
})
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
}), w = () => {
|
|
44
|
+
n.value = window.structuredClone(t.exportWorkspace());
|
|
45
|
+
}, C = () => {
|
|
46
|
+
if (!n.value) {
|
|
47
|
+
console.warn("No workspace store snapshot to restore");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
const e = R({
|
|
51
|
+
workspaceStore: t,
|
|
52
|
+
workspaceState: n.value,
|
|
53
|
+
name: l.value ?? ""
|
|
54
|
+
});
|
|
55
|
+
e.ok || console.error("Failed to restore workspace state", e.error);
|
|
56
|
+
};
|
|
57
|
+
N(
|
|
58
|
+
() => r.open,
|
|
59
|
+
(e) => e ? w() : C()
|
|
60
|
+
), c.config.idPrefix = "scalar-client";
|
|
61
|
+
const f = (e = v) => {
|
|
45
62
|
if (!e) {
|
|
46
63
|
console.error(
|
|
47
64
|
"[@scalar/api-client] Could not create the API client Modal.",
|
|
@@ -50,23 +67,23 @@ const T = ({
|
|
|
50
67
|
);
|
|
51
68
|
return;
|
|
52
69
|
}
|
|
53
|
-
|
|
70
|
+
c.mount(e);
|
|
54
71
|
};
|
|
55
|
-
return
|
|
72
|
+
return M && f(), {
|
|
56
73
|
/** The Vue app instance for the modal. Use with caution. */
|
|
57
|
-
app:
|
|
74
|
+
app: c,
|
|
58
75
|
/** Open the modal and optionally navigate to a specific route. */
|
|
59
76
|
open: (e) => {
|
|
60
|
-
|
|
77
|
+
r.open = !0, e && s(e);
|
|
61
78
|
},
|
|
62
79
|
/** Mount the modal to a given element. */
|
|
63
|
-
mount:
|
|
80
|
+
mount: f,
|
|
64
81
|
/** Navigate to the specified path, method, and example. */
|
|
65
|
-
route:
|
|
82
|
+
route: s,
|
|
66
83
|
/** Controls the visibility of the modal. */
|
|
67
|
-
modalState:
|
|
84
|
+
modalState: r
|
|
68
85
|
};
|
|
69
86
|
};
|
|
70
87
|
export {
|
|
71
|
-
|
|
88
|
+
D as createApiClientModal
|
|
72
89
|
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import type { InMemoryWorkspace } from '@scalar/workspace-store/schemas/inmemory-workspace';
|
|
3
|
+
/**
|
|
4
|
+
* Restores the state of a workspace document by reverting its state
|
|
5
|
+
* to the specified import, while preserving certain live properties
|
|
6
|
+
* such as servers, security schemes, and selected server.
|
|
7
|
+
*/
|
|
8
|
+
export declare const restoreWorkspaceState: ({ workspaceStore, workspaceState, name, }: {
|
|
9
|
+
workspaceStore: WorkspaceStore | null;
|
|
10
|
+
workspaceState: InMemoryWorkspace;
|
|
11
|
+
name: string;
|
|
12
|
+
}) => {
|
|
13
|
+
ok: true;
|
|
14
|
+
} | {
|
|
15
|
+
ok: false;
|
|
16
|
+
error: string;
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=restore-workspace-state.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restore-workspace-state.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/restore-workspace-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oDAAoD,CAAA;AAE3F;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,2CAInC;IACD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,cAAc,EAAE,iBAAiB,CAAA;IACjC,IAAI,EAAE,MAAM,CAAA;CACb,KAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAoD5C,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { unpackProxyObject as c } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
2
|
+
const m = ({
|
|
3
|
+
workspaceStore: r,
|
|
4
|
+
workspaceState: u,
|
|
5
|
+
name: s
|
|
6
|
+
}) => {
|
|
7
|
+
if (!r)
|
|
8
|
+
return { ok: !1, error: "Workspace store is not available" };
|
|
9
|
+
const t = c(r.workspace.documents[s]);
|
|
10
|
+
if (!t)
|
|
11
|
+
return { ok: !1, error: "Current document not found in workspace store" };
|
|
12
|
+
const n = u.documents[s];
|
|
13
|
+
if (!n)
|
|
14
|
+
return { ok: !1, error: "Importing document not found in workspace state" };
|
|
15
|
+
const o = {
|
|
16
|
+
selectedServer: t["x-scalar-selected-server"],
|
|
17
|
+
securitySchemes: t.components?.securitySchemes,
|
|
18
|
+
servers: t.servers
|
|
19
|
+
};
|
|
20
|
+
r.loadWorkspace({
|
|
21
|
+
meta: {},
|
|
22
|
+
documents: {
|
|
23
|
+
[s]: n
|
|
24
|
+
},
|
|
25
|
+
intermediateDocuments: {},
|
|
26
|
+
originalDocuments: {},
|
|
27
|
+
overrides: {},
|
|
28
|
+
history: {},
|
|
29
|
+
auth: {}
|
|
30
|
+
});
|
|
31
|
+
const e = c(r.workspace.documents[s]);
|
|
32
|
+
return e ? (e["x-scalar-selected-server"] = o.selectedServer, e.servers = o.servers, e.components ??= {}, e.components.securitySchemes = o.securitySchemes, { ok: !0 }) : { ok: !1, error: "New document not found in workspace store" };
|
|
33
|
+
};
|
|
34
|
+
export {
|
|
35
|
+
m as restoreWorkspaceState
|
|
36
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA8NA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAElE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAA;AAM/D;;;;;;;GAOG;;IAGC,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;;IAD/B,6CAA6C;cACnC,UAAU,CAAC,SAAS,CAAC;;AAHnC,wBAuSC"}
|