@scalar/api-client 2.1.26 → 2.1.28
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 +23 -0
- package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +149 -89
- package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
- package/dist/components/ImportCollection/ImportNowButton.vue.js +7 -9
- package/dist/layouts/App/create-api-client-app.d.ts +77 -20
- package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
- package/dist/layouts/App/create-api-client-app.js +14 -12
- package/dist/layouts/Modal/create-api-client-modal.d.ts +154 -40
- package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
- package/dist/layouts/Modal/create-api-client-modal.js +23 -26
- package/dist/layouts/Web/create-api-client-web.d.ts +77 -20
- package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
- package/dist/layouts/Web/create-api-client-web.js +12 -10
- package/dist/libs/create-client.d.ts +77 -20
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/create-client.js +60 -58
- package/dist/store/collections.d.ts +34 -4
- package/dist/store/collections.d.ts.map +1 -1
- package/dist/store/import-spec.d.ts +43 -4
- package/dist/store/import-spec.d.ts.map +1 -1
- package/dist/store/import-spec.js +60 -36
- package/dist/store/requests.d.ts +4 -1
- package/dist/store/requests.d.ts.map +1 -1
- package/dist/store/requests.js +76 -76
- package/dist/store/security-schemes.d.ts +2 -2
- package/dist/store/security-schemes.d.ts.map +1 -1
- package/dist/store/security-schemes.js +35 -37
- package/dist/store/servers.d.ts +10 -10
- package/dist/store/servers.d.ts.map +1 -1
- package/dist/store/store.d.ts +154 -40
- package/dist/store/store.d.ts.map +1 -1
- package/dist/store/store.js +27 -27
- package/dist/style.css +1 -1
- package/dist/views/Request/Request.vue.d.ts.map +1 -1
- package/dist/views/Request/Request.vue.js +1 -1
- package/dist/views/Request/Request.vue2.js +39 -38
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +12 -12
- package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebar.vue.js +4 -4
- package/dist/views/Request/RequestSidebar.vue2.js +107 -102
- package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
- package/dist/views/Request/RequestSidebarItem.vue2.js +165 -135
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +96 -71
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts +9 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -0
- package/dist/views/Request/hooks/useOpenApiWatcher.js +86 -0
- package/dist/views/Request/libs/live-sync.d.ts +59 -0
- package/dist/views/Request/libs/live-sync.d.ts.map +1 -0
- package/dist/views/Request/libs/live-sync.js +289 -0
- package/dist/views/Request/types/sidebar-item.d.ts +2 -0
- package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneral.vue.js +59 -69
- package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +1 -1
- package/dist/views/Settings/SettingsGeneralMode.vue.js +22 -22
- package/package.json +12 -10
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import { isHTTPMethod as D } from "../../../components/HttpMethod/helpers.js";
|
|
2
|
+
import { collectionSchema as b, requestSchema as O, serverSchema as V, tagSchema as M, oasOauthFlowSchema as H, securitySchemeSchema as S, createExampleFromRequest as j } from "@scalar/oas-utils/entities/spec";
|
|
3
|
+
import { schemaModel as R } from "@scalar/oas-utils/helpers";
|
|
4
|
+
import { getNestedValue as N } from "@scalar/object-utils/nested";
|
|
5
|
+
import G from "microdiff";
|
|
6
|
+
import { z as i } from "zod";
|
|
7
|
+
const x = (e, r = []) => {
|
|
8
|
+
const t = [];
|
|
9
|
+
let s = !1;
|
|
10
|
+
for (let u = 0; u < e.length; u++) {
|
|
11
|
+
if (s) {
|
|
12
|
+
s = !1;
|
|
13
|
+
continue;
|
|
14
|
+
}
|
|
15
|
+
const a = e[u], n = e[u + 1];
|
|
16
|
+
if (r.length)
|
|
17
|
+
a.path = [...r, ...a.path], n && (n.path = [...r, ...n.path]);
|
|
18
|
+
else if (a.path[0] !== "paths") {
|
|
19
|
+
t.push(a);
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
if (a.type === "REMOVE" && (n == null ? void 0 : n.type) === "CREATE") {
|
|
23
|
+
const [, h, p] = a.path, [, o, l] = n.path, c = ["paths", o];
|
|
24
|
+
if (h !== o && t.push({
|
|
25
|
+
type: "CHANGE",
|
|
26
|
+
path: ["paths", "path"],
|
|
27
|
+
oldValue: h,
|
|
28
|
+
value: o
|
|
29
|
+
}), p && l && p !== l && (t.push({
|
|
30
|
+
type: "CHANGE",
|
|
31
|
+
path: ["paths", o, "method"],
|
|
32
|
+
oldValue: p,
|
|
33
|
+
value: l
|
|
34
|
+
}), c.push(l)), r.length === 0) {
|
|
35
|
+
const m = G(a.oldValue, n.value);
|
|
36
|
+
if (m.length) {
|
|
37
|
+
const E = x(m, c);
|
|
38
|
+
t.push(...E);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
s = !0;
|
|
42
|
+
} else a.type === "CREATE" && a.path.length > 3 && typeof a.path.at(-1) != "number" ? t.push({ ...a, type: "CHANGE", oldValue: void 0 }) : a.type === "REMOVE" && a.path.length > 3 && typeof a.path.at(-1) != "number" ? t.push({ ...a, type: "CHANGE", value: void 0 }) : t.push(a);
|
|
43
|
+
}
|
|
44
|
+
return t;
|
|
45
|
+
}, v = (e, r, t) => {
|
|
46
|
+
for (const s of e) {
|
|
47
|
+
const u = r[s];
|
|
48
|
+
if (t(u)) return u;
|
|
49
|
+
}
|
|
50
|
+
return null;
|
|
51
|
+
}, y = (e) => e instanceof i.ZodOptional ? y(e.unwrap()) : e instanceof i.ZodDefault ? y(e._def.innerType) : e, C = (e, r) => {
|
|
52
|
+
let t = e;
|
|
53
|
+
for (const s of r) {
|
|
54
|
+
if (t = y(t), t instanceof i.ZodAny)
|
|
55
|
+
return t;
|
|
56
|
+
if (t instanceof i.ZodObject && typeof s == "string" && s in t.shape)
|
|
57
|
+
t = t.shape[s];
|
|
58
|
+
else if (t instanceof i.ZodArray)
|
|
59
|
+
if (typeof s == "number")
|
|
60
|
+
t = t.element;
|
|
61
|
+
else if (typeof s == "string")
|
|
62
|
+
if (t = t.element, t instanceof i.ZodObject && s in t.shape)
|
|
63
|
+
t = t.shape[s];
|
|
64
|
+
else
|
|
65
|
+
return null;
|
|
66
|
+
else
|
|
67
|
+
return null;
|
|
68
|
+
else if (t instanceof i.ZodRecord)
|
|
69
|
+
t = t.valueSchema;
|
|
70
|
+
else
|
|
71
|
+
return null;
|
|
72
|
+
t = y(t);
|
|
73
|
+
}
|
|
74
|
+
return t;
|
|
75
|
+
}, f = (e, r) => {
|
|
76
|
+
const t = C(e, r.path);
|
|
77
|
+
if (!t) return null;
|
|
78
|
+
const s = r.path.join("."), u = r.path.slice(0, -1).join(".");
|
|
79
|
+
if (r.type === "REMOVE")
|
|
80
|
+
return {
|
|
81
|
+
path: s,
|
|
82
|
+
pathMinusOne: u,
|
|
83
|
+
value: void 0
|
|
84
|
+
};
|
|
85
|
+
const a = R(r.value, t, !1);
|
|
86
|
+
return a ? {
|
|
87
|
+
path: s,
|
|
88
|
+
pathMinusOne: u,
|
|
89
|
+
value: a
|
|
90
|
+
} : null;
|
|
91
|
+
}, K = (e, { activeCollection: r, collectionMutators: t }) => {
|
|
92
|
+
if (!r.value) return !1;
|
|
93
|
+
if (typeof e.path[e.path.length - 1] == "number" && (e.type === "CREATE" || e.type === "REMOVE")) {
|
|
94
|
+
const s = f(b, {
|
|
95
|
+
...e,
|
|
96
|
+
path: e.path
|
|
97
|
+
});
|
|
98
|
+
if (!s) return !1;
|
|
99
|
+
const u = [
|
|
100
|
+
...N(r.value, s.pathMinusOne)
|
|
101
|
+
];
|
|
102
|
+
e.type === "CREATE" ? u.push(s.value) : e.type === "REMOVE" && u.pop(), t.edit(
|
|
103
|
+
r.value.uid,
|
|
104
|
+
s.pathMinusOne,
|
|
105
|
+
u
|
|
106
|
+
);
|
|
107
|
+
} else {
|
|
108
|
+
const s = f(b, e);
|
|
109
|
+
if (!s) return !1;
|
|
110
|
+
t.edit(
|
|
111
|
+
r.value.uid,
|
|
112
|
+
s.path,
|
|
113
|
+
s.value
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return !0;
|
|
117
|
+
}, T = (e, r) => {
|
|
118
|
+
const { requests: t, requestExamples: s, requestExampleMutators: u } = r, a = t[e];
|
|
119
|
+
a == null || a.examples.forEach((n) => {
|
|
120
|
+
const h = j(
|
|
121
|
+
a,
|
|
122
|
+
s[n].name
|
|
123
|
+
);
|
|
124
|
+
h && u.set({
|
|
125
|
+
...h,
|
|
126
|
+
uid: n
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
}, L = (e, r) => {
|
|
130
|
+
const { activeCollection: t, requests: s, requestMutators: u } = r;
|
|
131
|
+
if (!t.value) return !1;
|
|
132
|
+
const [, a, n, ...h] = e.path;
|
|
133
|
+
if (a === "path" && e.type === "CHANGE")
|
|
134
|
+
t.value.requests.forEach((p) => {
|
|
135
|
+
s[p].path === e.oldValue && u.edit(p, "path", e.value);
|
|
136
|
+
});
|
|
137
|
+
else if (n === "method" && e.type === "CHANGE")
|
|
138
|
+
t.value.requests.forEach((p) => {
|
|
139
|
+
s[p].method === e.oldValue && s[p].path === a && u.edit(p, "method", e.value);
|
|
140
|
+
});
|
|
141
|
+
else if (e.type !== "CHANGE" && typeof h.at(-1) == "number") {
|
|
142
|
+
const p = v(
|
|
143
|
+
t.value.requests,
|
|
144
|
+
s,
|
|
145
|
+
(c) => c.path === a && c.method === n
|
|
146
|
+
), o = f(O, {
|
|
147
|
+
...e,
|
|
148
|
+
path: e.path.slice(3)
|
|
149
|
+
});
|
|
150
|
+
if (!p || !o) return !1;
|
|
151
|
+
const l = [...N(p, o.pathMinusOne)];
|
|
152
|
+
e.type === "CREATE" ? l.push(o.value) : e.type === "REMOVE" && l.pop(), u.edit(p.uid, o.pathMinusOne, l), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, r);
|
|
153
|
+
} else if (e.type === "CREATE") {
|
|
154
|
+
const [[p, o]] = Object.entries(e.value), l = n ? e.value : o, c = n || p, m = V.array().parse(l.servers ?? []), { security: E, ...Z } = l, g = {
|
|
155
|
+
...Z,
|
|
156
|
+
method: D(c) ? c : "get",
|
|
157
|
+
path: a,
|
|
158
|
+
parameters: l.parameters ?? [],
|
|
159
|
+
servers: m.map((d) => d.uid)
|
|
160
|
+
};
|
|
161
|
+
E != null && E.length && (g.security = E.map((d) => {
|
|
162
|
+
if (Object.keys(d).length) {
|
|
163
|
+
const [q] = Object.keys(d);
|
|
164
|
+
return {
|
|
165
|
+
[q]: d[q]
|
|
166
|
+
};
|
|
167
|
+
} else return d;
|
|
168
|
+
}));
|
|
169
|
+
const A = R(g, O, !1);
|
|
170
|
+
if (!A) return !1;
|
|
171
|
+
u.add(A, t.value.uid);
|
|
172
|
+
} else if (e.type === "REMOVE") {
|
|
173
|
+
const p = v(
|
|
174
|
+
t.value.requests,
|
|
175
|
+
s,
|
|
176
|
+
(o) => o.path === a && o.method === n
|
|
177
|
+
);
|
|
178
|
+
if (!p) return !1;
|
|
179
|
+
u.delete(p, t.value.uid);
|
|
180
|
+
} else if (e.type === "CHANGE") {
|
|
181
|
+
const p = v(
|
|
182
|
+
t.value.requests,
|
|
183
|
+
s,
|
|
184
|
+
(l) => l.path === a && l.method === n
|
|
185
|
+
), o = f(O, { ...e, path: h });
|
|
186
|
+
if (!p || !o) return !1;
|
|
187
|
+
u.edit(p.uid, o.path, o.value), (e.path[3] === "parameters" || e.path[3] === "requestBody") && T(p.uid, r);
|
|
188
|
+
}
|
|
189
|
+
return !0;
|
|
190
|
+
}, W = (e, { activeCollection: r, servers: t, serverMutators: s }) => {
|
|
191
|
+
if (!r.value) return !1;
|
|
192
|
+
const [, u, ...a] = e.path;
|
|
193
|
+
if (a != null && a.length) {
|
|
194
|
+
const n = r.value.servers[u], h = t[n], p = f(V, { ...e, path: a });
|
|
195
|
+
if (!h || !p) return !1;
|
|
196
|
+
const l = e.type === "REMOVE" && a[a.length - 1] === "variables" ? {} : p.value;
|
|
197
|
+
s.edit(n, p.path, l);
|
|
198
|
+
} else if (e.type === "REMOVE") {
|
|
199
|
+
if (!r.value.servers[u]) return !1;
|
|
200
|
+
s.delete(
|
|
201
|
+
r.value.servers[u],
|
|
202
|
+
r.value.uid
|
|
203
|
+
);
|
|
204
|
+
} else if (e.type === "CREATE") {
|
|
205
|
+
const n = R(e.value, V, !1);
|
|
206
|
+
if (!n) return !1;
|
|
207
|
+
s.add(n, r.value.uid);
|
|
208
|
+
}
|
|
209
|
+
return !0;
|
|
210
|
+
}, I = (e, { activeCollection: r, tags: t, tagMutators: s }) => {
|
|
211
|
+
if (!r.value) return !1;
|
|
212
|
+
const [, u, ...a] = e.path;
|
|
213
|
+
if (a != null && a.length) {
|
|
214
|
+
const n = r.value.tags[u], h = t[n], p = f(M, { ...e, path: a });
|
|
215
|
+
if (!h || !p) return !1;
|
|
216
|
+
s.edit(n, p.path, p.value);
|
|
217
|
+
} else if (e.type === "REMOVE") {
|
|
218
|
+
const n = r.value.tags[u], h = t[n];
|
|
219
|
+
if (!h) return !1;
|
|
220
|
+
s.delete(h, r.value.uid);
|
|
221
|
+
} else if (e.type === "CREATE") {
|
|
222
|
+
const n = R(e.value, M, !1);
|
|
223
|
+
if (!n) return !1;
|
|
224
|
+
s.add(n, r.value.uid);
|
|
225
|
+
}
|
|
226
|
+
return !0;
|
|
227
|
+
}, w = (e, r, t) => {
|
|
228
|
+
const s = y(e);
|
|
229
|
+
if (s instanceof i.ZodUnion || s instanceof i.ZodDiscriminatedUnion) {
|
|
230
|
+
for (const u of s.options)
|
|
231
|
+
if (u instanceof i.ZodObject && r in u.shape && u.shape[r] instanceof i.ZodLiteral && u.shape[r].value === t)
|
|
232
|
+
return u;
|
|
233
|
+
}
|
|
234
|
+
return null;
|
|
235
|
+
}, J = (e, { activeCollection: r, securitySchemes: t, securitySchemeMutators: s }) => {
|
|
236
|
+
var h;
|
|
237
|
+
if (!r.value) return !1;
|
|
238
|
+
const [, , u, ...a] = e.path, n = t[u] ?? v(
|
|
239
|
+
r.value.securitySchemes,
|
|
240
|
+
t,
|
|
241
|
+
(p) => p.nameKey === u
|
|
242
|
+
);
|
|
243
|
+
if (a != null && a.length) {
|
|
244
|
+
if (!n) return !1;
|
|
245
|
+
const { schema: p, _path: o } = a[0] === "flows" && n.type === "oauth2" ? {
|
|
246
|
+
schema: w(
|
|
247
|
+
H,
|
|
248
|
+
"type",
|
|
249
|
+
(h = n == null ? void 0 : n.flow) == null ? void 0 : h.type
|
|
250
|
+
),
|
|
251
|
+
_path: a.slice(2)
|
|
252
|
+
} : {
|
|
253
|
+
schema: w(
|
|
254
|
+
S,
|
|
255
|
+
"type",
|
|
256
|
+
n == null ? void 0 : n.type
|
|
257
|
+
),
|
|
258
|
+
_path: a
|
|
259
|
+
};
|
|
260
|
+
if (o[0] === "scopes" && n.type === "oauth2") {
|
|
261
|
+
const m = { ...n.flow.scopes };
|
|
262
|
+
return e.type === "CREATE" || e.type === "CHANGE" ? m[o[1]] = e.value : delete m[o[1]], s.edit(n.uid, "flow.scopes", m), !0;
|
|
263
|
+
}
|
|
264
|
+
if (!p) return !1;
|
|
265
|
+
const l = f(p, { ...e, path: o });
|
|
266
|
+
if (!l) return !1;
|
|
267
|
+
const c = a[0] === "flows" ? ["flow", ...o].join(".") : l.path;
|
|
268
|
+
s.edit(n.uid, c, l.value);
|
|
269
|
+
} else if (e.type === "REMOVE") {
|
|
270
|
+
if (!n) return !1;
|
|
271
|
+
s.delete(n.uid);
|
|
272
|
+
} else e.type === "CREATE" && s.add(
|
|
273
|
+
S.parse(e.value),
|
|
274
|
+
r.value.uid
|
|
275
|
+
);
|
|
276
|
+
return !0;
|
|
277
|
+
};
|
|
278
|
+
export {
|
|
279
|
+
x as combineRenameDiffs,
|
|
280
|
+
v as findResource,
|
|
281
|
+
K as mutateCollectionDiff,
|
|
282
|
+
L as mutateRequestDiff,
|
|
283
|
+
J as mutateSecuritySchemeDiff,
|
|
284
|
+
W as mutateServerDiff,
|
|
285
|
+
I as mutateTagDiff,
|
|
286
|
+
w as narrowUnionSchema,
|
|
287
|
+
f as parseDiff,
|
|
288
|
+
C as traverseZodSchema
|
|
289
|
+
};
|
|
@@ -10,6 +10,8 @@ export type SidebarItem = {
|
|
|
10
10
|
icon?: string;
|
|
11
11
|
edit: (name: string, icon?: string) => void;
|
|
12
12
|
delete: () => void;
|
|
13
|
+
documentUrl?: string;
|
|
14
|
+
watchForChanges?: boolean;
|
|
13
15
|
};
|
|
14
16
|
export type SidebarMenuItem = {
|
|
15
17
|
/** The resource which we are opening the menu for */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,GAAG,cAAc,CAAA;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"sidebar-item.d.ts","sourceRoot":"","sources":["../../../../src/views/Request/types/sidebar-item.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,OAAO,EACP,cAAc,EACd,aAAa,EACb,GAAG,EACJ,MAAM,iCAAiC,CAAA;AAExC,MAAM,MAAM,WAAW,GAAG;IACxB,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,UAAU,GAAG,GAAG,GAAG,OAAO,GAAG,cAAc,CAAA;IACnD,aAAa,EAAE,MAAM,CAAA;IACrB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,CAAC,EAAE,aAAa,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,eAAe,CAAC,EAAE,OAAO,CAAA;CAC1B,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,qDAAqD;IACrD,IAAI,CAAC,EAAE,WAAW,CAAA;IAClB,4DAA4D;IAC5D,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;IACrB,0EAA0E;IAC1E,SAAS,CAAC,EAAE,iBAAiB,CAAA;IAC7B,8CAA8C;IAC9C,IAAI,EAAE,OAAO,CAAA;CACd,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsGeneral.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneral.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SettingsGeneral.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneral.vue"],"names":[],"mappings":";AAwmBA,wBAKG"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { ScalarButton as
|
|
3
|
-
import { themeLabels as
|
|
4
|
-
import
|
|
5
|
-
import { useWorkspace as
|
|
6
|
-
const
|
|
1
|
+
import { defineComponent as _, openBlock as o, createElementBlock as x, createElementVNode as e, createStaticVNode as C, createVNode as c, unref as t, normalizeClass as i, withCtx as d, createBlock as u, createCommentVNode as p, createTextVNode as b, Fragment as S, renderList as j, toDisplayString as z, normalizeStyle as m } from "vue";
|
|
2
|
+
import { ScalarButton as g, ScalarIcon as k } from "@scalar/components";
|
|
3
|
+
import { themeLabels as B } from "@scalar/themes";
|
|
4
|
+
import N from "./SettingsGeneralMode.vue.js";
|
|
5
|
+
import { useWorkspace as V } from "../../store/store.js";
|
|
6
|
+
const P = { class: "bg-b-1 w-full h-full overflow-auto" }, T = { class: "flex flex-col px-5 py-5 max-w-[720px] ml-auto mr-auto w-full" }, W = { class: "gap-2 mt-4 mb-8 flex flex-col" }, $ = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, U = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, E = { class: "flex flex-col gap-2" }, G = { class: "grid grid-cols-2 gap-2" }, L = { class: "flex items-center gap-2" }, O = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, R = { class: "flex items-center gap-1" }, K = /* @__PURE__ */ _({
|
|
7
7
|
__name: "SettingsGeneral",
|
|
8
|
-
setup(
|
|
9
|
-
const { activeWorkspace:
|
|
8
|
+
setup(q) {
|
|
9
|
+
const { activeWorkspace: a, workspaceMutators: y, proxyUrl: l, setProxyUrl: h } = V(), v = [
|
|
10
10
|
"default",
|
|
11
11
|
"alternate",
|
|
12
12
|
"moon",
|
|
@@ -17,7 +17,7 @@ const N = { class: "bg-b-1 w-full h-full overflow-auto" }, P = { class: "flex fl
|
|
|
17
17
|
"kepler",
|
|
18
18
|
"mars",
|
|
19
19
|
"deepSpace"
|
|
20
|
-
], f = (
|
|
20
|
+
], f = (n) => ({
|
|
21
21
|
default: { light: "#fff", dark: "#0f0f0f", accent: "#0099ff" },
|
|
22
22
|
alternate: { light: "#f9f9f9", dark: "#131313", accent: "#e7e7e7" },
|
|
23
23
|
moon: { light: "#ccc9b3", dark: "#313332", accent: "#645b0f" },
|
|
@@ -29,112 +29,102 @@ const N = { class: "bg-b-1 w-full h-full overflow-auto" }, P = { class: "flex fl
|
|
|
29
29
|
mars: { light: "#f2efe8", dark: "#321116", accent: "#c75549" },
|
|
30
30
|
deepSpace: { light: "#f4f4f5", dark: "#09090b", accent: "#8ab4f8" },
|
|
31
31
|
none: { light: "#ffffff", dark: "#000000", accent: "#3b82f6" }
|
|
32
|
-
})[
|
|
33
|
-
y.edit(
|
|
32
|
+
})[n] || { light: "#ffffff", dark: "#000000", accent: "#3b82f6" }, w = (n) => {
|
|
33
|
+
y.edit(a.value.uid, "themeId", n);
|
|
34
34
|
};
|
|
35
|
-
return (
|
|
36
|
-
e("div",
|
|
35
|
+
return (n, r) => (o(), x("div", P, [
|
|
36
|
+
e("div", T, [
|
|
37
37
|
e("div", null, [
|
|
38
38
|
e("div", null, [
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
href: "https://github.com/scalar/scalar/tree/main/packages/api-client-proxy",
|
|
46
|
-
target: "_blank"
|
|
47
|
-
}, "open source"),
|
|
48
|
-
o(" proxy to deal with CORS issues. ")
|
|
49
|
-
], -1)),
|
|
50
|
-
e("div", T, [
|
|
51
|
-
i(l(k), {
|
|
52
|
-
class: d(["w-full shadow-none text-c-1 justify-start pl-2 gap-2 bg-b-2", { "bg-b-1 shadow-border-1/2 text-c-1": l(s) }]),
|
|
53
|
-
variant: l(s) ? "primary" : "secondary",
|
|
54
|
-
onClick: t[0] || (t[0] = (r) => l(h)("https://proxy.scalar.com"))
|
|
39
|
+
r[4] || (r[4] = C('<h2 class="font-bold text-xl mb-5 mt-10">Settings</h2><h3 class="font-bold mb-1">CORS Proxy</h3><p class="text-c-2 mb-2 leading-[21px]"> Browsers block cross-origin requests for security. We provide a public proxy to <a class="hover:text-c-1 underline-offset-2" href="https://en.wikipedia.org/wiki/Cross-origin_resource_sharing" target="_blank">bypass CORS issues</a>. Check the <a class="hover:text-c-1 underline-offset-2" href="https://github.com/scalar/scalar/tree/main/examples/proxy-server" target="_blank">source code on GitHub</a>. </p>', 3)),
|
|
40
|
+
e("div", W, [
|
|
41
|
+
c(t(g), {
|
|
42
|
+
class: i(["w-full shadow-none text-c-1 justify-start pl-2 gap-2 bg-b-2 border-1/2", { "bg-b-1 text-c-1": t(l) }]),
|
|
43
|
+
variant: t(l) ? "primary" : "secondary",
|
|
44
|
+
onClick: r[0] || (r[0] = (s) => t(h)("https://proxy.scalar.com"))
|
|
55
45
|
}, {
|
|
56
|
-
default:
|
|
57
|
-
e("div",
|
|
58
|
-
l
|
|
46
|
+
default: d(() => [
|
|
47
|
+
e("div", $, [
|
|
48
|
+
t(l) ? (o(), u(t(k), {
|
|
59
49
|
key: 0,
|
|
60
50
|
icon: "Checkmark",
|
|
61
51
|
size: "xs",
|
|
62
52
|
thickness: "3.5"
|
|
63
|
-
})) :
|
|
53
|
+
})) : p("", !0)
|
|
64
54
|
]),
|
|
65
|
-
|
|
55
|
+
r[2] || (r[2] = b(" Use proxy.scalar.com (default) "))
|
|
66
56
|
]),
|
|
67
57
|
_: 1
|
|
68
58
|
}, 8, ["class", "variant"]),
|
|
69
|
-
|
|
70
|
-
class:
|
|
71
|
-
variant: l
|
|
72
|
-
onClick:
|
|
59
|
+
c(t(g), {
|
|
60
|
+
class: i(["w-full shadow-none text-c-1 justify-start pl-2 gap-2 bg-b-2 border-1/2", { "bg-b-1 text-c-1": !t(l) }]),
|
|
61
|
+
variant: t(l) ? "secondary" : "primary",
|
|
62
|
+
onClick: r[1] || (r[1] = (s) => t(h)(""))
|
|
73
63
|
}, {
|
|
74
|
-
default:
|
|
75
|
-
e("div",
|
|
76
|
-
l
|
|
64
|
+
default: d(() => [
|
|
65
|
+
e("div", U, [
|
|
66
|
+
t(l) ? p("", !0) : (o(), u(t(k), {
|
|
77
67
|
key: 0,
|
|
78
68
|
icon: "Checkmark",
|
|
79
69
|
size: "xs",
|
|
80
70
|
thickness: "3.5"
|
|
81
71
|
}))
|
|
82
72
|
]),
|
|
83
|
-
|
|
73
|
+
r[3] || (r[3] = b(" Skip the proxy "))
|
|
84
74
|
]),
|
|
85
75
|
_: 1
|
|
86
76
|
}, 8, ["class", "variant"])
|
|
87
77
|
])
|
|
88
78
|
]),
|
|
89
79
|
e("div", null, [
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
e("div",
|
|
93
|
-
e("div",
|
|
94
|
-
(
|
|
95
|
-
key:
|
|
96
|
-
class:
|
|
97
|
-
"flex items-center justify-between gap-2 text-c-1",
|
|
98
|
-
|
|
80
|
+
r[5] || (r[5] = e("h3", { class: "font-bold mb-1" }, "Theme", -1)),
|
|
81
|
+
r[6] || (r[6] = e("p", { class: "text-c-2 mb-4 leading-[21px]" }, " We’ve got a whole rainbow of themes for you to play with: ", -1)),
|
|
82
|
+
e("div", E, [
|
|
83
|
+
e("div", G, [
|
|
84
|
+
(o(), x(S, null, j(v, (s) => c(t(g), {
|
|
85
|
+
key: s,
|
|
86
|
+
class: i(["px-2", [
|
|
87
|
+
"flex items-center justify-between gap-2 text-c-1 border-1/2",
|
|
88
|
+
t(a).themeId === s ? "bg-b-1" : "bg-b-2"
|
|
99
89
|
]]),
|
|
100
90
|
variant: "ghost",
|
|
101
|
-
onClick: (
|
|
91
|
+
onClick: (D) => w(s)
|
|
102
92
|
}, {
|
|
103
|
-
default:
|
|
104
|
-
e("div",
|
|
93
|
+
default: d(() => [
|
|
94
|
+
e("div", L, [
|
|
105
95
|
e("div", {
|
|
106
|
-
class:
|
|
107
|
-
"bg-primary":
|
|
96
|
+
class: i(["flex items-center justify-center w-5 h-5 rounded-full border-2 border-c-3", {
|
|
97
|
+
"bg-primary": t(a).themeId === s
|
|
108
98
|
}])
|
|
109
99
|
}, [
|
|
110
|
-
e("div",
|
|
111
|
-
|
|
100
|
+
e("div", O, [
|
|
101
|
+
t(a).themeId === s ? (o(), u(t(k), {
|
|
112
102
|
key: 0,
|
|
113
103
|
icon: "Checkmark",
|
|
114
104
|
size: "xs",
|
|
115
105
|
thickness: "3.5"
|
|
116
|
-
})) :
|
|
106
|
+
})) : p("", !0)
|
|
117
107
|
])
|
|
118
108
|
], 2),
|
|
119
|
-
|
|
109
|
+
b(" " + z(t(B)[s]), 1)
|
|
120
110
|
]),
|
|
121
|
-
e("div",
|
|
111
|
+
e("div", R, [
|
|
122
112
|
e("span", {
|
|
123
|
-
class: "inline-block
|
|
113
|
+
class: "inline-block w-5 h-5 rounded-full border-c-3 -mr-3",
|
|
124
114
|
style: m({
|
|
125
|
-
backgroundColor: f(
|
|
115
|
+
backgroundColor: f(s).light
|
|
126
116
|
})
|
|
127
117
|
}, null, 4),
|
|
128
118
|
e("span", {
|
|
129
|
-
class: "inline-block
|
|
119
|
+
class: "inline-block w-5 h-5 rounded-full border-c-3 -mr-3",
|
|
130
120
|
style: m({
|
|
131
|
-
backgroundColor: f(
|
|
121
|
+
backgroundColor: f(s).dark
|
|
132
122
|
})
|
|
133
123
|
}, null, 4),
|
|
134
124
|
e("span", {
|
|
135
|
-
class: "inline-block
|
|
125
|
+
class: "inline-block w-5 h-5 rounded-full border-c-3",
|
|
136
126
|
style: m({
|
|
137
|
-
backgroundColor: f(
|
|
127
|
+
backgroundColor: f(s).accent
|
|
138
128
|
})
|
|
139
129
|
}, null, 4)
|
|
140
130
|
])
|
|
@@ -145,7 +135,7 @@ const N = { class: "bg-b-1 w-full h-full overflow-auto" }, P = { class: "flex fl
|
|
|
145
135
|
])
|
|
146
136
|
]),
|
|
147
137
|
e("div", null, [
|
|
148
|
-
|
|
138
|
+
c(N)
|
|
149
139
|
])
|
|
150
140
|
])
|
|
151
141
|
])
|
|
@@ -153,5 +143,5 @@ const N = { class: "bg-b-1 w-full h-full overflow-auto" }, P = { class: "flex fl
|
|
|
153
143
|
}
|
|
154
144
|
});
|
|
155
145
|
export {
|
|
156
|
-
|
|
146
|
+
K as default
|
|
157
147
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsGeneralMode.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneralMode.vue"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"SettingsGeneralMode.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneralMode.vue"],"names":[],"mappings":";AAoXA,wBAKG"}
|
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { defineComponent as
|
|
1
|
+
import { defineComponent as y, ref as g, openBlock as l, createElementBlock as v, Fragment as h, createElementVNode as s, createVNode as a, unref as r, normalizeClass as n, withCtx as c, createBlock as d, createCommentVNode as u, createTextVNode as i } from "vue";
|
|
2
2
|
import { ScalarButton as f, ScalarIcon as m } from "@scalar/components";
|
|
3
3
|
import { useDarkModeState as w } from "../../hooks/useDarkModeState.js";
|
|
4
|
-
const
|
|
4
|
+
const C = { class: "flex flex-col gap-2" }, S = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, M = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, D = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, B = /* @__PURE__ */ y({
|
|
5
5
|
__name: "SettingsGeneralMode",
|
|
6
6
|
setup(_) {
|
|
7
|
-
const { colorMode: k, setDarkMode:
|
|
7
|
+
const { colorMode: k, setDarkMode: o } = w(), e = g("System Preference");
|
|
8
8
|
k.value === "system" ? e.value = "System Preference" : k.value === "dark" ? e.value = "Dark" : e.value = "Light";
|
|
9
9
|
const p = () => {
|
|
10
|
-
|
|
10
|
+
o(null), e.value = "System Preference";
|
|
11
11
|
}, b = () => {
|
|
12
|
-
|
|
12
|
+
o(!1), e.value = "Light";
|
|
13
13
|
}, x = () => {
|
|
14
|
-
|
|
14
|
+
o(!0), e.value = "Dark";
|
|
15
15
|
};
|
|
16
|
-
return (P, t) => (
|
|
16
|
+
return (P, t) => (l(), v(h, null, [
|
|
17
17
|
t[3] || (t[3] = s("h3", { class: "font-bold mb-1 mt-8" }, "Appearance", -1)),
|
|
18
|
-
t[4] || (t[4] = s("p", { class: "text-c-2 mb-4" }, "
|
|
19
|
-
s("div",
|
|
18
|
+
t[4] || (t[4] = s("p", { class: "text-c-2 mb-4 leading-[21px]" }, " Choose between light, dark, or system-based appearance for your workspace. ", -1)),
|
|
19
|
+
s("div", C, [
|
|
20
20
|
a(r(f), {
|
|
21
21
|
class: n([
|
|
22
|
-
"w-full shadow-none text-c-1 justify-start pl-2 gap-2",
|
|
23
|
-
e.value === "System Preference" ? "bg-b-1
|
|
22
|
+
"w-full shadow-none text-c-1 justify-start pl-2 gap-2 border-1/2",
|
|
23
|
+
e.value === "System Preference" ? "bg-b-1 text-c-1" : "bg-b-2"
|
|
24
24
|
]),
|
|
25
25
|
onClick: p
|
|
26
26
|
}, {
|
|
27
27
|
default: c(() => [
|
|
28
|
-
s("div",
|
|
29
|
-
e.value === "System Preference" ? (
|
|
28
|
+
s("div", S, [
|
|
29
|
+
e.value === "System Preference" ? (l(), d(r(m), {
|
|
30
30
|
key: 0,
|
|
31
31
|
icon: "Checkmark",
|
|
32
32
|
size: "xs",
|
|
33
33
|
thickness: "3.5"
|
|
34
34
|
})) : u("", !0)
|
|
35
35
|
]),
|
|
36
|
-
t[0] || (t[0] = i(" System Preference "))
|
|
36
|
+
t[0] || (t[0] = i(" System Preference (default) "))
|
|
37
37
|
]),
|
|
38
38
|
_: 1
|
|
39
39
|
}, 8, ["class"]),
|
|
40
40
|
a(r(f), {
|
|
41
41
|
class: n([
|
|
42
|
-
"w-full shadow-none text-c-1 justify-start pl-2 gap-2",
|
|
43
|
-
e.value === "Light" ? "bg-b-1
|
|
42
|
+
"w-full shadow-none text-c-1 justify-start pl-2 gap-2 border-1/2",
|
|
43
|
+
e.value === "Light" ? "bg-b-1 text-c-1" : "bg-b-2"
|
|
44
44
|
]),
|
|
45
45
|
onClick: b
|
|
46
46
|
}, {
|
|
47
47
|
default: c(() => [
|
|
48
48
|
s("div", M, [
|
|
49
|
-
e.value === "Light" ? (
|
|
49
|
+
e.value === "Light" ? (l(), d(r(m), {
|
|
50
50
|
key: 0,
|
|
51
51
|
icon: "Checkmark",
|
|
52
52
|
size: "xs",
|
|
53
53
|
thickness: "3.5"
|
|
54
54
|
})) : u("", !0)
|
|
55
55
|
]),
|
|
56
|
-
t[1] || (t[1] = i(" Light Mode "))
|
|
56
|
+
t[1] || (t[1] = i(" Light Mode Always "))
|
|
57
57
|
]),
|
|
58
58
|
_: 1
|
|
59
59
|
}, 8, ["class"]),
|
|
60
60
|
a(r(f), {
|
|
61
61
|
class: n([
|
|
62
|
-
"w-full shadow-none text-c-1 justify-start pl-2 gap-2 mb-8",
|
|
63
|
-
e.value === "Dark" ? "bg-b-1
|
|
62
|
+
"w-full shadow-none text-c-1 justify-start pl-2 gap-2 mb-8 border-1/2",
|
|
63
|
+
e.value === "Dark" ? "bg-b-1 text-c-1" : "bg-b-2"
|
|
64
64
|
]),
|
|
65
65
|
onClick: x
|
|
66
66
|
}, {
|
|
67
67
|
default: c(() => [
|
|
68
68
|
s("div", D, [
|
|
69
|
-
e.value === "Dark" ? (
|
|
69
|
+
e.value === "Dark" ? (l(), d(r(m), {
|
|
70
70
|
key: 0,
|
|
71
71
|
icon: "Checkmark",
|
|
72
72
|
size: "xs",
|
|
73
73
|
thickness: "3.5"
|
|
74
74
|
})) : u("", !0)
|
|
75
75
|
]),
|
|
76
|
-
t[2] || (t[2] = i(" Dark Mode "))
|
|
76
|
+
t[2] || (t[2] = i(" Dark Mode Always "))
|
|
77
77
|
]),
|
|
78
78
|
_: 1
|
|
79
79
|
}, 8, ["class"])
|