@scalar/api-client 2.17.7 → 2.18.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.
Files changed (120) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/dist/components/CommandPalette/CommandActionInput.vue.js +1 -1
  3. package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js +5 -5
  4. package/dist/components/Sidebar/Actions/EditSidebarListCollection.vue.js +18 -18
  5. package/dist/components/Sidebar/Actions/EditSidebarListElement.vue.js +7 -7
  6. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
  7. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +44 -5
  8. package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +2 -44
  9. package/dist/style.css +1 -1
  10. package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
  11. package/dist/v2/blocks/operation-block/helpers/build-request.js +46 -51
  12. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts +9 -0
  13. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.d.ts.map +1 -0
  14. package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +7 -0
  15. package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
  16. package/dist/v2/blocks/operation-block/helpers/get-example.js +12 -10
  17. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts +3 -0
  18. package/dist/v2/blocks/operation-block/helpers/get-server-url.d.ts.map +1 -0
  19. package/dist/v2/blocks/operation-block/helpers/get-server-url.js +12 -0
  20. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
  21. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +1 -1
  22. package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +87 -65
  23. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +18 -10
  24. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
  25. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +149 -126
  26. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts +20 -0
  27. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -0
  28. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js +7 -0
  29. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue2.js +76 -0
  30. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +22 -5
  31. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
  32. package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +79 -64
  33. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +16 -8
  34. package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
  35. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -2
  36. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
  37. package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +84 -82
  38. package/dist/v2/components/code-input/CodeInput.vue.d.ts +115 -144
  39. package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
  40. package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
  41. package/dist/v2/components/code-input/CodeInput.vue2.js +120 -107
  42. package/dist/v2/components/data-table/DataTableInput.vue.d.ts +3 -3
  43. package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
  44. package/dist/v2/components/data-table/DataTableInput.vue.js +2 -2
  45. package/dist/v2/components/data-table/DataTableInput.vue2.js +27 -27
  46. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +3 -2
  47. package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
  48. package/dist/v2/components/data-table/DataTableInputSelect.vue.js +42 -39
  49. package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
  50. package/dist/v2/components/forms/ConfirmationForm.vue.js +43 -5
  51. package/dist/v2/components/forms/ConfirmationForm.vue2.js +2 -43
  52. package/dist/v2/components/modals/DeleteModal.vue.js +11 -11
  53. package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -3
  54. package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
  55. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +5 -3
  56. package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
  57. package/dist/v2/components/sidebar/SidebarMenu.vue.js +25 -30
  58. package/dist/v2/features/app/App.vue.d.ts.map +1 -1
  59. package/dist/v2/features/app/App.vue.js +89 -141
  60. package/dist/v2/features/app/app-events.d.ts +22 -0
  61. package/dist/v2/features/app/app-events.d.ts.map +1 -0
  62. package/dist/v2/features/app/app-events.js +136 -0
  63. package/dist/v2/features/app/app-state.d.ts +135 -0
  64. package/dist/v2/features/app/app-state.d.ts.map +1 -0
  65. package/dist/v2/features/app/app-state.js +316 -0
  66. package/dist/v2/features/app/components/AppSidebar.vue.d.ts +6 -3
  67. package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
  68. package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
  69. package/dist/v2/features/app/components/AppSidebar.vue2.js +4 -4
  70. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +4 -2
  71. package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
  72. package/dist/v2/features/app/components/DesktopTabs.vue.js +25 -22
  73. package/dist/v2/features/app/components/WebTopNav.vue.d.ts +9 -5
  74. package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
  75. package/dist/v2/features/app/helpers/create-api-client-app.d.ts +62 -1
  76. package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
  77. package/dist/v2/features/app/helpers/create-api-client-app.js +14 -10
  78. package/dist/v2/features/app/helpers/routes.d.ts +5 -2
  79. package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
  80. package/dist/v2/features/collection/WorkspaceCollection.vue.js +7 -7
  81. package/dist/v2/features/collection/components/Form.vue.d.ts +1 -1
  82. package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
  83. package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
  84. package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
  85. package/dist/v2/features/modal/Modal.vue.js +2 -2
  86. package/dist/v2/features/modal/Modal.vue2.js +40 -41
  87. package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
  88. package/dist/v2/features/operation/Operation.vue.js +38 -28
  89. package/dist/v2/features/operation/helpers/combine-params.d.ts +4 -0
  90. package/dist/v2/features/operation/helpers/combine-params.d.ts.map +1 -0
  91. package/dist/v2/features/operation/helpers/combine-params.js +13 -0
  92. package/dist/v2/features/operation/index.d.ts +1 -0
  93. package/dist/v2/features/operation/index.d.ts.map +1 -1
  94. package/dist/v2/features/operation/index.js +10 -8
  95. package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
  96. package/dist/v2/features/settings/DocumentSettings.vue.js +104 -5
  97. package/dist/v2/features/settings/DocumentSettings.vue2.js +2 -104
  98. package/dist/v2/helpers/get-tab-details.d.ts +2 -2
  99. package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
  100. package/dist/views/Collection/CollectionSettings.vue.d.ts.map +1 -1
  101. package/dist/views/Collection/CollectionSettings.vue.js +1 -4
  102. package/dist/views/Collection/CollectionSettings.vue2.js +5 -5
  103. package/dist/views/Environment/EnvironmentColorModal.vue.js +6 -6
  104. package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
  105. package/package.json +17 -17
  106. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts +0 -40
  107. package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +0 -1
  108. package/dist/v2/features/app/hooks/use-app-sidebar.js +0 -134
  109. package/dist/v2/features/app/hooks/use-sync-path.d.ts +0 -11
  110. package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +0 -1
  111. package/dist/v2/features/app/hooks/use-sync-path.js +0 -52
  112. package/dist/v2/features/app/hooks/use-tabs.d.ts +0 -31
  113. package/dist/v2/features/app/hooks/use-tabs.d.ts.map +0 -1
  114. package/dist/v2/features/app/hooks/use-tabs.js +0 -44
  115. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts +0 -18
  116. package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +0 -1
  117. package/dist/v2/features/app/hooks/use-workspace-client-app-events.js +0 -156
  118. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts +0 -28
  119. package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +0 -1
  120. package/dist/v2/features/app/hooks/use-workspace-selector.js +0 -81
