@scalar/api-client 2.2.7 → 2.2.9

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 (149) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
  3. package/dist/components/CodeInput/CodeInput.vue.js +2 -2
  4. package/dist/components/CodeInput/CodeInput.vue2.js +65 -65
  5. package/dist/components/CodeInput/codeVariableWidget.d.ts +6 -4
  6. package/dist/components/CodeInput/codeVariableWidget.d.ts.map +1 -1
  7. package/dist/components/CodeInput/codeVariableWidget.js +72 -68
  8. package/dist/components/CommandPalette/CommandPaletteImport.vue.d.ts.map +1 -1
  9. package/dist/components/CommandPalette/CommandPaletteImport.vue.js +108 -106
  10. package/dist/components/CommandPalette/TheCommandPalette.vue.d.ts +1 -1
  11. package/dist/components/CommandPalette/TheCommandPalette.vue.js +2 -2
  12. package/dist/components/CommandPalette/TheCommandPalette.vue2.js +12 -12
  13. package/dist/components/DataTable/DataTable.vue.d.ts.map +1 -1
  14. package/dist/components/DataTable/DataTable.vue.js +20 -15
  15. package/dist/components/DataTable/DataTableCell.vue.d.ts.map +1 -1
  16. package/dist/components/DataTable/DataTableCell.vue.js +16 -11
  17. package/dist/components/DataTable/DataTableHeader.vue.d.ts.map +1 -1
  18. package/dist/components/DataTable/DataTableHeader.vue.js +11 -12
  19. package/dist/components/DataTable/DataTableInput.vue.d.ts +2 -1
  20. package/dist/components/DataTable/DataTableInput.vue.d.ts.map +1 -1
  21. package/dist/components/DataTable/DataTableInput.vue.js +3 -3
  22. package/dist/components/DataTable/DataTableInput.vue2.js +9 -9
  23. package/dist/components/DataTable/index.js +14 -14
  24. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.d.ts.map +1 -1
  25. package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +87 -67
  26. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  27. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +2 -2
  28. package/dist/components/Sidebar/SidebarList.vue.d.ts.map +1 -1
  29. package/dist/components/Sidebar/SidebarList.vue.js +4 -4
  30. package/dist/components/Sidebar/SidebarListElement.vue.d.ts +8 -4
  31. package/dist/components/Sidebar/SidebarListElement.vue.d.ts.map +1 -1
  32. package/dist/components/Sidebar/SidebarListElement.vue.js +1 -1
  33. package/dist/components/Sidebar/SidebarListElement.vue2.js +52 -32
  34. package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts +3 -0
  35. package/dist/components/Sidebar/SidebarListElementActions.vue.d.ts.map +1 -1
  36. package/dist/components/Sidebar/SidebarListElementActions.vue.js +43 -31
  37. package/dist/components/TopNav/TopNav.vue.d.ts.map +1 -1
  38. package/dist/components/TopNav/TopNav.vue.js +32 -31
  39. package/dist/layouts/App/create-api-client-app.d.ts +49 -42
  40. package/dist/layouts/App/create-api-client-app.d.ts.map +1 -1
  41. package/dist/layouts/Modal/create-api-client-modal.d.ts +103 -89
  42. package/dist/layouts/Modal/create-api-client-modal.d.ts.map +1 -1
  43. package/dist/layouts/Modal/create-api-client-modal.js +31 -19
  44. package/dist/layouts/Web/create-api-client-web.d.ts +49 -42
  45. package/dist/layouts/Web/create-api-client-web.d.ts.map +1 -1
  46. package/dist/libs/create-client.d.ts +50 -44
  47. package/dist/libs/create-client.d.ts.map +1 -1
  48. package/dist/libs/env-helpers.d.ts +9 -0
  49. package/dist/libs/env-helpers.d.ts.map +1 -0
  50. package/dist/libs/env-helpers.js +4 -0
  51. package/dist/libs/environment-parser.d.ts +3 -4
  52. package/dist/libs/environment-parser.d.ts.map +1 -1
  53. package/dist/libs/environment-parser.js +5 -4
  54. package/dist/libs/index.d.ts +2 -0
  55. package/dist/libs/index.d.ts.map +1 -1
  56. package/dist/libs/index.js +28 -22
  57. package/dist/libs/postman.d.ts +11 -0
  58. package/dist/libs/postman.d.ts.map +1 -0
  59. package/dist/libs/postman.js +39 -0
  60. package/dist/libs/send-request/send-request.d.ts +5 -2
  61. package/dist/libs/send-request/send-request.d.ts.map +1 -1
  62. package/dist/libs/send-request/send-request.js +106 -104
  63. package/dist/routes.d.ts +11 -0
  64. package/dist/routes.d.ts.map +1 -1
  65. package/dist/routes.js +13 -7
  66. package/dist/store/active-entities.d.ts +18 -11
  67. package/dist/store/active-entities.d.ts.map +1 -1
  68. package/dist/store/active-entities.js +108 -69
  69. package/dist/store/collections.d.ts +17 -15
  70. package/dist/store/collections.d.ts.map +1 -1
  71. package/dist/store/collections.js +62 -41
  72. package/dist/store/environment.d.ts +4 -4
  73. package/dist/store/import-spec.d.ts +2 -2
  74. package/dist/store/import-spec.d.ts.map +1 -1
  75. package/dist/store/index.d.ts +1 -0
  76. package/dist/store/index.d.ts.map +1 -1
  77. package/dist/store/index.js +7 -3
  78. package/dist/store/requests.d.ts +4 -4
  79. package/dist/store/router-params.d.ts +1 -1
  80. package/dist/store/router-params.d.ts.map +1 -1
  81. package/dist/store/router-params.js +7 -7
  82. package/dist/store/store.d.ts +49 -42
  83. package/dist/store/store.d.ts.map +1 -1
  84. package/dist/store/store.js +76 -72
  85. package/dist/store/workspace.d.ts +12 -12
  86. package/dist/store/workspace.d.ts.map +1 -1
  87. package/dist/style.css +1 -1
  88. package/dist/types/index.d.ts +2 -0
  89. package/dist/types/index.d.ts.map +1 -0
  90. package/dist/types/index.js +1 -0
  91. package/dist/types/vue.d.ts +10 -0
  92. package/dist/types/vue.d.ts.map +1 -0
  93. package/dist/views/Cookies/Cookies.vue.d.ts.map +1 -1
  94. package/dist/views/Cookies/Cookies.vue2.js +75 -70
  95. package/dist/views/Environment/Environment.vue.d.ts.map +1 -1
  96. package/dist/views/Environment/Environment.vue2.js +308 -152
  97. package/dist/views/Environment/EnvironmentColorModal.vue.d.ts.map +1 -1
  98. package/dist/views/Environment/EnvironmentColorModal.vue.js +20 -18
  99. package/dist/views/Environment/EnvironmentColors.vue.d.ts +4 -1
  100. package/dist/views/Environment/EnvironmentColors.vue.d.ts.map +1 -1
  101. package/dist/views/Environment/EnvironmentColors.vue.js +83 -58
  102. package/dist/views/Environment/EnvironmentModal.vue.d.ts +7 -0
  103. package/dist/views/Environment/EnvironmentModal.vue.d.ts.map +1 -1
  104. package/dist/views/Environment/EnvironmentModal.vue.js +119 -37
  105. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +4 -5
  106. package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts.map +1 -1
  107. package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +73 -63
  108. package/dist/views/Request/Request.vue.d.ts.map +1 -1
  109. package/dist/views/Request/Request.vue.js +2 -2
  110. package/dist/views/Request/Request.vue2.js +60 -61
  111. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +1 -0
  112. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
  113. package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +185 -187
  114. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +1 -0
  115. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts.map +1 -1
  116. package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +27 -24
  117. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts.map +1 -1
  118. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +1 -1
  119. package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +35 -187
  120. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +7 -0
  121. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts.map +1 -0
  122. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +7 -0
  123. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +207 -0
  124. package/dist/views/Request/RequestSection/{RequestAuthDataTableInput.vue.d.ts → RequestAuth/RequestAuthDataTableInput.vue.d.ts} +2 -2
  125. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts.map +1 -0
  126. package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.js +43 -0
  127. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts +1 -0
  128. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.d.ts.map +1 -1
  129. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue.js +5 -134
  130. package/dist/views/Request/RequestSection/RequestAuth/RequestExampleAuth.vue2.js +176 -2
  131. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +2 -0
  132. package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -0
  133. package/dist/views/Request/RequestSection/RequestAuth/index.js +4 -0
  134. package/dist/views/Request/RequestSidebar.vue.d.ts.map +1 -1
  135. package/dist/views/Request/RequestSidebar.vue.js +3 -3
  136. package/dist/views/Request/RequestSidebar.vue2.js +139 -117
  137. package/dist/views/Request/RequestSidebarItem.vue.d.ts.map +1 -1
  138. package/dist/views/Request/RequestSidebarItem.vue.js +2 -2
  139. package/dist/views/Request/RequestSidebarItem.vue2.js +32 -38
  140. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  141. package/dist/views/Request/libs/auth.d.ts.map +1 -1
  142. package/dist/views/Request/libs/auth.js +3 -3
  143. package/dist/views/Request/libs/oauth2.d.ts.map +1 -1
  144. package/dist/views/Servers/Servers.vue.d.ts.map +1 -1
  145. package/dist/views/Servers/Servers.vue2.js +9 -8
  146. package/package.json +19 -8
  147. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.d.ts.map +0 -1
  148. package/dist/views/Request/RequestSection/RequestAuthDataTableInput.vue.js +0 -46
  149. /package/dist/views/Request/RequestSection/{RequestAuthDataTableInput.vue2.js → RequestAuth/RequestAuthDataTableInput.vue2.js} +0 -0
