@scalar/api-client 2.27.1 → 2.29.1

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 (77) hide show
  1. package/CHANGELOG.md +146 -0
  2. package/dist/components/ViewLayout/ViewLayoutSection.vue.d.ts.map +1 -1
  3. package/dist/components/ViewLayout/ViewLayoutSection.vue.js +1 -1
  4. package/dist/libs/local-storage.js +3 -3
  5. package/dist/style.css +1 -1
  6. package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
  7. package/dist/v2/blocks/request-block/RequestBlock.vue2.js +21 -21
  8. package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
  9. package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
  10. package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +67 -75
  11. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
  12. package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
  13. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -0
  14. package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
  15. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts +1 -1
  16. package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
  17. package/dist/v2/blocks/request-block/helpers/get-default-headers.js +20 -19
  18. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +2 -0
  19. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
  20. package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +42 -40
  21. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  22. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +5 -5
  23. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +3 -1
  24. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
  25. package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +35 -35
  26. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  27. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  28. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  29. package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
  30. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  31. package/dist/v2/features/app/App.vue.js +70 -70
  32. package/dist/v2/features/app/app-events.d.ts +2 -1
  33. package/dist/v2/features/app/app-events.d.ts.map +1 -1
  34. package/dist/v2/features/app/app-events.js +89 -64
  35. package/dist/v2/features/app/app-state.d.ts.map +1 -1
  36. package/dist/v2/features/app/app-state.js +172 -151
  37. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  38. package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
  39. package/dist/v2/features/app/components/AppSidebar.vue2.js +48 -47
  40. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  41. package/dist/v2/features/app/components/DesktopTabs.vue.js +4 -4
  42. package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts.map +1 -1
  43. package/dist/v2/features/app/components/DownloadAppButton.vue.js +1 -1
  44. package/dist/v2/features/app/components/DownloadAppButton.vue2.js +9 -9
  45. package/dist/v2/features/app/components/SidebarItemMenu.vue.d.ts.map +1 -1
  46. package/dist/v2/features/app/components/SidebarItemMenu.vue.js +71 -43
  47. package/dist/v2/features/app/helpers/routes.js +11 -11
  48. package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts +1 -6
  49. package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts.map +1 -1
  50. package/dist/v2/features/collection/WorkspaceCollection.vue.js +38 -20
  51. package/dist/v2/features/collection/components/LabelInput.vue.d.ts +3 -0
  52. package/dist/v2/features/collection/components/LabelInput.vue.d.ts.map +1 -1
  53. package/dist/v2/features/collection/components/LabelInput.vue.js +2 -2
  54. package/dist/v2/features/collection/components/LabelInput.vue2.js +20 -16
  55. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +7 -2
  56. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -1
  57. package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +70 -71
  58. package/dist/v2/features/command-palette/components/{CommandPaletteDocument.vue.d.ts → CommandPaletteOpenApiDocument.vue.d.ts} +3 -3
  59. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.d.ts.map +1 -0
  60. package/dist/v2/features/command-palette/components/{CommandPaletteDocument.vue.js → CommandPaletteOpenApiDocument.vue.js} +15 -15
  61. package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue2.js +4 -0
  62. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +2 -2
  63. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -1
  64. package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +10 -10
  65. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +27 -5
  66. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -1
  67. package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +80 -53
  68. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +34 -9
  69. package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
  70. package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +50 -44
  71. package/dist/v2/features/operation/Operation.vue.js +1 -1
  72. package/dist/v2/workspace-events.d.ts.map +1 -1
  73. package/dist/v2/workspace-events.js +123 -113
  74. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  75. package/package.json +17 -17
  76. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +0 -1
  77. package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +0 -4
@@ -1,32 +1,35 @@
1
- import { isDefined as Y } from "@scalar/helpers/array/is-defined";
1
+ import { isDefined as M } from "@scalar/helpers/array/is-defined";
2
2
  import { sortByOrder as pe } from "@scalar/helpers/array/sort-by-order";