@@ -0,0 +1,316 @@
1
+ import { isDefined as C } from "@scalar/helpers/array/is-defined";
2
+ import { sortByOrder as $ } from "@scalar/helpers/array/sort-by-order";
3
+ import { isHttpMethod as H } from "@scalar/helpers/http/is-http-method";
4
+ import { createSidebarState as V, generateReverseIndex as Y } from "@scalar/sidebar";
5
+ import { createWorkspaceStore as R } from "@scalar/workspace-store/client";
6
+ import { createWorkspaceEventBus as j } from "@scalar/workspace-store/events";
7
+ import { generateUniqueValue as q } from "@scalar/workspace-store/helpers/generate-unique-value";
8
+ import { getParentEntry as p } from "@scalar/workspace-store/navigation";
9
+ import { createWorkspaceStorePersistence as z } from "@scalar/workspace-store/persistence";
10
+ import { persistencePlugin as J } from "@scalar/workspace-store/plugins/client";
11
+ import { extensions as M } from "@scalar/workspace-store/schemas/extensions";
12
+ import { computed as l, ref as i, shallowRef as S, watch as G } from "vue";
13
+ import { getActiveEnvironment as Q } from "../../helpers/get-active-environment.js";
14
+ import { getTabDetails as X } from "../../helpers/get-tab-details.js";
15
+ import { slugify as Z } from "../../helpers/slugify.js";
16
+ import { workspaceStorage as ee } from "../../helpers/storage.js";
17
+ import { useCommandPaletteState as te } from "../command-palette/hooks/use-command-palette-state.js";
18
+ import { initializeAppEventHandlers as ae } from "./app-events.js";
19
+ const ne = 1e3, m = j({
20
+ debug: !1
21
+ }), b = i(void 0), v = i(void 0), D = i(void 0), A = i(void 0), U = i(void 0), d = i(!1), c = S(null);
22
+ G(c, (e) => {
23
+ e && e.afterEach((t) => we(t));
24
+ });
25
+ const f = l(() => c.value?.currentRoute.value ?? null);
26
+ function s(e, t) {
27
+ const a = t?.params[e];
28
+ if (typeof a == "string")
29
+ return e === "method" ? a && H(a) ? a : void 0 : decodeURIComponent(a);
30
+ }
31
+ const y = S(null), E = i([]), n = S(null), h = l(() => n.value?.workspace.documents[v.value ?? ""] || null), oe = l(() => Q(n.value, h.value)), { workspace: w } = await z();
32
+ E.value = await w.getAll().then((e) => e.map(({ id: t, name: a }) => ({ id: t, label: a })));
33
+ const re = async ({ workspaceId: e }) => R({
34
+ plugins: [await J({ workspaceId: e, debounceDelay: ne })]
35
+ }), se = async (e) => {
36
+ const t = await w.getItem(e);
37
+ if (!t)
38
+ return {
39
+ success: !1
40
+ };
41
+ const a = await re({ workspaceId: e });
42
+ return a.loadWorkspace(t.workspace), y.value = { id: e, label: t.name }, n.value = a, {
43
+ success: !0,
44
+ workspace: a.workspace
45
+ };
46
+ }, ce = async ({ id: e, name: t }) => {
47
+ const a = R();
48
+ await a.addDocument({
49
+ name: "drafts",
50
+ document: {
51
+ openapi: "3.1.0",
52
+ info: {
53
+ title: "Drafts",
54
+ version: "1.0.0"
55
+ },
56
+ paths: {
57
+ "/": {
58
+ get: {}
59
+ }
60
+ },
61
+ "x-scalar-original-document-hash": "drafts",
62
+ "x-scalar-icon": "interface-edit-tool-pencil"
63
+ }
64
+ }), await w.setItem(e, {
65
+ name: t,
66
+ workspace: a.exportWorkspace()
67
+ }), E.value.push({ id: e, label: t });
68
+ }, B = async (e) => {
69
+ e && await c.value?.push({
70
+ name: "workspace.environment",
71
+ params: { workspaceSlug: e }
72
+ });
73
+ }, P = async ({
74
+ id: e,
75
+ name: t
76
+ }) => {
77
+ n.value = null;
78
+ const a = await q({
79
+ defaultValue: e ?? t,
80
+ // Use the provided id if it exists, otherwise use the name
81
+ validation: async (u) => !await w.has(u),
82
+ maxRetries: 100,
83
+ transformation: Z
84
+ });
85
+ if (!a)
86
+ return;
87
+ const r = { id: a, name: t };
88
+ return await ce(r), await B(a), r;
89
+ }, le = async (e) => {
90
+ n.value = null, d.value = !0;
91
+ const t = await se(e);
92
+ if (t.success) {
93
+ const r = t.workspace["x-scalar-active-tab"] ?? 0, u = t.workspace["x-scalar-tabs"], W = u?.[r];
94
+ W && await c.value?.replace(W.path), u && r >= u.length && m.emit("tabs:update:tabs", {
95
+ "x-scalar-active-tab": 0
96
+ }), u || m.emit("tabs:update:tabs", {
97
+ "x-scalar-tabs": [I(f.value)],
98
+ "x-scalar-active-tab": 0
99
+ }), d.value = !1;
100
+ return;
101
+ }
102
+ const a = await P({
103
+ name: "Default Workspace",
104
+ id: "default"
105
+ });
106
+ if (d.value = !1, !a)
107
+ return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
108
+ o.reset();
109
+ }, O = l(() => {
110
+ const e = n.value;
111
+ if (!e)
112
+ return [];
113
+ const t = e.workspace["x-scalar-order"] ?? Object.keys(e.workspace.documents);
114
+ return $(Object.keys(e.workspace.documents), t, (a) => a).map((a) => e.workspace.documents[a]?.["x-scalar-navigation"]).filter(C);
115
+ }), o = V(O), g = ({
116
+ document: e,
117
+ path: t,
118
+ method: a,
119
+ example: r
120
+ }) => JSON.stringify([e, t, a, r].filter(C)), T = l(
121
+ () => Y({
122
+ items: O.value,
123
+ nestedKey: "children",
124
+ filter: (e) => e.type === "document" || e.type === "operation" || e.type === "example",
125
+ getId: (e) => {
126
+ const t = p("document", e), a = p("operation", e);
127
+ return g({
128
+ document: t?.name ?? "",
129
+ path: a?.path,
130
+ method: a?.method,
131
+ example: e.type === "example" ? e.name : void 0
132
+ });
133
+ }
134
+ })
135
+ ), x = (e) => {
136
+ const t = T.value.get(g(e));
137
+ return t || T.value.get(
138
+ g({
139
+ document: e.document,
140
+ path: e.path,
141
+ method: e.method
142
+ })
143
+ );
144
+ }, L = (e) => {
145
+ const t = o.getEntryById(e);
146
+ if (!t) {
147
+ console.warn(`Could not find sidebar entry with id ${e} to select`);
148
+ return;
149
+ }
150
+ if (t.type === "document")
151
+ return o.setSelected(e), o.setExpanded(e, !o.isExpanded(e)), c.value?.push({
152
+ name: "document.overview",
153
+ params: { documentSlug: t.name }
154
+ });
155
+ if (t.type === "operation") {
156
+ if (o.isSelected(e)) {
157
+ o.setExpanded(e, !o.isExpanded(e));
158
+ return;
159
+ }
160
+ const a = t.children?.find((r) => r.type === "example");
161
+ return a ? (o.setSelected(a.id), o.setExpanded(a.id, !0)) : o.setSelected(e), c.value?.push({
162
+ name: "example",
163
+ params: {
164
+ documentSlug: p("document", t)?.name,
165
+ pathEncoded: encodeURIComponent(t.path),
166
+ method: t.method,
167
+ exampleName: a?.name ?? "default"
168
+ }
169
+ });
170
+ }
171
+ if (t.type === "example") {
172
+ o.setSelected(e), o.setExpanded(e, !0);
173
+ const a = p("operation", t);
174
+ return c.value?.push({
175
+ name: "example",
176
+ params: {
177
+ documentSlug: p("document", t)?.name,
178
+ pathEncoded: encodeURIComponent(a?.path ?? ""),
179
+ method: a?.method,
180
+ exampleName: t.name
181
+ }
182
+ });
183
+ }
184
+ if (t.type === "text")
185
+ return c.value?.push({
186
+ name: "document.overview",
187
+ params: {
188
+ documentSlug: p("document", t)?.name
189
+ }
190
+ });
191
+ o.setExpanded(e, !o.isExpanded(e));
192
+ }, ue = async () => {
193
+ if (!n.value)
194
+ return;
195
+ const e = n.value.workspace["x-scalar-active-tab"] ?? 0, t = n.value.workspace["x-scalar-tabs"]?.[e];
196
+ t && await c.value?.replace(t.path);
197
+ }, _ = (e) => {
198
+ e && n.value?.buildSidebar(e);
199
+ }, ie = (e) => {
200
+ const t = h.value?.["x-scalar-navigation"]?.name;
201
+ if (!t)
202
+ return;
203
+ const a = x({
204
+ document: t,
205
+ path: e.path,
206
+ method: e.method,
207
+ example: e.exampleKey
208
+ });
209
+ (!a || a.type !== "example") && _(t);
210
+ }, pe = 288, de = l(() => n.value?.workspace?.["x-scalar-sidebar-width"] ?? pe), me = (e) => n.value?.update("x-scalar-sidebar-width", e), k = i(!0), ve = "x-scalar-tabs", fe = "x-scalar-active-tab", I = (e) => {
211
+ const t = s("method", e), a = s("pathEncoded", e), r = s("documentSlug", e), u = s("workspaceSlug", e);
212
+ return {
213
+ ...X({
214
+ workspace: u,
215
+ document: r,
216
+ path: a,
217
+ method: t,
218
+ getEntryByLocation: x
219
+ }),
220
+ path: f.value?.path ?? ""
221
+ };
222
+ }, N = l(() => n.value?.workspace[ve] ?? [I(f.value)]), he = l(() => n.value?.workspace[fe] ?? 0), F = async (e) => {
223
+ const t = N.value[e];
224
+ if (!t) {
225
+ console.warn(`Cannot copy URL: tab at index ${e} does not exist`);
226
+ return;
227
+ }
228
+ const a = `${window.location.origin}${t.path}`;
229
+ try {
230
+ await navigator.clipboard.writeText(a);
231
+ } catch (r) {
232
+ console.error("Failed to copy URL to clipboard:", r);
233
+ }
234
+ }, we = (e) => {
235
+ console.log({ message: "handleRouteChange", to: e });
236
+ const t = s("workspaceSlug", e), a = s("documentSlug", e);
237
+ if (b.value = t, v.value = a, D.value = s("method", e), A.value = s("pathEncoded", e), U.value = s("exampleName", e), !!t) {
238
+ if (e.path !== "" && ee.setCurrentPath(e.path), t !== y.value?.id)
239
+ return le(t);
240
+ if (a && a !== n.value?.workspace[M.workspace.activeDocument])
241
+ return n?.value?.update("x-scalar-active-document", a);
242
+ xe(e), be(e);
243
+ }
244
+ }, xe = (e) => {
245
+ const t = n.value?.workspace["x-scalar-tabs"] ?? [], a = n.value?.workspace["x-scalar-active-tab"] ?? 0, r = t[a];
246
+ !r || r.path === e.path || (t[a] = I(e));
247
+ }, be = (e) => {
248
+ const t = s("documentSlug", e);
249
+ if (!t) {
250
+ o.setSelected(null);
251
+ return;
252
+ }
253
+ const a = x({
254
+ document: t,
255
+ path: s("pathEncoded", e),
256
+ method: s("method", e),
257
+ example: s("exampleName", e)
258
+ });
259
+ a && (o.setSelected(a.id), o.setExpanded(a.id, !0));
260
+ }, K = te();
261
+ ae({
262
+ eventBus: m,
263
+ router: c,
264
+ getStore: () => n.value,
265
+ document: h,
266
+ navigateToCurrentTab: ue,
267
+ rebuildSidebar: _,
268
+ onAfterExampleCreation: ie,
269
+ onOpenCommandPalette: K.open,
270
+ onSelectSidebarItem: L,
271
+ onCopyTabUrl: (e) => F(e),
272
+ onToggleSidebar: () => k.value = !k.value
273
+ });
274
+ function Ne() {
275
+ return {
276
+ /** Active workspace store */
277
+ store: n,
278
+ sidebar: {
279
+ state: o,
280
+ width: de,
281
+ isOpen: k,
282
+ handleSelectItem: L,
283
+ handleSidebarWidthUpdate: me,
284
+ getEntryByLocation: x
285
+ },
286
+ tabs: {
287
+ state: N,
288
+ activeTabIndex: he,
289
+ copyTabUrl: F
290
+ },
291
+ workspace: {
292
+ create: P,
293
+ workspaceList: E,
294
+ activeWorkspace: y,
295
+ setId: B,
296
+ isOpen: l(() => !!(b.value && !v.value))
297
+ },
298
+ commandPalette: K,
299
+ eventBus: m,
300
+ router: c,
301
+ currentRoute: f,
302
+ loading: d,
303
+ activeEntities: {
304
+ workspaceSlug: b,
305
+ documentSlug: v,
306
+ path: A,
307
+ method: D,
308
+ exampleName: U
309
+ },
310
+ environment: oe,
311
+ document: h
312
+ };
313
+ }
314
+ export {
315
+ Ne as useAppState
316
+ };
@@ -1,8 +1,8 @@
1
+ import { type ScalarListboxOption } from '@scalar/components';
1
2
  import type { SidebarState } from '@scalar/sidebar';
