@scalar/api-client 2.26.2 → 2.27.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 +72 -0
- package/dist/components/Server/ServerSelector.vue.js +6 -6
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +6 -6
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +29 -25
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +15 -15
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts +10 -0
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +4 -0
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +6 -6
- 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 +62 -69
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +7 -7
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +31 -40
- 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 +37 -41
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +3 -2
- 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 +107 -87
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts +21 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js +91 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue2.js +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +107 -93
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +87 -65
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +36 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +35 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +18 -10
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts +5 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +27 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/secret-types.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +1 -2
- 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 +29 -37
- package/dist/v2/components/layout/CollapsibleSection.vue.js +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +2 -0
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +24 -23
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +2 -0
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +30 -30
- package/dist/v2/features/app/App.vue.d.ts +5 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +48 -46
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +3 -3
- package/dist/v2/features/app/components/AppSidebar.vue2.js +64 -63
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +11 -1
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +12 -10
- package/dist/v2/features/app/helpers/routes.d.ts +2 -0
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/hooks/use-theme.d.ts +42 -0
- package/dist/v2/features/app/hooks/use-theme.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-theme.js +34 -0
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +27 -26
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +13 -12
- 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 +49 -40
- package/dist/v2/features/collection/components/Cookies.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Cookies.vue.js +26 -13
- package/dist/v2/features/collection/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Environment.vue.js +27 -15
- package/dist/v2/features/collection/components/Overview.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Overview.vue.js +2 -2
- package/dist/v2/features/collection/components/Overview.vue2.js +68 -61
- package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Servers.vue.js +93 -88
- package/dist/v2/features/collection/components/Settings.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.js +19 -17
- package/dist/v2/features/environments/EnvironmentsList.vue.js +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.d.ts.map +1 -1
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +2 -2
- package/dist/v2/features/global-cookies/components/CookiesTable.vue2.js +8 -8
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +15 -15
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +30 -33
- package/dist/v2/features/settings/CollectionSettings.vue.d.ts +10 -7
- package/dist/v2/features/settings/CollectionSettings.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/CollectionSettings.vue.js +183 -149
- package/dist/v2/features/settings/DocumentSettings.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/DocumentSettings.vue.js +88 -79
- package/dist/v2/features/settings/components/Section.vue.d.ts +2 -1
- package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/components/Section.vue.js +26 -15
- package/dist/v2/features/settings/helpers/get-theme-colors.d.ts +4 -3
- package/dist/v2/features/settings/helpers/get-theme-colors.d.ts.map +1 -1
- package/dist/v2/features/settings/helpers/get-theme-colors.js +6 -7
- package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +2 -2
- package/dist/v2/hooks/use-global-hot-keys.d.ts +3 -1
- package/dist/v2/hooks/use-global-hot-keys.d.ts.map +1 -1
- package/dist/v2/hooks/use-global-hot-keys.js +8 -6
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +13 -6
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +18 -17
|
@@ -1,55 +1,56 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { useModal as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { extensions as _ } from "@scalar/workspace-store/schemas/extensions";
|
|
1
|
+
import { defineComponent as b, computed as T, createBlock as m, openBlock as i, unref as t, withCtx as p, createElementVNode as l, createVNode as r, createElementBlock as u, renderSlot as d, createCommentVNode as v, normalizeProps as y, guardReactiveProps as W } from "vue";
|
|
2
|
+
import { useModal as g, ScalarTeleportRoot as x } from "@scalar/components";
|
|
3
|
+
import { ScalarToasts as B } from "@scalar/use-toasts";
|
|
4
|
+
import { extensions as C } from "@scalar/workspace-store/schemas/extensions";
|
|
6
5
|
import { RouterView as E } from "vue-router";
|
|
7
6
|
import A from "./components/CreateWorkspaceModal.vue.js";
|
|
8
7
|
import O from "./components/SplashScreen.vue.js";
|
|
9
8
|
import { useDocumentWatcher as M } from "./hooks/use-document-watcher.js";
|
|
10
|
-
import U from "
|
|
9
|
+
import { useTheme as U } from "./hooks/use-theme.js";
|
|
10
|
+
import _ from "../command-palette/TheCommandPalette.vue.js";
|
|
11
11
|
import { useColorMode as D } from "../../hooks/use-color-mode.js";
|
|
12
12
|
import { useGlobalHotKeys as I } from "../../hooks/use-global-hot-keys.js";
|
|
13
13
|
import N from "./components/AppSidebar.vue.js";
|
|
14
14
|
import P from "./components/DesktopTabs.vue.js";
|
|
15
|
-
import
|
|
16
|
-
import { mergeSecurity as
|
|
17
|
-
const
|
|
15
|
+
import H from "./components/DownloadAppButton.vue.js";
|
|
16
|
+
import { mergeSecurity as L } from "../../blocks/scalar-auth-selector-block/helpers/merge-security.js";
|
|
17
|
+
const V = ["innerHTML"], $ = { key: 0 }, F = { class: "flex h-dvh w-dvw flex-1 flex-col" }, R = { class: "flex min-h-0 flex-1 flex-row" }, G = { class: "flex flex-1 flex-col" }, j = {
|
|
18
18
|
key: 0,
|
|
19
19
|
class: "flex h-12 items-center justify-end border-b p-2"
|
|
20
|
-
}, z = { class: "bg-b-1 min-h-0 flex-1" }, K = { key: 1 }, q = {},
|
|
20
|
+
}, z = { class: "bg-b-1 min-h-0 flex-1" }, K = { key: 1 }, q = {}, pe = /* @__PURE__ */ b({
|
|
21
21
|
...q,
|
|
22
22
|
__name: "App",
|
|
23
23
|
props: {
|
|
24
24
|
layout: {},
|
|
25
25
|
plugins: { default: () => [] },
|
|
26
|
+
customThemes: { default: () => [] },
|
|
27
|
+
fallbackThemeSlug: { default: "default" },
|
|
26
28
|
getAppState: { type: Function },
|
|
27
29
|
getCommandPaletteState: { type: Function }
|
|
28
30
|
},
|
|
29
|
-
setup(
|
|
30
|
-
|
|
31
|
+
setup(a, { expose: k }) {
|
|
32
|
+
k({
|
|
31
33
|
openCreateWorkspace: () => c.show()
|
|
32
34
|
});
|
|
33
|
-
const e =
|
|
34
|
-
typeof window < "u" && (window.dataDumpWorkspace = () => e.store.value, window.dumpAppState = () => e), I(e.eventBus,
|
|
35
|
-
documentName: () => e.store.value?.workspace[
|
|
35
|
+
const e = a.getAppState(), f = a.getCommandPaletteState();
|
|
36
|
+
typeof window < "u" && (window.dataDumpWorkspace = () => e.store.value, window.dumpAppState = () => e), I(e.eventBus, a.layout), M({
|
|
37
|
+
documentName: () => e.store.value?.workspace[C.workspace.activeDocument],
|
|
36
38
|
store: e.store,
|
|
37
39
|
initialTimeout: 5e3
|
|
38
40
|
}), D({ workspaceStore: e.store });
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
if (!a)
|
|
41
|
+
const { themeStyleTag: w } = U({
|
|
42
|
+
fallbackThemeSlug: () => a.fallbackThemeSlug,
|
|
43
|
+
customThemes: () => a.customThemes,
|
|
44
|
+
store: e.store
|
|
45
|
+
}), h = (s) => {
|
|
46
|
+
if (!s)
|
|
46
47
|
return;
|
|
47
48
|
const o = e.workspace.workspaceList.value?.find(
|
|
48
|
-
(n) => n.id ===
|
|
49
|
+
(n) => n.id === s
|
|
49
50
|
);
|
|
50
51
|
o && e.workspace.navigateToWorkspace(o.namespace, o.slug);
|
|
51
|
-
}, c =
|
|
52
|
-
const
|
|
52
|
+
}, c = g(), S = T(() => {
|
|
53
|
+
const s = e.store.value?.auth ? L(
|
|
53
54
|
e.document.value?.components?.securitySchemes ?? {},
|
|
54
55
|
{},
|
|
55
56
|
e.store.value.auth,
|
|
@@ -61,27 +62,28 @@ const L = ["innerHTML"], V = { key: 0 }, F = { class: "flex h-dvh w-dvw flex-1 f
|
|
|
61
62
|
environment: e.environment.value,
|
|
62
63
|
eventBus: e.eventBus,
|
|
63
64
|
exampleName: e.activeEntities.exampleName.value,
|
|
64
|
-
layout:
|
|
65
|
+
layout: a.layout,
|
|
65
66
|
method: e.activeEntities.method.value,
|
|
66
67
|
path: e.activeEntities.path.value,
|
|
67
68
|
workspaceStore: e.store.value,
|
|
68
69
|
activeWorkspace: e.workspace.activeWorkspace.value,
|
|
69
|
-
plugins:
|
|
70
|
-
securitySchemes:
|
|
70
|
+
plugins: a.plugins,
|
|
71
|
+
securitySchemes: s,
|
|
72
|
+
customThemes: a.customThemes
|
|
71
73
|
};
|
|
72
74
|
});
|
|
73
|
-
return (
|
|
74
|
-
default:
|
|
75
|
-
l("div", { innerHTML:
|
|
76
|
-
r(t(
|
|
77
|
-
t(e).store.value !== null && t(e).workspace.activeWorkspace.value !== null && !t(e).loading.value ? (i(), u("main",
|
|
75
|
+
return (s, o) => (i(), m(t(x), null, {
|
|
76
|
+
default: p(() => [
|
|
77
|
+
l("div", { innerHTML: t(w) }, null, 8, V),
|
|
78
|
+
r(t(B)),
|
|
79
|
+
t(e).store.value !== null && t(e).workspace.activeWorkspace.value !== null && !t(e).loading.value ? (i(), u("main", $, [
|
|
78
80
|
l("div", F, [
|
|
79
|
-
|
|
81
|
+
a.layout === "desktop" ? (i(), m(P, {
|
|
80
82
|
key: 0,
|
|
81
83
|
activeTabIndex: t(e).tabs.activeTabIndex.value,
|
|
82
84
|
eventBus: t(e).eventBus,
|
|
83
85
|
tabs: t(e).tabs.state.value
|
|
84
|
-
}, null, 8, ["activeTabIndex", "eventBus", "tabs"])) :
|
|
86
|
+
}, null, 8, ["activeTabIndex", "eventBus", "tabs"])) : v("", !0),
|
|
85
87
|
l("div", R, [
|
|
86
88
|
r(N, {
|
|
87
89
|
isSidebarOpen: t(e).sidebar.isOpen.value,
|
|
@@ -89,7 +91,7 @@ const L = ["innerHTML"], V = { key: 0 }, F = { class: "flex h-dvh w-dvw flex-1 f
|
|
|
89
91
|
activeWorkspace: t(e).workspace.activeWorkspace.value,
|
|
90
92
|
eventBus: t(e).eventBus,
|
|
91
93
|
isWorkspaceOpen: t(e).workspace.isOpen.value,
|
|
92
|
-
layout:
|
|
94
|
+
layout: a.layout,
|
|
93
95
|
sidebarState: t(e).sidebar.state,
|
|
94
96
|
sidebarWidth: t(e).sidebar.width.value,
|
|
95
97
|
store: t(e).store.value,
|
|
@@ -100,30 +102,30 @@ const L = ["innerHTML"], V = { key: 0 }, F = { class: "flex h-dvh w-dvw flex-1 f
|
|
|
100
102
|
onSelectItem: t(e).sidebar.handleSelectItem,
|
|
101
103
|
"onUpdate:sidebarWidth": t(e).sidebar.handleSidebarWidthUpdate
|
|
102
104
|
}, {
|
|
103
|
-
sidebarMenuActions:
|
|
104
|
-
|
|
105
|
+
sidebarMenuActions: p(() => [
|
|
106
|
+
d(s.$slots, "sidebar-menu-actions")
|
|
105
107
|
]),
|
|
106
108
|
_: 3
|
|
107
109
|
}, 8, ["isSidebarOpen", "activeWorkspace", "eventBus", "isWorkspaceOpen", "layout", "sidebarState", "sidebarWidth", "store", "workspaces", "onClick:workspace", "onSelectItem", "onUpdate:sidebarWidth"]),
|
|
108
110
|
l("div", G, [
|
|
109
|
-
|
|
110
|
-
r(
|
|
111
|
-
])) :
|
|
111
|
+
a.layout === "web" ? (i(), u("nav", j, [
|
|
112
|
+
r(H)
|
|
113
|
+
])) : v("", !0),
|
|
112
114
|
l("div", z, [
|
|
113
|
-
r(t(E),
|
|
115
|
+
r(t(E), y(W(S.value)), null, 16)
|
|
114
116
|
])
|
|
115
117
|
])
|
|
116
118
|
])
|
|
117
119
|
]),
|
|
118
|
-
|
|
120
|
+
d(s.$slots, "create-workspace", { state: t(c) }, () => [
|
|
119
121
|
r(A, {
|
|
120
122
|
state: t(c),
|
|
121
123
|
"onCreate:workspace": o[2] || (o[2] = (n) => t(e).workspace.create(n))
|
|
122
124
|
}, null, 8, ["state"])
|
|
123
125
|
]),
|
|
124
|
-
r(
|
|
126
|
+
r(_, {
|
|
125
127
|
eventBus: t(e).eventBus,
|
|
126
|
-
paletteState: t(
|
|
128
|
+
paletteState: t(f),
|
|
127
129
|
workspaceStore: t(e).store.value
|
|
128
130
|
}, null, 8, ["eventBus", "paletteState", "workspaceStore"])
|
|
129
131
|
])) : (i(), u("main", K, [
|
|
@@ -135,5 +137,5 @@ const L = ["innerHTML"], V = { key: 0 }, F = { class: "flex h-dvh w-dvw flex-1 f
|
|
|
135
137
|
}
|
|
136
138
|
});
|
|
137
139
|
export {
|
|
138
|
-
|
|
140
|
+
pe as default
|
|
139
141
|
};
|
|
@@ -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":"AA+eA,OAAO,EAML,KAAK,cA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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
|
-
import
|
|
4
|
-
const
|
|
3
|
+
import p from "../../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
+
const e = /* @__PURE__ */ p(o, [["__scopeId", "data-v-658f060e"]]);
|
|
5
5
|
export {
|
|
6
|
-
|
|
6
|
+
e as default
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { defineComponent as L, mergeModels as I, computed as k, capitalize as R, useModel as W, ref as V, createElementBlock as c, openBlock as u, createVNode as d, createBlock as x, createCommentVNode as p, unref as i, createSlots as j, withCtx as r, createTextVNode as b, createElementVNode as l, withKeys as w, withModifiers as v, toDisplayString as F, renderSlot as G, normalizeClass as H, Fragment as h, nextTick as U } from "vue";
|
|
2
|
-
import { useModal as J, ScalarSidebarItem as
|
|
2
|
+
import { useModal as J, ScalarSidebarItem as $, ScalarIconButton as Y, ScalarButton as O, ScalarModal as Q } from "@scalar/components";
|
|
3
3
|
import { isMacOS as X } from "@scalar/helpers/general/is-mac-os";
|
|
4
4
|
import { ScalarIconPlus as Z, ScalarIconDotsThree as _, ScalarIconGlobe as ee } from "@scalar/icons";
|
|
5
5
|
import { LibraryIcon as te } from "@scalar/icons/library";
|
|
6
|
-
import { getParentEntry as
|
|
6
|
+
import { getParentEntry as g } from "@scalar/workspace-store/navigation";
|
|
7
7
|
import ae from "../../../../assets/rabbit.ascii.js";
|
|
8
8
|
import oe from "../../../../assets/rabbitjump.ascii.js";
|
|
9
9
|
import E from "../../../../components/ScalarAsciiArt.vue.js";
|
|
@@ -37,64 +37,64 @@ const le = { class: "flex" }, de = {
|
|
|
37
37
|
sidebarWidthModifiers: {}
|
|
38
38
|
}),
|
|
39
39
|
emits: /* @__PURE__ */ I(["click:workspace", "selectItem", "select:workspace", "create:workspace"], ["update:isSidebarOpen", "update:sidebarWidth"]),
|
|
40
|
-
setup(
|
|
41
|
-
const f = A, D = k(() => R(
|
|
40
|
+
setup(a, { emit: A }) {
|
|
41
|
+
const f = A, D = k(() => R(a.activeWorkspace.label)), M = W(a, "isSidebarOpen"), B = W(a, "sidebarWidth"), S = k(() => a.sidebarState.items.value.length <= 1), C = k(
|
|
42
42
|
() => se({
|
|
43
|
-
store:
|
|
44
|
-
sidebarState:
|
|
43
|
+
store: a.store,
|
|
44
|
+
sidebarState: a.sidebarState
|
|
45
45
|
})
|
|
46
|
-
), N = (
|
|
47
|
-
const
|
|
48
|
-
return
|
|
46
|
+
), N = (o, e) => C.value.handleDragEnd(o, e), T = (o, e) => C.value.isDroppable(o, e), s = V(null), y = J(), K = k(() => {
|
|
47
|
+
const o = s.value?.item;
|
|
48
|
+
return o?.type === "document" ? "This cannot be undone. You're about to delete the document and all tags and operations inside it." : `Are you sure you want to delete this ${o?.type ?? "item"}? This action cannot be undone.`;
|
|
49
49
|
}), z = () => {
|
|
50
|
-
const
|
|
51
|
-
if (!
|
|
50
|
+
const o = s.value?.item;
|
|
51
|
+
if (!o)
|
|
52
52
|
return;
|
|
53
|
-
const e =
|
|
53
|
+
const e = a.sidebarState.getEntryById(o.id), t = g("document", e), n = g("operation", e);
|
|
54
54
|
if (t) {
|
|
55
|
-
if (
|
|
56
|
-
|
|
57
|
-
else if (
|
|
58
|
-
|
|
55
|
+
if (o.type === "document")
|
|
56
|
+
a.eventBus.emit("document:delete:document", { name: t.name });
|
|
57
|
+
else if (o.type === "tag")
|
|
58
|
+
a.eventBus.emit("tag:delete:tag", {
|
|
59
59
|
documentName: t.name,
|
|
60
|
-
name:
|
|
60
|
+
name: o.name
|
|
61
61
|
});
|
|
62
|
-
else if (
|
|
62
|
+
else if (o.type === "operation") {
|
|
63
63
|
if (!n)
|
|
64
64
|
return;
|
|
65
|
-
|
|
65
|
+
a.eventBus.emit("operation:delete:operation", {
|
|
66
66
|
meta: {
|
|
67
67
|
method: n.method,
|
|
68
68
|
path: n.path
|
|
69
69
|
},
|
|
70
70
|
documentName: t.name
|
|
71
71
|
});
|
|
72
|
-
} else if (
|
|
72
|
+
} else if (o.type === "example") {
|
|
73
73
|
if (!n)
|
|
74
74
|
return;
|
|
75
|
-
|
|
75
|
+
a.eventBus.emit("operation:delete:example", {
|
|
76
76
|
meta: {
|
|
77
77
|
method: n.method,
|
|
78
78
|
path: n.path,
|
|
79
|
-
exampleKey:
|
|
79
|
+
exampleKey: o.name
|
|
80
80
|
},
|
|
81
81
|
documentName: t.name
|
|
82
82
|
});
|
|
83
83
|
}
|
|
84
84
|
y.hide(), s.value = null;
|
|
85
85
|
}
|
|
86
|
-
}, m = async (
|
|
86
|
+
}, m = async (o, e) => {
|
|
87
87
|
if (s.value?.showMenu)
|
|
88
88
|
return;
|
|
89
|
-
const t =
|
|
89
|
+
const t = o.currentTarget;
|
|
90
90
|
s.value = { item: e, el: t, showMenu: !0 }, await U();
|
|
91
|
-
const n =
|
|
91
|
+
const n = o instanceof MouseEvent ? new MouseEvent(o.type, o) : new KeyboardEvent(o.type, o);
|
|
92
92
|
s.value?.el.dispatchEvent(n);
|
|
93
93
|
}, P = () => {
|
|
94
94
|
s.value && (s.value.showMenu = !1);
|
|
95
|
-
}, q = (
|
|
96
|
-
const e =
|
|
97
|
-
|
|
95
|
+
}, q = (o) => {
|
|
96
|
+
const e = a.sidebarState.getEntryById(o.id), t = g("document", e), n = g("tag", e);
|
|
97
|
+
a.eventBus.emit("ui:open:command-palette", {
|
|
98
98
|
action: "create-request",
|
|
99
99
|
payload: {
|
|
100
100
|
documentId: t?.id,
|
|
@@ -102,30 +102,31 @@ const le = { class: "flex" }, de = {
|
|
|
102
102
|
}
|
|
103
103
|
});
|
|
104
104
|
};
|
|
105
|
-
return (
|
|
105
|
+
return (o, e) => (u(), c("div", le, [
|
|
106
106
|
d(i(re), {
|
|
107
107
|
isSidebarOpen: M.value,
|
|
108
108
|
"onUpdate:isSidebarOpen": e[3] || (e[3] = (t) => M.value = t),
|
|
109
109
|
sidebarWidth: B.value,
|
|
110
110
|
"onUpdate:sidebarWidth": e[4] || (e[4] = (t) => B.value = t),
|
|
111
|
-
activeWorkspace:
|
|
112
|
-
documents: Object.values(
|
|
111
|
+
activeWorkspace: a.activeWorkspace,
|
|
112
|
+
documents: Object.values(a.store.workspace.documents),
|
|
113
113
|
isDroppable: T,
|
|
114
|
-
layout:
|
|
115
|
-
sidebarState:
|
|
116
|
-
workspaces:
|
|
114
|
+
layout: a.layout,
|
|
115
|
+
sidebarState: a.sidebarState,
|
|
116
|
+
workspaces: a.workspaces,
|
|
117
117
|
"onCreate:workspace": e[5] || (e[5] = (t) => f("create:workspace")),
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
118
|
+
"onNavigate:to:settings": e[6] || (e[6] = (t) => a.eventBus.emit("ui:navigate", { page: "workspace", path: "settings" })),
|
|
119
|
+
onReorder: e[7] || (e[7] = (t, n) => N(t, n)),
|
|
120
|
+
"onSelect:workspace": e[8] || (e[8] = (t) => f("select:workspace", t)),
|
|
121
|
+
onSelectItem: e[9] || (e[9] = (t) => f("selectItem", t))
|
|
121
122
|
}, j({
|
|
122
123
|
sidebarMenuActions: r(() => [
|
|
123
|
-
G(
|
|
124
|
+
G(o.$slots, "sidebarMenuActions", {}, void 0, !0)
|
|
124
125
|
]),
|
|
125
126
|
workspaceButton: r(() => [
|
|
126
|
-
d(i(
|
|
127
|
+
d(i($), {
|
|
127
128
|
is: "button",
|
|
128
|
-
active:
|
|
129
|
+
active: a.isWorkspaceOpen,
|
|
129
130
|
icon: i(ee),
|
|
130
131
|
onClick: e[0] || (e[0] = (t) => f("click:workspace"))
|
|
131
132
|
}, {
|
|
@@ -153,23 +154,23 @@ const le = { class: "flex" }, de = {
|
|
|
153
154
|
}, null, 8, ["icon", "onClick", "onKeydown"])
|
|
154
155
|
]),
|
|
155
156
|
icon: r(({ item: t }) => [
|
|
156
|
-
t.type === "document" &&
|
|
157
|
+
t.type === "document" && a.store.workspace.documents[t.name]?.["x-scalar-is-dirty"] === !0 ? (u(), c("div", de, [
|
|
157
158
|
d(i(te), {
|
|
158
159
|
class: "block",
|
|
159
160
|
src: "icon" in t && t.icon || "interface-content-folder"
|
|
160
161
|
}, null, 8, ["src"]),
|
|
161
|
-
e[
|
|
162
|
+
e[12] || (e[12] = l("div", { class: "bg-orange absolute -top-1.25 -right-1.25 flex h-2.5 w-2.5 items-center justify-center rounded-full text-[9px] font-bold text-white" }, " ! ", -1))
|
|
162
163
|
])) : p("", !0)
|
|
163
164
|
]),
|
|
164
165
|
empty: r(({ item: t }) => [
|
|
165
|
-
d(i(
|
|
166
|
+
d(i($), {
|
|
166
167
|
is: "button",
|
|
167
168
|
onClick: (n) => q(t)
|
|
168
169
|
}, {
|
|
169
170
|
icon: r(() => [
|
|
170
171
|
d(i(Z))
|
|
171
172
|
]),
|
|
172
|
-
default: r(() => [...e[
|
|
173
|
+
default: r(() => [...e[13] || (e[13] = [
|
|
173
174
|
b("Add operation", -1)
|
|
174
175
|
])]),
|
|
175
176
|
_: 1
|
|
@@ -177,15 +178,15 @@ const le = { class: "flex" }, de = {
|
|
|
177
178
|
]),
|
|
178
179
|
_: 2
|
|
179
180
|
}, [
|
|
180
|
-
|
|
181
|
+
a.layout !== "modal" ? {
|
|
181
182
|
name: "footer",
|
|
182
183
|
fn: r(() => [
|
|
183
184
|
l("div", {
|
|
184
185
|
class: H({
|
|
185
|
-
"empty-sidebar-item border-t":
|
|
186
|
+
"empty-sidebar-item border-t": S.value
|
|
186
187
|
})
|
|
187
188
|
}, [
|
|
188
|
-
|
|
189
|
+
S.value ? (u(), c("div", ue, [
|
|
189
190
|
l("div", me, [
|
|
190
191
|
d(E, {
|
|
191
192
|
art: i(ae),
|
|
@@ -196,44 +197,44 @@ const le = { class: "flex" }, de = {
|
|
|
196
197
|
class: "rabbitjump absolute top-0 left-0 font-bold"
|
|
197
198
|
}, null, 8, ["art"])
|
|
198
199
|
]),
|
|
199
|
-
e[
|
|
200
|
+
e[14] || (e[14] = l("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [
|
|
200
201
|
l("b", { class: "font-medium" }, "Let's Get Started"),
|
|
201
202
|
l("p", { class: "mt-2 leading-3" }, " Create request, folder, collection or import from OpenAPI/Postman ")
|
|
202
203
|
], -1))
|
|
203
204
|
])) : p("", !0),
|
|
204
205
|
l("div", ce, [
|
|
205
|
-
|
|
206
|
+
S.value ? (u(), x(i(O), {
|
|
206
207
|
key: 0,
|
|
207
208
|
class: "w-full",
|
|
208
209
|
size: "sm",
|
|
209
|
-
onClick: e[1] || (e[1] = (t) =>
|
|
210
|
+
onClick: e[1] || (e[1] = (t) => a.eventBus.emit("ui:open:command-palette", {
|
|
210
211
|
action: "import-from-openapi-swagger-postman-curl",
|
|
211
212
|
payload: void 0
|
|
212
213
|
}))
|
|
213
214
|
}, {
|
|
214
|
-
default: r(() => [...e[
|
|
215
|
+
default: r(() => [...e[15] || (e[15] = [
|
|
215
216
|
b(" Import Collection ", -1)
|
|
216
217
|
])]),
|
|
217
218
|
_: 1
|
|
218
219
|
})) : p("", !0),
|
|
219
|
-
d(i(
|
|
220
|
+
d(i(O), {
|
|
220
221
|
class: "w-full",
|
|
221
222
|
hotkey: "K",
|
|
222
223
|
size: "sm",
|
|
223
224
|
variant: "outlined",
|
|
224
|
-
onClick: e[2] || (e[2] = (t) =>
|
|
225
|
+
onClick: e[2] || (e[2] = (t) => a.eventBus.emit("ui:open:command-palette"))
|
|
225
226
|
}, {
|
|
226
227
|
default: r(() => [
|
|
227
|
-
e[
|
|
228
|
+
e[21] || (e[21] = b(" Add Item ", -1)),
|
|
228
229
|
l("span", pe, [
|
|
229
230
|
i(X)() ? (u(), c(h, { key: 0 }, [
|
|
230
|
-
e[
|
|
231
|
-
e[
|
|
231
|
+
e[16] || (e[16] = l("span", { class: "sr-only" }, "Command", -1)),
|
|
232
|
+
e[17] || (e[17] = l("span", { "aria-hidden": "true" }, "⌘", -1))
|
|
232
233
|
], 64)) : (u(), c(h, { key: 1 }, [
|
|
233
|
-
e[
|
|
234
|
-
e[
|
|
234
|
+
e[18] || (e[18] = l("span", { class: "sr-only" }, "CTRL", -1)),
|
|
235
|
+
e[19] || (e[19] = l("span", { "aria-hidden": "true" }, "⌃", -1))
|
|
235
236
|
], 64)),
|
|
236
|
-
e[
|
|
237
|
+
e[20] || (e[20] = b(" K ", -1))
|
|
237
238
|
])
|
|
238
239
|
]),
|
|
239
240
|
_: 1
|
|
@@ -246,12 +247,12 @@ const le = { class: "flex" }, de = {
|
|
|
246
247
|
]), 1032, ["isSidebarOpen", "sidebarWidth", "activeWorkspace", "documents", "layout", "sidebarState", "workspaces"]),
|
|
247
248
|
s.value?.showMenu ? (u(), x(ie, {
|
|
248
249
|
key: 0,
|
|
249
|
-
eventBus:
|
|
250
|
+
eventBus: a.eventBus,
|
|
250
251
|
item: s.value.item,
|
|
251
|
-
sidebarState:
|
|
252
|
+
sidebarState: a.sidebarState,
|
|
252
253
|
target: s.value.el,
|
|
253
254
|
onCloseMenu: P,
|
|
254
|
-
onShowDeleteModal: e[
|
|
255
|
+
onShowDeleteModal: e[10] || (e[10] = (t) => i(y).show())
|
|
255
256
|
}, null, 8, ["eventBus", "item", "sidebarState", "target"])) : p("", !0),
|
|
256
257
|
s.value ? (u(), x(i(Q), {
|
|
257
258
|
key: 1,
|
|
@@ -263,7 +264,7 @@ const le = { class: "flex" }, de = {
|
|
|
263
264
|
d(ne, {
|
|
264
265
|
variableName: s.value.item.title,
|
|
265
266
|
warningMessage: K.value,
|
|
266
|
-
onClose: e[
|
|
267
|
+
onClose: e[11] || (e[11] = (t) => i(y).hide()),
|
|
267
268
|
onDelete: z
|
|
268
269
|
}, null, 8, ["variableName", "warningMessage"])
|
|
269
270
|
]),
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ClientPlugin } from '@scalar/oas-utils/helpers';
|
|
2
|
+
import type { Theme } from '@scalar/themes';
|
|
2
3
|
import type { ClientLayout } from '../../../../v2/types/layout';
|
|
3
4
|
type CreateApiClientOptions = {
|
|
4
5
|
/**
|
|
@@ -12,6 +13,15 @@ type CreateApiClientOptions = {
|
|
|
12
13
|
* Api client plugins to include in the app
|
|
13
14
|
*/
|
|
14
15
|
plugins?: ClientPlugin[];
|
|
16
|
+
/**
|
|
17
|
+
* Custom themes to include in the app
|
|
18
|
+
*/
|
|
19
|
+
customThemes?: Theme[];
|
|
20
|
+
/**
|
|
21
|
+
* Fallback theme slug to use if no theme is selected for the workspace
|
|
22
|
+
* @default 'default'
|
|
23
|
+
*/
|
|
24
|
+
fallbackThemeSlug?: string;
|
|
15
25
|
};
|
|
16
26
|
/**
|
|
17
27
|
* Creates the appropriate router with the appropriate routes based on the layout
|
|
@@ -20,7 +30,7 @@ export declare const createAppRouter: (layout: CreateApiClientOptions["layout"])
|
|
|
20
30
|
/**
|
|
21
31
|
* Create the API Client with router and passes in the workspace store as a prop
|
|
22
32
|
*/
|
|
23
|
-
export declare const createApiClientApp: (el: HTMLElement | null, { layout, plugins }: CreateApiClientOptions) => Promise<{
|
|
33
|
+
export declare const createApiClientApp: (el: HTMLElement | null, { layout, plugins, customThemes, fallbackThemeSlug }: CreateApiClientOptions) => Promise<{
|
|
24
34
|
app: import("vue").App<Element>;
|
|
25
35
|
state: import("../../../../v2/features/app/app-state.js").AppState;
|
|
26
36
|
} | undefined>;
|
|
@@ -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":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,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":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;AAO3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAIrD,KAAK,sBAAsB,GAAG;IAC5B;;;;;OAKG;IACH,MAAM,EAAE,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC,CAAA;IACtC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;IACxB;;OAEG;IACH,YAAY,CAAC,EAAE,KAAK,EAAE,CAAA;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAAI,QAAQ,sBAAsB,CAAC,QAAQ,CAAC,gCAQvE,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,IAAI,WAAW,GAAG,IAAI,EACtB,sDAA8E,sBAAsB;;;cAkCrG,CAAA"}
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
-
import { createApp as
|
|
2
|
-
import { createRouter as p, createWebHistory as
|
|
3
|
-
import
|
|
1
|
+
import { createApp as l } from "vue";
|
|
2
|
+
import { createRouter as p, createWebHistory as u, createWebHashHistory as d } from "vue-router";
|
|
3
|
+
import f from "../App.vue.js";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import { createAppState as
|
|
5
|
+
import { createAppState as A } from "../app-state.js";
|
|
6
6
|
import { ROUTES as c } from "./routes.js";
|
|
7
|
-
import { useCommandPaletteState as
|
|
8
|
-
const
|
|
9
|
-
const o =
|
|
7
|
+
import { useCommandPaletteState as h } from "../../command-palette/hooks/use-command-palette-state.js";
|
|
8
|
+
const S = (t) => t === "web" ? p({ history: u(), routes: c }) : p({ history: d(), routes: c }), k = async (t, { layout: r = "desktop", plugins: i, customThemes: m, fallbackThemeSlug: n = "default" }) => {
|
|
9
|
+
const o = S(r), a = await A({ router: o }), s = h(), e = l(f, {
|
|
10
10
|
layout: r,
|
|
11
11
|
plugins: i,
|
|
12
|
+
customThemes: m,
|
|
13
|
+
fallbackThemeSlug: n,
|
|
12
14
|
getAppState: () => a,
|
|
13
|
-
getCommandPaletteState: () =>
|
|
15
|
+
getCommandPaletteState: () => s
|
|
14
16
|
});
|
|
15
17
|
if (e.use(o), !t) {
|
|
16
18
|
console.error(
|
|
@@ -26,6 +28,6 @@ const A = (t) => t === "web" ? p({ history: s(), routes: c }) : p({ history: l()
|
|
|
26
28
|
};
|
|
27
29
|
};
|
|
28
30
|
export {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
+
k as createApiClientApp,
|
|
32
|
+
S as createAppRouter
|
|
31
33
|
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
2
|
import type { ClientPlugin } from '@scalar/oas-utils/helpers';
|
|
3
|
+
import type { Theme } from '@scalar/themes';
|
|
3
4
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
5
|
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
5
6
|
import type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments';
|
|
@@ -23,6 +24,7 @@ export type RouteProps = {
|
|
|
23
24
|
label: string;
|
|
24
25
|
};
|
|
25
26
|
plugins: ClientPlugin[];
|
|
27
|
+
customThemes?: Theme[];
|
|
26
28
|
};
|
|
27
29
|
/** When in the collections pages */
|
|
28
30
|
export type CollectionProps = RouteProps & ({
|
|
@@ -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;AAEnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAC7D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE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BAAiB;;oCAGX,WAAW;8BACjB,IAAI;;;;;;;;;;;;;;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;gCALE,UAAU;0BAChB,iBAAiB;;gCAGX,WAAW;0BACjB,IAAI;;;;;;;;;IAgIM,CAAA"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { type Theme } from '@scalar/themes';
|
|
2
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
3
|
+
import { type MaybeRefOrGetter } from 'vue';
|
|
4
|
+
/**
|
|
5
|
+
* useTheme
|
|
6
|
+
*
|
|
7
|
+
* Reactive Vue.js hook to resolve and generate a <style> tag string based on the current theme.
|
|
8
|
+
* Automatically selects the appropriate theme styles in the following priority order:
|
|
9
|
+
* 1. Workspace theme (from the provided store, e.g. store.workspace['x-scalar-theme'])
|
|
10
|
+
* 2. Fallback theme (from the fallbackThemeSlug prop)
|
|
11
|
+
* 3. Default built-in theme (with slug "default")
|
|
12
|
+
*
|
|
13
|
+
* The returned `themeStyleTag` can be injected into your page to dynamically apply theming.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* // In a Vue component setup() function
|
|
18
|
+
* import { ref } from 'vue'
|
|
19
|
+
* import { useTheme } from './use-theme.js'
|
|
20
|
+
*
|
|
21
|
+
* const myThemes = ref([...])
|
|
22
|
+
* const workspaceStore = ref(...)
|
|
23
|
+
* const fallbackThemeSlug = ref('dark')
|
|
24
|
+
*
|
|
25
|
+
* const { themeStyleTag } = useTheme({
|
|
26
|
+
* customThemes: myThemes,
|
|
27
|
+
* fallbackThemeSlug,
|
|
28
|
+
* store: workspaceStore
|
|
29
|
+
* })
|
|
30
|
+
*
|
|
31
|
+
* // To inject in template:
|
|
32
|
+
* // <div v-html="themeStyleTag"></div>
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export declare const useTheme: ({ fallbackThemeSlug, store, customThemes, }: {
|
|
36
|
+
customThemes: MaybeRefOrGetter<Theme[]>;
|
|
37
|
+
fallbackThemeSlug: MaybeRefOrGetter<string>;
|
|
38
|
+
store: MaybeRefOrGetter<WorkspaceStore | null>;
|
|
39
|
+
}) => {
|
|
40
|
+
themeStyleTag: import("vue").ComputedRef<string>;
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=use-theme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-theme.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/app/hooks/use-theme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,KAAK,EAA8B,MAAM,gBAAgB,CAAA;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,KAAK,CAAA;AAkC9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,QAAQ,GAAI,6CAItB;IACD,YAAY,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAA;IACvC,iBAAiB,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC3C,KAAK,EAAE,gBAAgB,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;CAC/C;;CA2CA,CAAA"}
|