3
- import { createSidebarState as ue, generateReverseIndex as me } from "@scalar/sidebar";
4
- import { createWorkspaceStore as j } from "@scalar/workspace-store/client";
5
- import { createWorkspaceEventBus as de } from "@scalar/workspace-store/events";
6
- import { generateUniqueValue as ve } from "@scalar/workspace-store/helpers/generate-unique-value";
7
- import { getParentEntry as v } from "@scalar/workspace-store/navigation";
8
- import { createWorkspaceStorePersistence as fe } from "@scalar/workspace-store/persistence";
9
- import { persistencePlugin as he } from "@scalar/workspace-store/plugins/client";
10
- import { extensions as we } from "@scalar/workspace-store/schemas/extensions";
11
- import { ref as u, computed as p, shallowRef as H } from "vue";
3
+ import { migrateLocalStorageToIndexDb as me } from "@scalar/oas-utils/migrations";
4
+ import { createSidebarState as de, generateReverseIndex as ve } from "@scalar/sidebar";
5
+ import { createWorkspaceStore as Y } from "@scalar/workspace-store/client";
6
+ import { createWorkspaceEventBus as fe } from "@scalar/workspace-store/events";
7
+ import { generateUniqueValue as he } from "@scalar/workspace-store/helpers/generate-unique-value";
8
+ import { getParentEntry as f } from "@scalar/workspace-store/navigation";
9
+ import { createWorkspaceStorePersistence as we, getWorkspaceId as h } from "@scalar/workspace-store/persistence";
10
+ import { persistencePlugin as ge } from "@scalar/workspace-store/plugins/client";
11
+ import { extensions as ke } from "@scalar/workspace-store/schemas/extensions";
12
+ import { ref as p, computed as u, shallowRef as j } from "vue";
12
13
  import { getRouteParam as l } from "./helpers/get-route-param.js";