2
3
  import type { WorkspaceStore } from '@scalar/workspace-store/client';
3
4
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
4
5
  import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
5
- import type { Workspace } from '../../../../v2/features/app/hooks/use-workspace-selector.js';
6
6
  import type { ClientLayout } from '../../../../v2/types/layout';
7
7
  type __VLS_Props = {
8
8
  /**
@@ -21,12 +21,15 @@ type __VLS_Props = {
21
21
  * The currently active workspace.
22
22
  * This represents the workspace that the user is currently working in.
23
23
  */
24
- activeWorkspace: Workspace;
24
+ activeWorkspace: {
25
+ id: string;
26
+ label: string;
27
+ };
25
28
  /**
26
29
  * The list of all available workspaces.
27
30
  * Used to render options for workspace switching and selection.
28
31
  */
29
- workspaces: Workspace[];
32
+ workspaces: ScalarListboxOption[];
30
33
  /**
31
34
  * The workspace event bus for handling workspace-level events.
32
35
  * Used for triggering and responding to workspace changes and actions.
@@ -1 +1 @@
1
- {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AA2cA,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;AAShF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAA;AAE/E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,KAAK,WAAW,GAAG;IACjB;;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,SAAS,CAAA;IAC1B;;;OAGG;IACH,UAAU,EAAE,SAAS,EAAE,CAAA;IACvB;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AA+LF,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;;;;;;;;;;;;;;;;;AAicF,wBAOG"}
1
+ {"version":3,"file":"AppSidebar.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/AppSidebar.vue"],"names":[],"mappings":"AAgcA,OAAO,EAML,KAAK,mBAAmB,EACzB,MAAM,oBAAoB,CAAA;AAM3B,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,mBAAmB,EAAE,CAAA;IACjC;;;OAGG;IACH,QAAQ,EAAE,iBAAiB,CAAA;IAC3B;;;OAGG;IACH,KAAK,EAAE,cAAc,CAAA;CACtB,CAAC;AAgMJ,KAAK,iBAAiB,GAAG,WAAW,GAAG;IACvC,6CAA6C;IAC7C,eAAe,EAAE,OAAO,CAAC;IACzB,wCAAwC;IACxC,cAAc,EAAE,MAAM,CAAC;CACtB,CAAC;;;;;;;;;;;;;;;;;AAicF,wBAOG"}
@@ -1,7 +1,7 @@
1
1
  import o from "./AppSidebar.vue2.js";
2
2
  /* empty css */
3
- import a from "../../../../_virtual/_plugin-vue_export-helper.js";
4
- const c = /* @__PURE__ */ a(o, [["__scopeId", "data-v-75aacdc4"]]);
3
+ import p from "../../../../_virtual/_plugin-vue_export-helper.js";
4
+ const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-9bec4555"]]);
5
5
  export {
6
- c as default
6
+ e as default
7
7
  };
@@ -33,7 +33,7 @@ const ne = { class: "flex" }, se = {
33
33
  }),
