@scalar/api-client 2.1.25 → 2.1.27

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.
Files changed (71) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  3. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +150 -90
  4. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
  5. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts.map +1 -1
  6. package/dist/components/CommandPalette/TheCommandPalette.vue.js +4 -4
  7. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +42 -42
  8. package/dist/components/ImportCollection/ImportNowButton.vue.d.ts.map +1 -1
  9. package/dist/components/ImportCollection/ImportNowButton.vue.js +7 -9
  10. package/dist/layouts/App/create-api-client-app.d.ts +77 -20
  11. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  12. package/dist/layouts/App/create-api-client-app.js +14 -12
  13. package/dist/layouts/Modal/create-api-client-modal.d.ts +154 -40
  14. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  15. package/dist/layouts/Modal/create-api-client-modal.js +23 -26
  16. package/dist/layouts/Web/create-api-client-web.d.ts +77 -20
  17. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  18. package/dist/layouts/Web/create-api-client-web.js +12 -10
  19. package/dist/libs/create-client.d.ts +77 -20
  20. package/dist/libs/create-client.d.ts.map +1 -1
  21. package/dist/libs/create-client.js +60 -58
  22. package/dist/store/collections.d.ts +34 -4
  23. package/dist/store/collections.d.ts.map +1 -1
  24. package/dist/store/import-spec.d.ts +43 -4
  25. package/dist/store/import-spec.d.ts.map +1 -1
  26. package/dist/store/import-spec.js +60 -36
  27. package/dist/store/requests.d.ts +4 -1
  28. package/dist/store/requests.d.ts.map +1 -1
  29. package/dist/store/requests.js +76 -76
  30. package/dist/store/security-schemes.d.ts +2 -2
  31. package/dist/store/security-schemes.d.ts.map +1 -1
  32. package/dist/store/security-schemes.js +35 -37
  33. package/dist/store/servers.d.ts +10 -10
  34. package/dist/store/servers.d.ts.map +1 -1
  35. package/dist/store/store.d.ts +154 -40
  36. package/dist/store/store.d.ts.map +1 -1
  37. package/dist/store/store.js +74 -72
  38. package/dist/store/workspace.d.ts.map +1 -1
  39. package/dist/store/workspace.js +23 -18
  40. package/dist/style.css +1 -1
  41. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  42. package/dist/views/Request/Request.vue.js +1 -1
  43. package/dist/views/Request/Request.vue2.js +39 -38
  44. package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.d.ts.map +1 -1
  45. package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +12 -12
  46. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  47. package/dist/views/Request/RequestSidebar.vue.js +4 -4
  48. package/dist/views/Request/RequestSidebar.vue2.js +107 -102
  49. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  50. package/dist/views/Request/RequestSidebarItem.vue.js +1 -1
  51. package/dist/views/Request/RequestSidebarItem.vue2.js +165 -135
  52. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -1
  53. package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts.map +1 -1
  54. package/dist/views/Request/RequestSidebarItemMenu.vue.js +4 -4
  55. package/dist/views/Request/RequestSidebarItemMenu.vue2.js +96 -71
  56. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  57. package/dist/views/Request/hooks/useOpenApiWatcher.d.ts +9 -0
  58. package/dist/views/Request/hooks/useOpenApiWatcher.d.ts.map +1 -0
  59. package/dist/views/Request/hooks/useOpenApiWatcher.js +86 -0
  60. package/dist/views/Request/libs/live-sync.d.ts +59 -0
  61. package/dist/views/Request/libs/live-sync.d.ts.map +1 -0
  62. package/dist/views/Request/libs/live-sync.js +289 -0
  63. package/dist/views/Request/types/sidebar-item.d.ts +2 -0
  64. package/dist/views/Request/types/sidebar-item.d.ts.map +1 -1
  65. package/dist/views/Settings/Settings.vue.d.ts.map +1 -1
  66. package/dist/views/Settings/Settings.vue2.js +15 -45
  67. package/dist/views/Settings/SettingsGeneral.vue.d.ts.map +1 -1
  68. package/dist/views/Settings/SettingsGeneral.vue.js +135 -102
  69. package/dist/views/Settings/SettingsGeneralMode.vue.d.ts.map +1 -1
  70. package/dist/views/Settings/SettingsGeneralMode.vue.js +76 -68
  71. package/package.json +8 -6
