@scalar/api-client 2.22.2 → 2.23.0
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 +27 -0
- package/dist/style.css +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 +9 -9
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +100 -91
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +2 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +43 -37
- package/dist/v2/components/layout/ValueEmitter.vue.d.ts +6 -2
- package/dist/v2/components/layout/ValueEmitter.vue.d.ts.map +1 -1
- package/dist/v2/components/layout/ValueEmitter.vue.js +10 -10
- package/dist/v2/components/server/ServerDropdown.vue.d.ts +2 -0
- package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.js +48 -42
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +117 -89
- package/dist/v2/features/app/app-state.d.ts +23 -12
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +228 -196
- package/dist/v2/features/app/helpers/routes.d.ts +1 -1
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +33 -27
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts +52 -0
- package/dist/v2/features/import-listener/ImportListener.vue.d.ts.map +1 -0
- package/dist/v2/features/import-listener/ImportListener.vue.js +91 -0
- package/dist/v2/features/import-listener/ImportListener.vue2.js +4 -0
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts +7 -0
- package/dist/v2/features/import-listener/components/DropEventListener.vue.d.ts.map +1 -0
- package/dist/v2/features/import-listener/components/DropEventListener.vue.js +81 -0
- package/dist/v2/features/import-listener/components/DropEventListener.vue2.js +4 -0
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts +40 -0
- package/dist/v2/features/import-listener/components/ImportModal.vue.d.ts.map +1 -0
- package/dist/v2/features/import-listener/components/ImportModal.vue.js +170 -0
- package/dist/v2/features/import-listener/components/ImportModal.vue3.js +5 -0
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts +29 -0
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.d.ts.map +1 -0
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue.js +83 -0
- package/dist/v2/features/import-listener/components/WorkspaceSelector.vue2.js +4 -0
- package/dist/v2/features/import-listener/helpers/generate-unique-slug.d.ts +16 -0
- package/dist/v2/features/import-listener/helpers/generate-unique-slug.d.ts.map +1 -0
- package/dist/v2/features/import-listener/helpers/generate-unique-slug.js +11 -0
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts +8 -0
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.d.ts.map +1 -0
- package/dist/v2/features/import-listener/helpers/get-url-query-parameter.js +4 -0
- package/dist/v2/features/import-listener/helpers/import-document-to-workspace.d.ts +30 -0
- package/dist/v2/features/import-listener/helpers/import-document-to-workspace.d.ts.map +1 -0
- package/dist/v2/features/import-listener/helpers/import-document-to-workspace.js +31 -0
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts +15 -0
- package/dist/v2/features/import-listener/helpers/load-document-from-source.d.ts.map +1 -0
- package/dist/v2/features/import-listener/helpers/load-document-from-source.js +28 -0
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts +15 -0
- package/dist/v2/features/import-listener/helpers/wait-for-condition.d.ts.map +1 -0
- package/dist/v2/features/import-listener/helpers/wait-for-condition.js +16 -0
- package/dist/v2/features/import-listener/index.d.ts +2 -0
- package/dist/v2/features/import-listener/index.d.ts.map +1 -0
- package/dist/v2/features/import-listener/index.js +4 -0
- package/dist/v2/features/operation/Operation.vue.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +16 -11
|
@@ -1,50 +1,63 @@
|
|
|
1
|
-
import { isDefined as
|
|
2
|
-
import { sortByOrder as
|
|
3
|
-
import { isHttpMethod as
|
|
4
|
-
import { createSidebarState as
|
|
5
|
-
import { createWorkspaceStore as
|
|
6
|
-
import { createWorkspaceEventBus as
|
|
7
|
-
import { generateUniqueValue as
|
|
8
|
-
import { getParentEntry as
|
|
9
|
-
import { createWorkspaceStorePersistence as
|
|
10
|
-
import { persistencePlugin as
|
|
11
|
-
import { extensions as
|
|
12
|
-
import { shallowRef as
|
|
13
|
-
import { getActiveEnvironment as
|
|
14
|
-
import { getTabDetails as
|
|
15
|
-
import { slugify as
|
|
16
|
-
import { workspaceStorage as
|
|
17
|
-
import { initializeAppEventHandlers as
|
|
18
|
-
const
|
|
1
|
+
import { isDefined as A } from "@scalar/helpers/array/is-defined";
|
|
2
|
+
import { sortByOrder as V } from "@scalar/helpers/array/sort-by-order";
|
|
3
|
+
import { isHttpMethod as Y } from "@scalar/helpers/http/is-http-method";
|
|
4
|
+
import { createSidebarState as j, generateReverseIndex as z } from "@scalar/sidebar";
|
|
5
|
+
import { createWorkspaceStore as C } from "@scalar/workspace-store/client";
|
|
6
|
+
import { createWorkspaceEventBus as J } from "@scalar/workspace-store/events";
|
|
7
|
+
import { generateUniqueValue as M } from "@scalar/workspace-store/helpers/generate-unique-value";
|
|
8
|
+
import { getParentEntry as d } from "@scalar/workspace-store/navigation";
|
|
9
|
+
import { createWorkspaceStorePersistence as G } from "@scalar/workspace-store/persistence";
|
|
10
|
+
import { persistencePlugin as Q } from "@scalar/workspace-store/plugins/client";
|
|
11
|
+
import { extensions as X } from "@scalar/workspace-store/schemas/extensions";
|
|
12
|
+
import { shallowRef as E, computed as i, ref as p, watch as Z } from "vue";
|
|
13
|
+
import { getActiveEnvironment as ee } from "../../helpers/get-active-environment.js";
|
|
14
|
+
import { getTabDetails as ae } from "../../helpers/get-tab-details.js";
|
|
15
|
+
import { slugify as te } from "../../helpers/slugify.js";
|
|
16
|
+
import { workspaceStorage as ne } from "../../helpers/storage.js";
|
|
17
|
+
import { initializeAppEventHandlers as re } from "./app-events.js";
|
|
18
|
+
const oe = 1e3, h = J({
|
|
19
19
|
debug: !1
|
|
20
|
-
}),
|
|
21
|
-
|
|
22
|
-
e && e.afterEach((
|
|
20
|
+
}), v = p(void 0), k = p(void 0), w = p(void 0), B = p(void 0), O = p(void 0), $ = p(void 0), f = p(!1), l = E(null);
|
|
21
|
+
Z(l, (e) => {
|
|
22
|
+
e && e.afterEach((a) => ge(a));
|
|
23
23
|
});
|
|
24
|
-
const
|
|
25
|
-
function
|
|
26
|
-
const
|
|
27
|
-
if (typeof
|
|
28
|
-
return e === "method" ?
|
|
24
|
+
const m = i(() => l.value?.currentRoute.value ?? null);
|
|
25
|
+
function c(e, a) {
|
|
26
|
+
const t = a?.params[e];
|
|
27
|
+
if (typeof t == "string")
|
|
28
|
+
return e === "method" ? t && Y(t) ? t : void 0 : decodeURIComponent(t);
|
|
29
29
|
}
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
const W = E(null), I = p([]), o = E(null), T = i(() => o.value?.workspace.documents[w.value ?? ""] || null), se = i(() => ee(o.value, T.value)), { workspace: x } = await G(), g = (e, a) => `${e}/${a}`;
|
|
31
|
+
I.value = await x.getAll().then(
|
|
32
|
+
(e) => e.map(({ teamUid: a, namespace: t, slug: n, name: u }) => ({
|
|
33
|
+
id: g(t, n),
|
|
34
|
+
teamUid: a,
|
|
35
|
+
namespace: t,
|
|
36
|
+
slug: n,
|
|
37
|
+
label: u
|
|
38
|
+
}))
|
|
39
|
+
);
|
|
40
|
+
const ce = async ({ namespace: e, slug: a }) => C({
|
|
41
|
+
plugins: [await Q({ workspaceId: `${e}-${a}`, debounceDelay: oe })]
|
|
42
|
+
}), ue = async (e, a) => {
|
|
43
|
+
const t = await x.getItem({ namespace: e, slug: a });
|
|
36
44
|
if (!t)
|
|
37
45
|
return {
|
|
38
46
|
success: !1
|
|
39
47
|
};
|
|
40
|
-
const
|
|
41
|
-
return
|
|
48
|
+
const n = await ce({ namespace: e, slug: a });
|
|
49
|
+
return n.loadWorkspace(t.workspace), W.value = { id: g(t.namespace, t.slug), label: t.name }, o.value = n, {
|
|
42
50
|
success: !0,
|
|
43
|
-
workspace:
|
|
51
|
+
workspace: n.workspace
|
|
44
52
|
};
|
|
45
|
-
},
|
|
46
|
-
|
|
47
|
-
|
|
53
|
+
}, le = async ({
|
|
54
|
+
name: e,
|
|
55
|
+
teamUid: a,
|
|
56
|
+
namespace: t,
|
|
57
|
+
slug: n
|
|
58
|
+
}) => {
|
|
59
|
+
const u = C();
|
|
60
|
+
await u.addDocument({
|
|
48
61
|
name: "drafts",
|
|
49
62
|
document: {
|
|
50
63
|
openapi: "3.1.0",
|
|
@@ -60,257 +73,276 @@ const ne = async ({ workspaceId: e }) => R({
|
|
|
60
73
|
"x-scalar-original-document-hash": "drafts",
|
|
61
74
|
"x-scalar-icon": "interface-edit-tool-pencil"
|
|
62
75
|
}
|
|
63
|
-
})
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
76
|
+
});
|
|
77
|
+
const s = await x.setItem(
|
|
78
|
+
{ namespace: t, slug: n },
|
|
79
|
+
{
|
|
80
|
+
name: e,
|
|
81
|
+
teamUid: a,
|
|
82
|
+
workspace: u.exportWorkspace()
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
return I.value.push({
|
|
86
|
+
id: g(s.namespace, s.slug),
|
|
87
|
+
teamUid: s.teamUid,
|
|
88
|
+
namespace: s.namespace,
|
|
89
|
+
slug: s.slug,
|
|
90
|
+
label: s.name
|
|
91
|
+
}), s;
|
|
92
|
+
}, L = async (e, a) => {
|
|
93
|
+
await l.value?.push({
|
|
69
94
|
name: "workspace.environment",
|
|
70
|
-
params: {
|
|
95
|
+
params: { namespace: e, workspaceSlug: a }
|
|
71
96
|
});
|
|
72
|
-
},
|
|
73
|
-
|
|
74
|
-
name:
|
|
97
|
+
}, N = async ({
|
|
98
|
+
key: e,
|
|
99
|
+
name: a
|
|
75
100
|
}) => {
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
defaultValue: e ??
|
|
101
|
+
o.value = null;
|
|
102
|
+
const t = await M({
|
|
103
|
+
defaultValue: e?.slug ?? a,
|
|
79
104
|
// Use the provided id if it exists, otherwise use the name
|
|
80
|
-
validation: async (
|
|
105
|
+
validation: async (s) => !await x.has({ namespace: e?.namespace ?? "local", slug: s }),
|
|
81
106
|
maxRetries: 100,
|
|
82
|
-
transformation:
|
|
107
|
+
transformation: te
|
|
83
108
|
});
|
|
84
|
-
if (!
|
|
109
|
+
if (!t)
|
|
85
110
|
return;
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
111
|
+
const n = {
|
|
112
|
+
teamUid: e?.teamUid,
|
|
113
|
+
namespace: e?.namespace,
|
|
114
|
+
slug: t,
|
|
115
|
+
name: a
|
|
116
|
+
}, u = await le(n);
|
|
117
|
+
return await L(u.namespace, u.slug), u;
|
|
118
|
+
}, ie = async (e, a) => {
|
|
119
|
+
o.value = null, f.value = !0;
|
|
120
|
+
const t = await ue(e, a);
|
|
91
121
|
if (t.success) {
|
|
92
|
-
const
|
|
93
|
-
|
|
122
|
+
const u = t.workspace["x-scalar-active-tab"] ?? 0, s = t.workspace["x-scalar-tabs"], D = s?.[u];
|
|
123
|
+
D && await l.value?.replace({
|
|
124
|
+
path: D.path,
|
|
125
|
+
query: m.value?.query ?? {}
|
|
126
|
+
}), s && u >= s.length && h.emit("tabs:update:tabs", {
|
|
94
127
|
"x-scalar-active-tab": 0
|
|
95
|
-
}),
|
|
96
|
-
"x-scalar-tabs": [
|
|
128
|
+
}), s || h.emit("tabs:update:tabs", {
|
|
129
|
+
"x-scalar-tabs": [U(m.value)],
|
|
97
130
|
"x-scalar-active-tab": 0
|
|
98
|
-
}),
|
|
131
|
+
}), f.value = !1;
|
|
99
132
|
return;
|
|
100
133
|
}
|
|
101
|
-
const
|
|
134
|
+
const n = await N({
|
|
102
135
|
name: "Default Workspace",
|
|
103
|
-
|
|
136
|
+
key: { slug: "default" }
|
|
104
137
|
});
|
|
105
|
-
if (
|
|
138
|
+
if (f.value = !1, !n)
|
|
106
139
|
return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
|
|
107
140
|
r.reset();
|
|
108
|
-
},
|
|
109
|
-
const e =
|
|
141
|
+
}, P = i(() => {
|
|
142
|
+
const e = o.value;
|
|
110
143
|
if (!e)
|
|
111
144
|
return [];
|
|
112
|
-
const
|
|
113
|
-
return
|
|
114
|
-
}), r =
|
|
145
|
+
const a = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
|
|
146
|
+
return V(Object.keys(e.workspace.documents), a, (t) => t).map((t) => e.workspace.documents[t]?.["x-scalar-navigation"]).filter(A);
|
|
147
|
+
}), r = j(P), y = ({
|
|
115
148
|
document: e,
|
|
116
|
-
path:
|
|
117
|
-
method:
|
|
118
|
-
example:
|
|
119
|
-
}) => JSON.stringify([e,
|
|
120
|
-
() =>
|
|
121
|
-
items:
|
|
149
|
+
path: a,
|
|
150
|
+
method: t,
|
|
151
|
+
example: n
|
|
152
|
+
}) => JSON.stringify([e, a, t, n].filter(A)), R = i(
|
|
153
|
+
() => z({
|
|
154
|
+
items: P.value,
|
|
122
155
|
nestedKey: "children",
|
|
123
156
|
filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
|
|
124
157
|
getId: (e) => {
|
|
125
|
-
const
|
|
126
|
-
return
|
|
127
|
-
document:
|
|
128
|
-
path:
|
|
129
|
-
method:
|
|
158
|
+
const a = d("document", e), t = d("operation", e);
|
|
159
|
+
return y({
|
|
160
|
+
document: a?.name ?? "",
|
|
161
|
+
path: t?.path,
|
|
162
|
+
method: t?.method,
|
|
130
163
|
example: e.type === "example" ? e.name : void 0
|
|
131
164
|
});
|
|
132
165
|
}
|
|
133
166
|
})
|
|
134
|
-
),
|
|
135
|
-
const
|
|
136
|
-
return
|
|
137
|
-
|
|
167
|
+
), b = (e) => {
|
|
168
|
+
const a = R.value.get(y(e));
|
|
169
|
+
return a || R.value.get(
|
|
170
|
+
y({
|
|
138
171
|
document: e.document,
|
|
139
172
|
path: e.path,
|
|
140
173
|
method: e.method
|
|
141
174
|
})
|
|
142
175
|
);
|
|
143
|
-
},
|
|
144
|
-
const
|
|
145
|
-
if (!
|
|
176
|
+
}, _ = (e) => {
|
|
177
|
+
const a = r.getEntryById(e);
|
|
178
|
+
if (!a) {
|
|
146
179
|
console.warn(`Could not find sidebar entry with id ${e} to select`);
|
|
147
180
|
return;
|
|
148
181
|
}
|
|
149
|
-
if (
|
|
182
|
+
if (a.type === "document") {
|
|
150
183
|
if (r.selectedItem.value === e) {
|
|
151
184
|
r.setExpanded(e, !r.isExpanded(e));
|
|
152
185
|
return;
|
|
153
186
|
}
|
|
154
|
-
return r.setSelected(e), r.setExpanded(e, !0),
|
|
187
|
+
return r.setSelected(e), r.setExpanded(e, !0), l.value?.push({
|
|
155
188
|
name: "document.overview",
|
|
156
|
-
params: { documentSlug:
|
|
189
|
+
params: { documentSlug: a.name }
|
|
157
190
|
});
|
|
158
191
|
}
|
|
159
|
-
if (
|
|
192
|
+
if (a.type === "operation") {
|
|
160
193
|
if (r.isSelected(e)) {
|
|
161
194
|
r.setExpanded(e, !r.isExpanded(e));
|
|
162
195
|
return;
|
|
163
196
|
}
|
|
164
|
-
const
|
|
165
|
-
return
|
|
197
|
+
const t = a.children?.find((n) => n.type === "example");
|
|
198
|
+
return t ? (r.setSelected(t.id), r.setExpanded(t.id, !0)) : r.setSelected(e), l.value?.push({
|
|
166
199
|
name: "example",
|
|
167
200
|
params: {
|
|
168
|
-
documentSlug:
|
|
169
|
-
pathEncoded: encodeURIComponent(
|
|
170
|
-
method:
|
|
171
|
-
exampleName:
|
|
201
|
+
documentSlug: d("document", a)?.name,
|
|
202
|
+
pathEncoded: encodeURIComponent(a.path),
|
|
203
|
+
method: a.method,
|
|
204
|
+
exampleName: t?.name ?? "default"
|
|
172
205
|
}
|
|
173
206
|
});
|
|
174
207
|
}
|
|
175
|
-
if (
|
|
208
|
+
if (a.type === "example") {
|
|
176
209
|
r.setSelected(e);
|
|
177
|
-
const
|
|
178
|
-
return
|
|
210
|
+
const t = d("operation", a);
|
|
211
|
+
return l.value?.push({
|
|
179
212
|
name: "example",
|
|
180
213
|
params: {
|
|
181
|
-
documentSlug:
|
|
182
|
-
pathEncoded: encodeURIComponent(
|
|
183
|
-
method:
|
|
184
|
-
exampleName:
|
|
214
|
+
documentSlug: d("document", a)?.name,
|
|
215
|
+
pathEncoded: encodeURIComponent(t?.path ?? ""),
|
|
216
|
+
method: t?.method,
|
|
217
|
+
exampleName: a.name
|
|
185
218
|
}
|
|
186
219
|
});
|
|
187
220
|
}
|
|
188
|
-
if (
|
|
189
|
-
return
|
|
221
|
+
if (a.type === "text")
|
|
222
|
+
return l.value?.push({
|
|
190
223
|
name: "document.overview",
|
|
191
224
|
params: {
|
|
192
|
-
documentSlug:
|
|
225
|
+
documentSlug: d("document", a)?.name
|
|
193
226
|
}
|
|
194
227
|
});
|
|
195
228
|
r.setExpanded(e, !r.isExpanded(e));
|
|
196
|
-
},
|
|
197
|
-
if (!
|
|
229
|
+
}, pe = async () => {
|
|
230
|
+
if (!o.value)
|
|
198
231
|
return;
|
|
199
|
-
const e =
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
e &&
|
|
203
|
-
},
|
|
204
|
-
const
|
|
205
|
-
if (!
|
|
232
|
+
const e = o.value.workspace["x-scalar-active-tab"] ?? 0, a = o.value.workspace["x-scalar-tabs"]?.[e];
|
|
233
|
+
a && await l.value?.replace(a.path);
|
|
234
|
+
}, F = (e) => {
|
|
235
|
+
e && o.value?.buildSidebar(e);
|
|
236
|
+
}, me = (e) => {
|
|
237
|
+
const a = T.value?.["x-scalar-navigation"]?.name;
|
|
238
|
+
if (!a)
|
|
206
239
|
return;
|
|
207
|
-
const
|
|
208
|
-
document:
|
|
240
|
+
const t = b({
|
|
241
|
+
document: a,
|
|
209
242
|
path: e.path,
|
|
210
243
|
method: e.method,
|
|
211
244
|
example: e.exampleKey
|
|
212
245
|
});
|
|
213
|
-
(!
|
|
214
|
-
},
|
|
215
|
-
const
|
|
246
|
+
(!t || t.type !== "example") && (F(a), m.value && H(m.value));
|
|
247
|
+
}, de = 288, ve = i(() => o.value?.workspace?.["x-scalar-sidebar-width"] ?? de), fe = (e) => o.value?.update("x-scalar-sidebar-width", e), S = p(!0), he = "x-scalar-tabs", we = "x-scalar-active-tab", U = (e) => {
|
|
248
|
+
const a = c("method", e), t = c("pathEncoded", e), n = c("documentSlug", e), u = c("workspaceSlug", e);
|
|
216
249
|
return {
|
|
217
|
-
...
|
|
218
|
-
workspace:
|
|
219
|
-
document:
|
|
220
|
-
path:
|
|
221
|
-
method:
|
|
222
|
-
getEntryByLocation:
|
|
250
|
+
...ae({
|
|
251
|
+
workspace: u,
|
|
252
|
+
document: n,
|
|
253
|
+
path: t,
|
|
254
|
+
method: a,
|
|
255
|
+
getEntryByLocation: b
|
|
223
256
|
}),
|
|
224
|
-
path:
|
|
257
|
+
path: m.value?.path ?? ""
|
|
225
258
|
};
|
|
226
|
-
},
|
|
227
|
-
const
|
|
228
|
-
if (!
|
|
259
|
+
}, K = i(() => o.value?.workspace[he] ?? [U(m.value)]), xe = i(() => o.value?.workspace[we] ?? 0), q = async (e) => {
|
|
260
|
+
const a = K.value[e];
|
|
261
|
+
if (!a) {
|
|
229
262
|
console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
|
|
230
263
|
return;
|
|
231
264
|
}
|
|
232
|
-
const
|
|
265
|
+
const t = `${window.location.origin}${a.path}`;
|
|
233
266
|
try {
|
|
234
|
-
await navigator.clipboard.writeText(
|
|
235
|
-
} catch (
|
|
236
|
-
console.error("Failed to copy URL to clipboard:",
|
|
267
|
+
await navigator.clipboard.writeText(t);
|
|
268
|
+
} catch (n) {
|
|
269
|
+
console.error("Failed to copy URL to clipboard:", n);
|
|
237
270
|
}
|
|
238
|
-
},
|
|
239
|
-
const
|
|
240
|
-
if (
|
|
241
|
-
if (e.path !== "" &&
|
|
242
|
-
return
|
|
243
|
-
|
|
244
|
-
return n?.value?.update("x-scalar-active-document", a);
|
|
245
|
-
we(e), K(e);
|
|
271
|
+
}, ge = (e) => {
|
|
272
|
+
const a = c("workspaceSlug", e), t = c("documentSlug", e);
|
|
273
|
+
if (v.value = c("namespace", e), k.value = a, w.value = t, B.value = c("method", e), O.value = c("pathEncoded", e), $.value = c("exampleName", e), !(!v.value || !a)) {
|
|
274
|
+
if (e.path !== "" && ne.setCurrentPath(e.path), g(v.value, a) !== W.value?.id)
|
|
275
|
+
return ie(v.value, a);
|
|
276
|
+
t && t !== o.value?.workspace[X.workspace.activeDocument] && o?.value?.update("x-scalar-active-document", t), be(e), H(e);
|
|
246
277
|
}
|
|
247
|
-
},
|
|
248
|
-
const
|
|
249
|
-
!
|
|
250
|
-
},
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
278
|
+
}, be = (e) => {
|
|
279
|
+
const a = o.value?.workspace["x-scalar-tabs"] ?? [], t = o.value?.workspace["x-scalar-active-tab"] ?? 0, n = a[t];
|
|
280
|
+
!n || n.path === e.path || (a[t] = U(e));
|
|
281
|
+
}, H = (e) => {
|
|
282
|
+
const a = c("documentSlug", e);
|
|
283
|
+
if (!a) {
|
|
253
284
|
r.setSelected(null);
|
|
254
285
|
return;
|
|
255
286
|
}
|
|
256
|
-
const
|
|
257
|
-
document:
|
|
258
|
-
path:
|
|
259
|
-
method:
|
|
260
|
-
example:
|
|
287
|
+
const t = b({
|
|
288
|
+
document: a,
|
|
289
|
+
path: c("pathEncoded", e),
|
|
290
|
+
method: c("method", e),
|
|
291
|
+
example: c("exampleName", e)
|
|
261
292
|
});
|
|
262
|
-
|
|
293
|
+
t && (r.setSelected(t.id), r.setExpanded(t.id, !0));
|
|
263
294
|
};
|
|
264
|
-
|
|
265
|
-
eventBus:
|
|
266
|
-
router:
|
|
267
|
-
store:
|
|
268
|
-
navigateToCurrentTab:
|
|
269
|
-
rebuildSidebar:
|
|
270
|
-
onAfterExampleCreation:
|
|
271
|
-
onSelectSidebarItem:
|
|
272
|
-
onCopyTabUrl: (e) =>
|
|
273
|
-
onToggleSidebar: () =>
|
|
295
|
+
re({
|
|
296
|
+
eventBus: h,
|
|
297
|
+
router: l,
|
|
298
|
+
store: o,
|
|
299
|
+
navigateToCurrentTab: pe,
|
|
300
|
+
rebuildSidebar: F,
|
|
301
|
+
onAfterExampleCreation: me,
|
|
302
|
+
onSelectSidebarItem: _,
|
|
303
|
+
onCopyTabUrl: (e) => q(e),
|
|
304
|
+
onToggleSidebar: () => S.value = !S.value
|
|
274
305
|
});
|
|
275
|
-
function
|
|
276
|
-
return e && (
|
|
306
|
+
function Pe(e) {
|
|
307
|
+
return e && (l.value = e), {
|
|
277
308
|
/** Active workspace store */
|
|
278
|
-
store:
|
|
309
|
+
store: o,
|
|
279
310
|
sidebar: {
|
|
280
311
|
state: r,
|
|
281
|
-
width:
|
|
282
|
-
isOpen:
|
|
283
|
-
handleSelectItem:
|
|
284
|
-
handleSidebarWidthUpdate:
|
|
285
|
-
getEntryByLocation:
|
|
312
|
+
width: ve,
|
|
313
|
+
isOpen: S,
|
|
314
|
+
handleSelectItem: _,
|
|
315
|
+
handleSidebarWidthUpdate: fe,
|
|
316
|
+
getEntryByLocation: b
|
|
286
317
|
},
|
|
287
318
|
tabs: {
|
|
288
|
-
state:
|
|
289
|
-
activeTabIndex:
|
|
290
|
-
copyTabUrl:
|
|
319
|
+
state: K,
|
|
320
|
+
activeTabIndex: xe,
|
|
321
|
+
copyTabUrl: q
|
|
291
322
|
},
|
|
292
323
|
workspace: {
|
|
293
|
-
create:
|
|
294
|
-
workspaceList:
|
|
295
|
-
activeWorkspace:
|
|
296
|
-
|
|
297
|
-
isOpen:
|
|
324
|
+
create: N,
|
|
325
|
+
workspaceList: I,
|
|
326
|
+
activeWorkspace: W,
|
|
327
|
+
navigateToWorkspace: L,
|
|
328
|
+
isOpen: i(() => !!(k.value && !w.value))
|
|
298
329
|
},
|
|
299
|
-
eventBus:
|
|
300
|
-
router:
|
|
301
|
-
currentRoute:
|
|
302
|
-
loading:
|
|
330
|
+
eventBus: h,
|
|
331
|
+
router: l,
|
|
332
|
+
currentRoute: m,
|
|
333
|
+
loading: f,
|
|
303
334
|
activeEntities: {
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
335
|
+
namespace: v,
|
|
336
|
+
workspaceSlug: k,
|
|
337
|
+
documentSlug: w,
|
|
338
|
+
path: O,
|
|
339
|
+
method: B,
|
|
340
|
+
exampleName: $
|
|
309
341
|
},
|
|
310
|
-
environment:
|
|
311
|
-
document:
|
|
342
|
+
environment: se,
|
|
343
|
+
document: T
|
|
312
344
|
};
|
|
313
345
|
}
|
|
314
346
|
export {
|
|
315
|
-
|
|
347
|
+
Pe as useAppState
|
|
316
348
|
};
|
|
@@ -32,7 +32,7 @@ export type CollectionProps = RouteProps & ({
|
|
|
32
32
|
collectionType: 'workspace';
|
|
33
33
|
document: null;
|
|
34
34
|
});
|
|
35
|
-
export type ScalarClientAppRouteParams = 'workspaceSlug' | 'documentSlug' | 'pathEncoded' | 'method' | 'exampleName';
|
|
35
|
+
export type ScalarClientAppRouteParams = 'namespace' | 'workspaceSlug' | 'documentSlug' | 'pathEncoded' | 'method' | 'exampleName';
|
|
36
36
|
/** Routes for the API client app and web, the same as modal + workspace routes */
|
|
37
37
|
export declare const ROUTES: ({
|
|
38
38
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;
|
|
1
|
+
{"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/routes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAGlF,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAA;AAU7G,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,kDAAkD;AAClD,MAAM,MAAM,UAAU,GAAG;IACvB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,iBAAiB,GAAG,IAAI,CAAA;IAClC,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,MAAM,EAAE,YAAY,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,MAAM,CAAC,EAAE,UAAU,CAAA;IACnB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,WAAW,EAAE,kBAAkB,CAAA;IAC/B,eAAe,EAAE,qBAAqB,CAAA;IACtC,cAAc,EAAE,cAAc,CAAA;IAC9B,eAAe,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,OAAO,EAAE,YAAY,EAAE,CAAA;CAGxB,CAAA;AAED,oCAAoC;AACpC,MAAM,MAAM,eAAe,GAAG,UAAU,GACtC,CACI;IACE,cAAc,EAAE,UAAU,CAAA;IAC1B,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,GACD;IACE,cAAc,EAAE,WAAW,CAAA;IAC3B,QAAQ,EAAE,IAAI,CAAA;CACf,CACJ,CAAA;AAEH,MAAM,MAAM,0BAA0B,GAClC,WAAW,GACX,eAAe,GACf,cAAc,GACd,aAAa,GACb,QAAQ,GACR,aAAa,CAAA;AAEjB,kFAAkF;AAClF,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;oCAlBK,UAAU;8BAChB,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;oCALE,UAAU;8BAChB,iBAAiB;;oCAGX,WAAW;8BACjB,IAAI;;;;;;;;;;;;;;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;;;;;;;;IAgIM,CAAA"}
|