34
34
  emits: /* @__PURE__ */ C(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
35
35
  setup(i, { emit: D }) {
36
- const c = D, N = b(() => V(i.activeWorkspace.name)), B = W(i, "isSidebarOpen"), M = W(i, "sidebarWidth"), S = b(() => i.sidebarState.items.value.length <= 1), h = b(
36
+ const c = D, N = b(() => V(i.activeWorkspace.label)), B = W(i, "isSidebarOpen"), M = W(i, "sidebarWidth"), S = b(() => i.sidebarState.items.value.length <= 1), h = b(
37
37
  () => ae({
38
38
  store: i.store,
39
39
  sidebarState: i.sidebarState
@@ -130,17 +130,17 @@ const ne = { class: "flex" }, se = {
130
130
  ]),
131
131
  decorator: r(({ item: a }) => [
132
132
  l(n(U), {
133
+ "aria-expanded": "false",
134
+ "aria-haspopup": "menu",
133
135
  icon: n(Q),
134
136
  label: "More options",
135
137
  size: "sm",
136
138
  weight: "bold",
137
- "aria-haspopup": "menu",
138
- "aria-expanded": "false",
139
139
  onClick: p((o) => u(o, a), ["stop"]),
140
140
  onKeydown: [
141
+ k(p((o) => u(o, a), ["stop"]), ["down"]),
141
142
  k(p((o) => u(o, a), ["stop"]), ["enter"]),
142
143
  k(p((o) => u(o, a), ["stop"]), ["space"]),
143
- k(p((o) => u(o, a), ["stop"]), ["down"]),
144
144
  k(p((o) => u(o, a), ["stop"]), ["up"])
145
145
  ]
146
146
  }, null, 8, ["icon", "onClick", "onKeydown"])
@@ -1,8 +1,10 @@
1
1
  import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
2
- import type { UseTabsReturn } from '../../../../v2/features/app/hooks/use-tabs.js';
2
+ import type { Tab } from '@scalar/workspace-store/schemas/extensions/workspace/x-scalar-tabs';
3
3
  type __VLS_Props = {
4
4
  /** Tabs state */
5
- tabsState: UseTabsReturn;
5
+ tabs: Tab[];
6
+ /** Current active tab index */
7
+ activeTabIndex: number;
6
8
  /** Workspace event bus for emitting tab-related events */
7
9
  eventBus: WorkspaceEventBus;
8
10
  };
@@ -1 +1 @@
1
- {"version":3,"file":"DesktopTabs.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/DesktopTabs.vue"],"names":[],"mappings":"AAoEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAIvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAA;AAErE,KAAK,WAAW,GAAG;IACjB,iBAAiB;IACjB,SAAS,EAAE,aAAa,CAAA;IACxB,0DAA0D;IAC1D,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;;AA6IF,wBAMG"}
1
+ {"version":3,"file":"DesktopTabs.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/DesktopTabs.vue"],"names":[],"mappings":"AA0EA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,oEAAoE,CAAA;AAK7F,KAAK,WAAW,GAAG;IACjB,iBAAiB;IACjB,IAAI,EAAE,GAAG,EAAE,CAAA;IACX,+BAA+B;IAC/B,cAAc,EAAE,MAAM,CAAA;IACtB,0DAA0D;IAC1D,QAAQ,EAAE,iBAAiB,CAAA;CAC5B,CAAC;;AAkJF,wBAMG"}
@@ -1,41 +1,44 @@
1
- import { defineComponent as v, computed as m, createElementBlock as c, openBlock as n, createElementVNode as h, Fragment as d, renderList as T, createBlock as p, createVNode as k, unref as C } from "vue";
2
- import { ScalarIcon as g } from "@scalar/components";
3
- import S from "./DesktopTab.vue.js";
4
- const f = { class: "flex h-10 items-center gap-2 px-2" }, O = /* @__PURE__ */ v({
1
+ import { defineComponent as v, computed as d, createElementBlock as c, openBlock as o, createElementVNode as h, Fragment as p, renderList as T, createBlock as C, createVNode as k, unref as g } from "vue";
2
+ import { ScalarIcon as f } from "@scalar/components";
3
+ import B from "./DesktopTab.vue.js";
4
+ const y = { class: "mac:pl-[72px] t-app__top-nav flex h-10 items-center gap-2 px-2" }, U = /* @__PURE__ */ v({
5
5
  __name: "DesktopTabs",
6
6
  props: {
7
- tabsState: {},
7
+ tabs: {},
8
+ activeTabIndex: {},
8
9
  eventBus: {}
9
10
  },
10
11
  setup(a) {
11
- const s = m(() => a.tabsState.tabs.value.length === 1), l = () => {
12
+ const n = d(() => a.tabs.length === 1), s = () => {
12
13
  a.eventBus.emit("tabs:add:tab", void 0);
13
- }, b = (e) => {
14
- a.eventBus.emit("tabs:focus:tab", { index: e });
15
14
  }, r = (e) => {
15
+ a.eventBus.emit("tabs:focus:tab", { index: e });
16
+ }, b = (e) => {
16
17
  a.eventBus.emit("tabs:close:tab", { index: e });
17
18
  }, i = (e) => {
18
19
  a.eventBus.emit("tabs:close:other-tabs", { index: e });
20
+ }, u = (e) => {
21
+ a.eventBus.emit("tabs:copy:url", { index: e });
19
22
  };
20
- return (e, B) => (n(), c("nav", f, [
21
- (n(!0), c(d, null, T(e.tabsState.tabs.value, (u, t) => (n(), p(S, {
23
+ return (e, S) => (o(), c("nav", y, [
24
+ (o(!0), c(p, null, T(e.tabs, (m, t) => (o(), C(B, {
22
25
  key: t,
23
- active: t === e.tabsState.activeTabIndex.value,
24
- hotkey: !s.value && t < 9 ? String(t + 1) : void 0,
25
- isSingleTab: s.value,
26
- tab: u,
27
- onClick: (o) => b(t),
28
- onClose: (o) => r(t),
29
- onCloseOtherTabs: (o) => i(t),
30
- onCopyUrl: (o) => e.tabsState.copyTabUrl(t),
31
- onNewTab: l
26
+ active: t === e.activeTabIndex,
27
+ hotkey: !n.value && t < 9 ? String(t + 1) : void 0,
28
+ isSingleTab: n.value,
29
+ tab: m,
30
+ onClick: (l) => r(t),
31
+ onClose: (l) => b(t),
32
+ onCloseOtherTabs: (l) => i(t),
33
+ onCopyUrl: () => u(t),
34
+ onNewTab: s
32
35
  }, null, 8, ["active", "hotkey", "isSingleTab", "tab", "onClick", "onClose", "onCloseOtherTabs", "onCopyUrl"]))), 128)),
33
36
  h("button", {
34
37
  class: "text-c-3 hover:bg-b-3 app-no-drag-region rounded p-1.5",
35
38
  type: "button",
36
- onClick: l
39
+ onClick: s
37
40
  }, [
38
- k(C(g), {
41
+ k(g(f), {
39
42
  icon: "Add",
40
43
  size: "sm",
41
44
  thickness: "2.5"
@@ -45,5 +48,5 @@ const f = { class: "flex h-10 items-center gap-2 px-2" }, O = /* @__PURE__ */ v(
45
48
  }
46
49
  });
47
50
  export {
48
- O as default
51
+ U as default
49
52
  };
@@ -1,4 +1,4 @@
1
- import type { Workspace } from '../../../../v2/features/app/hooks/use-workspace-selector.js';
1
+ import type { ScalarListboxOption } from '@scalar/components';
2
2
  /**
3
3
  * The top nav on the web
4
4
  *
@@ -9,12 +9,14 @@ declare const _default: import("vue").DefineComponent<{
9
9
  * The currently active workspace.
10
10
  * This represents the workspace that the user is currently working in.
11
11
  */
12
- activeWorkspace: Workspace;
12
+ activeWorkspace: {
13
+ id: string;
14
+ };
13
15
  /**
14
16
  * The list of all available workspaces.
15
17
  * Used to render options for workspace switching and selection.
16
18
  */
17
- workspaces: Workspace[];
19
+ workspaces: ScalarListboxOption[];
18
20
  }, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
19
21
  "create:workspace": () => any;
20
22
  "select:workspace": (id?: string | undefined) => any;
@@ -23,12 +25,14 @@ declare const _default: import("vue").DefineComponent<{
23
25
  * The currently active workspace.
24
26
  * This represents the workspace that the user is currently working in.
25
27
  */
26
- activeWorkspace: Workspace;
28
+ activeWorkspace: {
29
+ id: string;
30
+ };
27
31
  /**
28
32
  * The list of all available workspaces.
29
33
  * Used to render options for workspace switching and selection.
30
34
  */
31
- workspaces: Workspace[];
35
+ workspaces: ScalarListboxOption[];
32
36
  }> & Readonly<{
33
37
  "onCreate:workspace"?: (() => any) | undefined;
34
38
  "onSelect:workspace"?: ((id?: string | undefined) => any) | undefined;
@@ -1 +1 @@
1
- {"version":3,"file":"WebTopNav.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/WebTopNav.vue"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gDAAgD,CAAA;AAK/E;;;;GAIG;;IAGD;;;OAGG;qBACc,SAAS;IAC1B;;;OAGG;gBACS,SAAS,EAAE;;;;;IATvB;;;OAGG;qBACc,SAAS;IAC1B;;;OAGG;gBACS,SAAS,EAAE;;;;;AAXzB,wBAuGC"}
1
+ {"version":3,"file":"WebTopNav.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/components/WebTopNav.vue"],"names":[],"mappings":"AAiDA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAA;AAO7D;;;;GAIG;;IAGD;;;OAGG;qBACc;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;IAC/B;;;OAGG;gBACS,mBAAmB,EAAE;;;;;IATjC;;;OAGG;qBACc;QAAE,EAAE,EAAE,MAAM,CAAA;KAAE;IAC/B;;;OAGG;gBACS,mBAAmB,EAAE;;;;;AAXnC,wBAuGC"}
@@ -20,5 +20,66 @@ export declare const createAppRouter: (layout: CreateApiClientOptions["layout"])
20
20
  /**
21
21
  * Create the API Client with router and passes in the workspace store as a prop
22
22
  */
23
- export declare const createApiClientApp: (el: HTMLElement | null, { layout, plugins }: CreateApiClientOptions) => void;
23
+ export declare const createApiClientApp: (el: HTMLElement | null, { layout, plugins }: CreateApiClientOptions) => {
24
+ app: import("vue").App<Element>;
25
+ state: {
26
+ store: import("vue").ShallowRef<import("@scalar/workspace-store/client").WorkspaceStore | null>;
27
+ sidebar: {
28
+ state: {
29
+ items: import("vue").ComputedRef<import("@scalar/workspace-store/schemas/navigation").TraversedEntry[]>;
30
+ index: import("vue").ComputedRef<Map<string, import("@scalar/workspace-store/schemas/navigation").TraversedEntry & {
31
+ parent?: import("@scalar/workspace-store/schemas/navigation").TraversedEntry | undefined;
32
+ }>>;
33
+ selectedItems: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
34
+ expandedItems: import("vue").Ref<Record<string, boolean>, Record<string, boolean>>;
35
+ selectedItem: import("vue").Ref<string | null, string | null>;
36
+ setSelected: (id: string | null) => void;
37
+ setExpanded: (id: string, value: boolean) => void;
38
+ isExpanded: (id: string) => boolean;
39
+ isSelected: (id: string) => boolean;
40
+ getEntryById: (id: string) => (import("@scalar/workspace-store/schemas/navigation").TraversedEntry & {
41
+ parent?: import("@scalar/workspace-store/schemas/navigation").TraversedEntry | undefined;
42
+ }) | undefined;
43
+ reset: () => void;
44
+ };
45
+ width: import("vue").ComputedRef<number>;
46
+ isOpen: import("vue").Ref<boolean>;
47
+ handleSelectItem: (id: string) => Promise<void | import("vue-router").NavigationFailure | undefined> | undefined;
48
+ handleSidebarWidthUpdate: (width: number) => void | undefined;
49
+ getEntryByLocation: import("../../../../v2/features/app/app-state.js").GetEntryByLocation;
50
+ };
51
+ tabs: {
52
+ state: import("vue").Ref<import("@scalar/workspace-store/schemas/extensions/workspace/x-scalar-tabs").Tab[]>;
53
+ activeTabIndex: import("vue").Ref<number>;
54
+ copyTabUrl: (index: number) => Promise<void>;
55
+ };
56
+ workspace: {
57
+ create: ({ id, name, }: {
58
+ id?: string;
59
+ name: string;
60
+ }) => Promise<{
61
+ id: string;
62
+ name: string;
63
+ } | undefined>;
64
+ workspaceList: import("vue").Ref<import("@scalar/components").ScalarListboxOption[]>;
65
+ activeWorkspace: import("vue").ShallowRef<import("@scalar/components").ScalarListboxOption | null>;
66
+ setId: (id?: string) => Promise<void>;
67
+ isOpen: import("vue").ComputedRef<boolean>;
68
+ };
69
+ commandPalette: import("../../command-palette/hooks/use-command-palette-state.js").UseCommandPaletteStateReturn;
70
+ eventBus: import("@scalar/workspace-store/events").WorkspaceEventBus;
71
+ router: import("vue").ShallowRef<import("vue-router").Router | null>;
72
+ currentRoute: import("vue").Ref<import("vue-router").RouteLocationNormalizedGeneric | null>;
73
+ loading: import("vue").Ref<boolean>;
74
+ activeEntities: {
75
+ workspaceSlug: import("vue").Ref<string | undefined>;
76
+ documentSlug: import("vue").Ref<string | undefined>;
77
+ path: import("vue").Ref<string | undefined>;
78
+ method: import("vue").Ref<import("@scalar/helpers/http/http-methods").HttpMethod | undefined>;
79
+ exampleName: import("vue").Ref<string | undefined>;
80
+ };
81
+ environment: import("vue").ComputedRef<import("@scalar/workspace-store/schemas/extensions/document/x-scalar-environments").XScalarEnvironment>;
82
+ document: import("vue").ComputedRef<import("@scalar/workspace-store/schemas").WorkspaceDocument | null>;
83
+ };
84
+ } | undefined;
24
85
  //# sourceMappingURL=create-api-client-app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"create-api-client-app.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/create-api-client-app.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,sBAAsB,CAAC,QAAQ,CAAC,gCAQvE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,WAAW,GAAG,IAAI,EAAE,qBAAiC,sBAAsB,SAkBjH,CAAA"}
1
+ {"version":3,"file":"create-api-client-app.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/helpers/create-api-client-app.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,MAAM,MAAM,sBAAsB,GAAG;IACnC;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;CACzB,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,sBAAsB,CAAC,QAAQ,CAAC,gCAQvE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAAI,IAAI,WAAW,GAAG,IAAI,EAAE,qBAAiC,sBAAsB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBA4B21K,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;aAD78K,CAAA"}
@@ -1,11 +1,12 @@
1
- import { createApp as p } from "vue";
2
- import { createRouter as o, createWebHistory as c, createWebHashHistory as s } from "vue-router";
3
- import n from "../App.vue.js";
1
+ import { createApp as c } from "vue";
2
+ import { createRouter as i, createWebHistory as n, createWebHashHistory as m } from "vue-router";
3
+ import u from "../App.vue.js";
4
4
  /* empty css */
5
- import { ROUTES as a } from "./routes.js";
6
- const m = (e) => e === "web" ? o({ history: c(), routes: a }) : o({ history: s(), routes: a }), A = (e, { layout: r = "desktop", plugins: i }) => {
7
- const t = p(n, { layout: r, plugins: i });
8
- if (t.use(m(r)), !e) {
5
+ import { useAppState as l } from "../app-state.js";
6
+ import { ROUTES as p } from "./routes.js";
7
+ const f = (e) => e === "web" ? i({ history: n(), routes: p }) : i({ history: m(), routes: p }), v = (e, { layout: r = "desktop", plugins: s }) => {
8
+ const t = c(u, { layout: r, plugins: s }), o = f(r), a = l();
9
+ if (a.router.value = o, t.use(o), !e) {
9
10
  console.error(
10
11
  "[@scalar/api-client-modal] Could not create the API client.",
11
12
  "Invalid HTML element provided.",
@@ -13,9 +14,12 @@ const m = (e) => e === "web" ? o({ history: c(), routes: a }) : o({ history: s()
13
14
  );
14
15
  return;
15
16
  }
16
- t.mount(e);
17
+ return t.mount(e), {
18
+ app: t,
19
+ state: a
20
+ };
17
21
  };
18
22
  export {
19
- A as createApiClientApp,
20
- m as createAppRouter
23
+ v as createApiClientApp,
24
+ f as createAppRouter
21
25
  };