@@ -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;CACnB,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
+ {"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":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Settings.vue"],"names":[],"mappings":"AA0DA,OAAO,EAAE,KAAK,eAAe,EAAO,MAAM,KAAK,CAAA;;AAuI/C,wBAKG"}
1
+ {"version":3,"file":"Settings.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/Settings.vue"],"names":[],"mappings":"AAgCA,OAAO,EAAE,KAAK,eAAe,EAAO,MAAM,KAAK,CAAA;;AAiF/C,wBAKG"}
@@ -1,51 +1,21 @@
1
- import { defineComponent as i, ref as m, openBlock as a, createBlock as r, withCtx as e, createVNode as o, unref as s, createElementVNode as c, createElementBlock as f, Fragment as p, renderList as u, createTextVNode as _, toDisplayString as d, resolveDynamicComponent as x } from "vue";
2
- import b from "../../components/Sidebar/SidebarList.vue.js";
3
- import S from "../../components/Sidebar/SidebarListElement.vue.js";
4
- import g from "../../components/ViewLayout/ViewLayout.vue.js";
5
- import v from "../../components/ViewLayout/ViewLayoutContent.vue.js";
6
- import y from "./SettingsGeneral.vue.js";
7
- import C from "../../components/Sidebar/Sidebar.vue.js";
8
- const L = { class: "flex-1" }, T = /* @__PURE__ */ i({
1
+ import { defineComponent as a, ref as c, openBlock as e, createBlock as t, withCtx as o, createVNode as i, resolveDynamicComponent as m } from "vue";
2
+ import l from "../../components/ViewLayout/ViewLayout.vue.js";
3
+ import s from "../../components/ViewLayout/ViewLayoutContent.vue.js";
4
+ import p from "./SettingsGeneral.vue.js";
5
+ const v = /* @__PURE__ */ a({
9
6
  __name: "Settings",
10
- setup(V) {
11
- const l = {
7
+ setup(f) {
8
+ const n = {
12
9
  general: {
13
- component: y,
10
+ component: p,
14
11
  title: "general"
15
12
  }
16
- }, n = m("general");
17
- return (k, h) => (a(), r(g, null, {
18
- default: e(() => [
19
- o(s(C), { title: "Settings" }, {
20
- content: e(() => [
21
- c("div", L, [
22
- o(b, null, {
23
- default: e(() => [
24
- (a(), f(p, null, u(l, (t) => o(S, {
25
- key: t.title,
26
- class: "text-xs capitalize",
27
- isCopyable: !1,
28
- isDeletable: !1,
29
- variable: {
30
- uid: t.title,
31
- name: t.title
32
- }
33
- }, {
34
- default: e(() => [
35
- _(d(t.title), 1)
36
- ]),
37
- _: 2
38
- }, 1032, ["variable"])), 64))
39
- ]),
40
- _: 1
41
- })
42
- ])
43
- ]),
44
- _: 1
45
- }),
46
- o(v, { class: "flex-1" }, {
47
- default: e(() => [
48
- (a(), r(x(l[n.value].component)))
13
+ }, r = c("general");
14
+ return (_, u) => (e(), t(l, null, {
15
+ default: o(() => [
16
+ i(s, { class: "flex-1" }, {
17
+ default: o(() => [
18
+ (e(), t(m(n[r.value].component)))
49
19
  ]),
50
20
  _: 1
51
21
  })
@@ -55,5 +25,5 @@ const L = { class: "flex-1" }, T = /* @__PURE__ */ i({
55
25
  }
56
26
  });
57
27
  export {
58
- T as default
28
+ v as default
59
29
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsGeneral.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneral.vue"],"names":[],"mappings":";AA2bA,wBAKG"}
1
+ {"version":3,"file":"SettingsGeneral.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneral.vue"],"names":[],"mappings":";AA+lBA,wBAKG"}
@@ -1,20 +1,12 @@
1
- import { defineComponent as v, openBlock as u, createBlock as y, withCtx as t, createTextVNode as a, createElementVNode as s, createVNode as e, unref as l, createElementBlock as b, Fragment as S, renderList as C, withModifiers as $, normalizeClass as V, toDisplayString as p } from "vue";
2
- import D from "../../components/DataTable/DataTable.vue.js";
3
- import P from "../../components/DataTable/DataTableCell.vue.js";
4
- import z from "../../components/DataTable/DataTableCheckbox.vue.js";
5
- import n from "../../components/DataTable/DataTableRow.vue.js";
6
- import d from "../../components/DataTable/DataTableText.vue.js";
7
- import B from "../../components/ViewLayout/ViewLayoutSection.vue.js";
8
- import { ScalarDropdown as T, ScalarDropdownItem as U, ScalarIcon as _, ScalarButton as I } from "@scalar/components";
9
- import { themeLabels as h } from "@scalar/themes";
10
- import N from "./SettingsGeneralMode.vue.js";
11
- import { useWorkspace as W } from "../../store/store.js";
12
- const j = { class: "flex flex-col p-2" }, E = { class: "font-medium m-0 text-sm flex gap-1.5 items-center" }, Y = /* @__PURE__ */ v({
1
+ import { defineComponent as C, openBlock as a, createElementBlock as x, createElementVNode as e, createTextVNode as o, createVNode as i, unref as l, normalizeClass as d, withCtx as u, createBlock as p, createCommentVNode as b, Fragment as _, renderList as S, toDisplayString as j, normalizeStyle as m } from "vue";
2
+ import { ScalarButton as k, ScalarIcon as g } from "@scalar/components";
3
+ import { themeLabels as z } from "@scalar/themes";
4
+ import B from "./SettingsGeneralMode.vue.js";
5
+ import { useWorkspace as E } from "../../store/store.js";
6
+ const N = { class: "bg-b-1 w-full h-full overflow-auto" }, P = { class: "flex flex-col px-5 py-5 max-w-[720px] ml-auto mr-auto w-full" }, T = { class: "gap-2 mt-4 mb-8 flex flex-col" }, V = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, $ = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, D = { class: "flex flex-col gap-2" }, L = { class: "grid grid-cols-2 gap-2" }, U = { class: "flex items-center gap-2" }, W = { class: "flex items-center justify-center w-5 h-5 rounded-full border-[1.5px] p-1" }, F = { class: "flex items-center gap-1" }, J = /* @__PURE__ */ C({
13
7
  __name: "SettingsGeneral",
14
8
  setup(G) {
15
- const { activeWorkspace: r, workspaceMutators: x, proxyUrl: i, setProxyUrl: c } = W(), k = () => {
16
- i.value ? c("") : c("https://proxy.scalar.com");
17
- }, g = [
9
+ const { activeWorkspace: n, workspaceMutators: y, proxyUrl: s, setProxyUrl: h } = E(), v = [
18
10
  "default",
19
11
  "alternate",
20
12
  "moon",
@@ -25,100 +17,141 @@ const j = { class: "flex flex-col p-2" }, E = { class: "font-medium m-0 text-sm
25
17
  "kepler",
26
18
  "mars",
27
19
  "deepSpace"
28
- ], w = (m) => {
29
- x.edit(r.value.uid, "themeId", m);
20
+ ], f = (c) => ({
21
+ default: { light: "#fff", dark: "#0f0f0f", accent: "#0099ff" },
22
+ alternate: { light: "#f9f9f9", dark: "#131313", accent: "#e7e7e7" },
23
+ moon: { light: "#ccc9b3", dark: "#313332", accent: "#645b0f" },
24
+ purple: { light: "#f5f6f8", dark: "#22252b", accent: "#5469d4" },
25
+ solarized: { light: "#fdf6e3", dark: "#00212b", accent: "#007acc" },
26
+ bluePlanet: { light: "#f0f2f5", dark: "#000e23", accent: "#e0e2e6" },
27
+ saturn: { light: "#e4e4df", dark: "#2c2c30", accent: "#1763a6" },
28
+ kepler: { light: "#f6f6f6", dark: "#0d0f1e", accent: "#7070ff" },
29
+ mars: { light: "#f2efe8", dark: "#321116", accent: "#c75549" },
30
+ deepSpace: { light: "#f4f4f5", dark: "#09090b", accent: "#8ab4f8" },
31
+ none: { light: "#ffffff", dark: "#000000", accent: "#3b82f6" }
32
+ })[c] || { light: "#ffffff", dark: "#000000", accent: "#3b82f6" }, w = (c) => {
33
+ y.edit(n.value.uid, "themeId", c);
30
34
  };
31
- return (m, f) => (u(), y(B, null, {
32
- title: t(() => f[0] || (f[0] = [
33
- a("General")
34
- ])),
35
- default: t(() => [
36
- s("div", j, [
37
- e(D, { columns: ["", ""] }, {
38
- default: t(() => [
39
- e(n, null, {
40
- default: t(() => [
41
- e(d, { text: "Use Scalar Proxy" }),
42
- e(z, {
43
- align: "left",
44
- modelValue: !!l(i),
45
- "onUpdate:modelValue": k
46
- }, null, 8, ["modelValue"])
35
+ return (c, t) => (a(), x("div", N, [
36
+ e("div", P, [
37
+ e("div", null, [
38
+ e("div", null, [
39
+ t[4] || (t[4] = e("h2", { class: "font-bold text-xl mb-5 mt-10" }, "Settings", -1)),
40
+ t[5] || (t[5] = e("h3", { class: "font-bold mb-1" }, "Scalar Proxy", -1)),
41
+ t[6] || (t[6] = e("p", { class: "text-c-2 mb-2" }, [
42
+ o(" Enable Scalar's "),
43
+ e("a", {
44
+ class: "hover:text-c-1",
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"))
55
+ }, {
56
+ default: u(() => [
57
+ e("div", V, [
58
+ l(s) ? (a(), p(l(g), {
59
+ key: 0,
60
+ icon: "Checkmark",
61
+ size: "xs",
62
+ thickness: "3.5"
63
+ })) : b("", !0)
64
+ ]),
65
+ t[2] || (t[2] = o(" Enable "))
47
66
  ]),
48
67
  _: 1
49
- }),
50
- e(n, null, {
51
- default: t(() => [
52
- e(d, { text: "Theme Picker" }),
53
- e(P, null, {
54
- default: t(() => [
55
- e(l(T), null, {
56
- items: t(() => [
57
- (u(), b(S, null, C(g, (o) => e(l(U), {
58
- key: o,
59
- class: "flex gap-1.5 group/item items-center whitespace-nowrap text-ellipsis overflow-hidden",
60
- onClick: $((L) => w(o), ["stop"])
61
- }, {
62
- default: t(() => [
63
- s("div", {
64
- class: V([
65
- "flex items-center justify-center rounded-full p-[3px] w-4 h-4 group-hover/item:shadow-border",
66
- l(r).themeId === o ? "bg-blue text-b-1" : "text-transparent"
67
- ])
68
- }, [
69
- e(l(_), {
70
- class: "size-2.5",
71
- icon: "Checkmark",
72
- thickness: "3.5"
73
- })
74
- ], 2),
75
- a(" " + p(l(h)[o]), 1)
76
- ]),
77
- _: 2
78
- }, 1032, ["onClick"])), 64))
79
- ]),
80
- default: t(() => [
81
- e(l(I), {
82
- class: "font-normal h-full justify-start py-1.5 px-1.5 text-c-1 hover:bg-b-2 w-fit",
83
- fullWidth: "",
84
- variant: "ghost"
85
- }, {
86
- default: t(() => [
87
- s("h2", E, [
88
- a(p(l(h)[l(r).themeId]) + " ", 1),
89
- e(l(_), {
90
- class: "size-2.5",
91
- icon: "ChevronDown",
92
- thickness: "3.5"
93
- })
94
- ])
95
- ]),
96
- _: 1
97
- })
98
- ]),
99
- _: 1
100
- })
101
- ]),
102
- _: 1
103
- })
104
- ]),
105
- _: 1
106
- }),
107
- e(n, null, {
108
- default: t(() => [
109
- e(N)
68
+ }, 8, ["class", "variant"]),
69
+ i(l(k), {
70
+ 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) }]),
71
+ variant: l(s) ? "secondary" : "primary",
72
+ onClick: t[1] || (t[1] = (r) => l(h)(""))
73
+ }, {
74
+ default: u(() => [
75
+ e("div", $, [
76
+ l(s) ? b("", !0) : (a(), p(l(g), {
77
+ key: 0,
78
+ icon: "Checkmark",
79
+ size: "xs",
80
+ thickness: "3.5"
81
+ }))
82
+ ]),
83
+ t[3] || (t[3] = o(" Disable "))
110
84
  ]),
111
85
  _: 1
112
- })
113
- ]),
114
- _: 1
115
- })
86
+ }, 8, ["class", "variant"])
87
+ ])
88
+ ]),
89
+ e("div", null, [
90
+ t[7] || (t[7] = e("h3", { class: "font-bold mb-1" }, "Theme", -1)),
91
+ t[8] || (t[8] = e("p", { class: "text-c-2 mb-4" }, "Set the theme for your workspace.", -1)),
92
+ e("div", D, [
93
+ e("div", L, [
94
+ (a(), x(_, null, S(v, (r) => i(l(k), {
95
+ key: r,
96
+ class: d(["px-2", [
97
+ "flex items-center justify-between gap-2 text-c-1",
98
+ l(n).themeId === r ? "bg-b-1 shadow-border-1/2" : "bg-b-2"
99
+ ]]),
100
+ variant: "ghost",
101
+ onClick: (M) => w(r)
102
+ }, {
103
+ default: u(() => [
104
+ e("div", U, [
105
+ e("div", {
106
+ class: d(["flex items-center justify-center w-5 h-5 rounded-full border-2 border-c-3", {
107
+ "bg-primary": l(n).themeId === r
108
+ }])
109
+ }, [
110
+ e("div", W, [
111
+ l(n).themeId === r ? (a(), p(l(g), {
112
+ key: 0,
113
+ icon: "Checkmark",
114
+ size: "xs",
115
+ thickness: "3.5"
116
+ })) : b("", !0)
117
+ ])
118
+ ], 2),
119
+ o(" " + j(l(z)[r]), 1)
120
+ ]),
121
+ e("div", F, [
122
+ e("span", {
123
+ class: "inline-block shadow-border-1/2 w-5 h-5 rounded-full border-c-3 -mr-3",
124
+ style: m({
125
+ backgroundColor: f(r).light
126
+ })
127
+ }, null, 4),
128
+ e("span", {
129
+ class: "inline-block shadow-border-1/2 w-5 h-5 rounded-full border-c-3 -mr-3",
130
+ style: m({
131
+ backgroundColor: f(r).dark
132
+ })
133
+ }, null, 4),
134
+ e("span", {
135
+ class: "inline-block shadow-border-1/2 w-5 h-5 rounded-full border-c-3",
136
+ style: m({
137
+ backgroundColor: f(r).accent
138
+ })
139
+ }, null, 4)
140
+ ])
141
+ ]),
142
+ _: 2
143
+ }, 1032, ["class", "onClick"])), 64))
144
+ ])
145
+ ])
146
+ ]),
147
+ e("div", null, [
148
+ i(B)
149
+ ])
116
150
  ])
117
- ]),
118
- _: 1
119
- }));
151
+ ])
152
+ ]));
120
153
  }
121
154
  });
122
155
  export {
123
- Y as default
156
+ J as default
124
157
  };
@@ -1 +1 @@
1
- {"version":3,"file":"SettingsGeneralMode.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneralMode.vue"],"names":[],"mappings":";AAgUA,wBAKG"}
1
+ {"version":3,"file":"SettingsGeneralMode.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Settings/SettingsGeneralMode.vue"],"names":[],"mappings":";AAqYA,wBAKG"}