@scalar/api-client 2.27.1 → 2.29.2
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 +166 -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 +4 -2
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +185 -156
- 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/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
- package/dist/v2/features/collection/components/Authentication.vue2.js +20 -16
- 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/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +18 -14
- 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.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +19 -15
- package/dist/v2/helpers/get-active-proxy-url.d.ts +18 -0
- package/dist/v2/helpers/get-active-proxy-url.d.ts.map +1 -0
- package/dist/v2/helpers/get-active-proxy-url.js +5 -0
- 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 +18 -18
- 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,69 +1,78 @@
|
|
|
1
|
-
import { isDefined as
|
|
2
|
-
import { sortByOrder as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
1
|
+
import { isDefined as M } from "@scalar/helpers/array/is-defined";
|
|
2
|
+
import { sortByOrder as de } from "@scalar/helpers/array/sort-by-order";
|
|
3
|
+
import { migrateLocalStorageToIndexDb as ve } from "@scalar/oas-utils/migrations";
|
|
4
|
+
import { createSidebarState as fe, generateReverseIndex as he } from "@scalar/sidebar";
|
|
5
|
+
import { createWorkspaceStore as Y } from "@scalar/workspace-store/client";
|
|
6
|
+
import { createWorkspaceEventBus as we } from "@scalar/workspace-store/events";
|
|
7
|
+
import { generateUniqueValue as ge } from "@scalar/workspace-store/helpers/generate-unique-value";
|
|
8
|
+
import { getParentEntry as h } from "@scalar/workspace-store/navigation";
|
|
9
|
+
import { createWorkspaceStorePersistence as ke, getWorkspaceId as w } from "@scalar/workspace-store/persistence";
|
|
10
|
+
import { persistencePlugin as xe } from "@scalar/workspace-store/plugins/client";
|
|
11
|
+
import { extensions as be } from "@scalar/workspace-store/schemas/extensions";
|
|
12
|
+
import { ref as p, computed as u, shallowRef as j, readonly as ye } 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 Se } from "./helpers/group-workspaces.js";
|
|
15
|
+
import { getActiveEnvironment as Ee } from "../../helpers/get-active-environment.js";
|
|
16
|
+
import { getTabDetails as We } from "../../helpers/get-tab-details.js";
|
|
17
|
+
import { slugify as Ue } from "../../helpers/slugify.js";
|
|
18
|
+
import { workspaceStorage as Te } from "../../helpers/storage.js";
|
|
19
|
+
import { initializeAppEventHandlers as Ie } from "./app-events.js";
|
|
20
|
+
import { filterWorkspacesByTeam as De, canLoadWorkspace as H } from "./helpers/filter-workspaces.js";
|
|
21
|
+
const Re = 1e3, Ae = 288, Xe = async ({
|
|
21
22
|
router: i,
|
|
22
|
-
fileLoader:
|
|
23
|
+
fileLoader: z
|
|
23
24
|
}) => {
|
|
24
|
-
const
|
|
25
|
+
const S = we({
|
|
25
26
|
debug: !1
|
|
26
|
-
}), { workspace:
|
|
27
|
-
|
|
28
|
-
const
|
|
29
|
-
|
|
27
|
+
}), { workspace: g } = await ke();
|
|
28
|
+
await ve();
|
|
29
|
+
const k = p("local"), f = p(void 0), x = p(void 0), E = p(void 0), B = p(void 0), L = p(void 0), N = p(void 0), W = p(!1);
|
|
30
|
+
i.afterEach((e) => ue(e));
|
|
31
|
+
const d = u(() => i.currentRoute.value ?? null), U = j(null), v = p([]), b = u(() => De(v.value, k.value)), G = u(() => Se(b.value, k.value)), s = j(null), D = u(() => s.value?.workspace.documents[E.value ?? ""] || null), J = u(() => Ee(s.value, D.value));
|
|
32
|
+
v.value = await g.getAll().then(
|
|
30
33
|
(e) => e.map(({ teamUid: a, namespace: t, slug: n, name: c }) => ({
|
|
31
|
-
id:
|
|
34
|
+
id: w(t, n),
|
|
32
35
|
teamUid: a,
|
|
33
36
|
namespace: t,
|
|
34
37
|
slug: n,
|
|
35
38
|
label: c
|
|
36
39
|
}))
|
|
37
40
|
);
|
|
38
|
-
const
|
|
41
|
+
const Q = async (e) => {
|
|
42
|
+
const a = f.value, t = x.value;
|
|
43
|
+
if (!a || !t)
|
|
44
|
+
return;
|
|
45
|
+
const n = w(a, t);
|
|
46
|
+
await g.updateName({ namespace: a, slug: t }, e) !== void 0 && (v.value = v.value.map((o) => o.id === n ? { ...o, label: e } : o), U.value = { id: n, label: e });
|
|
47
|
+
}, X = async ({
|
|
39
48
|
namespace: e,
|
|
40
49
|
slug: a
|
|
41
|
-
}) =>
|
|
50
|
+
}) => Y({
|
|
42
51
|
plugins: [
|
|
43
|
-
await
|
|
44
|
-
workspaceId:
|
|
45
|
-
debounceDelay:
|
|
52
|
+
await xe({
|
|
53
|
+
workspaceId: w(e, a),
|
|
54
|
+
debounceDelay: Re
|
|
46
55
|
})
|
|
47
56
|
],
|
|
48
|
-
fileLoader:
|
|
49
|
-
}),
|
|
50
|
-
const t = await
|
|
57
|
+
fileLoader: z
|
|
58
|
+
}), Z = async (e, a) => {
|
|
59
|
+
const t = await g.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 X({ namespace: e, slug: a });
|
|
65
|
+
return n.loadWorkspace(t.workspace), U.value = { id: w(t.namespace, t.slug), label: t.name }, s.value = n, {
|
|
57
66
|
success: !0,
|
|
58
67
|
workspace: n.workspace
|
|
59
68
|
};
|
|
60
|
-
},
|
|
69
|
+
}, ee = 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 g.setItem(
|
|
85
94
|
{ namespace: t, slug: n },
|
|
86
95
|
{
|
|
87
96
|
name: e,
|
|
@@ -89,85 +98,103 @@ 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:
|
|
94
|
-
teamUid:
|
|
95
|
-
namespace:
|
|
96
|
-
slug:
|
|
97
|
-
label:
|
|
98
|
-
}),
|
|
99
|
-
},
|
|
101
|
+
return v.value.push({
|
|
102
|
+
id: w(o.namespace, o.slug),
|
|
103
|
+
teamUid: o.teamUid,
|
|
104
|
+
namespace: o.namespace,
|
|
105
|
+
slug: o.slug,
|
|
106
|
+
label: o.name
|
|
107
|
+
}), o;
|
|
108
|
+
}, y = 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 ge({
|
|
112
132
|
defaultValue: t ?? n,
|
|
113
133
|
// Use the provided id if it exists, otherwise use the name
|
|
114
|
-
validation: async (
|
|
134
|
+
validation: async (I) => !await g.has({ namespace: a ?? "local", slug: I }),
|
|
115
135
|
maxRetries: 100,
|
|
116
|
-
transformation:
|
|
136
|
+
transformation: Ue
|
|
117
137
|
});
|
|
118
138
|
if (!c)
|
|
119
139
|
return;
|
|
120
|
-
const m = await
|
|
140
|
+
const m = await ee({
|
|
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 y(m.namespace, m.slug), m;
|
|
147
|
+
}, ae = async (e, a) => {
|
|
148
|
+
s.value = null, W.value = !0;
|
|
149
|
+
const t = await Z(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"], I = m?.[o];
|
|
152
|
+
I && await i.replace({
|
|
153
|
+
path: I.path,
|
|
134
154
|
query: d.value?.query ?? {}
|
|
135
|
-
}), m &&
|
|
155
|
+
}), m && o >= m.length && S.emit("tabs:update:tabs", {
|
|
136
156
|
"x-scalar-active-tab": 0
|
|
137
|
-
}), m ||
|
|
138
|
-
"x-scalar-tabs": [
|
|
157
|
+
}), m || S.emit("tabs:update:tabs", {
|
|
158
|
+
"x-scalar-tabs": [C(d.value)],
|
|
139
159
|
"x-scalar-active-tab": 0
|
|
140
|
-
}),
|
|
160
|
+
}), W.value = !1;
|
|
141
161
|
return;
|
|
142
162
|
}
|
|
143
|
-
const n =
|
|
163
|
+
const n = b.value.find((o) => o.teamUid === "local" && o.slug === "default") ?? b.value[0];
|
|
144
164
|
if (n)
|
|
145
|
-
return
|
|
146
|
-
const c = await
|
|
165
|
+
return y(n.namespace, n.slug);
|
|
166
|
+
const c = await O({
|
|
147
167
|
name: "Default Workspace",
|
|
148
168
|
slug: "default"
|
|
149
169
|
});
|
|
150
|
-
if (
|
|
170
|
+
if (W.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
|
+
}, te = (e) => {
|
|
174
|
+
k.value = e;
|
|
175
|
+
const a = b.value.find(
|
|
176
|
+
(t) => t.namespace === f.value && t.slug === x.value
|
|
177
|
+
);
|
|
178
|
+
if (!(a && H(a.teamUid, e)))
|
|
179
|
+
return y("local", "default");
|
|
180
|
+
}, _ = u(() => {
|
|
154
181
|
const e = s.value;
|
|
155
182
|
if (!e)
|
|
156
183
|
return [];
|
|
157
184
|
const a = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
|
|
158
|
-
return
|
|
159
|
-
}),
|
|
185
|
+
return de(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(M);
|
|
186
|
+
}), r = fe(_), R = ({
|
|
160
187
|
document: e,
|
|
161
188
|
path: a,
|
|
162
189
|
method: t,
|
|
163
190
|
example: n
|
|
164
|
-
}) => JSON.stringify([e, a, t, n].filter(
|
|
165
|
-
() =>
|
|
166
|
-
items:
|
|
191
|
+
}) => JSON.stringify([e, a, t, n].filter(M)), P = u(
|
|
192
|
+
() => he({
|
|
193
|
+
items: _.value,
|
|
167
194
|
nestedKey: "children",
|
|
168
195
|
filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
|
|
169
196
|
getId: (e) => {
|
|
170
|
-
const a =
|
|
197
|
+
const a = h("document", e), t = h("operation", e);
|
|
171
198
|
return R({
|
|
172
199
|
document: a?.name ?? "",
|
|
173
200
|
path: t?.path,
|
|
@@ -176,41 +203,41 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
|
|
|
176
203
|
});
|
|
177
204
|
}
|
|
178
205
|
})
|
|
179
|
-
),
|
|
180
|
-
const a =
|
|
181
|
-
return a ||
|
|
206
|
+
), T = (e) => {
|
|
207
|
+
const a = P.value.get(R(e));
|
|
208
|
+
return a || P.value.get(
|
|
182
209
|
R({
|
|
183
210
|
document: e.document,
|
|
184
211
|
path: e.path,
|
|
185
212
|
method: e.method
|
|
186
213
|
})
|
|
187
214
|
);
|
|
188
|
-
},
|
|
189
|
-
const a =
|
|
215
|
+
}, V = (e) => {
|
|
216
|
+
const a = r.getEntryById(e);
|
|
190
217
|
if (!a) {
|
|
191
218
|
console.warn(`Could not find sidebar entry with id ${e} to select`);
|
|
192
219
|
return;
|
|
193
220
|
}
|
|
194
221
|
if (a.type === "document") {
|
|
195
|
-
if (
|
|
196
|
-
|
|
222
|
+
if (r.selectedItem.value === e) {
|
|
223
|
+
r.setExpanded(e, !r.isExpanded(e));
|
|
197
224
|
return;
|
|
198
225
|
}
|
|
199
|
-
return
|
|
226
|
+
return r.setSelected(e), r.setExpanded(e, !0), i.push({
|
|
200
227
|
name: "document.overview",
|
|
201
228
|
params: { documentSlug: a.name }
|
|
202
229
|
});
|
|
203
230
|
}
|
|
204
231
|
if (a.type === "operation") {
|
|
205
|
-
if (
|
|
206
|
-
|
|
232
|
+
if (r.isSelected(e)) {
|
|
233
|
+
r.setExpanded(e, !r.isExpanded(e));
|
|
207
234
|
return;
|
|
208
235
|
}
|
|
209
236
|
const t = a.children?.find((n) => n.type === "example");
|
|
210
|
-
return t ? (
|
|
237
|
+
return t ? (r.setSelected(t.id), r.setExpanded(t.id, !0)) : r.setSelected(e), i.push({
|
|
211
238
|
name: "example",
|
|
212
239
|
params: {
|
|
213
|
-
documentSlug:
|
|
240
|
+
documentSlug: h("document", a)?.name,
|
|
214
241
|
pathEncoded: encodeURIComponent(a.path),
|
|
215
242
|
method: a.method,
|
|
216
243
|
exampleName: t?.name ?? "default"
|
|
@@ -218,12 +245,12 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
|
|
|
218
245
|
});
|
|
219
246
|
}
|
|
220
247
|
if (a.type === "example") {
|
|
221
|
-
|
|
222
|
-
const t =
|
|
248
|
+
r.setSelected(e);
|
|
249
|
+
const t = h("operation", a);
|
|
223
250
|
return i.push({
|
|
224
251
|
name: "example",
|
|
225
252
|
params: {
|
|
226
|
-
documentSlug:
|
|
253
|
+
documentSlug: h("document", a)?.name,
|
|
227
254
|
pathEncoded: encodeURIComponent(t?.path ?? ""),
|
|
228
255
|
method: t?.method,
|
|
229
256
|
exampleName: a.name
|
|
@@ -234,42 +261,42 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
|
|
|
234
261
|
return i.push({
|
|
235
262
|
name: "document.overview",
|
|
236
263
|
params: {
|
|
237
|
-
documentSlug:
|
|
264
|
+
documentSlug: h("document", a)?.name
|
|
238
265
|
}
|
|
239
266
|
});
|
|
240
|
-
|
|
241
|
-
},
|
|
267
|
+
r.setExpanded(e, !r.isExpanded(e));
|
|
268
|
+
}, ne = async () => {
|
|
242
269
|
if (!s.value)
|
|
243
270
|
return;
|
|
244
271
|
const e = s.value.workspace["x-scalar-active-tab"] ?? 0, a = s.value.workspace["x-scalar-tabs"]?.[e];
|
|
245
272
|
a && await i.replace(a.path);
|
|
246
|
-
},
|
|
273
|
+
}, F = (e) => {
|
|
247
274
|
e && s.value?.buildSidebar(e);
|
|
248
|
-
},
|
|
249
|
-
const a =
|
|
275
|
+
}, se = (e) => {
|
|
276
|
+
const a = D.value?.["x-scalar-navigation"]?.name;
|
|
250
277
|
if (!a)
|
|
251
278
|
return;
|
|
252
|
-
const t =
|
|
279
|
+
const t = T({
|
|
253
280
|
document: a,
|
|
254
281
|
path: e.path,
|
|
255
282
|
method: e.method,
|
|
256
283
|
example: e.exampleKey
|
|
257
284
|
});
|
|
258
|
-
(!t || t.type !== "example") && (
|
|
259
|
-
},
|
|
285
|
+
(!t || t.type !== "example") && (F(a), d.value && q(d.value));
|
|
286
|
+
}, oe = u(() => s.value?.workspace?.["x-scalar-sidebar-width"] ?? Ae), re = (e) => s.value?.update("x-scalar-sidebar-width", e), A = p(!0), ce = "x-scalar-tabs", le = "x-scalar-active-tab", C = (e) => {
|
|
260
287
|
const a = l("method", e), t = l("pathEncoded", e), n = l("documentSlug", e), c = l("workspaceSlug", e);
|
|
261
288
|
return {
|
|
262
|
-
...
|
|
289
|
+
...We({
|
|
263
290
|
workspace: c,
|
|
264
291
|
document: n,
|
|
265
292
|
path: t,
|
|
266
293
|
method: a,
|
|
267
|
-
getEntryByLocation:
|
|
294
|
+
getEntryByLocation: T
|
|
268
295
|
}),
|
|
269
296
|
path: d.value?.path ?? ""
|
|
270
297
|
};
|
|
271
|
-
},
|
|
272
|
-
const a =
|
|
298
|
+
}, K = u(() => s.value?.workspace[ce] ?? [C(d.value)]), ie = u(() => s.value?.workspace[le] ?? 0), $ = async (e) => {
|
|
299
|
+
const a = K.value[e];
|
|
273
300
|
if (!a) {
|
|
274
301
|
console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
|
|
275
302
|
return;
|
|
@@ -280,47 +307,48 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
|
|
|
280
307
|
} catch (n) {
|
|
281
308
|
console.error("Failed to copy URL to clipboard:", n);
|
|
282
309
|
}
|
|
283
|
-
},
|
|
310
|
+
}, ue = (e) => {
|
|
284
311
|
const a = l("workspaceSlug", e), t = l("documentSlug", e), n = l("namespace", e);
|
|
285
312
|
if (!n || !a)
|
|
286
313
|
return;
|
|
287
|
-
const c =
|
|
288
|
-
(
|
|
314
|
+
const c = v.value.find(
|
|
315
|
+
(o) => o.slug === a && o.namespace === n
|
|
289
316
|
);
|
|
290
|
-
if (c && !
|
|
291
|
-
return
|
|
292
|
-
if (
|
|
293
|
-
return
|
|
294
|
-
t && t !== s.value?.workspace[
|
|
295
|
-
},
|
|
317
|
+
if (c && !H(c.teamUid, k.value))
|
|
318
|
+
return y("local", "default");
|
|
319
|
+
if (f.value = n, x.value = a, E.value = t, B.value = l("method", e), L.value = l("pathEncoded", e), N.value = l("exampleName", e), e.path !== "" && Te.setCurrentPath(e.path), w(f.value, a) !== U.value?.id)
|
|
320
|
+
return ae(f.value, a);
|
|
321
|
+
t && t !== s.value?.workspace[be.workspace.activeDocument] && s?.value?.update("x-scalar-active-document", t), pe(e), q(e);
|
|
322
|
+
}, pe = (e) => {
|
|
296
323
|
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
|
-
},
|
|
324
|
+
!n || n.path === e.path || (a[t] = C(e));
|
|
325
|
+
}, q = (e) => {
|
|
299
326
|
const a = l("documentSlug", e);
|
|
300
327
|
if (!a) {
|
|
301
|
-
|
|
328
|
+
r.setSelected(null);
|
|
302
329
|
return;
|
|
303
330
|
}
|
|
304
|
-
const t =
|
|
331
|
+
const t = T({
|
|
305
332
|
document: a,
|
|
306
333
|
path: l("pathEncoded", e),
|
|
307
334
|
method: l("method", e),
|
|
308
335
|
example: l("exampleName", e)
|
|
309
336
|
});
|
|
310
|
-
t && (
|
|
337
|
+
t && (r.setSelected(t.id), r.setExpanded(t.id, !0));
|
|
311
338
|
};
|
|
312
|
-
|
|
313
|
-
eventBus:
|
|
339
|
+
Ie({
|
|
340
|
+
eventBus: S,
|
|
314
341
|
router: i,
|
|
315
342
|
store: s,
|
|
316
|
-
navigateToCurrentTab:
|
|
317
|
-
rebuildSidebar:
|
|
318
|
-
onAfterExampleCreation:
|
|
319
|
-
onSelectSidebarItem:
|
|
320
|
-
onCopyTabUrl: (e) =>
|
|
321
|
-
onToggleSidebar: () =>
|
|
343
|
+
navigateToCurrentTab: ne,
|
|
344
|
+
rebuildSidebar: F,
|
|
345
|
+
onAfterExampleCreation: se,
|
|
346
|
+
onSelectSidebarItem: V,
|
|
347
|
+
onCopyTabUrl: (e) => $(e),
|
|
348
|
+
onToggleSidebar: () => A.value = !A.value,
|
|
349
|
+
renameWorkspace: Q
|
|
322
350
|
});
|
|
323
|
-
const
|
|
351
|
+
const me = u(() => {
|
|
324
352
|
const e = s.value?.workspace["x-scalar-color-mode"] ?? "system";
|
|
325
353
|
return e === "system" ? window.matchMedia?.("(prefers-color-scheme: dark)")?.matches ?? !1 : e === "dark";
|
|
326
354
|
});
|
|
@@ -328,45 +356,46 @@ const Ue = 1e3, Te = 288, h = (i, T) => `${i}/${T}`, He = async ({
|
|
|
328
356
|
/** Active workspace store */
|
|
329
357
|
store: s,
|
|
330
358
|
sidebar: {
|
|
331
|
-
state:
|
|
332
|
-
width:
|
|
333
|
-
isOpen:
|
|
334
|
-
handleSelectItem:
|
|
335
|
-
handleSidebarWidthUpdate:
|
|
336
|
-
getEntryByLocation:
|
|
359
|
+
state: r,
|
|
360
|
+
width: oe,
|
|
361
|
+
isOpen: A,
|
|
362
|
+
handleSelectItem: V,
|
|
363
|
+
handleSidebarWidthUpdate: re,
|
|
364
|
+
getEntryByLocation: T
|
|
337
365
|
},
|
|
338
366
|
tabs: {
|
|
339
|
-
state:
|
|
340
|
-
activeTabIndex:
|
|
341
|
-
copyTabUrl:
|
|
367
|
+
state: K,
|
|
368
|
+
activeTabIndex: ie,
|
|
369
|
+
copyTabUrl: $
|
|
342
370
|
},
|
|
343
371
|
workspace: {
|
|
344
|
-
create:
|
|
345
|
-
workspaceList:
|
|
346
|
-
filteredWorkspaceList:
|
|
347
|
-
workspaceGroups:
|
|
348
|
-
activeWorkspace:
|
|
349
|
-
navigateToWorkspace:
|
|
350
|
-
isOpen:
|
|
372
|
+
create: O,
|
|
373
|
+
workspaceList: v,
|
|
374
|
+
filteredWorkspaceList: b,
|
|
375
|
+
workspaceGroups: G,
|
|
376
|
+
activeWorkspace: U,
|
|
377
|
+
navigateToWorkspace: y,
|
|
378
|
+
isOpen: u(() => !!(x.value && !E.value))
|
|
351
379
|
},
|
|
352
|
-
eventBus:
|
|
380
|
+
eventBus: S,
|
|
353
381
|
router: i,
|
|
354
382
|
currentRoute: d,
|
|
355
|
-
loading:
|
|
383
|
+
loading: W,
|
|
356
384
|
activeEntities: {
|
|
357
|
-
namespace:
|
|
358
|
-
workspaceSlug:
|
|
359
|
-
documentSlug:
|
|
360
|
-
path:
|
|
361
|
-
method:
|
|
385
|
+
namespace: f,
|
|
386
|
+
workspaceSlug: x,
|
|
387
|
+
documentSlug: E,
|
|
388
|
+
path: L,
|
|
389
|
+
method: B,
|
|
362
390
|
exampleName: N,
|
|
363
|
-
teamUid:
|
|
391
|
+
teamUid: ye(k),
|
|
392
|
+
setTeamUid: te
|
|
364
393
|
},
|
|
365
|
-
environment:
|
|
366
|
-
document:
|
|
367
|
-
isDarkMode:
|
|
394
|
+
environment: J,
|
|
395
|
+
document: D,
|
|
396
|
+
isDarkMode: me
|
|
368
397
|
};
|
|
369
398
|
};
|
|
370
399
|
export {
|
|
371
|
-
|
|
400
|
+
Xe as createAppState
|
|
372
401
|
};
|
|
@@ -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
|
};
|