@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.
- package/CHANGELOG.md +146 -0
- package/dist/components/ViewLayout/ViewLayoutSection.vue.d.ts.map +1 -1
- package/dist/components/ViewLayout/ViewLayoutSection.vue.js +1 -1
- package/dist/libs/local-storage.js +3 -3
- package/dist/style.css +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +21 -21
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +67 -75
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +20 -19
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +42 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +5 -5
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +35 -35
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +70 -70
- package/dist/v2/features/app/app-events.d.ts +2 -1
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +89 -64
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +172 -151
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +48 -47
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +4 -4
- package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.js +1 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue2.js +9 -9
- package/dist/v2/features/app/components/SidebarItemMenu.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/SidebarItemMenu.vue.js +71 -43
- package/dist/v2/features/app/helpers/routes.js +11 -11
- package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts +1 -6
- package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +38 -20
- package/dist/v2/features/collection/components/LabelInput.vue.d.ts +3 -0
- package/dist/v2/features/collection/components/LabelInput.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/LabelInput.vue.js +2 -2
- package/dist/v2/features/collection/components/LabelInput.vue2.js +20 -16
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +7 -2
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +70 -71
- package/dist/v2/features/command-palette/components/{CommandPaletteDocument.vue.d.ts → CommandPaletteOpenApiDocument.vue.d.ts} +3 -3
- package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/{CommandPaletteDocument.vue.js → CommandPaletteOpenApiDocument.vue.js} +15 -15
- package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +2 -2
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +10 -10
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +27 -5
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +80 -53
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +34 -9
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +50 -44
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +123 -113
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +17 -17
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +0 -1
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +0 -4
|
@@ -1,32 +1,35 @@
|
|
|
1
|
-
import { isDefined as
|
|
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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
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
|
|
14
|
-
import { getActiveEnvironment as
|
|
15
|
-
import { getTabDetails as
|
|
16
|
-
import { slugify as
|
|
17
|
-
import { workspaceStorage as
|
|
18
|
-
import { initializeAppEventHandlers as
|
|
19
|
-
import { filterWorkspacesByTeam as
|
|
20
|
-
const
|
|
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:
|
|
23
|
+
fileLoader: H
|
|
23
24
|
}) => {
|
|
24
|
-
const
|
|
25
|
+
const k = fe({
|
|
25
26
|
debug: !1
|
|
26
|
-
}), { workspace:
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
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
|
-
}) =>
|
|
50
|
+
}) => Y({
|
|
42
51
|
plugins: [
|
|
43
|
-
await
|
|
52
|
+
await ge({
|
|
44
53
|
workspaceId: h(e, a),
|
|
45
|
-
debounceDelay:
|
|
54
|
+
debounceDelay: Te
|
|
46
55
|
})
|
|
47
56
|
],
|
|
48
|
-
fileLoader:
|
|
49
|
-
}),
|
|
50
|
-
const t = await
|
|
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
|
|
56
|
-
return n.loadWorkspace(t.workspace),
|
|
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
|
-
},
|
|
69
|
+
}, Z = async ({
|
|
61
70
|
name: e,
|
|
62
71
|
teamUid: a,
|
|
63
72
|
namespace: t,
|
|
64
73
|
slug: n
|
|
65
74
|
}) => {
|
|
66
|
-
const c =
|
|
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
|
|
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
|
|
93
|
-
id: h(
|
|
94
|
-
teamUid:
|
|
95
|
-
namespace:
|
|
96
|
-
slug:
|
|
97
|
-
label:
|
|
98
|
-
}),
|
|
99
|
-
},
|
|
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: "
|
|
102
|
-
params: {
|
|
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
|
-
},
|
|
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
|
|
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 (
|
|
134
|
+
validation: async (T) => !await w.has({ namespace: a ?? "local", slug: T }),
|
|
115
135
|
maxRetries: 100,
|
|
116
|
-
transformation:
|
|
136
|
+
transformation: Se
|
|
117
137
|
});
|
|
118
138
|
if (!c)
|
|
119
139
|
return;
|
|
120
|
-
const m = await
|
|
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
|
|
127
|
-
},
|
|
128
|
-
s.value = null,
|
|
129
|
-
const t = await
|
|
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
|
|
132
|
-
|
|
133
|
-
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 &&
|
|
155
|
+
}), m && o >= m.length && k.emit("tabs:update:tabs", {
|
|
136
156
|
"x-scalar-active-tab": 0
|
|
137
|
-
}), m ||
|
|
138
|
-
"x-scalar-tabs": [
|
|
157
|
+
}), m || k.emit("tabs:update:tabs", {
|
|
158
|
+
"x-scalar-tabs": [C(d.value)],
|
|
139
159
|
"x-scalar-active-tab": 0
|
|
140
|
-
}),
|
|
160
|
+
}), S.value = !1;
|
|
141
161
|
return;
|
|
142
162
|
}
|
|
143
|
-
const n =
|
|
163
|
+
const n = W.value.find((o) => o.teamUid === "local" && o.slug === "default") ?? W.value[0];
|
|
144
164
|
if (n)
|
|
145
|
-
return
|
|
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 (
|
|
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
|
-
|
|
153
|
-
},
|
|
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(
|
|
159
|
-
}),
|
|
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(
|
|
165
|
-
() =>
|
|
166
|
-
items:
|
|
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 =
|
|
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
|
-
),
|
|
180
|
-
const a =
|
|
181
|
-
return a ||
|
|
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
|
-
},
|
|
189
|
-
const a =
|
|
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 (
|
|
196
|
-
|
|
215
|
+
if (r.selectedItem.value === e) {
|
|
216
|
+
r.setExpanded(e, !r.isExpanded(e));
|
|
197
217
|
return;
|
|
198
218
|
}
|
|
199
|
-
return
|
|
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 (
|
|
206
|
-
|
|
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 ? (
|
|
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:
|
|
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
|
-
|
|
222
|
-
const t =
|
|
241
|
+
r.setSelected(e);
|
|
242
|
+
const t = f("operation", a);
|
|
223
243
|
return i.push({
|
|
224
244
|
name: "example",
|
|
225
245
|
params: {
|
|
226
|
-
documentSlug:
|
|
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:
|
|
257
|
+
documentSlug: f("document", a)?.name
|
|
238
258
|
}
|
|
239
259
|
});
|
|
240
|
-
|
|
241
|
-
},
|
|
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
|
-
},
|
|
266
|
+
}, F = (e) => {
|
|
247
267
|
e && s.value?.buildSidebar(e);
|
|
248
|
-
},
|
|
249
|
-
const a =
|
|
268
|
+
}, te = (e) => {
|
|
269
|
+
const a = D.value?.["x-scalar-navigation"]?.name;
|
|
250
270
|
if (!a)
|
|
251
271
|
return;
|
|
252
|
-
const t =
|
|
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") && (
|
|
259
|
-
},
|
|
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
|
-
...
|
|
282
|
+
...ye({
|
|
263
283
|
workspace: c,
|
|
264
284
|
document: n,
|
|
265
285
|
path: t,
|
|
266
286
|
method: a,
|
|
267
|
-
getEntryByLocation:
|
|
287
|
+
getEntryByLocation: I
|
|
268
288
|
}),
|
|
269
289
|
path: d.value?.path ?? ""
|
|
270
290
|
};
|
|
271
|
-
},
|
|
272
|
-
const a =
|
|
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
|
-
},
|
|
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 =
|
|
288
|
-
(
|
|
307
|
+
const c = v.value.find(
|
|
308
|
+
(o) => o.slug === a && o.namespace === n
|
|
289
309
|
);
|
|
290
|
-
if (c && !
|
|
291
|
-
return
|
|
292
|
-
if (
|
|
293
|
-
return
|
|
294
|
-
t && t !== s.value?.workspace[
|
|
295
|
-
},
|
|
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] =
|
|
298
|
-
},
|
|
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
|
-
|
|
321
|
+
r.setSelected(null);
|
|
302
322
|
return;
|
|
303
323
|
}
|
|
304
|
-
const t =
|
|
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 && (
|
|
330
|
+
t && (r.setSelected(t.id), r.setExpanded(t.id, !0));
|
|
311
331
|
};
|
|
312
|
-
|
|
313
|
-
eventBus:
|
|
332
|
+
We({
|
|
333
|
+
eventBus: k,
|
|
314
334
|
router: i,
|
|
315
335
|
store: s,
|
|
316
|
-
navigateToCurrentTab:
|
|
317
|
-
rebuildSidebar:
|
|
318
|
-
onAfterExampleCreation:
|
|
319
|
-
onSelectSidebarItem:
|
|
320
|
-
onCopyTabUrl: (e) =>
|
|
321
|
-
onToggleSidebar: () =>
|
|
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
|
|
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:
|
|
332
|
-
width:
|
|
333
|
-
isOpen:
|
|
334
|
-
handleSelectItem:
|
|
335
|
-
handleSidebarWidthUpdate:
|
|
336
|
-
getEntryByLocation:
|
|
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:
|
|
340
|
-
activeTabIndex:
|
|
341
|
-
copyTabUrl:
|
|
360
|
+
state: K,
|
|
361
|
+
activeTabIndex: ce,
|
|
362
|
+
copyTabUrl: $
|
|
342
363
|
},
|
|
343
364
|
workspace: {
|
|
344
|
-
create:
|
|
345
|
-
workspaceList:
|
|
346
|
-
filteredWorkspaceList:
|
|
365
|
+
create: O,
|
|
366
|
+
workspaceList: v,
|
|
367
|
+
filteredWorkspaceList: W,
|
|
347
368
|
workspaceGroups: z,
|
|
348
|
-
activeWorkspace:
|
|
349
|
-
navigateToWorkspace:
|
|
350
|
-
isOpen:
|
|
369
|
+
activeWorkspace: E,
|
|
370
|
+
navigateToWorkspace: U,
|
|
371
|
+
isOpen: u(() => !!(b.value && !y.value))
|
|
351
372
|
},
|
|
352
|
-
eventBus:
|
|
373
|
+
eventBus: k,
|
|
353
374
|
router: i,
|
|
354
375
|
currentRoute: d,
|
|
355
|
-
loading:
|
|
376
|
+
loading: S,
|
|
356
377
|
activeEntities: {
|
|
357
|
-
namespace:
|
|
358
|
-
workspaceSlug:
|
|
359
|
-
documentSlug:
|
|
360
|
-
path:
|
|
361
|
-
method:
|
|
378
|
+
namespace: g,
|
|
379
|
+
workspaceSlug: b,
|
|
380
|
+
documentSlug: y,
|
|
381
|
+
path: L,
|
|
382
|
+
method: B,
|
|
362
383
|
exampleName: N,
|
|
363
|
-
teamUid:
|
|
384
|
+
teamUid: x
|
|
364
385
|
},
|
|
365
386
|
environment: G,
|
|
366
|
-
document:
|
|
367
|
-
isDarkMode:
|
|
387
|
+
document: D,
|
|
388
|
+
isDarkMode: ue
|
|
368
389
|
};
|
|
369
390
|
};
|
|
370
391
|
export {
|
|
371
|
-
|
|
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":"
|
|
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-
|
|
4
|
+
const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-2baee4d5"]]);
|
|
5
5
|
export {
|
|
6
6
|
e as default
|
|
7
7
|
};
|