13
- import { groupWorkspacesByTeam as ke } from "./helpers/group-workspaces.js";
14
- import { getActiveEnvironment as ge } from "../../helpers/get-active-environment.js";
15
- import { getTabDetails as xe } from "../../helpers/get-tab-details.js";
16
- import { slugify as be } from "../../helpers/slugify.js";
17
- import { workspaceStorage as ye } from "../../helpers/storage.js";
18
- import { initializeAppEventHandlers as Se } from "./app-events.js";
19
- import { filterWorkspacesByTeam as Ee, canLoadWorkspace as We } from "./helpers/filter-workspaces.js";
20
- const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
14
+ import { groupWorkspacesByTeam as xe } from "./helpers/group-workspaces.js";
15
+ import { getActiveEnvironment as be } from "../../helpers/get-active-environment.js";
16
+ import { getTabDetails as ye } from "../../helpers/get-tab-details.js";
17
+ import { slugify as Se } from "../../helpers/slugify.js";
18
+ import { workspaceStorage as Ee } from "../../helpers/storage.js";
19
+ import { initializeAppEventHandlers as We } from "./app-events.js";
20
+ import { filterWorkspacesByTeam as Ue, canLoadWorkspace as Ie } from "./helpers/filter-workspaces.js";
21
+ const Te = 1e3, De = 288, Je = async ({
21
22
  router: i,
22
- fileLoader: T
23
+ fileLoader: H
23
24
  }) => {
24
- const w = de({
25
+ const k = fe({
25
26
  debug: !1
26
- }), { workspace: k } = await fe(), g = u("local"), x = u(void 0), I = u(void 0), b = u(void 0), L = u(void 0), O = u(void 0), N = u(void 0), y = u(!1);
27
- i.afterEach((e) => ce(e));
28
- const d = p(() => i.currentRoute.value ?? null), D = H(null), f = u([]), S = p(() => Ee(f.value, g.value)), z = p(() => ke(S.value, g.value)), s = H(null), A = p(() => s.value?.workspace.documents[b.value ?? ""] || null), G = p(() => ge(s.value, A.value));
29
- f.value = await k.getAll().then(
27
+ }), { workspace: w } = await we();
28
+ await me();
29
+ const x = p("local"), g = p(void 0), b = p(void 0), y = p(void 0), B = p(void 0), L = p(void 0), N = p(void 0), S = p(!1);
30
+ i.afterEach((e) => le(e));
31
+ const d = u(() => i.currentRoute.value ?? null), E = j(null), v = p([]), W = u(() => Ue(v.value, x.value)), z = u(() => xe(W.value, x.value)), s = j(null), D = u(() => s.value?.workspace.documents[y.value ?? ""] || null), G = u(() => be(s.value, D.value));
32
+ v.value = await w.getAll().then(
30
33
  (e) => e.map(({ teamUid: a, namespace: t, slug: n, name: c }) => ({
31
34
  id: h(t, n),
32
35
  teamUid: a,
@@ -35,35 +38,41 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
35
38
  label: c
36
39
  }))
37
40
  );
38
- const J = async ({
41
+ const J = async (e) => {
42
+ const a = g.value, t = b.value;
43
+ if (!a || !t)
44
+ return;
45
+ const n = h(a, t);
46
+ await w.updateName({ namespace: a, slug: t }, e) !== void 0 && (v.value = v.value.map((o) => o.id === n ? { ...o, label: e } : o), E.value = { id: n, label: e });
47
+ }, Q = async ({
39
48
  namespace: e,
40
49
  slug: a
41
- }) => j({
50
+ }) => Y({
42
51
  plugins: [
43
- await he({
52
+ await ge({
44
53
  workspaceId: h(e, a),
45
- debounceDelay: Ue
54
+ debounceDelay: Te
46
55
  })
47
56
  ],
48
- fileLoader: T
49
- }), Q = async (e, a) => {
50
- const t = await k.getItem({ namespace: e, slug: a });
57
+ fileLoader: H
58
+ }), X = async (e, a) => {
59
+ const t = await w.getItem({ namespace: e, slug: a });
51
60
  if (!t)
52
61
  return {
53
62
  success: !1
54
63
  };
55
- const n = await J({ namespace: e, slug: a });
56
- return n.loadWorkspace(t.workspace), D.value = { id: h(t.namespace, t.slug), label: t.name }, s.value = n, {
64
+ const n = await Q({ namespace: e, slug: a });
65
+ return n.loadWorkspace(t.workspace), E.value = { id: h(t.namespace, t.slug), label: t.name }, s.value = n, {
57
66
  success: !0,
58
67
  workspace: n.workspace
59
68
  };
60
- }, X = async ({
69
+ }, Z = async ({
61
70
  name: e,
62
71
  teamUid: a,
63
72
  namespace: t,
64
73
  slug: n
65
74
  }) => {
66
- const c = j();
75
+ const c = Y();
67
76
  await c.addDocument({
68
77
  name: "drafts",
69
78
  document: {
@@ -81,7 +90,7 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
81
90
  "x-scalar-icon": "interface-edit-tool-pencil"
82
91
  }
83
92
  });
84
- const r = await k.setItem(
93
+ const o = await w.setItem(
85
94
  { namespace: t, slug: n },
86
95
  {
87
96
  name: e,
@@ -89,85 +98,96 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
89
98
  workspace: c.exportWorkspace()
90
99
  }
91
100
  );
92
- return f.value.push({
93
- id: h(r.namespace, r.slug),
94
- teamUid: r.teamUid,
95
- namespace: r.namespace,
96
- slug: r.slug,
97
- label: r.name
98
- }), r;
99
- }, E = async (e, a) => {
101
+ return v.value.push({
102
+ id: h(o.namespace, o.slug),
103
+ teamUid: o.teamUid,
104
+ namespace: o.namespace,
105
+ slug: o.slug,
106
+ label: o.name
107
+ }), o;
108
+ }, U = async (e, a) => {
109
+ if (!e || !a) {
110
+ await i.push("/");
111
+ return;
112
+ }
100
113
  await i.push({
101
- name: "workspace.environment",
102
- params: { namespace: e, workspaceSlug: a }
114
+ name: "example",
115
+ params: {
116
+ namespace: e,
117
+ workspaceSlug: a,
118
+ documentSlug: "drafts",
119
+ pathEncoded: encodeURIComponent("/"),
120
+ method: "get",
121
+ exampleName: "default"
122
+ }
103
123
  });
104
- }, _ = async ({
124
+ }, O = async ({
105
125
  teamUid: e,
106
126
  namespace: a,
107
127
  slug: t,
108
128
  name: n
109
129
  }) => {
110
130
  s.value = null;
111
- const c = await ve({
131
+ const c = await he({
112
132
  defaultValue: t ?? n,
113
133
  // Use the provided id if it exists, otherwise use the name
114
- validation: async (U) => !await k.has({ namespace: a ?? "local", slug: U }),
134
+ validation: async (T) => !await w.has({ namespace: a ?? "local", slug: T }),
115
135
  maxRetries: 100,
116
- transformation: be
136
+ transformation: Se
117
137
  });
118
138
  if (!c)
119
139
  return;
120
- const m = await X({
140
+ const m = await Z({
121
141
  teamUid: e,
122
142
  namespace: a,
123
143
  slug: c,
124
144
  name: n
125
145
  });
126
- return await E(m.namespace, m.slug), m;
127
- }, Z = async (e, a) => {
128
- s.value = null, y.value = !0;
129
- const t = await Q(e, a);
146
+ return await U(m.namespace, m.slug), m;
147
+ }, ee = async (e, a) => {
148
+ s.value = null, S.value = !0;
149
+ const t = await X(e, a);
130
150
  if (t.success) {
131
- const r = t.workspace["x-scalar-active-tab"] ?? 0, m = t.workspace["x-scalar-tabs"], U = m?.[r];
132
- U && await i.replace({
133
- path: U.path,
151
+ const o = t.workspace["x-scalar-active-tab"] ?? 0, m = t.workspace["x-scalar-tabs"], T = m?.[o];
152
+ T && await i.replace({
153
+ path: T.path,
134
154
  query: d.value?.query ?? {}
135
- }), m && r >= m.length && w.emit("tabs:update:tabs", {
155
+ }), m && o >= m.length && k.emit("tabs:update:tabs", {
136
156
  "x-scalar-active-tab": 0
137
- }), m || w.emit("tabs:update:tabs", {
138
- "x-scalar-tabs": [B(d.value)],
157
+ }), m || k.emit("tabs:update:tabs", {
158
+ "x-scalar-tabs": [C(d.value)],
139
159
  "x-scalar-active-tab": 0
140
- }), y.value = !1;
160
+ }), S.value = !1;
141
161
  return;
142
162
  }
143
- const n = S.value.find((r) => r.teamUid === "local" && r.slug === "default") ?? S.value[0];
163
+ const n = W.value.find((o) => o.teamUid === "local" && o.slug === "default") ?? W.value[0];
144
164
  if (n)
145
- return E(n.namespace, n.slug);
146
- const c = await _({
165
+ return U(n.namespace, n.slug);
166
+ const c = await O({
147
167
  name: "Default Workspace",
148
168
  slug: "default"
149
169
  });
150
- if (y.value = !1, !c)
170
+ if (S.value = !1, !c)
151
171
  return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
152
- o.reset();
153
- }, P = p(() => {
172
+ r.reset();
173
+ }, _ = u(() => {
154
174
  const e = s.value;
155
175
  if (!e)
156
176
  return [];
157
177
  const a = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
158
- return pe(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(Y);
159
- }), o = ue(P), R = ({
178
+ return pe(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(M);
179
+ }), r = de(_), R = ({
160
180
  document: e,
161
181
  path: a,
162
182
  method: t,
163
183
  example: n
164
- }) => JSON.stringify([e, a, t, n].filter(Y)), $ = p(
165
- () => me({
166
- items: P.value,
184
+ }) => JSON.stringify([e, a, t, n].filter(M)), P = u(
185
+ () => ve({
186
+ items: _.value,
167
187
  nestedKey: "children",
168
188
  filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
169
189
  getId: (e) => {
170
- const a = v("document", e), t = v("operation", e);
190
+ const a = f("document", e), t = f("operation", e);
171
191
  return R({
172
192
  document: a?.name ?? "",
173
193
  path: t?.path,
@@ -176,41 +196,41 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
176
196
  });
177
197
  }
178
198
  })
179
- ), W = (e) => {
180
- const a = $.value.get(R(e));
181
- return a || $.value.get(
199
+ ), I = (e) => {
200
+ const a = P.value.get(R(e));
201
+ return a || P.value.get(
182
202
  R({
183
203
  document: e.document,
184
204
  path: e.path,
185
205
  method: e.method
186
206
  })
187
207
  );
188
- }, F = (e) => {
189
- const a = o.getEntryById(e);
208
+ }, V = (e) => {
209
+ const a = r.getEntryById(e);
190
210
  if (!a) {
191
211
  console.warn(`Could not find sidebar entry with id ${e} to select`);
192
212
  return;
193
213
  }
194
214
  if (a.type === "document") {
195
- if (o.selectedItem.value === e) {
196
- o.setExpanded(e, !o.isExpanded(e));
215
+ if (r.selectedItem.value === e) {
216
+ r.setExpanded(e, !r.isExpanded(e));
197
217
  return;
198
218
  }
199
- return o.setSelected(e), o.setExpanded(e, !0), i.push({
219
+ return r.setSelected(e), r.setExpanded(e, !0), i.push({
200
220
  name: "document.overview",
201
221
  params: { documentSlug: a.name }
202
222
  });
203
223
  }
204
224
  if (a.type === "operation") {
205
- if (o.isSelected(e)) {
206
- o.setExpanded(e, !o.isExpanded(e));
225
+ if (r.isSelected(e)) {
226
+ r.setExpanded(e, !r.isExpanded(e));
207
227
  return;
208
228
  }
209
229
  const t = a.children?.find((n) => n.type === "example");
210
- return t ? (o.setSelected(t.id), o.setExpanded(t.id, !0)) : o.setSelected(e), i.push({
230
+ return t ? (r.setSelected(t.id), r.setExpanded(t.id, !0)) : r.setSelected(e), i.push({
211
231
  name: "example",
212
232
  params: {
213
- documentSlug: v("document", a)?.name,
233
+ documentSlug: f("document", a)?.name,
214
234
  pathEncoded: encodeURIComponent(a.path),
215
235
  method: a.method,
216
236
  exampleName: t?.name ?? "default"
@@ -218,12 +238,12 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
218
238
  });
219
239
  }
220
240
  if (a.type === "example") {
221
- o.setSelected(e);
222
- const t = v("operation", a);
241
+ r.setSelected(e);
242
+ const t = f("operation", a);
223
243
  return i.push({
224
244
  name: "example",
225
245
  params: {
226
- documentSlug: v("document", a)?.name,
246
+ documentSlug: f("document", a)?.name,
227
247
  pathEncoded: encodeURIComponent(t?.path ?? ""),
228
248
  method: t?.method,
229
249
  exampleName: a.name
@@ -234,42 +254,42 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
234
254
  return i.push({
235
255
  name: "document.overview",
236
256
  params: {
237
- documentSlug: v("document", a)?.name
257
+ documentSlug: f("document", a)?.name
238
258
  }
239
259
  });
240
- o.setExpanded(e, !o.isExpanded(e));
241
- }, ee = async () => {
260
+ r.setExpanded(e, !r.isExpanded(e));
261
+ }, ae = async () => {
242
262
  if (!s.value)
243
263
  return;
244
264
  const e = s.value.workspace["x-scalar-active-tab"] ?? 0, a = s.value.workspace["x-scalar-tabs"]?.[e];
245
265
  a && await i.replace(a.path);
246
- }, K = (e) => {
266
+ }, F = (e) => {
247
267
  e && s.value?.buildSidebar(e);
248
- }, ae = (e) => {
249
- const a = A.value?.["x-scalar-navigation"]?.name;
268
+ }, te = (e) => {
269
+ const a = D.value?.["x-scalar-navigation"]?.name;
250
270
  if (!a)
251
271
  return;
252
- const t = W({
272
+ const t = I({
253
273
  document: a,
254
274
  path: e.path,
255
275
  method: e.method,
256
276
  example: e.exampleKey
257
277
  });
258
- (!t || t.type !== "example") && (K(a), d.value && M(d.value));
259
- }, te = p(() => s.value?.workspace?.["x-scalar-sidebar-width"] ?? Te), ne = (e) => s.value?.update("x-scalar-sidebar-width", e), C = u(!0), se = "x-scalar-tabs", oe = "x-scalar-active-tab", B = (e) => {
278
+ (!t || t.type !== "example") && (F(a), d.value && q(d.value));
279
+ }, ne = u(() => s.value?.workspace?.["x-scalar-sidebar-width"] ?? De), se = (e) => s.value?.update("x-scalar-sidebar-width", e), A = p(!0), oe = "x-scalar-tabs", re = "x-scalar-active-tab", C = (e) => {
260
280
  const a = l("method", e), t = l("pathEncoded", e), n = l("documentSlug", e), c = l("workspaceSlug", e);
261
281
  return {
262
- ...xe({
282
+ ...ye({
263
283
  workspace: c,
264
284
  document: n,
265
285
  path: t,
266
286
  method: a,
267
- getEntryByLocation: W
287
+ getEntryByLocation: I
268
288
  }),
269
289
  path: d.value?.path ?? ""
270
290
  };
271
- }, V = p(() => s.value?.workspace[se] ?? [B(d.value)]), re = p(() => s.value?.workspace[oe] ?? 0), q = async (e) => {
272
- const a = V.value[e];
291
+ }, K = u(() => s.value?.workspace[oe] ?? [C(d.value)]), ce = u(() => s.value?.workspace[re] ?? 0), $ = async (e) => {
292
+ const a = K.value[e];
273
293
  if (!a) {
274
294
  console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
275
295
  return;
@@ -280,47 +300,48 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
280
300
  } catch (n) {
281
301
  console.error("Failed to copy URL to clipboard:", n);
282
302
  }
283
- }, ce = (e) => {
303
+ }, le = (e) => {
284
304
  const a = l("workspaceSlug", e), t = l("documentSlug", e), n = l("namespace", e);
285
305
  if (!n || !a)
286
306
  return;
287
- const c = f.value.find(
288
- (r) => r.slug === a && r.namespace === n
307
+ const c = v.value.find(
308
+ (o) => o.slug === a && o.namespace === n
289
309
  );
290
- if (c && !We(c.teamUid, g.value))
291
- return E("local", "default");
292
- if (x.value = n, I.value = a, b.value = t, L.value = l("method", e), O.value = l("pathEncoded", e), N.value = l("exampleName", e), e.path !== "" && ye.setCurrentPath(e.path), h(x.value, a) !== D.value?.id)
293
- return Z(x.value, a);
294
- t && t !== s.value?.workspace[we.workspace.activeDocument] && s?.value?.update("x-scalar-active-document", t), le(e), M(e);
295
- }, le = (e) => {
310
+ if (c && !Ie(c.teamUid, x.value))
311
+ return U("local", "default");
312
+ if (g.value = n, b.value = a, y.value = t, B.value = l("method", e), L.value = l("pathEncoded", e), N.value = l("exampleName", e), e.path !== "" && Ee.setCurrentPath(e.path), h(g.value, a) !== E.value?.id)
313
+ return ee(g.value, a);
314
+ t && t !== s.value?.workspace[ke.workspace.activeDocument] && s?.value?.update("x-scalar-active-document", t), ie(e), q(e);
315
+ }, ie = (e) => {
296
316
  const a = s.value?.workspace["x-scalar-tabs"] ?? [], t = s.value?.workspace["x-scalar-active-tab"] ?? 0, n = a[t];
297
- !n || n.path === e.path || (a[t] = B(e));
298
- }, M = (e) => {
317
+ !n || n.path === e.path || (a[t] = C(e));
318
+ }, q = (e) => {
299
319
  const a = l("documentSlug", e);
300
320
  if (!a) {
301
- o.setSelected(null);
321
+ r.setSelected(null);
302
322
  return;
303
323
  }
304
- const t = W({
324
+ const t = I({
305
325
  document: a,
306
326
  path: l("pathEncoded", e),
307
327
  method: l("method", e),
308
328
  example: l("exampleName", e)
309
329
  });
310
- t && (o.setSelected(t.id), o.setExpanded(t.id, !0));
330
+ t && (r.setSelected(t.id), r.setExpanded(t.id, !0));
311
331
  };
312
- Se({
313
- eventBus: w,
332
+ We({
333
+ eventBus: k,
314
334
  router: i,
315
335
  store: s,
316
- navigateToCurrentTab: ee,
317
- rebuildSidebar: K,
318
- onAfterExampleCreation: ae,
319
- onSelectSidebarItem: F,
320
- onCopyTabUrl: (e) => q(e),
321
- onToggleSidebar: () => C.value = !C.value
336
+ navigateToCurrentTab: ae,
337
+ rebuildSidebar: F,
338
+ onAfterExampleCreation: te,
339
+ onSelectSidebarItem: V,
340
+ onCopyTabUrl: (e) => $(e),
341
+ onToggleSidebar: () => A.value = !A.value,
342
+ renameWorkspace: J
322
343
  });
323
- const ie = p(() => {
344
+ const ue = u(() => {
324
345
  const e = s.value?.workspace["x-scalar-color-mode"] ?? "system";
325
346
  return e === "system" ? window.matchMedia?.("(prefers-color-scheme: dark)")?.matches ?? !1 : e === "dark";
326
347
  });
@@ -328,45 +349,45 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
328
349
  /** Active workspace store */
329
350
  store: s,
330
351
  sidebar: {
331
- state: o,
332
- width: te,
333
- isOpen: C,
334
- handleSelectItem: F,
335
- handleSidebarWidthUpdate: ne,
336
- getEntryByLocation: W
352
+ state: r,
353
+ width: ne,
354
+ isOpen: A,
355
+ handleSelectItem: V,
356
+ handleSidebarWidthUpdate: se,
357
+ getEntryByLocation: I
337
358
  },
338
359
  tabs: {
339
- state: V,
340
- activeTabIndex: re,
341
- copyTabUrl: q
360
+ state: K,
361
+ activeTabIndex: ce,
362
+ copyTabUrl: $
342
363
  },
343
364
  workspace: {
344
- create: _,
345
- workspaceList: f,
346
- filteredWorkspaceList: S,
365
+ create: O,
366
+ workspaceList: v,
367
+ filteredWorkspaceList: W,
347
368
  workspaceGroups: z,
348
- activeWorkspace: D,
349
- navigateToWorkspace: E,
350
- isOpen: p(() => !!(I.value && !b.value))
369
+ activeWorkspace: E,
370
+ navigateToWorkspace: U,
371
+ isOpen: u(() => !!(b.value && !y.value))
351
372
  },
352
- eventBus: w,
373
+ eventBus: k,
353
374
  router: i,
354
375
  currentRoute: d,
355
- loading: y,
376
+ loading: S,
356
377
  activeEntities: {
357
- namespace: x,
358
- workspaceSlug: I,
359
- documentSlug: b,
360
- path: O,
361
- method: L,
378
+ namespace: g,
379
+ workspaceSlug: b,
380
+ documentSlug: y,
381
+ path: L,
382
+ method: B,
362
383
  exampleName: N,
363
- teamUid: g
384
+ teamUid: x
364
385
  },
365
386
  environment: G,
366
- document: A,
367
- isDarkMode: ie
387
+ document: D,
388
+ isDarkMode: ue
368
389
  };
369
390
  };
370
391
  export {
371
- He as createAppState
392
+ Je as createAppState
372
393
  };
@@ -1 +1 @@
1
- {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AA+eA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAA;AAQ3B,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAUhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf;;OAEG;IACH,MAAM,EAAE,YAAY,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAE1C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C;;;OAGG;IACH,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AAiBJ,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,kBAAkB,CAAC,IAAI,OAAO,CAAA;CAC/B,CAAC;AAkLF,KAAK,gBAAgB,GAAG;IACxB,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;AAMF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AA2kBxD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
1
+ {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AA6eA,OAAO,EAML,KAAK,cAAc,EACpB,MAAM,oBAAoB,CAAA;AAI3B,OAAO,KAAK,EAA6B,YAAY,EAAE,MAAM,iBAAiB,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAWhF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACf;;OAEG;IACH,MAAM,EAAE,YAAY,CAAA;IAEpB;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAA;IAE1C;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;OAGG;IACH,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C;;;OAGG;IACH,UAAU,EAAE,cAAc,EAAE,CAAA;IAC5B;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AAiBJ,KAAK,WAAW,GAAG;IACjB,oEAAoE;IACpE,kBAAkB,CAAC,IAAI,OAAO,CAAA;CAC/B,CAAC;AAkLF,KAAK,gBAAgB,GAAG;IACxB,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;AAMF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAklBxD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;kFAGd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
@@ -1,7 +1,7 @@
1
1
  import o from "./AppSidebar.vue2.js";
2
2
  /* empty css */
3
3
  import p from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-658f060e"]]);
4
+ const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-2baee4d5"]]);
5
5
  export {
6
6
  e as default
7
7
  };