@scalar/api-client 2.36.1 → 2.36.2
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 +36 -0
- package/dist/monacoeditorwork/editor.worker.bundle.js +14463 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +22211 -0
- package/dist/monacoeditorwork/yaml.worker.bundle.js +46771 -0
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +12 -11
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/components/resize/index.d.ts +1 -0
- package/dist/v2/components/resize/index.d.ts.map +1 -1
- package/dist/v2/components/resize/index.js +4 -2
- package/dist/v2/components/resize/use-split-resize.d.ts +27 -0
- package/dist/v2/components/resize/use-split-resize.d.ts.map +1 -0
- package/dist/v2/components/resize/use-split-resize.js +57 -0
- 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 +71 -63
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +7 -1
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +15 -10
- package/dist/v2/features/app/helpers/routes.d.ts +6 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +3 -2
- package/dist/v2/features/app/hooks/use-document-watcher.js +13 -13
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +292 -100
- package/dist/v2/features/collection/DocumentCollection.vue3.js +5 -0
- package/dist/v2/features/collection/OperationCollection.vue.js +20 -19
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +6 -5
- package/dist/v2/features/collection/components/Authentication.vue2.js +16 -15
- package/dist/v2/features/collection/components/Cookies.vue.js +7 -6
- package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Editor/Editor.vue.js +3 -3
- package/dist/v2/features/collection/components/Editor/Editor.vue2.js +182 -171
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts +2 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +13 -12
- package/dist/v2/features/collection/components/Overview.vue2.js +7 -6
- package/dist/v2/features/collection/components/Servers.vue.js +64 -63
- package/dist/v2/features/collection/components/Settings.vue.js +8 -7
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts +18 -0
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.js +7 -0
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue2.js +136 -0
- package/dist/v2/features/editor/config.d.ts +16 -0
- package/dist/v2/features/editor/config.d.ts.map +1 -0
- package/dist/v2/features/editor/config.js +16 -0
- package/dist/v2/features/editor/helpers/configure-language-support.d.ts +13 -0
- package/dist/v2/features/editor/helpers/configure-language-support.d.ts.map +1 -0
- package/dist/v2/features/{collection/components/Editor → editor}/helpers/configure-language-support.js +6 -7
- package/dist/v2/features/editor/helpers/ensure-monaco-environment.d.ts.map +1 -0
- package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.js +9 -12
- package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +12 -0
- package/dist/v2/features/editor/helpers/json/create-json-model.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/create-json-model.js +19 -0
- package/dist/v2/features/editor/helpers/json/get-json-ast-node-from-path.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-ast.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-pointer-links.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-pointer-path.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/json/json-pointer-path.js +21 -0
- package/dist/v2/features/editor/helpers/model.d.ts +9 -0
- package/dist/v2/features/editor/helpers/model.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts +14 -0
- package/dist/v2/features/editor/helpers/range-to-whole-line.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/range-to-whole-line.js +8 -0
- package/dist/v2/features/editor/helpers/theme/apply-scalar-theme.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/theme/load-css-variables.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +13 -0
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts.map +1 -0
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.js +19 -0
- package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.d.ts +2 -2
- package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-editor-markers.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-editor.d.ts +39 -0
- package/dist/v2/features/editor/hooks/use-editor.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-editor.js +107 -0
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +16 -0
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.js +27 -0
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts +77 -0
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.d.ts.map +1 -0
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +316 -0
- package/dist/v2/features/editor/index.d.ts +5 -0
- package/dist/v2/features/editor/index.d.ts.map +1 -0
- package/dist/v2/features/editor/index.js +10 -0
- package/dist/v2/features/operation/Operation.vue.js +18 -17
- package/dist/v2/types/configuration.d.ts +11 -0
- package/dist/v2/types/configuration.d.ts.map +1 -0
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +24 -18
- package/dist/assets/yaml.worker-CcQnAKCg.js +0 -490
- package/dist/v2/features/collection/DocumentCollection.vue2.js +0 -4
- package/dist/v2/features/collection/components/Editor/helpers/apply-scalar-theme.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts +0 -7
- package/dist/v2/features/collection/components/Editor/helpers/configure-language-support.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/ensure-monaco-environment.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/get-json-ast-node-from-path.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/get-yaml-node-range-from-path.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-ast.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-links.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/json-pointer-path.js +0 -20
- package/dist/v2/features/collection/components/Editor/helpers/load-css-variables.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts +0 -2
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/helpers/yaml.worker.js +0 -11
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-markers.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts +0 -39
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.d.ts.map +0 -1
- package/dist/v2/features/collection/components/Editor/hooks/use-editor.js +0 -153
- /package/dist/v2/features/{collection/components/Editor → editor}/helpers/ensure-monaco-environment.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/get-json-ast-node-from-path.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-ast.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-links.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/json}/json-pointer-path.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/apply-scalar-theme.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/theme}/load-css-variables.js +0 -0
- /package/dist/v2/features/{collection/components/Editor/helpers → editor/helpers/yaml}/get-yaml-node-range-from-path.js +0 -0
- /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.d.ts +0 -0
- /package/dist/v2/features/{collection/components/Editor → editor}/hooks/use-editor-markers.js +0 -0
- /package/dist/v2/features/{collection/components/Editor → editor}/schemas/openapi-3.1-schema.json.js +0 -0
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarButton as
|
|
3
|
-
import { ScalarIconFloppyDisk as
|
|
4
|
-
import { LibraryIcon as
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { defineComponent as P, computed as f, ref as B, createElementBlock as x, openBlock as u, Fragment as W, createElementVNode as o, createVNode as l, createBlock as p, createCommentVNode as w, withCtx as a, unref as n, resolveDynamicComponent as Y, mergeProps as q, createTextVNode as S } from "vue";
|
|
2
|
+
import { useModal as T, ScalarButton as d, ScalarModal as V } from "@scalar/components";
|
|
3
|
+
import { ScalarIconFloppyDisk as M, ScalarIconSpinner as L, ScalarIconCloudArrowDown as O, ScalarIconWarning as G } from "@scalar/icons";
|
|
4
|
+
import { LibraryIcon as H } from "@scalar/icons/library";
|
|
5
|
+
import { apply as J } from "@scalar/json-magic/diff";
|
|
6
|
+
import { useToasts as K } from "@scalar/use-toasts";
|
|
7
|
+
import { deepClone as Q } from "@scalar/workspace-store/helpers/deep-clone";
|
|
8
|
+
import { RouterView as X } from "vue-router";
|
|
9
|
+
import Z from "../../../components/IconSelector.vue.js";
|
|
10
|
+
import ee from "../../components/callout/Callout.vue.js";
|
|
11
|
+
import te from "./components/LabelInput.vue.js";
|
|
12
|
+
import oe from "./components/SyncConflictResolutionEditor.vue.js";
|
|
13
|
+
import ne from "./components/Tabs.vue.js";
|
|
14
|
+
const se = { class: "custom-scroll h-full" }, le = {
|
|
11
15
|
key: 0,
|
|
12
16
|
class: "w-full px-3 md:mx-auto md:max-w-180"
|
|
13
|
-
},
|
|
17
|
+
}, ae = ["aria-label"], re = { class: "flex flex-row items-center justify-between gap-2" }, ce = { class: "flex min-w-0 items-center gap-2" }, ue = { class: "group relative ml-1.25 min-w-0" }, ie = { class: "px-1.5 py-8" }, de = {
|
|
14
18
|
key: 1,
|
|
15
19
|
class: "flex w-full flex-1 items-center justify-center"
|
|
16
|
-
},
|
|
20
|
+
}, me = { class: "flex flex-col gap-5" }, fe = { class: "flex gap-3" }, pe = {
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
class: "bg-b-3 text-c-2 flex size-10 shrink-0 items-center justify-center rounded-lg"
|
|
23
|
+
}, ve = { class: "flex flex-wrap items-center justify-end gap-2 border-t border-[var(--scalar-border-color)] pt-4" }, ye = { class: "flex h-full w-full flex-col gap-4 overflow-hidden" }, he = {
|
|
17
24
|
name: "DocumentCollection"
|
|
18
|
-
},
|
|
19
|
-
...
|
|
25
|
+
}, Me = /* @__PURE__ */ P({
|
|
26
|
+
...he,
|
|
20
27
|
props: {
|
|
21
28
|
documentSlug: {},
|
|
22
29
|
document: {},
|
|
@@ -32,113 +39,298 @@ const D = { class: "custom-scroll h-full" }, N = {
|
|
|
32
39
|
plugins: {},
|
|
33
40
|
customThemes: {},
|
|
34
41
|
currentTheme: {},
|
|
35
|
-
isDarkMode: { type: Boolean }
|
|
42
|
+
isDarkMode: { type: Boolean },
|
|
43
|
+
fetchRegistryDocument: { type: Function }
|
|
36
44
|
},
|
|
37
|
-
setup(
|
|
38
|
-
const
|
|
39
|
-
() =>
|
|
40
|
-
),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
45
|
+
setup(v) {
|
|
46
|
+
const t = v, k = f(() => t.document?.info?.title ?? ""), b = f(
|
|
47
|
+
() => t.document?.["x-scalar-icon"] || "interface-content-folder"
|
|
48
|
+
), y = T(), m = T(), N = f(
|
|
49
|
+
() => t.document?.["x-scalar-is-dirty"] === !0
|
|
50
|
+
), C = f(
|
|
51
|
+
() => t.document?.["x-scalar-original-source-url"]
|
|
52
|
+
), D = f(
|
|
53
|
+
() => t.document?.["x-scalar-registry-meta"]
|
|
54
|
+
), I = f(
|
|
55
|
+
() => C.value !== void 0 || D.value !== void 0
|
|
56
|
+
), { toast: h } = K(), E = () => {
|
|
57
|
+
t.workspaceStore.revertDocumentChanges(t.documentSlug);
|
|
58
|
+
}, R = () => {
|
|
59
|
+
t.workspaceStore.saveDocument(t.documentSlug);
|
|
60
|
+
}, F = async () => {
|
|
61
|
+
await t.workspaceStore.saveDocument(t.documentSlug), m.hide(), await g();
|
|
62
|
+
}, j = async () => {
|
|
63
|
+
await t.workspaceStore.revertDocumentChanges(t.documentSlug), m.hide(), await g();
|
|
64
|
+
}, i = B(!1), c = B(null), $ = async () => {
|
|
65
|
+
const r = D.value;
|
|
66
|
+
if (r && t.fetchRegistryDocument)
|
|
67
|
+
try {
|
|
68
|
+
const s = await t.fetchRegistryDocument(r);
|
|
69
|
+
return s.ok ? { document: s.data } : (h(s.error, "error"), null);
|
|
70
|
+
} catch {
|
|
71
|
+
return h("Failed to resolve document from registry", "error"), null;
|
|
72
|
+
}
|
|
73
|
+
const e = C.value;
|
|
74
|
+
return e ? { url: e } : null;
|
|
75
|
+
}, z = () => {
|
|
76
|
+
y.hide(), i.value = !1, h(
|
|
77
|
+
"Your document has been rebased with the latest version from the source.",
|
|
78
|
+
"info"
|
|
79
|
+
), t.eventBus.emit("hooks:on:rebase:document:complete", {
|
|
80
|
+
meta: {
|
|
81
|
+
documentName: t.documentSlug
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
}, _ = (r) => {
|
|
85
|
+
r !== null && h(r, "error"), i.value = !1;
|
|
86
|
+
}, g = async () => {
|
|
87
|
+
if (N.value) {
|
|
88
|
+
m.show();
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (i.value)
|
|
92
|
+
return;
|
|
93
|
+
i.value = !0;
|
|
94
|
+
const r = await $();
|
|
95
|
+
if (!r) {
|
|
96
|
+
_(null);
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
const e = await t.workspaceStore.rebaseDocument({
|
|
100
|
+
name: t.documentSlug,
|
|
101
|
+
...r
|
|
102
|
+
});
|
|
103
|
+
if (e?.ok) {
|
|
104
|
+
const s = t.workspaceStore.getOriginalDocument(t.documentSlug) ?? {};
|
|
105
|
+
c.value = {
|
|
106
|
+
conflicts: e.conflicts,
|
|
107
|
+
applyChanges: e.applyChanges,
|
|
108
|
+
resolvedDocument: J(Q(s), e.changes),
|
|
109
|
+
originalDocument: s
|
|
110
|
+
}, c.value.conflicts.length > 0 ? y.show() : (await c.value?.applyChanges({
|
|
111
|
+
resolvedDocument: c.value.resolvedDocument
|
|
112
|
+
}), z());
|
|
113
|
+
} else e?.ok === !1 && e.type === "NO_CHANGES_DETECTED" ? z() : _("Failed to sync document");
|
|
114
|
+
}, A = async ({
|
|
115
|
+
resolvedDocument: r
|
|
116
|
+
}) => {
|
|
117
|
+
await c.value?.applyChanges({ resolvedDocument: r }), t.eventBus.emit("hooks:on:rebase:document:complete", {
|
|
118
|
+
meta: {
|
|
119
|
+
documentName: t.documentSlug
|
|
120
|
+
}
|
|
121
|
+
}), y.hide();
|
|
122
|
+
}, U = () => {
|
|
123
|
+
i.value = !1, c.value = null;
|
|
44
124
|
};
|
|
45
|
-
return (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
125
|
+
return (r, e) => (u(), x(W, null, [
|
|
126
|
+
o("div", se, [
|
|
127
|
+
v.document ? (u(), x("div", le, [
|
|
128
|
+
o("div", {
|
|
129
|
+
"aria-label": `title: ${k.value}`,
|
|
130
|
+
class: "mx-auto flex h-fit w-full flex-col gap-2 pt-14 pb-3 md:max-w-180 md:pt-6"
|
|
131
|
+
}, [
|
|
132
|
+
v.document?.["x-scalar-is-dirty"] ? (u(), p(ee, {
|
|
133
|
+
key: 0,
|
|
134
|
+
class: "mb-5",
|
|
135
|
+
type: "warning"
|
|
136
|
+
}, {
|
|
137
|
+
actions: a(() => [
|
|
138
|
+
l(n(d), {
|
|
139
|
+
class: "text-c-2 hover:text-c-1 flex items-center gap-2",
|
|
140
|
+
size: "xs",
|
|
141
|
+
type: "button",
|
|
142
|
+
variant: "outlined",
|
|
143
|
+
onClick: E
|
|
144
|
+
}, {
|
|
145
|
+
default: a(() => [...e[5] || (e[5] = [
|
|
146
|
+
o("span", null, "Undo", -1)
|
|
147
|
+
])]),
|
|
148
|
+
_: 1
|
|
149
|
+
}),
|
|
150
|
+
l(n(d), {
|
|
151
|
+
class: "text-c-btn flex items-center gap-2",
|
|
152
|
+
size: "xs",
|
|
153
|
+
type: "button",
|
|
154
|
+
variant: "solid",
|
|
155
|
+
onClick: R
|
|
156
|
+
}, {
|
|
157
|
+
default: a(() => [
|
|
158
|
+
l(n(M), {
|
|
159
|
+
size: "sm",
|
|
160
|
+
thickness: "1.5"
|
|
161
|
+
}),
|
|
162
|
+
e[6] || (e[6] = o("span", null, "Save", -1))
|
|
163
|
+
]),
|
|
164
|
+
_: 1
|
|
165
|
+
})
|
|
166
|
+
]),
|
|
167
|
+
default: a(() => [
|
|
168
|
+
e[7] || (e[7] = o("p", null, " You have unsaved changes. Save your work to keep your changes, or undo to revert them. ", -1))
|
|
169
|
+
]),
|
|
170
|
+
_: 1
|
|
171
|
+
})) : w("", !0),
|
|
172
|
+
o("div", re, [
|
|
173
|
+
o("div", ce, [
|
|
174
|
+
l(Z, {
|
|
175
|
+
modelValue: b.value,
|
|
176
|
+
placement: "bottom-start",
|
|
177
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => v.eventBus.emit("document:update:icon", s))
|
|
178
|
+
}, {
|
|
179
|
+
default: a(() => [
|
|
180
|
+
l(n(d), {
|
|
181
|
+
class: "hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit",
|
|
182
|
+
variant: "ghost"
|
|
183
|
+
}, {
|
|
184
|
+
default: a(() => [
|
|
185
|
+
l(n(H), {
|
|
186
|
+
class: "text-c-2 size-5",
|
|
187
|
+
src: b.value,
|
|
188
|
+
"stroke-width": "2"
|
|
189
|
+
}, null, 8, ["src"])
|
|
190
|
+
]),
|
|
191
|
+
_: 1
|
|
192
|
+
})
|
|
193
|
+
]),
|
|
194
|
+
_: 1
|
|
195
|
+
}, 8, ["modelValue"]),
|
|
196
|
+
o("div", ue, [
|
|
197
|
+
l(te, {
|
|
198
|
+
class: "text-xl font-bold",
|
|
199
|
+
inputId: "documentName",
|
|
200
|
+
modelValue: k.value,
|
|
201
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => v.eventBus.emit("document:update:info", { title: s }))
|
|
202
|
+
}, null, 8, ["modelValue"])
|
|
203
|
+
])
|
|
204
|
+
]),
|
|
205
|
+
I.value ? (u(), p(n(d), {
|
|
206
|
+
key: 0,
|
|
207
|
+
class: "text-c-2 hover:text-c-1 shrink-0 gap-1.5",
|
|
208
|
+
"data-testid": "document-sync-button",
|
|
209
|
+
disabled: i.value,
|
|
59
210
|
size: "xs",
|
|
211
|
+
title: "Pull the latest version from the document source and merge with your local copy. Save your changes first if you have unsaved edits.",
|
|
212
|
+
type: "button",
|
|
213
|
+
variant: "ghost",
|
|
214
|
+
onClick: g
|
|
215
|
+
}, {
|
|
216
|
+
default: a(() => [
|
|
217
|
+
i.value ? (u(), p(n(L), {
|
|
218
|
+
key: 0,
|
|
219
|
+
class: "size-3.5 animate-spin",
|
|
220
|
+
size: "sm"
|
|
221
|
+
})) : (u(), p(n(O), {
|
|
222
|
+
key: 1,
|
|
223
|
+
class: "size-3.5",
|
|
224
|
+
size: "sm",
|
|
225
|
+
thickness: "1.5"
|
|
226
|
+
})),
|
|
227
|
+
e[8] || (e[8] = o("span", null, "Sync from source", -1))
|
|
228
|
+
]),
|
|
229
|
+
_: 1
|
|
230
|
+
}, 8, ["disabled"])) : w("", !0)
|
|
231
|
+
])
|
|
232
|
+
], 8, ae),
|
|
233
|
+
l(ne, { type: "document" }),
|
|
234
|
+
o("div", ie, [
|
|
235
|
+
l(n(X), null, {
|
|
236
|
+
default: a(({ Component: s }) => [
|
|
237
|
+
(u(), p(Y(s), q(t, { collectionType: "document" }), null, 16))
|
|
238
|
+
]),
|
|
239
|
+
_: 1
|
|
240
|
+
})
|
|
241
|
+
])
|
|
242
|
+
])) : (u(), x("div", de, [...e[9] || (e[9] = [
|
|
243
|
+
o("div", { class: "flex h-full flex-col items-center justify-center" }, [
|
|
244
|
+
o("h1", { class: "text-2xl font-bold" }, "Document not found"),
|
|
245
|
+
o("p", { class: "text-gray-500" }, " The document you are looking for does not exist. ")
|
|
246
|
+
], -1)
|
|
247
|
+
])]))
|
|
248
|
+
]),
|
|
249
|
+
l(n(V), {
|
|
250
|
+
bodyClass: "border-t-0 rounded-t-lg flex flex-col gap-5",
|
|
251
|
+
size: "xs",
|
|
252
|
+
state: n(m),
|
|
253
|
+
title: "Sync requires saved document",
|
|
254
|
+
onClose: e[3] || (e[3] = (s) => n(m).hide())
|
|
255
|
+
}, {
|
|
256
|
+
default: a(() => [
|
|
257
|
+
o("div", me, [
|
|
258
|
+
o("div", fe, [
|
|
259
|
+
o("div", pe, [
|
|
260
|
+
l(n(G), { class: "size-5 text-[var(--scalar-color-yellow)]" })
|
|
261
|
+
]),
|
|
262
|
+
e[10] || (e[10] = o("div", { class: "min-w-0 flex-1 space-y-1" }, [
|
|
263
|
+
o("p", { class: "text-c-1 text-sm leading-snug font-medium" }, " You have unsaved changes "),
|
|
264
|
+
o("p", { class: "text-c-2 text-sm leading-relaxed" }, " Save your work to keep changes, or discard to revert to the last saved version. Then you can sync with the source. ")
|
|
265
|
+
], -1))
|
|
266
|
+
]),
|
|
267
|
+
o("div", ve, [
|
|
268
|
+
l(n(d), {
|
|
269
|
+
size: "sm",
|
|
270
|
+
type: "button",
|
|
271
|
+
variant: "ghost",
|
|
272
|
+
onClick: e[2] || (e[2] = (s) => n(m).hide())
|
|
273
|
+
}, {
|
|
274
|
+
default: a(() => [...e[11] || (e[11] = [
|
|
275
|
+
S(" Cancel ", -1)
|
|
276
|
+
])]),
|
|
277
|
+
_: 1
|
|
278
|
+
}),
|
|
279
|
+
l(n(d), {
|
|
280
|
+
size: "sm",
|
|
60
281
|
type: "button",
|
|
61
282
|
variant: "outlined",
|
|
62
|
-
onClick:
|
|
283
|
+
onClick: j
|
|
63
284
|
}, {
|
|
64
|
-
default:
|
|
65
|
-
|
|
285
|
+
default: a(() => [...e[12] || (e[12] = [
|
|
286
|
+
S(" Discard changes ", -1)
|
|
66
287
|
])]),
|
|
67
288
|
_: 1
|
|
68
289
|
}),
|
|
69
|
-
|
|
70
|
-
class: "
|
|
71
|
-
size: "
|
|
290
|
+
l(n(d), {
|
|
291
|
+
class: "flex items-center gap-2",
|
|
292
|
+
size: "sm",
|
|
72
293
|
type: "button",
|
|
73
294
|
variant: "solid",
|
|
74
|
-
onClick:
|
|
295
|
+
onClick: F
|
|
75
296
|
}, {
|
|
76
|
-
default:
|
|
77
|
-
|
|
297
|
+
default: a(() => [
|
|
298
|
+
l(n(M), {
|
|
78
299
|
size: "sm",
|
|
79
300
|
thickness: "1.5"
|
|
80
301
|
}),
|
|
81
|
-
e[
|
|
302
|
+
e[13] || (e[13] = S(" Save and continue ", -1))
|
|
82
303
|
]),
|
|
83
304
|
_: 1
|
|
84
305
|
})
|
|
85
|
-
]),
|
|
86
|
-
default: n(() => [
|
|
87
|
-
e[4] || (e[4] = t("p", null, " You have unsaved changes. Save your work to keep your changes, or undo to revert them. ", -1))
|
|
88
|
-
]),
|
|
89
|
-
_: 1
|
|
90
|
-
})) : y("", !0),
|
|
91
|
-
t("div", I, [
|
|
92
|
-
o(C, {
|
|
93
|
-
modelValue: d.value,
|
|
94
|
-
placement: "bottom-start",
|
|
95
|
-
"onUpdate:modelValue": e[0] || (e[0] = (r) => a.eventBus.emit("document:update:icon", r))
|
|
96
|
-
}, {
|
|
97
|
-
default: n(() => [
|
|
98
|
-
o(s(i), {
|
|
99
|
-
class: "hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit",
|
|
100
|
-
variant: "ghost"
|
|
101
|
-
}, {
|
|
102
|
-
default: n(() => [
|
|
103
|
-
o(s(w), {
|
|
104
|
-
class: "text-c-2 size-5",
|
|
105
|
-
src: d.value,
|
|
106
|
-
"stroke-width": "2"
|
|
107
|
-
}, null, 8, ["src"])
|
|
108
|
-
]),
|
|
109
|
-
_: 1
|
|
110
|
-
})
|
|
111
|
-
]),
|
|
112
|
-
_: 1
|
|
113
|
-
}, 8, ["modelValue"]),
|
|
114
|
-
t("div", T, [
|
|
115
|
-
o(V, {
|
|
116
|
-
class: "text-xl font-bold",
|
|
117
|
-
inputId: "documentName",
|
|
118
|
-
modelValue: m.value,
|
|
119
|
-
"onUpdate:modelValue": e[1] || (e[1] = (r) => a.eventBus.emit("document:update:info", { title: r }))
|
|
120
|
-
}, null, 8, ["modelValue"])
|
|
121
306
|
])
|
|
122
307
|
])
|
|
123
|
-
]
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
308
|
+
]),
|
|
309
|
+
_: 1
|
|
310
|
+
}, 8, ["state"]),
|
|
311
|
+
c.value ? (u(), p(n(V), {
|
|
312
|
+
key: 0,
|
|
313
|
+
bodyClass: "sync-conflict-modal-root flex h-dvh flex-col p-4",
|
|
314
|
+
maxWidth: "calc(100dvw - 32px)",
|
|
315
|
+
size: "full",
|
|
316
|
+
state: n(y),
|
|
317
|
+
onClose: U
|
|
318
|
+
}, {
|
|
319
|
+
default: a(() => [
|
|
320
|
+
o("div", ye, [
|
|
321
|
+
l(oe, {
|
|
322
|
+
baseDocument: c.value.originalDocument,
|
|
323
|
+
conflicts: c.value.conflicts,
|
|
324
|
+
resolvedDocument: c.value.resolvedDocument,
|
|
325
|
+
onApplyChanges: e[4] || (e[4] = (s) => A(s))
|
|
326
|
+
}, null, 8, ["baseDocument", "conflicts", "resolvedDocument"])
|
|
327
|
+
])
|
|
328
|
+
]),
|
|
329
|
+
_: 1
|
|
330
|
+
}, 8, ["state"])) : w("", !0)
|
|
331
|
+
], 64));
|
|
140
332
|
}
|
|
141
333
|
});
|
|
142
334
|
export {
|
|
143
|
-
|
|
335
|
+
Me as default
|
|
144
336
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { defineComponent as f, computed as m, ref as h, watch as v, createElementBlock as i, openBlock as p, createElementVNode as o, createVNode as s, unref as x, mergeProps as
|
|
2
|
-
import { isHttpMethod as
|
|
3
|
-
import { getResolvedRef as
|
|
4
|
-
import { RouterView as
|
|
1
|
+
import { defineComponent as f, computed as m, ref as h, watch as v, createElementBlock as i, openBlock as p, createElementVNode as o, createVNode as s, unref as x, mergeProps as y } from "vue";
|
|
2
|
+
import { isHttpMethod as _ } from "@scalar/helpers/http/is-http-method";
|
|
3
|
+
import { getResolvedRef as g } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
4
|
+
import { RouterView as w } from "vue-router";
|
|
5
5
|
import k from "./components/LabelInput.vue.js";
|
|
6
6
|
import b from "./components/Tabs.vue.js";
|
|
7
7
|
const B = {
|
|
8
8
|
key: 0,
|
|
9
9
|
class: "custom-scroll h-full"
|
|
10
|
-
}, S = { class: "w-full px-3 md:mx-auto md:max-w-180" }, V = ["aria-label"],
|
|
10
|
+
}, S = { class: "w-full px-3 md:mx-auto md:max-w-180" }, V = ["aria-label"], R = { class: "group relative ml-1.25" }, T = { class: "px-1.5 py-8" }, U = {
|
|
11
11
|
key: 1,
|
|
12
12
|
class: "flex w-full flex-1 items-center justify-center"
|
|
13
|
-
},
|
|
14
|
-
|
|
13
|
+
}, $ = {}, I = /* @__PURE__ */ f({
|
|
14
|
+
...$,
|
|
15
15
|
__name: "OperationCollection",
|
|
16
16
|
props: {
|
|
17
17
|
documentSlug: {},
|
|
@@ -28,12 +28,13 @@ const B = {
|
|
|
28
28
|
plugins: {},
|
|
29
29
|
customThemes: {},
|
|
30
30
|
currentTheme: {},
|
|
31
|
-
isDarkMode: { type: Boolean }
|
|
31
|
+
isDarkMode: { type: Boolean },
|
|
32
|
+
fetchRegistryDocument: { type: Function }
|
|
32
33
|
},
|
|
33
34
|
setup(u) {
|
|
34
35
|
const e = u, n = m(() => {
|
|
35
36
|
if (!(!e.path || !e.method))
|
|
36
|
-
return
|
|
37
|
+
return g(e.document?.paths?.[e.path]?.[e.method]);
|
|
37
38
|
}), l = h(n.value?.summary ?? "");
|
|
38
39
|
v(
|
|
39
40
|
() => n.value?.summary,
|
|
@@ -41,38 +42,38 @@ const B = {
|
|
|
41
42
|
l.value = r ?? "";
|
|
42
43
|
}
|
|
43
44
|
);
|
|
44
|
-
const
|
|
45
|
+
const c = (r) => {
|
|
45
46
|
const { path: t, method: a } = e;
|
|
46
|
-
!t || !a || !
|
|
47
|
+
!t || !a || !_(a) || e.eventBus.emit("operation:update:meta", {
|
|
47
48
|
meta: { path: t, method: a },
|
|
48
49
|
payload: {
|
|
49
50
|
summary: r.trim()
|
|
50
51
|
}
|
|
51
52
|
});
|
|
52
|
-
},
|
|
53
|
+
}, d = m(() => !e.path || !e.method ? "Untitled Operation" : `${e.method.toUpperCase()} ${e.path}`);
|
|
53
54
|
return (r, t) => n.value !== void 0 ? (p(), i("div", B, [
|
|
54
55
|
o("div", S, [
|
|
55
56
|
o("div", {
|
|
56
57
|
"aria-label": `title: ${l.value}`,
|
|
57
58
|
class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-8"
|
|
58
59
|
}, [
|
|
59
|
-
o("div",
|
|
60
|
+
o("div", R, [
|
|
60
61
|
s(k, {
|
|
61
62
|
modelValue: l.value,
|
|
62
63
|
"onUpdate:modelValue": t[0] || (t[0] = (a) => l.value = a),
|
|
63
64
|
class: "text-xl font-bold",
|
|
64
65
|
inputId: "operationSummary",
|
|
65
|
-
placeholder:
|
|
66
|
-
onBlur:
|
|
66
|
+
placeholder: d.value,
|
|
67
|
+
onBlur: c
|
|
67
68
|
}, null, 8, ["modelValue", "placeholder"])
|
|
68
69
|
])
|
|
69
70
|
], 8, V),
|
|
70
71
|
s(b, { type: "operation" }),
|
|
71
|
-
o("div",
|
|
72
|
-
s(x(
|
|
72
|
+
o("div", T, [
|
|
73
|
+
s(x(w), y(e, { collectionType: "operation" }), null, 16)
|
|
73
74
|
])
|
|
74
75
|
])
|
|
75
|
-
])) : (p(), i("div",
|
|
76
|
+
])) : (p(), i("div", U, [...t[1] || (t[1] = [
|
|
76
77
|
o("div", { class: "flex h-full flex-col items-center justify-center" }, [
|
|
77
78
|
o("h1", { class: "text-2xl font-bold" }, "Operation not found"),
|
|
78
79
|
o("p", { class: "text-gray-500" }, " The operation you are looking for does not exist. ")
|
|
@@ -81,5 +82,5 @@ const B = {
|
|
|
81
82
|
}
|
|
82
83
|
});
|
|
83
84
|
export {
|
|
84
|
-
|
|
85
|
+
I as default
|
|
85
86
|
};
|
|
@@ -2,8 +2,8 @@ import { defineComponent as p, ref as m, watch as i, createElementBlock as u, op
|
|
|
2
2
|
import { RouterView as _ } from "vue-router";
|
|
3
3
|
import k from "./components/LabelInput.vue.js";
|
|
4
4
|
import h from "./components/Tabs.vue.js";
|
|
5
|
-
const w = { class: "custom-scroll h-full" }, x = { class: "w-full px-3 md:mx-auto md:max-w-180" }, b = ["aria-label"],
|
|
6
|
-
...
|
|
5
|
+
const w = { class: "custom-scroll h-full" }, x = { class: "w-full px-3 md:mx-auto md:max-w-180" }, b = ["aria-label"], y = { class: "group relative ml-1.25" }, W = { class: "px-1.5 py-8" }, g = {}, S = /* @__PURE__ */ p({
|
|
6
|
+
...g,
|
|
7
7
|
__name: "WorkspaceCollection",
|
|
8
8
|
props: {
|
|
9
9
|
documentSlug: {},
|
|
@@ -20,7 +20,8 @@ const w = { class: "custom-scroll h-full" }, x = { class: "w-full px-3 md:mx-aut
|
|
|
20
20
|
plugins: {},
|
|
21
21
|
customThemes: {},
|
|
22
22
|
currentTheme: {},
|
|
23
|
-
isDarkMode: { type: Boolean }
|
|
23
|
+
isDarkMode: { type: Boolean },
|
|
24
|
+
fetchRegistryDocument: { type: Function }
|
|
24
25
|
},
|
|
25
26
|
setup(s) {
|
|
26
27
|
const e = s, o = m(e.activeWorkspace.label);
|
|
@@ -43,7 +44,7 @@ const w = { class: "custom-scroll h-full" }, x = { class: "w-full px-3 md:mx-aut
|
|
|
43
44
|
"aria-label": `title: ${s.activeWorkspace.label}`,
|
|
44
45
|
class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-6"
|
|
45
46
|
}, [
|
|
46
|
-
a("div",
|
|
47
|
+
a("div", y, [
|
|
47
48
|
l(k, {
|
|
48
49
|
modelValue: o.value,
|
|
49
50
|
"onUpdate:modelValue": c[0] || (c[0] = (n) => o.value = n),
|
|
@@ -55,7 +56,7 @@ const w = { class: "custom-scroll h-full" }, x = { class: "w-full px-3 md:mx-aut
|
|
|
55
56
|
])
|
|
56
57
|
], 8, b),
|
|
57
58
|
l(h, { type: "workspace" }),
|
|
58
|
-
a("div",
|
|
59
|
+
a("div", W, [
|
|
59
60
|
l(f(_), v(e, { collectionType: "workspace" }), null, 16)
|
|
60
61
|
])
|
|
61
62
|
])
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { defineComponent as A, computed as n, ref as O, watchEffect as b, createBlock as N, openBlock as s, createSlots as
|
|
2
|
-
import { ScalarToggle as
|
|
1
|
+
import { defineComponent as A, computed as n, ref as O, watchEffect as b, createBlock as N, openBlock as s, createSlots as R, withCtx as u, createElementVNode as r, normalizeClass as v, createVNode as h, unref as y, createElementBlock as f, Fragment as S, createTextVNode as i } from "vue";
|
|
2
|
+
import { ScalarToggle as U } from "@scalar/components";
|
|
3
3
|
import { isHttpMethod as V } from "@scalar/helpers/http/is-http-method";
|
|
4
4
|
import { getResolvedRef as q } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
5
5
|
import { unpackProxyObject as C } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
6
|
-
import { getDefaultOperationSecurityToggle as
|
|
7
|
-
import
|
|
8
|
-
import { getActiveProxyUrl as
|
|
6
|
+
import { getDefaultOperationSecurityToggle as D } from "../helpers/get-default-operation-security-toggle.js";
|
|
7
|
+
import E from "../../settings/components/Section.vue.js";
|
|
8
|
+
import { getActiveProxyUrl as M } from "../../../helpers/get-active-proxy-url.js";
|
|
9
9
|
import { getSelectedSecurity as g } from "../../operation/helpers/get-selected-security.js";
|
|
10
|
-
import { getServers as
|
|
11
|
-
import
|
|
12
|
-
const
|
|
10
|
+
import { getServers as P } from "../../../helpers/get-servers.js";
|
|
11
|
+
import F from "../../../blocks/scalar-auth-selector-block/components/AuthSelector.vue.js";
|
|
12
|
+
const $ = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
13
13
|
__name: "Authentication",
|
|
14
14
|
props: {
|
|
15
15
|
documentSlug: {},
|
|
@@ -27,6 +27,7 @@ const j = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
|
27
27
|
customThemes: {},
|
|
28
28
|
currentTheme: {},
|
|
29
29
|
isDarkMode: { type: Boolean },
|
|
30
|
+
fetchRegistryDocument: { type: Function },
|
|
30
31
|
collectionType: {}
|
|
31
32
|
},
|
|
32
33
|
setup(e) {
|
|
@@ -36,7 +37,7 @@ const j = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
|
36
37
|
method: e.method ?? "get"
|
|
37
38
|
} : { type: "document" }), l = n(() => e.collectionType === "operation" ? !e.path || !V(e.method) ? null : q(e.document?.paths?.[e.path]?.[e.method]) : null), a = O(!1);
|
|
38
39
|
b(() => {
|
|
39
|
-
a.value =
|
|
40
|
+
a.value = D({
|
|
40
41
|
authStore: e.workspaceStore.auth,
|
|
41
42
|
documentName: e.documentSlug,
|
|
42
43
|
...c.value
|
|
@@ -62,11 +63,11 @@ const j = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
|
62
63
|
});
|
|
63
64
|
return g(o, void 0, e.document?.security ?? []);
|
|
64
65
|
}), p = n(() => e.collectionType === "operation" ? l.value?.security ?? [] : e.document?.security ?? []), k = n(
|
|
65
|
-
() =>
|
|
66
|
+
() => M(
|
|
66
67
|
e.workspaceStore.workspace["x-scalar-active-proxy"],
|
|
67
68
|
e.layout
|
|
68
69
|
) ?? ""
|
|
69
|
-
), d = n(() =>
|
|
70
|
+
), d = n(() => P(l.value?.servers ?? e.document?.servers, {
|
|
70
71
|
documentUrl: e.document?.["x-scalar-original-source-url"]
|
|
71
72
|
})), x = n(() => {
|
|
72
73
|
const o = e.document?.["x-scalar-selected-server"], w = l.value?.["x-scalar-selected-server"] ?? o;
|
|
@@ -86,7 +87,7 @@ const j = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
};
|
|
89
|
-
return (o, t) => (s(), N(
|
|
90
|
+
return (o, t) => (s(), N(E, null, R({
|
|
90
91
|
title: u(() => [
|
|
91
92
|
t[0] || (t[0] = i("Authentication", -1))
|
|
92
93
|
]),
|
|
@@ -111,7 +112,7 @@ const j = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
|
111
112
|
e.collectionType === "operation" && !a.value && "cursor-not-allowed"
|
|
112
113
|
)
|
|
113
114
|
}, [
|
|
114
|
-
h(y(
|
|
115
|
+
h(y(F), {
|
|
115
116
|
class: v([
|
|
116
117
|
"scalar-collection-auth border-none!",
|
|
117
118
|
e.collectionType === "operation" && !a.value && "pointer-events-none opacity-50 mix-blend-luminosity"
|
|
@@ -135,8 +136,8 @@ const j = { class: "flex h-8 items-center" }, Y = /* @__PURE__ */ A({
|
|
|
135
136
|
e.collectionType === "operation" ? {
|
|
136
137
|
name: "actions",
|
|
137
138
|
fn: u(() => [
|
|
138
|
-
r("div",
|
|
139
|
-
h(y(
|
|
139
|
+
r("div", $, [
|
|
140
|
+
h(y(U), {
|
|
140
141
|
class: "w-4",
|
|
141
142
|
modelValue: a.value,
|
|
142
143
|
"onUpdate:modelValue": T
|