@scalar/api-client 2.36.1 → 2.37.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 +57 -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 +23 -17
- 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
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
import { apply as _ } from "@scalar/json-magic/diff";
|
|
2
|
+
import { deepClone as A } from "@scalar/workspace-store/helpers/deep-clone";
|
|
3
|
+
import * as i from "monaco-editor";
|
|
4
|
+
import { ref as ae, shallowRef as L, computed as E, toValue as h, watch as ge, markRaw as pe } from "vue";
|
|
5
|
+
import { createJsonModel as V } from "../helpers/json/create-json-model.js";
|
|
6
|
+
import { ensureJsonPointerLinkSupport as he } from "../helpers/json/json-pointer-links.js";
|
|
7
|
+
import { parseJsonPointerPath as ve } from "../helpers/json/json-pointer-path.js";
|
|
8
|
+
import { rangeToWholeLine as Ce } from "../helpers/range-to-whole-line.js";
|
|
9
|
+
function Je(se) {
|
|
10
|
+
const { baseDocument: ie, resolvedDocument: P, conflicts: w, onApplyChanges: le, onError: F } = se, f = ae([]), S = L([]), Y = L([]), z = L([]), H = ae(-1), M = L(), N = L(), v = L();
|
|
11
|
+
let b, O;
|
|
12
|
+
const x = [];
|
|
13
|
+
let J = [];
|
|
14
|
+
const g = E(() => h(w).map((s) => {
|
|
15
|
+
const r = s[0], d = s[1];
|
|
16
|
+
let u = r[0].path;
|
|
17
|
+
for (const m of r)
|
|
18
|
+
m.path.length < u.length && (u = m.path);
|
|
19
|
+
for (const m of d)
|
|
20
|
+
m.path.length < u.length && (u = m.path);
|
|
21
|
+
return {
|
|
22
|
+
local: {
|
|
23
|
+
path: u,
|
|
24
|
+
changes: r,
|
|
25
|
+
type: r[0].type
|
|
26
|
+
},
|
|
27
|
+
remote: {
|
|
28
|
+
path: u,
|
|
29
|
+
changes: d,
|
|
30
|
+
type: d[0].type
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
})), re = E(
|
|
34
|
+
() => _(
|
|
35
|
+
A(h(P)),
|
|
36
|
+
h(w).flatMap((o) => o[0])
|
|
37
|
+
)
|
|
38
|
+
), ce = E(
|
|
39
|
+
() => _(
|
|
40
|
+
A(h(P)),
|
|
41
|
+
h(w).flatMap((o) => o[1])
|
|
42
|
+
)
|
|
43
|
+
), U = E(() => f.value.filter((o) => o === "idle").length);
|
|
44
|
+
ge(
|
|
45
|
+
g,
|
|
46
|
+
(o) => {
|
|
47
|
+
f.value = o.map((s, r) => f.value[r] ?? "idle");
|
|
48
|
+
},
|
|
49
|
+
{ immediate: !0 }
|
|
50
|
+
);
|
|
51
|
+
const j = (o, s) => {
|
|
52
|
+
if (!o || !s)
|
|
53
|
+
return;
|
|
54
|
+
const r = o.getModifiedEditor(), d = new i.Range(s.startLineNumber, s.startColumn, s.endLineNumber, s.endColumn);
|
|
55
|
+
r.setSelection(d), r.revealRangeNearTop(d);
|
|
56
|
+
};
|
|
57
|
+
return {
|
|
58
|
+
init: (o) => {
|
|
59
|
+
const s = h(ie), r = h(P), d = re.value, u = ce.value, m = i.editor.createModel(JSON.stringify(r, null, 2), "json"), c = V(JSON.stringify(d, null, 2)), D = i.editor.createModel(JSON.stringify(r, null, 2), "json"), I = V(JSON.stringify(u, null, 2)), $ = i.editor.createModel(JSON.stringify(s, null, 2), "json"), p = V(JSON.stringify(r, null, 2));
|
|
60
|
+
J = [
|
|
61
|
+
m,
|
|
62
|
+
c.model,
|
|
63
|
+
D,
|
|
64
|
+
I.model,
|
|
65
|
+
$,
|
|
66
|
+
p.model
|
|
67
|
+
];
|
|
68
|
+
const q = i.editor.createDiffEditor(o.local, {
|
|
69
|
+
originalEditable: !1,
|
|
70
|
+
readOnly: !0,
|
|
71
|
+
automaticLayout: !0,
|
|
72
|
+
renderSideBySide: !1
|
|
73
|
+
});
|
|
74
|
+
q.setModel({
|
|
75
|
+
original: m,
|
|
76
|
+
modified: c.model
|
|
77
|
+
}), M.value = q;
|
|
78
|
+
const G = i.editor.createDiffEditor(o.remote, {
|
|
79
|
+
originalEditable: !1,
|
|
80
|
+
readOnly: !0,
|
|
81
|
+
automaticLayout: !0,
|
|
82
|
+
renderSideBySide: !1
|
|
83
|
+
});
|
|
84
|
+
G.setModel({
|
|
85
|
+
original: D,
|
|
86
|
+
modified: I.model
|
|
87
|
+
}), N.value = G;
|
|
88
|
+
const T = i.editor.createDiffEditor(o.result, {
|
|
89
|
+
originalEditable: !1,
|
|
90
|
+
readOnly: !1,
|
|
91
|
+
renderSideBySide: !1,
|
|
92
|
+
automaticLayout: !0
|
|
93
|
+
});
|
|
94
|
+
T.setModel({
|
|
95
|
+
original: $,
|
|
96
|
+
modified: p.model
|
|
97
|
+
});
|
|
98
|
+
const C = T.getModifiedEditor();
|
|
99
|
+
C.updateOptions({ codeLens: !0 });
|
|
100
|
+
const de = async (t) => {
|
|
101
|
+
const e = await p.getRangeFromPath(t);
|
|
102
|
+
if (!e)
|
|
103
|
+
return;
|
|
104
|
+
const n = new i.Range(e.startLineNumber, e.startColumn, e.endLineNumber, e.endColumn);
|
|
105
|
+
C.setSelection(n), C.revealRangeNearTop(n);
|
|
106
|
+
};
|
|
107
|
+
O = he(async (t) => {
|
|
108
|
+
const e = ve(t);
|
|
109
|
+
e && await de(e);
|
|
110
|
+
}).dispose;
|
|
111
|
+
let K = [], W = 0;
|
|
112
|
+
const Q = "scalar.conflict.applyCurrent", X = "scalar.conflict.applyRemote", Z = "scalar.conflict.ignore", ue = C.addCommand(0, () => {
|
|
113
|
+
}) ?? "scalar.conflict.status.noop", me = (t) => {
|
|
114
|
+
const e = t.startLineNumber, n = t.endLineNumber;
|
|
115
|
+
if (e === n)
|
|
116
|
+
return [
|
|
117
|
+
{
|
|
118
|
+
range: t,
|
|
119
|
+
options: {
|
|
120
|
+
isWholeLine: !0,
|
|
121
|
+
className: "json-focus-highlight-box-single"
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
];
|
|
125
|
+
const a = new i.Range(e, 1, e, t.endColumn), l = new i.Range(e + 1, 1, Math.max(e + 1, n - 1), 1), R = new i.Range(n, 1, n, t.endColumn), y = [
|
|
126
|
+
{
|
|
127
|
+
range: a,
|
|
128
|
+
options: {
|
|
129
|
+
isWholeLine: !0,
|
|
130
|
+
className: "json-focus-highlight-box-top"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
{
|
|
134
|
+
range: R,
|
|
135
|
+
options: {
|
|
136
|
+
isWholeLine: !0,
|
|
137
|
+
className: "json-focus-highlight-box-bottom"
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
];
|
|
141
|
+
return n - e > 1 && y.push({
|
|
142
|
+
range: l,
|
|
143
|
+
options: {
|
|
144
|
+
isWholeLine: !0,
|
|
145
|
+
className: "json-focus-highlight-box-middle"
|
|
146
|
+
}
|
|
147
|
+
}), y;
|
|
148
|
+
}, k = () => {
|
|
149
|
+
b?.dispose(), b = i.languages.registerCodeLensProvider("json", {
|
|
150
|
+
provideCodeLenses: (t) => t.uri.toString() !== p.model.uri.toString() ? { lenses: [], dispose: () => {
|
|
151
|
+
} } : {
|
|
152
|
+
lenses: S.value.flatMap((e) => {
|
|
153
|
+
const n = new i.Range(
|
|
154
|
+
e.range.startLineNumber,
|
|
155
|
+
1,
|
|
156
|
+
e.range.startLineNumber,
|
|
157
|
+
1
|
|
158
|
+
);
|
|
159
|
+
return [
|
|
160
|
+
{
|
|
161
|
+
range: n,
|
|
162
|
+
command: {
|
|
163
|
+
id: ue,
|
|
164
|
+
title: `Status: ${f.value[e.index] ?? "idle"}`
|
|
165
|
+
}
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
range: n,
|
|
169
|
+
command: {
|
|
170
|
+
id: Q,
|
|
171
|
+
title: "Accept Current",
|
|
172
|
+
arguments: [e.index]
|
|
173
|
+
}
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
range: n,
|
|
177
|
+
command: {
|
|
178
|
+
id: X,
|
|
179
|
+
title: "Accept Remote",
|
|
180
|
+
arguments: [e.index]
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
range: n,
|
|
185
|
+
command: {
|
|
186
|
+
id: Z,
|
|
187
|
+
title: "Ignore",
|
|
188
|
+
arguments: [e.index]
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
];
|
|
192
|
+
}),
|
|
193
|
+
dispose: () => {
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
}, B = async (t, e, n) => {
|
|
198
|
+
const { model: a } = t, l = new i.Range(1, 1, 1, a.getLineMaxColumn(1));
|
|
199
|
+
let R = null;
|
|
200
|
+
for (let y = n.length; y >= 0; y -= 1) {
|
|
201
|
+
const fe = n.slice(0, y), ne = await t.getRangeFromPath(fe);
|
|
202
|
+
if (ne) {
|
|
203
|
+
R = Ce(a, ne);
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
index: e,
|
|
209
|
+
path: n,
|
|
210
|
+
range: pe(R ?? l)
|
|
211
|
+
};
|
|
212
|
+
}, ee = async () => {
|
|
213
|
+
const [t, e, n] = await Promise.all([
|
|
214
|
+
Promise.all(
|
|
215
|
+
g.value.map(
|
|
216
|
+
(a, l) => B(p, l, a.local.path)
|
|
217
|
+
)
|
|
218
|
+
),
|
|
219
|
+
Promise.all(
|
|
220
|
+
g.value.map(
|
|
221
|
+
(a, l) => B(c, l, a.local.path)
|
|
222
|
+
)
|
|
223
|
+
),
|
|
224
|
+
Promise.all(
|
|
225
|
+
g.value.map(
|
|
226
|
+
(a, l) => B(I, l, a.local.path)
|
|
227
|
+
)
|
|
228
|
+
)
|
|
229
|
+
]);
|
|
230
|
+
S.value = t.filter((a) => !!a), Y.value = e.filter((a) => !!a), z.value = n.filter((a) => !!a), K = C.deltaDecorations(
|
|
231
|
+
K,
|
|
232
|
+
S.value.flatMap((a) => me(a.range))
|
|
233
|
+
), k();
|
|
234
|
+
}, oe = (t, e) => {
|
|
235
|
+
f.value[t] = e, k();
|
|
236
|
+
}, te = async (t, e) => {
|
|
237
|
+
const n = g.value[t];
|
|
238
|
+
if (!n)
|
|
239
|
+
return;
|
|
240
|
+
let a = null;
|
|
241
|
+
try {
|
|
242
|
+
a = JSON.parse(p.model.getValue());
|
|
243
|
+
} catch {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
const l = e === "local" ? n.local.changes : n.remote.changes, R = _(A(a), l);
|
|
247
|
+
W += 1, p.model.setValue(JSON.stringify(R, null, 2)), oe(t, e), await ee();
|
|
248
|
+
};
|
|
249
|
+
x.push(
|
|
250
|
+
i.editor.registerCommand(Q, (t, e) => {
|
|
251
|
+
te(e, "local");
|
|
252
|
+
})
|
|
253
|
+
), x.push(
|
|
254
|
+
i.editor.registerCommand(X, (t, e) => {
|
|
255
|
+
te(e, "remote");
|
|
256
|
+
})
|
|
257
|
+
), x.push(
|
|
258
|
+
i.editor.registerCommand(Z, (t, e) => {
|
|
259
|
+
oe(e, "ignore");
|
|
260
|
+
})
|
|
261
|
+
), ee(), C.onDidChangeModelContent((t) => {
|
|
262
|
+
if (W > 0) {
|
|
263
|
+
W -= 1;
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
let e = !1;
|
|
267
|
+
for (const n of t.changes) {
|
|
268
|
+
const a = S.value.filter(
|
|
269
|
+
(l) => i.Range.areIntersectingOrTouching(n.range, l.range)
|
|
270
|
+
);
|
|
271
|
+
a.length && a.forEach((l) => {
|
|
272
|
+
f.value[l.index] !== "manual" && (f.value[l.index] = "manual", e = !0);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
e && k();
|
|
276
|
+
}), v.value = T;
|
|
277
|
+
},
|
|
278
|
+
dispose: () => {
|
|
279
|
+
M.value?.dispose(), M.value = void 0, N.value?.dispose(), N.value = void 0, v.value?.dispose(), v.value = void 0;
|
|
280
|
+
for (const o of J)
|
|
281
|
+
o.dispose();
|
|
282
|
+
J = [], b?.dispose(), b = void 0, O?.(), O = void 0, x.forEach((o) => o.dispose()), x.length = 0;
|
|
283
|
+
},
|
|
284
|
+
conflictsLeft: U,
|
|
285
|
+
goToNextConflict: () => {
|
|
286
|
+
const o = g.value.map((c, D) => D).filter((c) => f.value[c] === "idle");
|
|
287
|
+
if (!o.length)
|
|
288
|
+
return;
|
|
289
|
+
const s = o.find((c) => c > H.value) ?? o[0];
|
|
290
|
+
if (s === void 0 || !g.value[s])
|
|
291
|
+
return;
|
|
292
|
+
const d = Y.value.find((c) => c.index === s)?.range, u = z.value.find((c) => c.index === s)?.range, m = S.value.find((c) => c.index === s)?.range;
|
|
293
|
+
j(M.value, d), j(N.value, u), j(v.value, m), v.value?.getModifiedEditor().focus(), H.value = s;
|
|
294
|
+
},
|
|
295
|
+
applyResolvedConflicts: () => {
|
|
296
|
+
if (U.value > 0) {
|
|
297
|
+
F?.("You have conflicts left");
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
const o = v.value?.getModel()?.modified;
|
|
301
|
+
if (!o)
|
|
302
|
+
return;
|
|
303
|
+
let s = null;
|
|
304
|
+
try {
|
|
305
|
+
s = JSON.parse(o.getValue());
|
|
306
|
+
} catch {
|
|
307
|
+
F?.("You have formatting errors");
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
le(s);
|
|
311
|
+
}
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
export {
|
|
315
|
+
Je as useThreeWayMergeEditor
|
|
316
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { useMonacoEditorConfiguration } from './config.js';
|
|
2
|
+
export { rangeToWholeLine } from './helpers/range-to-whole-line.js';
|
|
3
|
+
export { useEditor } from './hooks/use-editor.js';
|
|
4
|
+
export { useJsonPointerLinkSupport } from './hooks/use-json-pointer-link-support.js';
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/editor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAA;AACvD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAA;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { useMonacoEditorConfiguration as e } from "./config.js";
|
|
2
|
+
import { rangeToWholeLine as n } from "./helpers/range-to-whole-line.js";
|
|
3
|
+
import { useEditor as p } from "./hooks/use-editor.js";
|
|
4
|
+
import { useJsonPointerLinkSupport as u } from "./hooks/use-json-pointer-link-support.js";
|
|
5
|
+
export {
|
|
6
|
+
n as rangeToWholeLine,
|
|
7
|
+
p as useEditor,
|
|
8
|
+
u as useJsonPointerLinkSupport,
|
|
9
|
+
e as useMonacoEditorConfiguration
|
|
10
|
+
};
|
|
@@ -5,12 +5,12 @@ import { combineParams as M } from "./helpers/combine-params.js";
|
|
|
5
5
|
import { getSelectedServer as N } from "./helpers/get-selected-server.js";
|
|
6
6
|
import { getActiveProxyUrl as A } from "../../helpers/get-active-proxy-url.js";
|
|
7
7
|
import { getServers as E } from "../../helpers/get-servers.js";
|
|
8
|
-
import
|
|
9
|
-
const
|
|
8
|
+
import R from "../../blocks/operation-block/OperationBlock.vue.js";
|
|
9
|
+
const V = {
|
|
10
10
|
key: 1,
|
|
11
11
|
class: "flex h-full w-full items-center justify-center"
|
|
12
|
-
},
|
|
13
|
-
...
|
|
12
|
+
}, P = {}, L = /* @__PURE__ */ w({
|
|
13
|
+
...P,
|
|
14
14
|
__name: "Operation",
|
|
15
15
|
props: {
|
|
16
16
|
documentSlug: {},
|
|
@@ -28,19 +28,20 @@ const P = {
|
|
|
28
28
|
customThemes: {},
|
|
29
29
|
currentTheme: {},
|
|
30
30
|
isDarkMode: { type: Boolean },
|
|
31
|
+
fetchRegistryDocument: { type: Function },
|
|
31
32
|
options: {}
|
|
32
33
|
},
|
|
33
34
|
setup(e) {
|
|
34
|
-
const
|
|
35
|
+
const u = t(() => e.path ? s(e.document?.paths?.[e.path]) : null), r = t(() => {
|
|
35
36
|
if (!e.path || !e.method)
|
|
36
37
|
return null;
|
|
37
38
|
const n = s(e.document?.paths?.[e.path]?.[e.method]);
|
|
38
39
|
if (!n)
|
|
39
40
|
return null;
|
|
40
|
-
if (!
|
|
41
|
+
if (!u.value)
|
|
41
42
|
return n;
|
|
42
43
|
const o = M(
|
|
43
|
-
|
|
44
|
+
u.value.parameters,
|
|
44
45
|
n.parameters
|
|
45
46
|
);
|
|
46
47
|
return { ...n, parameters: o };
|
|
@@ -53,7 +54,7 @@ const P = {
|
|
|
53
54
|
...n,
|
|
54
55
|
location: "document"
|
|
55
56
|
}))
|
|
56
|
-
]),
|
|
57
|
+
]), l = t(() => {
|
|
57
58
|
const n = a(e.options)?.servers ?? r.value?.servers ?? // pathItem.value?.servers ?? TODO: add support for pathItem servers
|
|
58
59
|
e.document?.servers;
|
|
59
60
|
return E(n, {
|
|
@@ -61,7 +62,7 @@ const P = {
|
|
|
61
62
|
documentUrl: e.document?.["x-scalar-original-source-url"]
|
|
62
63
|
});
|
|
63
64
|
}), v = t(() => a(e.options)?.servers != null ? e.document?.["x-scalar-selected-server"] : r.value?.servers != null ? r.value["x-scalar-selected-server"] : e.document?.["x-scalar-selected-server"]), h = t(
|
|
64
|
-
() => N(
|
|
65
|
+
() => N(l.value, v.value)
|
|
65
66
|
), S = t(() => r.value?.servers != null ? { type: "operation", path: e.path ?? "", method: e.method ?? "get" } : { type: "document" }), y = t(() => e.workspaceStore.auth.getAuthSelectedSchemas({
|
|
66
67
|
type: "document",
|
|
67
68
|
documentName: e.documentSlug
|
|
@@ -81,13 +82,13 @@ const P = {
|
|
|
81
82
|
...e.workspaceStore.workspace["x-scalar-environments"]
|
|
82
83
|
})
|
|
83
84
|
)
|
|
84
|
-
)),
|
|
85
|
+
)), g = t(
|
|
85
86
|
() => b(a(e.options)?.hiddenClients)
|
|
86
|
-
),
|
|
87
|
-
return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(
|
|
87
|
+
), x = "2.37.0";
|
|
88
|
+
return (n, o) => e.path && e.method && e.exampleName && r.value ? (m(), C(c(R), {
|
|
88
89
|
key: 0,
|
|
89
90
|
activeEnvironment: e.workspaceStore.workspace["x-scalar-active-environment"],
|
|
90
|
-
appVersion: c(
|
|
91
|
+
appVersion: c(x),
|
|
91
92
|
authMeta: f.value,
|
|
92
93
|
documentSecurity: e.document?.security ?? [],
|
|
93
94
|
documentSelectedSecurity: y.value,
|
|
@@ -99,7 +100,7 @@ const P = {
|
|
|
99
100
|
globalCookies: d.value,
|
|
100
101
|
hideClientButton: a(e.options)?.hideClientButton ?? !1,
|
|
101
102
|
history: e.workspaceStore.history.getHistory(e.documentSlug, e.path, e.method),
|
|
102
|
-
httpClients:
|
|
103
|
+
httpClients: g.value,
|
|
103
104
|
layout: e.layout,
|
|
104
105
|
method: e.method,
|
|
105
106
|
operation: r.value,
|
|
@@ -114,12 +115,12 @@ const P = {
|
|
|
114
115
|
selectedClient: e.workspaceStore.workspace["x-scalar-default-client"],
|
|
115
116
|
server: h.value,
|
|
116
117
|
serverMeta: S.value,
|
|
117
|
-
servers:
|
|
118
|
-
}, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "serverMeta", "servers"])) : (m(), B("div",
|
|
118
|
+
servers: l.value
|
|
119
|
+
}, null, 8, ["activeEnvironment", "appVersion", "authMeta", "documentSecurity", "documentSelectedSecurity", "documentUrl", "environment", "environments", "eventBus", "exampleKey", "globalCookies", "hideClientButton", "history", "httpClients", "layout", "method", "operation", "operationSelectedSecurity", "path", "plugins", "proxyUrl", "securitySchemes", "selectedClient", "server", "serverMeta", "servers"])) : (m(), B("div", V, [...o[0] || (o[0] = [
|
|
119
120
|
U("span", { class: "text-c-3" }, "Select an operation to view details", -1)
|
|
120
121
|
])]));
|
|
121
122
|
}
|
|
122
123
|
});
|
|
123
124
|
export {
|
|
124
|
-
|
|
125
|
+
L as default
|
|
125
126
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"configuration.d.ts","sourceRoot":"","sources":["../../../src/v2/types/configuration.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,0BAA0B,GAAG,CAAC,IAAI,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,KAAK,OAAO,CAC3F;IACE,EAAE,EAAE,IAAI,CAAA;IACR,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAC9B,GACD;IACE,EAAE,EAAE,KAAK,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;CACd,CACJ,CAAA"}
|
|
@@ -33,7 +33,7 @@ const W = { class: "flex-center relative flex flex-1 flex-col gap-6 p-2 capitali
|
|
|
33
33
|
}));
|
|
34
34
|
}, f = (u) => {
|
|
35
35
|
u?.createNew && g.name === "request" && p();
|
|
36
|
-
}, v = "2.
|
|
36
|
+
}, v = "2.37.0";
|
|
37
37
|
return q(() => a.hotKeys.on(f)), R(() => a.hotKeys.off(f)), (u, e) => (l(), n("div", W, [
|
|
38
38
|
s("div", {
|
|
39
39
|
class: y(["flex h-[calc(100%_-_50px)] flex-col items-center justify-center", {
|
package/package.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
"rest",
|
|
19
19
|
"testing"
|
|
20
20
|
],
|
|
21
|
-
"version": "2.
|
|
21
|
+
"version": "2.37.0",
|
|
22
22
|
"engines": {
|
|
23
23
|
"node": ">=22"
|
|
24
24
|
},
|
|
@@ -231,6 +231,11 @@
|
|
|
231
231
|
"types": "./dist/v2/features/command-palette/index.d.ts",
|
|
232
232
|
"default": "./dist/v2/features/command-palette/index.js"
|
|
233
233
|
},
|
|
234
|
+
"./v2/features/editor": {
|
|
235
|
+
"import": "./dist/v2/features/editor/index.js",
|
|
236
|
+
"types": "./dist/v2/features/editor/index.d.ts",
|
|
237
|
+
"default": "./dist/v2/features/editor/index.js"
|
|
238
|
+
},
|
|
234
239
|
"./v2/features/environments": {
|
|
235
240
|
"import": "./dist/v2/features/environments/index.js",
|
|
236
241
|
"types": "./dist/v2/features/environments/index.d.ts",
|
|
@@ -329,31 +334,32 @@
|
|
|
329
334
|
"pretty-ms": "^9.3.0",
|
|
330
335
|
"shell-quote": "^1.8.1",
|
|
331
336
|
"type-fest": "^5.3.1",
|
|
337
|
+
"vite-plugin-monaco-editor": "^1.1.0",
|
|
332
338
|
"vue": "^3.5.26",
|
|
333
339
|
"vue-router": "4.6.2",
|
|
334
340
|
"whatwg-mimetype": "4.0.0",
|
|
335
341
|
"yaml": "^2.8.0",
|
|
336
342
|
"zod": "^4.3.5",
|
|
343
|
+
"@scalar/analytics-client": "1.1.0",
|
|
337
344
|
"@scalar/draggable": "0.4.0",
|
|
345
|
+
"@scalar/components": "0.20.7",
|
|
338
346
|
"@scalar/icons": "0.6.0",
|
|
339
|
-
"@scalar/
|
|
340
|
-
"@scalar/
|
|
341
|
-
"@scalar/
|
|
342
|
-
"@scalar/
|
|
343
|
-
"@scalar/
|
|
344
|
-
"@scalar/
|
|
345
|
-
"@scalar/openapi
|
|
347
|
+
"@scalar/helpers": "0.4.1",
|
|
348
|
+
"@scalar/import": "0.5.2",
|
|
349
|
+
"@scalar/json-magic": "0.12.3",
|
|
350
|
+
"@scalar/oas-utils": "0.10.6",
|
|
351
|
+
"@scalar/object-utils": "1.3.2",
|
|
352
|
+
"@scalar/openapi-parser": "0.25.3",
|
|
353
|
+
"@scalar/postman-to-openapi": "0.5.2",
|
|
354
|
+
"@scalar/sidebar": "0.8.7",
|
|
355
|
+
"@scalar/themes": "0.15.0",
|
|
346
356
|
"@scalar/openapi-types": "0.6.0",
|
|
347
|
-
"@scalar/
|
|
348
|
-
"@scalar/
|
|
349
|
-
"@scalar/json-magic": "0.12.2",
|
|
350
|
-
"@scalar/snippetz": "0.7.3",
|
|
357
|
+
"@scalar/types": "0.7.3",
|
|
358
|
+
"@scalar/use-codemirror": "0.14.7",
|
|
351
359
|
"@scalar/use-hooks": "0.4.0",
|
|
352
|
-
"@scalar/
|
|
353
|
-
"@scalar/use-codemirror": "0.14.5",
|
|
354
|
-
"@scalar/types": "0.7.2",
|
|
360
|
+
"@scalar/workspace-store": "0.40.0",
|
|
355
361
|
"@scalar/use-toasts": "0.10.0",
|
|
356
|
-
"@scalar/
|
|
362
|
+
"@scalar/snippetz": "0.7.4"
|
|
357
363
|
},
|
|
358
364
|
"devDependencies": {
|
|
359
365
|
"@tailwindcss/vite": "^4.1.18",
|
|
@@ -370,7 +376,7 @@
|
|
|
370
376
|
"vitest": "4.0.16",
|
|
371
377
|
"@scalar/build-tooling": "0.5.0",
|
|
372
378
|
"@scalar/galaxy": "0.6.0",
|
|
373
|
-
"@scalar/pre-post-request-scripts": "0.3.
|
|
379
|
+
"@scalar/pre-post-request-scripts": "0.3.7"
|
|
374
380
|
},
|
|
375
381
|
"scripts": {
|
|
376
382
|
"build": "scalar-build-vite",
|