@@ -1,180 +1,320 @@
1
- import { defineComponent as z, ref as d, watch as J, onMounted as T, onBeforeUnmount as F, openBlock as m, createBlock as b, withCtx as i, createVNode as s, createElementVNode as H, createElementBlock as g, Fragment as W, renderList as q, unref as u, createTextVNode as G, createSlots as P, createCommentVNode as Q, toDisplayString as X, withKeys as Y, nextTick as Z } from "vue";
2
- import ee from "../../components/CodeInput/CodeInput.vue.js";
3
- import ne from "../../components/Sidebar/Sidebar.vue.js";
4
- import te from "../../components/Sidebar/SidebarButton.vue.js";
5
- import oe from "../../components/Sidebar/SidebarList.vue.js";
6
- import le from "../../components/Sidebar/SidebarListElement.vue.js";
7
- import ae from "../../components/ViewLayout/ViewLayout.vue.js";
8
- import ue from "../../components/ViewLayout/ViewLayoutContent.vue.js";
9
- import ie from "../../components/ViewLayout/ViewLayoutSection.vue.js";
10
- import { useModal as S } from "@scalar/components";
11
- import { environmentSchema as re } from "@scalar/oas-utils/entities/environment";
12
- import { nanoid as se } from "nanoid";
13
- import { useRouter as me, useRoute as ce } from "vue-router";
14
- import de from "./EnvironmentColorModal.vue.js";
15
- import fe from "./EnvironmentModal.vue.js";
16
- import { useWorkspace as ve } from "../../store/store.js";
17
- const pe = { class: "flex-1" }, ye = ["value"], Ke = /* @__PURE__ */ z({
1
+ import { defineComponent as re, ref as f, watch as se, onMounted as ie, onBeforeUnmount as ue, openBlock as m, createBlock as h, withCtx as d, createVNode as u, createElementVNode as y, createElementBlock as M, Fragment as U, renderList as z, unref as r, normalizeClass as A, createTextVNode as B, toDisplayString as W, withDirectives as de, withModifiers as ce, createCommentVNode as K, vShow as me, createSlots as ve } from "vue";
2
+ import fe from "../../components/CodeInput/CodeInput.vue.js";
3
+ import pe from "../../components/Sidebar/Actions/EditSidebarListElement.vue.js";
4
+ import xe from "../../components/Sidebar/Sidebar.vue.js";
5
+ import be from "../../components/Sidebar/SidebarButton.vue.js";
6
+ import he from "../../components/Sidebar/SidebarList.vue.js";
7
+ import F from "../../components/Sidebar/SidebarListElement.vue.js";
8
+ import ye from "../../components/ViewLayout/ViewLayout.vue.js";
9
+ import Ce from "../../components/ViewLayout/ViewLayoutContent.vue.js";
10
+ import ke from "../../components/ViewLayout/ViewLayoutSection.vue.js";
11
+ import { useActiveEntities as Ee } from "../../store/active-entities.js";
12
+ import { useModal as $, ScalarIcon as G, ScalarButton as ge, ScalarModal as _e } from "@scalar/components";
13
+ import { LibraryIcon as Ie } from "@scalar/icons";
14
+ import { useToasts as we } from "@scalar/use-toasts";
15
+ import { useRouter as Se, useRoute as Me } from "vue-router";
16
+ import $e from "./EnvironmentColorModal.vue.js";
17
+ import Ve from "./EnvironmentModal.vue.js";
18
+ import { useWorkspace as Ne } from "../../store/store.js";
19
+ import { useSidebar as Oe } from "../../hooks/useSidebar.js";
20
+ const Re = { class: "flex-1" }, je = ["onClick"], nn = /* @__PURE__ */ re({
18
21
  __name: "Environment",
19
- setup(Ee) {
20
- const f = me(), k = ce(), { environments: l, environmentMutators: r, events: C } = ve(), v = S(), p = S(), o = d(null), V = d(null), y = d(!1), E = d(null), _ = d(""), c = (e) => JSON.parse(e), h = (e) => JSON.stringify(e, null, 2);
21
- function x(e) {
22
- const t = l[Object.keys(l)[0]], a = (t ? Object.keys(c(t.value)) : []).reduce(
23
- (D, U) => (D[U] = "", D),
24
- {}
25
- ), w = re.parse({
26
- name: e.name,
27
- uid: se(),
28
- color: e.color,
29
- value: h(a),
30
- isDefault: !1
31
- });
32
- r.add(w), o.value = w.uid, f.push(o.value), p.hide();
22
+ setup(De) {
23
+ const p = Se(), C = Me(), { activeWorkspace: V, activeEnvironment: J, activeWorkspaceCollections: s } = Ee(), { events: N, workspaceMutators: T, collectionMutators: x } = Ne(), { collapsedSidebarFolders: b, toggleSidebarFolder: k } = Oe(), E = $(), g = $(), _ = $(), O = f(null), l = f("default"), R = f(""), v = f(void 0), c = f(void 0), I = f(void 0), { toast: j } = we(), H = (e) => JSON.parse(e);
24
+ function D(e, o, n) {
25
+ var t;
26
+ e && (o.uid === n ? j(
27
+ `Environment name already used in ${(t = o.info) == null ? void 0 : t.title}`,
28
+ "error"
29
+ ) : j("Environment name already used in another collection", "error"));
33
30
  }
34
- function M(e) {
35
- Object.values(l).forEach((t) => {
36
- const n = c(t.value);
37
- e in n || (n[e] = "", r.edit(
38
- t.uid,
39
- "value",
40
- h(n)
41
- ));
42
- });
31
+ function q(e) {
32
+ s.value.some(
33
+ (n) => {
34
+ const t = Object.keys(
35
+ n["x-scalar-environments"] || {}
36
+ ).includes(e.name);
37
+ return D(t, n, e.collectionId), t;
38
+ }
39
+ ) || (e.collectionId && (x.addEnvironment(
40
+ e.name,
41
+ {
42
+ variables: {},
43
+ color: e.color
44
+ },
45
+ e.collectionId
46
+ ), b[e.collectionId] || k(e.collectionId), p.push({
47
+ name: "environment.collection",
48
+ params: {
49
+ collectionId: e.collectionId,
50
+ environmentId: e.name
51
+ }
52
+ })), g.hide());
43
53
  }
44
- function O(e) {
45
- Object.values(l).forEach((t) => {
46
- const n = c(t.value);
47
- e in n && (delete n[e], r.edit(
54
+ function P(e) {
55
+ var o;
56
+ if (J) {
57
+ const n = H(e);
58
+ if (l.value === "default")
59
+ T.edit(
60
+ V.value.uid,
61
+ "environments",
62
+ n
63
+ );
64
+ else {
65
+ const t = s.value.find(
66
+ (a) => {
67
+ var i;
68
+ return (i = a["x-scalar-environments"]) == null ? void 0 : i[l.value ?? ""];
69
+ }
70
+ );
71
+ (o = t == null ? void 0 : t["x-scalar-environments"]) != null && o[l.value ?? ""] && (t["x-scalar-environments"][l.value ?? ""].variables = n, x.edit(
72
+ t.uid,
73
+ "x-scalar-environments",
74
+ t["x-scalar-environments"]
75
+ ));
76
+ }
77
+ }
78
+ }
79
+ const S = (e) => {
80
+ v.value = e, g.show();
81
+ }, Q = (e, o) => {
82
+ c.value = e, v.value = o, I.value = e, _.show();
83
+ }, X = (e) => {
84
+ var o, n, t;
85
+ O.value = e, R.value = ((t = (n = (o = s.value.find(
86
+ (a) => {
87
+ var i;
88
+ return (i = a["x-scalar-environments"]) == null ? void 0 : i[e];
89
+ }
90
+ )) == null ? void 0 : o["x-scalar-environments"]) == null ? void 0 : n[e]) == null ? void 0 : t.color) ?? "", E.show();
91
+ }, Y = (e) => {
92
+ const o = O.value;
93
+ typeof o == "string" && (s.value.some(
94
+ (t) => {
95
+ var a;
96
+ return (a = t["x-scalar-environments"]) == null ? void 0 : a[o];
97
+ }
98
+ ) && s.value.forEach((t) => {
99
+ var a;
100
+ (a = t["x-scalar-environments"]) != null && a[o] && (t["x-scalar-environments"][o].color = e, x.edit(
48
101
  t.uid,
49
- "value",
50
- h(n)
102
+ "x-scalar-environments",
103
+ t["x-scalar-environments"]
51
104
  ));
105
+ }), E.hide());
106
+ };
107
+ function Z(e) {
108
+ s.value.forEach((n) => {
109
+ x.removeEnvironment(e, n.uid);
52
110
  });
53
- }
54
- function $(e) {
55
- if (o.value) {
56
- const t = c(e), n = c(
57
- l[o.value].value
111
+ const o = s.value.flatMap(
112
+ (n) => Object.keys(n["x-scalar-environments"] || {})
113
+ );
114
+ if (o.length > 0) {
115
+ const n = o[o.length - 1], t = s.value.find(
116
+ (a) => Object.keys(a["x-scalar-environments"] || {}).includes(
117
+ n
118
+ )
58
119
  );
59
- Object.keys(t).forEach((a) => {
60
- a in n || M(a);
61
- }), Object.keys(n).forEach((a) => {
62
- a in t || O(a);
63
- }), r.edit(o.value, "value", e);
64
- }
120
+ l.value = n, p.push({
121
+ name: "environment.collection",
122
+ params: {
123
+ collectionId: t == null ? void 0 : t.uid,
124
+ environmentId: n
125
+ }
126
+ }), t && !b[t.uid] && k(t.uid);
127
+ } else
128
+ l.value = "default", p.push({
129
+ name: "environment",
130
+ params: { environment: "default" }
131
+ });
65
132
  }
66
- const j = (e) => {
67
- if (r.delete(e), o.value === e) {
68
- const t = Object.values(l);
69
- if (t.length > 0) {
70
- const n = t[t.length - 1];
71
- o.value = n.uid, f.push({
72
- name: "environment",
73
- params: { environment: n.uid }
74
- });
75
- } else
76
- o.value = l.default.uid, f.push({ name: "environment", params: { environment: "default" } });
133
+ const ee = () => l.value === "default" ? "Global Environment" : l.value, ne = () => {
134
+ var e, o, n;
135
+ return l.value === "default" ? JSON.stringify(V.value.environments, null, 2) : JSON.stringify(
136
+ (n = (o = (e = s.value.find(
137
+ (t) => {
138
+ var a;
139
+ return (a = t["x-scalar-environments"]) == null ? void 0 : a[l.value ?? ""];
140
+ }
141
+ )) == null ? void 0 : e["x-scalar-environments"]) == null ? void 0 : o[l.value ?? ""]) == null ? void 0 : n.variables,
142
+ null,
143
+ 2
144
+ );
145
+ }, te = (e) => b[e], L = (e) => {
146
+ e != null && e.createNew && C.name === "environment" && S();
147
+ };
148
+ se(
149
+ () => [C.params.collectionId, C.params.environmentId],
150
+ ([e, o]) => {
151
+ e ? l.value = o : l.value = "default";
77
152
  }
78
- }, K = (e) => {
79
- E.value = e, _.value = l[e].color || "", v.show();
80
- }, I = (e) => {
81
- E.value && (r.edit(E.value, "color", e), v.hide());
82
- }, L = () => {
83
- const e = f.currentRoute.value.params.environment;
84
- e ? o.value = e : e === "default" && (o.value = l.default.uid);
85
- }, R = () => {
86
- o.value && !l[o.value].isDefault && (y.value = !0, Z(() => {
87
- var e;
88
- (e = V.value) == null || e.focus();
89
- }));
90
- }, B = (e) => {
91
- const n = e.target.value;
92
- o.value && !l[o.value].isDefault && r.edit(o.value, "name", n);
93
- }, N = (e) => {
94
- e != null && e.createNew && k.name === "environment" && x({ name: "", color: "" });
95
- }, A = () => {
96
- p.show();
153
+ ), ie(() => {
154
+ l.value = C.params.environmentId || "default", N.hotKeys.on(L);
155
+ const { collectionId: e } = p.currentRoute.value.params;
156
+ e && !b[e] && k(e);
157
+ }), ue(() => N.hotKeys.off(L));
158
+ const oe = (e, o, n) => {
159
+ const t = n ? `/workspace/default/environment/${n}/${o}` : `/workspace/default/environment/${o}`;
160
+ e.metaKey ? window.open(t, "_blank") : p.push({ path: t });
97
161
  };
98
- return J(
99
- () => k.params.environment,
100
- (e) => o.value = e || l.default.uid
101
- ), T(() => {
102
- L(), C.hotKeys.on(N);
103
- }), F(() => C.hotKeys.off(N)), (e, t) => (m(), b(ae, null, {
104
- default: i(() => [
105
- s(ne, { title: "Environment" }, {
106
- content: i(() => [
107
- H("div", pe, [
108
- s(oe, null, {
109
- default: i(() => [
110
- (m(!0), g(W, null, q(u(l), (n) => (m(), b(le, {
111
- key: n.uid,
162
+ function ae() {
163
+ c.value = void 0, v.value = void 0, I.value = void 0, _.hide();
164
+ }
165
+ function le(e) {
166
+ s.value.some(
167
+ (n) => {
168
+ const t = Object.keys(
169
+ n["x-scalar-environments"] || {}
170
+ ).includes(e);
171
+ return D(
172
+ t,
173
+ n,
174
+ v.value
175
+ ), t;
176
+ }
177
+ ) || (e && c.value !== "default" && s.value.forEach((n) => {
178
+ var t;
179
+ if ((t = n["x-scalar-environments"]) != null && t[c.value ?? ""]) {
180
+ const a = n["x-scalar-environments"][c.value ?? ""];
181
+ delete n["x-scalar-environments"][c.value ?? ""], n["x-scalar-environments"][e] = a, x.edit(
182
+ n.uid,
183
+ "x-scalar-environments",
184
+ n["x-scalar-environments"]
185
+ );
186
+ }
187
+ }), e && l.value === c.value && (l.value = e), c.value = void 0, v.value = void 0, I.value = void 0, _.hide());
188
+ }
189
+ return (e, o) => (m(), h(ye, null, {
190
+ default: d(() => [
191
+ u(xe, { title: "Collections" }, {
192
+ content: d(() => [
193
+ y("div", Re, [
194
+ u(he, null, {
195
+ default: d(() => [
196
+ (m(), h(F, {
197
+ key: "default",
112
198
  class: "text-xs",
113
199
  isCopyable: !1,
200
+ type: "environment",
114
201
  variable: {
115
- name: n.name,
116
- uid: n.uid,
117
- color: n.color,
118
- isDefault: n.isDefault
119
- },
120
- warningMessage: "Are you sure you want to delete this environment?",
121
- onClick: (a) => o.value = n.uid,
122
- onColorModal: K,
123
- onDelete: (a) => j(n.uid)
124
- }, null, 8, ["variable", "onClick", "onDelete"]))), 128))
202
+ name: "Global Environment",
203
+ uid: "default",
204
+ icon: "Globe",
205
+ isDefault: !0
206
+ }
207
+ })),
208
+ (m(!0), M(U, null, z(r(s), (n) => {
209
+ var t;
210
+ return m(), M("div", {
211
+ key: n.uid,
212
+ class: "flex flex-col gap-0.25"
213
+ }, [
214
+ y("button", {
215
+ class: "flex font-medium gap-1.5 group items-center px-2 py-1.5 text-left text-sm w-full break-words rounded hover:bg-b-2",
216
+ type: "button",
217
+ onClick: (a) => r(k)(n.uid)
218
+ }, [
219
+ u(r(Ie), {
220
+ class: "text-sidebar-c-2 size-3.5 stroke-[2.25] group-hover:hidden",
221
+ src: n["x-scalar-icon"] || "interface-content-folder"
222
+ }, null, 8, ["src"]),
223
+ u(r(G), {
224
+ class: A(["text-c-3 hidden text-sm group-hover:block", {
225
+ "rotate-90": r(b)[n.uid]
226
+ }]),
227
+ icon: "ChevronRight",
228
+ size: "sm",
229
+ thickness: "2.5"
230
+ }, null, 8, ["class"]),
231
+ B(" " + W(((t = n.info) == null ? void 0 : t.title) ?? ""), 1)
232
+ ], 8, je),
233
+ de(y("div", {
234
+ class: A({
235
+ "before:bg-border before:pointer-events-none before:z-1 before:absolute before:left-[calc(1rem_-_1.5px)] before:top-0 before:h-[calc(100%_+_.5px)] last:before:h-full before:w-[.5px] flex flex-col gap-px mb-[.5px] last:mb-0 relative": Object.keys(n["x-scalar-environments"] || {}).length > 0
236
+ })
237
+ }, [
238
+ (m(!0), M(U, null, z(n["x-scalar-environments"], (a, i) => (m(), h(F, {
239
+ key: i,
240
+ class: "text-xs [&>a]:pl-5",
241
+ collectionId: n.uid,
242
+ isCopyable: !1,
243
+ isDeletable: !0,
244
+ isRenameable: !0,
245
+ type: "environment",
246
+ variable: {
247
+ name: i,
248
+ uid: i,
249
+ color: a.color ?? "#8E8E8E",
250
+ isDefault: !1
251
+ },
252
+ warningMessage: "Are you sure you want to delete this environment?",
253
+ onClick: ce((w) => oe(w, i, n.uid), ["prevent"]),
254
+ onColorModal: (w) => X(i),
255
+ onDelete: (w) => Z(i),
256
+ onRename: (w) => Q(i, n.uid)
257
+ }, null, 8, ["collectionId", "variable", "onClick", "onColorModal", "onDelete", "onRename"]))), 128)),
258
+ Object.keys(n["x-scalar-environments"] || {}).length === 0 ? (m(), h(r(ge), {
259
+ key: 0,
260
+ class: "mb-[.5px] flex gap-1.5 h-8 text-c-1 pl-6 py-0 justify-start text-xs w-full hover:bg-b-2",
261
+ variant: "ghost",
262
+ onClick: (a) => S(n.uid)
263
+ }, {
264
+ default: d(() => [
265
+ u(r(G), {
266
+ class: "ml-0.5 h-2.5 w-2.5",
267
+ icon: "Add",
268
+ thickness: "3"
269
+ }),
270
+ o[2] || (o[2] = y("span", null, "Add Environment", -1))
271
+ ]),
272
+ _: 2
273
+ }, 1032, ["onClick"])) : K("", !0)
274
+ ], 2), [
275
+ [me, te(n.uid)]
276
+ ])
277
+ ]);
278
+ }), 128))
125
279
  ]),
126
280
  _: 1
127
281
  })
128
282
  ])
129
283
  ]),
130
- button: i(() => [
131
- s(te, {
132
- click: A,
284
+ button: d(() => [
285
+ u(be, {
286
+ click: S,
133
287
  hotkey: "N"
134
288
  }, {
135
- title: i(() => t[4] || (t[4] = [
136
- G("Add Environment")
289
+ title: d(() => o[3] || (o[3] = [
290
+ B("Add Environment")
137
291
  ])),
138
292
  _: 1
139
293
  })
140
294
  ]),
141
295
  _: 1
142
296
  }),
143
- s(ue, { class: "flex-1" }, {
144
- default: i(() => [
145
- s(ie, null, P({
146
- default: i(() => [
147
- o.value ? (m(), b(ee, {
297
+ u(Ce, { class: "flex-1" }, {
298
+ default: d(() => [
299
+ u(ke, null, ve({
300
+ default: d(() => [
301
+ l.value ? (m(), h(fe, {
148
302
  key: 0,
149
303
  class: "pl-px pr-2 md:px-4 py-2",
150
304
  isCopyable: "",
151
305
  language: "json",
152
306
  lineNumbers: "",
153
307
  lint: "",
154
- modelValue: u(l)[o.value].value,
155
- "onUpdate:modelValue": $
156
- }, null, 8, ["modelValue"])) : Q("", !0)
308
+ modelValue: ne(),
309
+ "onUpdate:modelValue": P
310
+ }, null, 8, ["modelValue"])) : K("", !0)
157
311
  ]),
158
312
  _: 2
159
313
  }, [
160
- o.value ? {
314
+ l.value ? {
161
315
  name: "title",
162
- fn: i(() => [
163
- !y.value || u(l)[o.value].isDefault ? (m(), g("span", {
164
- key: 0,
165
- onDblclick: R
166
- }, X(u(l)[o.value].name), 33)) : (m(), g("input", {
167
- key: 1,
168
- ref_key: "nameInputRef",
169
- ref: V,
170
- class: "ring-1 ring-offset-4 ring-b-outline rounded",
171
- spellcheck: "false",
172
- type: "text",
173
- value: u(l)[o.value].name,
174
- onBlur: t[0] || (t[0] = (n) => y.value = !1),
175
- onInput: B,
176
- onKeyup: t[1] || (t[1] = Y((n) => y.value = !1, ["enter"]))
177
- }, null, 40, ye))
316
+ fn: d(() => [
317
+ y("span", null, W(ee()), 1)
178
318
  ]),
179
319
  key: "0"
180
320
  } : void 0
@@ -182,22 +322,38 @@ const pe = { class: "flex-1" }, ye = ["value"], Ke = /* @__PURE__ */ z({
182
322
  ]),
183
323
  _: 1
184
324
  }),
185
- s(de, {
186
- selectedColor: _.value,
187
- state: u(v),
188
- onCancel: t[2] || (t[2] = (n) => u(v).hide()),
189
- onSubmit: I
325
+ u($e, {
326
+ selectedColor: R.value,
327
+ state: r(E),
328
+ onCancel: o[0] || (o[0] = (n) => r(E).hide()),
329
+ onSubmit: Y
190
330
  }, null, 8, ["selectedColor", "state"]),
191
- s(fe, {
192
- state: u(p),
193
- onCancel: t[3] || (t[3] = (n) => u(p).hide()),
194
- onSubmit: x
195
- }, null, 8, ["state"])
331
+ u(Ve, {
332
+ activeWorkspaceCollections: r(s),
333
+ collectionId: v.value,
334
+ state: r(g),
335
+ onCancel: o[1] || (o[1] = (n) => r(g).hide()),
336
+ onSubmit: q
337
+ }, null, 8, ["activeWorkspaceCollections", "collectionId", "state"]),
338
+ u(r(_e), {
339
+ size: "xxs",
340
+ state: r(_),
341
+ title: `Edit ${c.value}`
342
+ }, {
343
+ default: d(() => [
344
+ u(pe, {
345
+ name: I.value ?? "",
346
+ onClose: ae,
347
+ onEdit: le
348
+ }, null, 8, ["name"])
349
+ ]),
350
+ _: 1
351
+ }, 8, ["state", "title"])
196
352
  ]),
197
353
  _: 1
198
354
  }));
199
355
  }
200
356
  });
201
357
  export {
202
- Ke as default
358
+ nn as default
203
359
  };
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentColorModal.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/EnvironmentColorModal.vue"],"names":[],"mappings":"AA2CA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,oBAAoB,CAAA;AAOjE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,UAAU,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAC;;;;;;;;AAgJF,wBAQG"}
1
+ {"version":3,"file":"EnvironmentColorModal.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/EnvironmentColorModal.vue"],"names":[],"mappings":"AAgDA,OAAO,EAAE,KAAK,UAAU,EAAe,MAAM,oBAAoB,CAAA;AAOjE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,UAAU,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;CACtB,CAAC;;;;;;;;AAoJF,wBAQG"}
@@ -1,33 +1,35 @@
1
- import { defineComponent as c, ref as d, openBlock as f, createBlock as p, unref as u, withCtx as C, createElementVNode as v, createVNode as n } from "vue";
2
- import x from "../../components/Sidebar/Actions/SidebarListElementForm.vue.js";
3
- import { ScalarModal as _ } from "@scalar/components";
4
- import E from "./EnvironmentColors.vue.js";
5
- const S = { class: "flex flex-col gap-4" }, B = /* @__PURE__ */ c({
1
+ import { defineComponent as m, ref as u, openBlock as d, createBlock as f, unref as p, withCtx as C, createElementVNode as v, createVNode as n } from "vue";
2
+ import _ from "../../components/Sidebar/Actions/SidebarListElementForm.vue.js";
3
+ import { ScalarModal as x } from "@scalar/components";
4
+ import S from "./EnvironmentColors.vue.js";
5
+ const b = { class: "flex flex-col gap-4" }, M = /* @__PURE__ */ m({
6
6
  __name: "EnvironmentColorModal",
7
7
  props: {
8
8
  state: {},
9
9
  selectedColor: {}
10
10
  },
11
11
  emits: ["cancel", "submit"],
12
- setup(r, { emit: s }) {
13
- const a = r, l = s, t = d(""), i = (o) => {
14
- t.value = o;
12
+ setup(r, { emit: a }) {
13
+ const s = r, o = a, e = u(""), c = (t) => {
14
+ e.value = t;
15
+ }, i = () => {
16
+ o("submit", e.value), e.value = "";
15
17
  };
16
- return (o, e) => (f(), p(u(_), {
18
+ return (t, l) => (d(), f(p(x), {
17
19
  size: "xxs",
18
- state: o.state,
20
+ state: t.state,
19
21
  title: "Edit Environment Color"
20
22
  }, {
21
23
  default: C(() => [
22
- v("div", S, [
23
- n(E, {
24
- activeColor: t.value || a.selectedColor,
24
+ v("div", b, [
25
+ n(S, {
26
+ activeColor: e.value || s.selectedColor,
25
27
  class: "p-1 w-full",
26
- onSelect: i
28
+ onSelect: c
27
29
  }, null, 8, ["activeColor"]),
28
- n(x, {
29
- onCancel: e[0] || (e[0] = (m) => l("cancel")),
30
- onSubmit: e[1] || (e[1] = (m) => l("submit", t.value))
30
+ n(_, {
31
+ onCancel: l[0] || (l[0] = (E) => o("cancel")),
32
+ onSubmit: i
31
33
  })
32
34
  ])
33
35
  ]),
@@ -36,5 +38,5 @@ const S = { class: "flex flex-col gap-4" }, B = /* @__PURE__ */ c({
36
38
  }
37
39
  });
38
40
  export {
39
- B as default
41
+ M as default
40
42
  };
@@ -1,10 +1,13 @@
1
1
  type __VLS_Props = {
2
2
  activeColor: string;
3
+ selector?: boolean;
3
4
  };
4
5
  declare const _default: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
5
6
  select: (color: string) => any;
6
7
  }, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
7
8
  onSelect?: ((color: string) => any) | undefined;
8
- }>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
9
+ }>, {
10
+ selector: boolean;
11
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, HTMLDivElement>;
9
12
  export default _default;
10
13
  //# sourceMappingURL=EnvironmentColors.vue.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"EnvironmentColors.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/EnvironmentColors.vue"],"names":[],"mappings":"AAsHA,KAAK,WAAW,GAAG;IACjB,WAAW,EAAE,MAAM,CAAA;CACpB,CAAC;;;;;;AAmNF,wBAQG"}
1
+ {"version":3,"file":"EnvironmentColors.vue.d.ts","sourceRoot":"","sources":["../../../src/views/Environment/EnvironmentColors.vue"],"names":[],"mappings":"AAoKA,KAAK,WAAW,GAAG;IACf,WAAW,EAAE,MAAM,CAAA;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,CAAC;;;;;;cADW,OAAO;;AA2PtB,wBASG"}