@scalar/api-client 3.2.2 → 3.3.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 +11 -0
- package/dist/style.css +102 -130
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +9 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js +20 -10
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
- package/dist/v2/components/server/ServerDropdown.vue.d.ts +2 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js +2 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts +22 -4
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js.map +1 -1
- package/dist/v2/features/app/App.vue.script.js +57 -54
- package/dist/v2/features/app/App.vue.script.js.map +1 -1
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +4 -0
- package/dist/v2/features/app/app-events.js.map +1 -1
- package/dist/v2/features/app/app-state.d.ts +6 -0
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +15 -1
- package/dist/v2/features/app/app-state.js.map +1 -1
- package/dist/v2/features/app/components/AppHeader.vue.d.ts +20 -0
- package/dist/v2/features/app/components/AppHeader.vue.d.ts.map +1 -0
- package/dist/v2/features/app/components/AppHeader.vue.js +7 -0
- package/dist/v2/features/app/components/AppHeader.vue.js.map +1 -0
- package/dist/v2/features/app/components/AppHeader.vue.script.js +43 -0
- package/dist/v2/features/app/components/AppHeader.vue.script.js.map +1 -0
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +17 -56
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.script.js +437 -271
- package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
- package/dist/v2/features/app/helpers/load-registry-document.d.ts +18 -0
- package/dist/v2/features/app/helpers/load-registry-document.d.ts.map +1 -0
- package/dist/v2/features/app/helpers/load-registry-document.js +45 -0
- package/dist/v2/features/app/helpers/load-registry-document.js.map +1 -0
- package/dist/v2/features/app/helpers/routes.d.ts +6 -1
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +84 -75
- package/dist/v2/features/app/helpers/routes.js.map +1 -1
- package/dist/v2/features/app/hooks/use-document-filter.d.ts +38 -0
- package/dist/v2/features/app/hooks/use-document-filter.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-document-filter.js +63 -0
- package/dist/v2/features/app/hooks/use-document-filter.js.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.d.ts +17258 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.js +107 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.js.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts +95 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.js +97 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.js.map +1 -0
- package/dist/v2/features/app/index.d.ts +1 -0
- package/dist/v2/features/app/index.d.ts.map +1 -1
- package/dist/v2/features/collection/components/GetStarted.vue.d.ts +13 -0
- package/dist/v2/features/collection/components/GetStarted.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/GetStarted.vue.js +7 -0
- package/dist/v2/features/collection/components/GetStarted.vue.js.map +1 -0
- package/dist/v2/features/collection/components/GetStarted.vue.script.js +101 -0
- package/dist/v2/features/collection/components/GetStarted.vue.script.js.map +1 -0
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.d.ts +4 -0
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.js +5 -1
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts +16 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js +9 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +123 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -0
- package/dist/v2/features/search/components/SearchResult.vue.d.ts +11 -0
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -0
- package/dist/v2/features/search/components/SearchResult.vue.js +7 -0
- package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -0
- package/dist/v2/features/search/components/SearchResult.vue.script.js +71 -0
- package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -0
- package/dist/v2/features/search/hooks/use-document-search.d.ts +19 -0
- package/dist/v2/features/search/hooks/use-document-search.d.ts.map +1 -0
- package/dist/v2/features/search/hooks/use-document-search.js +42 -0
- package/dist/v2/features/search/hooks/use-document-search.js.map +1 -0
- package/dist/v2/features/search/index.d.ts +2 -0
- package/dist/v2/features/search/index.d.ts.map +1 -1
- package/dist/v2/features/search/index.js +3 -1
- package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +8 -4
- package/dist/v2/helpers/handle-hotkeys.js.map +1 -1
- package/dist/v2/types/configuration.d.ts +1 -0
- package/dist/v2/types/configuration.d.ts.map +1 -1
- package/package.json +11 -10
- package/dist/assets/rabbit.ascii.virtual.js +0 -6
- package/dist/assets/rabbit.ascii.virtual.js.map +0 -1
- package/dist/assets/rabbitjump.ascii.virtual.js +0 -6
- package/dist/assets/rabbitjump.ascii.virtual.js.map +0 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts +0 -4
- package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts.map +0 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.js +0 -9
- package/dist/v2/features/app/components/DownloadAppButton.vue.js.map +0 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.script.js +0 -21
- package/dist/v2/features/app/components/DownloadAppButton.vue.script.js.map +0 -1
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
import TheCommandPalette_default from "../command-palette/TheCommandPalette.vue.js";
|
|
2
2
|
import SidebarToggle_default from "../../components/sidebar/SidebarToggle.vue.js";
|
|
3
3
|
import CreateWorkspaceModal_default from "./components/CreateWorkspaceModal.vue.js";
|
|
4
|
+
import AppHeader_default from "./components/AppHeader.vue.js";
|
|
5
|
+
import AppSidebar_default from "./components/AppSidebar.vue.js";
|
|
4
6
|
import SplashScreen_default from "./components/SplashScreen.vue.js";
|
|
5
7
|
import { useDocumentWatcher } from "./hooks/use-document-watcher.js";
|
|
6
8
|
import { useMonacoEditorConfiguration } from "../editor/config.js";
|
|
7
9
|
import { useColorMode } from "../../hooks/use-color-mode.js";
|
|
8
10
|
import { useGlobalHotKeys } from "../../hooks/use-global-hot-keys.js";
|
|
9
|
-
import AppSidebar_default from "./components/AppSidebar.vue.js";
|
|
10
11
|
import DesktopTabs_default from "./components/DesktopTabs.vue.js";
|
|
11
12
|
import { computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, guardReactiveProps, normalizeClass, normalizeProps, onBeforeUnmount, openBlock, renderSlot, toValue, unref, watch, withCtx } from "vue";
|
|
12
|
-
import { ScalarTeleportRoot, useModal } from "@scalar/components";
|
|
13
|
+
import { ScalarMenuWorkspacePicker, ScalarTeleportRoot, useModal } from "@scalar/components";
|
|
13
14
|
import { ScalarToasts } from "@scalar/use-toasts";
|
|
14
15
|
import { RouterView } from "vue-router";
|
|
15
16
|
import { extensions } from "@scalar/workspace-store/schemas/extensions";
|
|
16
17
|
//#region src/v2/features/app/App.vue?vue&type=script&setup=true&lang.ts
|
|
17
18
|
var _hoisted_1 = ["innerHTML"];
|
|
18
19
|
var _hoisted_2 = { key: 0 };
|
|
19
|
-
var _hoisted_3 = { class: "flex
|
|
20
|
-
var _hoisted_4 = { class: "flex min-h-0 flex-1 flex-
|
|
21
|
-
var _hoisted_5 = { class: "
|
|
22
|
-
var _hoisted_6 = {
|
|
20
|
+
var _hoisted_3 = { class: "relative flex h-dvh w-dvw flex-col" };
|
|
21
|
+
var _hoisted_4 = { class: "flex min-h-0 flex-1 flex-row" };
|
|
22
|
+
var _hoisted_5 = { class: "flex min-h-0 flex-1 flex-col" };
|
|
23
|
+
var _hoisted_6 = { class: "bg-b-1 relative min-h-0 flex-1" };
|
|
24
|
+
var _hoisted_7 = { key: 1 };
|
|
23
25
|
var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
24
26
|
__name: "App",
|
|
25
27
|
props: {
|
|
@@ -27,7 +29,11 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
|
|
|
27
29
|
plugins: { default: () => [] },
|
|
28
30
|
getAppState: { type: Function },
|
|
29
31
|
getCommandPaletteState: { type: Function },
|
|
30
|
-
fetchRegistryDocument: { type: Function }
|
|
32
|
+
fetchRegistryDocument: { type: Function },
|
|
33
|
+
registryDocuments: { default: () => ({
|
|
34
|
+
status: "success",
|
|
35
|
+
documents: []
|
|
36
|
+
}) }
|
|
31
37
|
},
|
|
32
38
|
setup(__props, { expose: __expose }) {
|
|
33
39
|
__expose({ openCreateWorkspace: () => createWorkspaceModalState.show() });
|
|
@@ -114,54 +120,51 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
|
|
|
114
120
|
createElementVNode("div", { innerHTML: unref(app).theme.themeStyleTag.value }, null, 8, _hoisted_1),
|
|
115
121
|
createVNode(unref(ScalarToasts)),
|
|
116
122
|
unref(app).store.value !== null && unref(app).workspace.activeWorkspace.value !== null && !unref(app).loading.value ? (openBlock(), createElementBlock("main", _hoisted_2, [
|
|
117
|
-
createElementVNode("div",
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
"
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
"
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
"eventBus",
|
|
160
|
-
"tabs"
|
|
161
|
-
])) : createCommentVNode("", true), createElementVNode("div", _hoisted_5, [createVNode(unref(RouterView), normalizeProps(guardReactiveProps(routerViewProps.value)), null, 16)])])])], 2),
|
|
123
|
+
createElementVNode("div", _hoisted_3, [
|
|
124
|
+
createVNode(unref(SidebarToggle_default), {
|
|
125
|
+
modelValue: unref(app).sidebar.isOpen.value,
|
|
126
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(app).sidebar.isOpen.value = $event),
|
|
127
|
+
class: normalizeClass(["absolute z-60 md:hidden", __props.layout === "desktop" ? "top-14 left-4" : "top-4 left-4"])
|
|
128
|
+
}, null, 8, ["modelValue", "class"]),
|
|
129
|
+
createVNode(AppHeader_default, { "onNavigate:to:settings": _cache[3] || (_cache[3] = ($event) => unref(app).eventBus.emit("ui:navigate", {
|
|
130
|
+
page: "workspace",
|
|
131
|
+
path: "settings"
|
|
132
|
+
})) }, {
|
|
133
|
+
menuItems: withCtx(() => [renderSlot(_ctx.$slots, "header-menu-items", {}, () => [createVNode(unref(ScalarMenuWorkspacePicker), {
|
|
134
|
+
modelValue: unref(app).workspace.activeWorkspace.value?.id,
|
|
135
|
+
workspaceOptions: unref(app).workspace.workspaceGroups.value,
|
|
136
|
+
onCreateWorkspace: _cache[1] || (_cache[1] = ($event) => unref(createWorkspaceModalState).show()),
|
|
137
|
+
"onUpdate:modelValue": _cache[2] || (_cache[2] = (value) => setActiveWorkspace(value))
|
|
138
|
+
}, null, 8, ["modelValue", "workspaceOptions"])])]),
|
|
139
|
+
end: withCtx(() => [renderSlot(_ctx.$slots, "header-end")]),
|
|
140
|
+
_: 3
|
|
141
|
+
}),
|
|
142
|
+
createElementVNode("div", _hoisted_4, [createVNode(AppSidebar_default, {
|
|
143
|
+
app: unref(app),
|
|
144
|
+
fetchRegistryDocument: __props.fetchRegistryDocument,
|
|
145
|
+
registryDocuments: __props.registryDocuments,
|
|
146
|
+
sidebarWidth: unref(app).sidebar.width.value,
|
|
147
|
+
"onUpdate:sidebarWidth": unref(app).sidebar.handleSidebarWidthUpdate
|
|
148
|
+
}, null, 8, [
|
|
149
|
+
"app",
|
|
150
|
+
"fetchRegistryDocument",
|
|
151
|
+
"registryDocuments",
|
|
152
|
+
"sidebarWidth",
|
|
153
|
+
"onUpdate:sidebarWidth"
|
|
154
|
+
]), createElementVNode("div", _hoisted_5, [__props.layout === "desktop" ? (openBlock(), createBlock(DesktopTabs_default, {
|
|
155
|
+
key: 0,
|
|
156
|
+
activeTabIndex: unref(app).tabs.activeTabIndex.value,
|
|
157
|
+
eventBus: unref(app).eventBus,
|
|
158
|
+
tabs: unref(app).tabs.state.value
|
|
159
|
+
}, null, 8, [
|
|
160
|
+
"activeTabIndex",
|
|
161
|
+
"eventBus",
|
|
162
|
+
"tabs"
|
|
163
|
+
])) : createCommentVNode("", true), createElementVNode("div", _hoisted_6, [createVNode(unref(RouterView), normalizeProps(guardReactiveProps(routerViewProps.value)), null, 16)])])])
|
|
164
|
+
]),
|
|
162
165
|
renderSlot(_ctx.$slots, "create-workspace", { state: unref(createWorkspaceModalState) }, () => [createVNode(CreateWorkspaceModal_default, {
|
|
163
166
|
state: unref(createWorkspaceModalState),
|
|
164
|
-
"onCreate:workspace": _cache[
|
|
167
|
+
"onCreate:workspace": _cache[4] || (_cache[4] = (payload) => unref(app).workspace.create(payload))
|
|
165
168
|
}, null, 8, ["state"])]),
|
|
166
169
|
createVNode(TheCommandPalette_default, {
|
|
167
170
|
eventBus: unref(app).eventBus,
|
|
@@ -172,7 +175,7 @@ var App_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComp
|
|
|
172
175
|
"paletteState",
|
|
173
176
|
"workspaceStore"
|
|
174
177
|
])
|
|
175
|
-
])) : (openBlock(), createElementBlock("main",
|
|
178
|
+
])) : (openBlock(), createElementBlock("main", _hoisted_7, [createVNode(SplashScreen_default)]))
|
|
176
179
|
]),
|
|
177
180
|
_: 3
|
|
178
181
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.vue.script.js","names":[],"sources":["../../../../src/v2/features/app/App.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Main entry point for the API client for electron and web.\n *\n * This component handles all events and store business logic for the application.\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarTeleportRoot,\n useModal,\n type ModalState,\n} from '@scalar/components'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport { extensions } from '@scalar/workspace-store/schemas/extensions'\nimport { computed, onBeforeUnmount, toValue, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport { SidebarToggle } from '@/v2/components/sidebar'\nimport CreateWorkspaceModal from '@/v2/features/app/components/CreateWorkspaceModal.vue'\nimport SplashScreen from '@/v2/features/app/components/SplashScreen.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { useDocumentWatcher } from '@/v2/features/app/hooks/use-document-watcher'\nimport type { CommandPaletteState } from '@/v2/features/command-palette/hooks/use-command-palette-state'\nimport TheCommandPalette from '@/v2/features/command-palette/TheCommandPalette.vue'\nimport { useMonacoEditorConfiguration } from '@/v2/features/editor'\nimport { useColorMode } from '@/v2/hooks/use-color-mode'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport { type AppState } from './app-state'\nimport AppSidebar from './components/AppSidebar.vue'\nimport DesktopTabs from './components/DesktopTabs.vue'\n\nconst {\n layout,\n plugins = [],\n getAppState,\n getCommandPaletteState,\n fetchRegistryDocument,\n} = defineProps<{\n layout: Exclude<ClientLayout, 'modal'>\n plugins?: ClientPlugin[]\n getAppState: () => AppState\n getCommandPaletteState: () => CommandPaletteState\n /** Fetches the full document from registry by meta. Passed through to route props for sync. */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n}>()\n\ndefineSlots<{\n /**\n * Slot for customizing the actions section of the sidebar menu.\n * This slot is used to render custom actions or components within the actions section.\n */\n 'sidebar-menu-actions': () => unknown\n /**\n * Slot for customizing the create workspace modal.\n * This slot is used to render custom actions or components within the create workspace modal.\n */\n 'create-workspace'?: (payload: { state: ModalState }) => unknown\n}>()\n\ndefineExpose({\n openCreateWorkspace: () => createWorkspaceModalState.show(),\n})\n\nconst app = getAppState()\nconst paletteState = getCommandPaletteState()\n\n/** Expose workspace store to window for debugging purposes. */\nif (typeof window !== 'undefined') {\n window.dataDumpWorkspace = () => app.store.value\n window.dumpAppState = () => app\n}\n\n/** Call lifecycle hooks on plugins and subscribe to event bus events */\nconst pluginUnsubscribes: (() => void)[] = []\n\nfor (const plugin of plugins) {\n plugin.lifecycle?.onInit?.({ config: { telemetry: app.telemetry.value } })\n\n if (plugin.on) {\n for (const [event, handler] of Object.entries(plugin.on)) {\n pluginUnsubscribes.push(app.eventBus.on(event as any, handler as any))\n }\n }\n}\n\n/** Notify plugins when telemetry config changes */\nwatch(app.telemetry, () => {\n for (const plugin of plugins) {\n plugin.lifecycle?.onConfigChange?.({\n config: { telemetry: app.telemetry.value },\n })\n }\n})\n\nonBeforeUnmount(() => {\n for (const unsub of pluginUnsubscribes) {\n unsub()\n }\n for (const plugin of plugins) {\n plugin.lifecycle?.onDestroy?.()\n }\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(app.eventBus, layout)\n\nconst DEFAULT_DOCUMENT_WATCH_TIMEOUT = 5000\n\n/** Watch the active document for changes and rebase it with its remote source */\nuseDocumentWatcher({\n documentName: () =>\n app.store.value?.workspace[extensions.workspace.activeDocument],\n store: app.store,\n initialTimeout: DEFAULT_DOCUMENT_WATCH_TIMEOUT,\n})\n\n/** Color mode */\nuseColorMode({ workspaceStore: app.store })\n\nconst currentTheme = computed(() => app.theme.styles.value.themeStyles)\nconst isDarkMode = computed(() => app.isDarkMode.value)\n\n/** Setup monaco editor configuration */\nuseMonacoEditorConfiguration({\n theme: currentTheme,\n darkMode: isDarkMode,\n})\n\nconst navigateToWorkspaceOverview = (namespace?: string, slug?: string) => {\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'environment',\n namespace,\n workspaceSlug: slug,\n })\n}\n\n/** Sets the active workspace by ID: finds the workspace in the list and updates app state & navigation. */\nconst setActiveWorkspace = (id?: string) => {\n if (!id) {\n return\n }\n const workspace = app.workspace.workspaceList.value?.find(\n (workspace) => workspace.id === id,\n )\n if (!workspace) {\n return\n }\n\n navigateToWorkspaceOverview(workspace.namespace, workspace.slug)\n}\n\nconst createWorkspaceModalState = useModal()\n\n/** Props to pass to the RouterView component. */\nconst routerViewProps = computed<RouteProps>(() => {\n return {\n documentSlug: app.activeEntities.documentSlug.value ?? '',\n document: app.store.value?.workspace.activeDocument ?? null,\n environment: app.environment.value,\n eventBus: app.eventBus,\n exampleName: app.activeEntities.exampleName.value,\n fetchRegistryDocument,\n layout,\n method: app.activeEntities.method.value,\n path: app.activeEntities.path.value,\n workspaceStore: app.store.value!,\n activeWorkspace: app.workspace.activeWorkspace.value!,\n plugins,\n isDarkMode: app.isDarkMode.value,\n currentTheme: app.theme.styles.value.themeStyles,\n customThemes: toValue(app.theme.customThemes),\n telemetry: app.telemetry.value,\n onUpdateTelemetry: (value: boolean) => {\n app.telemetry.value = value\n },\n options: app.options,\n }\n})\n</script>\n\n<template>\n <ScalarTeleportRoot>\n <!-- Theme style tag -->\n <div v-html=\"app.theme.themeStyleTag.value\" />\n\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- Main content -->\n <main\n v-if=\"\n app.store.value !== null &&\n app.workspace.activeWorkspace.value !== null &&\n !app.loading.value\n \">\n <div\n class=\"relative flex w-dvw flex-col\"\n :class=\"layout === 'web' ? 'min-h-0' : 'h-dvh'\">\n <SidebarToggle\n v-model=\"app.sidebar.isOpen.value\"\n class=\"absolute z-60 md:hidden\"\n :class=\"layout === 'desktop' ? 'top-14 left-4' : 'top-4 left-4'\" />\n <div class=\"flex min-h-0 flex-1 flex-row\">\n <!-- App sidebar -->\n <AppSidebar\n v-model:isSidebarOpen=\"app.sidebar.isOpen.value\"\n :activeWorkspace=\"app.workspace.activeWorkspace.value\"\n :eventBus=\"app.eventBus\"\n :isWorkspaceOpen=\"app.workspace.isOpen.value\"\n :layout\n :sidebarState=\"app.sidebar.state\"\n :sidebarWidth=\"app.sidebar.width.value\"\n :store=\"app.store.value!\"\n :workspaces=\"app.workspace.workspaceGroups.value\"\n @click:workspace=\"navigateToWorkspaceOverview\"\n @create:workspace=\"createWorkspaceModalState.show()\"\n @select:workspace=\"setActiveWorkspace\"\n @selectItem=\"app.sidebar.handleSelectItem\"\n @update:sidebarWidth=\"app.sidebar.handleSidebarWidthUpdate\">\n <template #sidebarMenuActions>\n <slot name=\"sidebar-menu-actions\" />\n </template>\n </AppSidebar>\n\n <div class=\"flex min-h-0 flex-1 flex-col\">\n <!-- App Tabs -->\n <DesktopTabs\n v-if=\"layout === 'desktop'\"\n :activeTabIndex=\"app.tabs.activeTabIndex.value\"\n :eventBus=\"app.eventBus\"\n :tabs=\"app.tabs.state.value\" />\n\n <!-- Router view min-h-0 is required for scrolling, do not remove it -->\n <div class=\"bg-b-1 relative min-h-0 flex-1\">\n <RouterView v-bind=\"routerViewProps\" />\n </div>\n </div>\n </div>\n </div>\n\n <slot\n name=\"create-workspace\"\n :state=\"createWorkspaceModalState\">\n <!-- Create workspace modal -->\n <CreateWorkspaceModal\n :state=\"createWorkspaceModalState\"\n @create:workspace=\"(payload) => app.workspace.create(payload)\" />\n </slot>\n\n <!-- Popup command palette to add resources from anywhere -->\n <TheCommandPalette\n :eventBus=\"app.eventBus\"\n :paletteState=\"paletteState\"\n :workspaceStore=\"app.store.value!\" />\n </main>\n <!-- Splash screen -->\n <main v-else>\n <SplashScreen />\n </main>\n </ScalarTeleportRoot>\n</template>\n\n<style>\n#scalar-client {\n position: relative;\n background-color: var(--scalar-background-2);\n}\n.dark-mode #scalar-client {\n background-color: color-mix(in srgb, var(--scalar-background-1) 65%, black);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkEA,WAAa,EACX,2BAA2B,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,YAEmE,8BAAA;OADhE,OAAO,MAAA,0BAAyB;OAChC,sBAAgB,OAAA,OAAA,OAAA,MAAG,YAAY,MAAA,IAAG,CAAC,UAAU,OAAO,QAAO;;MAIhE,YAGuC,2BAAA;OAFpC,UAAU,MAAA,IAAG,CAAC;OACd,cAAc,MAAA,aAAY;OAC1B,gBAAgB,MAAA,IAAG,CAAC,MAAM;;;;;;yBAG/B,mBAEO,QAAA,YAAA,CADL,YAAgB,qBAAA,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"App.vue.script.js","names":[],"sources":["../../../../src/v2/features/app/App.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Main entry point for the API client for electron and web.\n *\n * This component handles all events and store business logic for the application.\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarMenuWorkspacePicker,\n ScalarTeleportRoot,\n useModal,\n type ModalState,\n} from '@scalar/components'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport { extensions } from '@scalar/workspace-store/schemas/extensions'\nimport { computed, onBeforeUnmount, toValue, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport { SidebarToggle } from '@/v2/components/sidebar'\nimport AppHeader from '@/v2/features/app/components/AppHeader.vue'\nimport AppSidebar from '@/v2/features/app/components/AppSidebar.vue'\nimport CreateWorkspaceModal from '@/v2/features/app/components/CreateWorkspaceModal.vue'\nimport SplashScreen from '@/v2/features/app/components/SplashScreen.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { useDocumentWatcher } from '@/v2/features/app/hooks/use-document-watcher'\nimport type { RegistryDocumentsState } from '@/v2/features/app/hooks/use-sidebar-documents'\nimport type { CommandPaletteState } from '@/v2/features/command-palette/hooks/use-command-palette-state'\nimport TheCommandPalette from '@/v2/features/command-palette/TheCommandPalette.vue'\nimport { useMonacoEditorConfiguration } from '@/v2/features/editor'\nimport { useColorMode } from '@/v2/hooks/use-color-mode'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport { type AppState } from './app-state'\nimport DesktopTabs from './components/DesktopTabs.vue'\n\nconst {\n layout,\n plugins = [],\n getAppState,\n getCommandPaletteState,\n fetchRegistryDocument,\n registryDocuments = { status: 'success', documents: [] },\n} = defineProps<{\n layout: Exclude<ClientLayout, 'modal'>\n plugins?: ClientPlugin[]\n getAppState: () => AppState\n getCommandPaletteState: () => CommandPaletteState\n /** Fetches the full document from registry by meta. Passed through to route props for sync. */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /**\n * The list of all available registry documents, with a loading status so the\n * sidebar can render skeleton placeholders until the real list is ready.\n */\n registryDocuments?: RegistryDocumentsState\n}>()\n\ndefineSlots<{\n /**\n * Slot for customizing the create workspace modal.\n * This slot is used to render custom actions or components within the create workspace modal.\n */\n 'create-workspace'?: (payload: { state: ModalState }) => unknown\n /**\n * Slot for customizing the menu items section of the app header.\n * Defaults to a workspace picker bound to the current app state. Overriding this slot\n * replaces the default picker entirely, so the consumer is responsible for rendering\n * any workspace switcher (or other menu content) they need.\n */\n 'header-menu-items'?: () => unknown\n /**\n * Slot for customizing the end section of the app header.\n * Typically used for user menus, action buttons, or other trailing controls.\n */\n 'header-end'?: () => unknown\n}>()\n\ndefineExpose({\n openCreateWorkspace: () => createWorkspaceModalState.show(),\n})\n\nconst app = getAppState()\nconst paletteState = getCommandPaletteState()\n\n/** Expose workspace store to window for debugging purposes. */\nif (typeof window !== 'undefined') {\n window.dataDumpWorkspace = () => app.store.value\n window.dumpAppState = () => app\n}\n\n/** Call lifecycle hooks on plugins and subscribe to event bus events */\nconst pluginUnsubscribes: (() => void)[] = []\n\nfor (const plugin of plugins) {\n plugin.lifecycle?.onInit?.({ config: { telemetry: app.telemetry.value } })\n\n if (plugin.on) {\n for (const [event, handler] of Object.entries(plugin.on)) {\n pluginUnsubscribes.push(app.eventBus.on(event as any, handler as any))\n }\n }\n}\n\n/** Notify plugins when telemetry config changes */\nwatch(app.telemetry, () => {\n for (const plugin of plugins) {\n plugin.lifecycle?.onConfigChange?.({\n config: { telemetry: app.telemetry.value },\n })\n }\n})\n\nonBeforeUnmount(() => {\n for (const unsub of pluginUnsubscribes) {\n unsub()\n }\n for (const plugin of plugins) {\n plugin.lifecycle?.onDestroy?.()\n }\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(app.eventBus, layout)\n\nconst DEFAULT_DOCUMENT_WATCH_TIMEOUT = 5000\n\n/** Watch the active document for changes and rebase it with its remote source */\nuseDocumentWatcher({\n documentName: () =>\n app.store.value?.workspace[extensions.workspace.activeDocument],\n store: app.store,\n initialTimeout: DEFAULT_DOCUMENT_WATCH_TIMEOUT,\n})\n\n/** Color mode */\nuseColorMode({ workspaceStore: app.store })\n\nconst currentTheme = computed(() => app.theme.styles.value.themeStyles)\nconst isDarkMode = computed(() => app.isDarkMode.value)\n\n/** Setup monaco editor configuration */\nuseMonacoEditorConfiguration({\n theme: currentTheme,\n darkMode: isDarkMode,\n})\n\nconst navigateToWorkspaceOverview = (namespace?: string, slug?: string) => {\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'environment',\n namespace,\n workspaceSlug: slug,\n })\n}\n\n/** Sets the active workspace by ID: finds the workspace in the list and updates app state & navigation. */\nconst setActiveWorkspace = (id?: string) => {\n if (!id) {\n return\n }\n const workspace = app.workspace.workspaceList.value?.find(\n (workspace) => workspace.id === id,\n )\n if (!workspace) {\n return\n }\n\n navigateToWorkspaceOverview(workspace.namespace, workspace.slug)\n}\n\nconst createWorkspaceModalState = useModal()\n\n/** Props to pass to the RouterView component. */\nconst routerViewProps = computed<RouteProps>(() => {\n return {\n documentSlug: app.activeEntities.documentSlug.value ?? '',\n document: app.store.value?.workspace.activeDocument ?? null,\n environment: app.environment.value,\n eventBus: app.eventBus,\n exampleName: app.activeEntities.exampleName.value,\n fetchRegistryDocument,\n layout,\n method: app.activeEntities.method.value,\n path: app.activeEntities.path.value,\n workspaceStore: app.store.value!,\n activeWorkspace: app.workspace.activeWorkspace.value!,\n plugins,\n isDarkMode: app.isDarkMode.value,\n currentTheme: app.theme.styles.value.themeStyles,\n customThemes: toValue(app.theme.customThemes),\n telemetry: app.telemetry.value,\n onUpdateTelemetry: (value: boolean) => {\n app.telemetry.value = value\n },\n options: app.options,\n }\n})\n</script>\n\n<template>\n <ScalarTeleportRoot>\n <!-- Theme style tag -->\n <div v-html=\"app.theme.themeStyleTag.value\" />\n\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- Main content -->\n <main\n v-if=\"\n app.store.value !== null &&\n app.workspace.activeWorkspace.value !== null &&\n !app.loading.value\n \">\n <div class=\"relative flex h-dvh w-dvw flex-col\">\n <SidebarToggle\n v-model=\"app.sidebar.isOpen.value\"\n class=\"absolute z-60 md:hidden\"\n :class=\"layout === 'desktop' ? 'top-14 left-4' : 'top-4 left-4'\" />\n <AppHeader\n @navigate:to:settings=\"\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'settings',\n })\n \">\n <template #menuItems>\n <slot name=\"header-menu-items\">\n <ScalarMenuWorkspacePicker\n :modelValue=\"app.workspace.activeWorkspace.value?.id\"\n :workspaceOptions=\"app.workspace.workspaceGroups.value\"\n @createWorkspace=\"createWorkspaceModalState.show()\"\n @update:modelValue=\"(value) => setActiveWorkspace(value)\" />\n </slot>\n </template>\n <template #end>\n <slot name=\"header-end\" />\n </template>\n </AppHeader>\n <div class=\"flex min-h-0 flex-1 flex-row\">\n <!-- App sidebar -->\n <AppSidebar\n :app=\"app\"\n :fetchRegistryDocument=\"fetchRegistryDocument\"\n :registryDocuments=\"registryDocuments\"\n :sidebarWidth=\"app.sidebar.width.value\"\n @update:sidebarWidth=\"app.sidebar.handleSidebarWidthUpdate\" />\n\n <div class=\"flex min-h-0 flex-1 flex-col\">\n <!-- App Tabs -->\n <DesktopTabs\n v-if=\"layout === 'desktop'\"\n :activeTabIndex=\"app.tabs.activeTabIndex.value\"\n :eventBus=\"app.eventBus\"\n :tabs=\"app.tabs.state.value\" />\n\n <!-- Router view min-h-0 is required for scrolling, do not remove it -->\n <div class=\"bg-b-1 relative min-h-0 flex-1\">\n <RouterView v-bind=\"routerViewProps\" />\n </div>\n </div>\n </div>\n </div>\n\n <slot\n name=\"create-workspace\"\n :state=\"createWorkspaceModalState\">\n <!-- Create workspace modal -->\n <CreateWorkspaceModal\n :state=\"createWorkspaceModalState\"\n @create:workspace=\"(payload) => app.workspace.create(payload)\" />\n </slot>\n <!-- Popup command palette to add resources from anywhere -->\n <TheCommandPalette\n :eventBus=\"app.eventBus\"\n :paletteState=\"paletteState\"\n :workspaceStore=\"app.store.value!\" />\n </main>\n <!-- Splash screen -->\n <main v-else>\n <SplashScreen />\n </main>\n </ScalarTeleportRoot>\n</template>\n\n<style>\n#scalar-client {\n position: relative;\n background-color: var(--scalar-background-2);\n}\n.dark-mode #scalar-client {\n background-color: color-mix(in srgb, var(--scalar-background-1) 65%, black);\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkFA,WAAa,EACX,2BAA2B,0BAA0B,MAAM,EAC5D,CAAA;EAED,MAAM,MAAM,QAAA,aAAY;EACxB,MAAM,eAAe,QAAA,wBAAuB;;AAG5C,MAAI,OAAO,WAAW,aAAa;AACjC,UAAO,0BAA0B,IAAI,MAAM;AAC3C,UAAO,qBAAqB;;;EAI9B,MAAM,qBAAqC,EAAC;AAE5C,OAAK,MAAM,UAAU,QAAA,SAAS;AAC5B,UAAO,WAAW,SAAS,EAAE,QAAQ,EAAE,WAAW,IAAI,UAAU,OAAO,EAAE,CAAA;AAEzE,OAAI,OAAO,GACT,MAAK,MAAM,CAAC,OAAO,YAAY,OAAO,QAAQ,OAAO,GAAG,CACtD,oBAAmB,KAAK,IAAI,SAAS,GAAG,OAAc,QAAe,CAAA;;;AAM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AAM,EAAE,MAAM,YAAY,CAAA;AAKvF,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,KAAK,EACL,MAAM,EACN,cAAc,EACd,oBAAoB,EACpB,mBAAmB,EACnB,sBAAsB,EACtB,YAAY,EACZ,eAAe,EACf,YAAY,EACZ,eAAe,GAChB,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,KAAK,EAAE,UAAU,CAAC,cAAc,GAAG,IAAI,CAAC,CAAA;IACxC,MAAM,EAAE,MAAM,CAAA;IACd,cAAc,EAAE,CAAC,YAAY,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAC/C,oBAAoB,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IACzC,mBAAmB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACzC,sBAAsB,EAAE,CAAC,CAAC,EAAE,oBAAoB,GAAG;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAA;IACrF,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACxC,eAAe,EAAE,MAAM,IAAI,CAAA;IAC3B,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB,eAAe,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;CACjD,QAqXA"}
|
|
@@ -196,6 +196,10 @@ function initializeAppEventHandlers({ eventBus, store, router, rebuildSidebar, n
|
|
|
196
196
|
workspaceSlug: payload.workspaceSlug,
|
|
197
197
|
namespace: payload.namespace
|
|
198
198
|
};
|
|
199
|
+
if (payload.path === "get-started") return execCallback(await fn({
|
|
200
|
+
name: "workspace.get-started",
|
|
201
|
+
params
|
|
202
|
+
}));
|
|
199
203
|
if (payload.path === "environment") return execCallback(await fn({
|
|
200
204
|
name: "workspace.environment",
|
|
201
205
|
params
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-events.js","names":[],"sources":["../../../../src/v2/features/app/app-events.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { OperationExampleMeta, WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { type ShallowRef, computed } from 'vue'\nimport { type NavigationFailure, NavigationFailureType, type Router } from 'vue-router'\n\nimport type { ScalarClientAppRouteParams } from '@/v2/features/app/helpers/routes'\nimport { initializeWorkspaceEventHandlers } from '@/v2/workspace-events'\n\nexport function initializeAppEventHandlers({\n eventBus,\n store,\n router,\n rebuildSidebar,\n navigateToCurrentTab,\n onSelectSidebarItem,\n onAfterExampleCreation,\n onCopyTabUrl,\n onToggleSidebar,\n closeSidebar,\n renameWorkspace,\n}: {\n eventBus: WorkspaceEventBus\n store: ShallowRef<WorkspaceStore | null>\n router: Router\n rebuildSidebar: (documentName?: string) => void\n navigateToCurrentTab: () => Promise<void>\n onSelectSidebarItem: (id: string) => void\n onAfterExampleCreation: (o: OperationExampleMeta & { documentName?: string }) => void\n onCopyTabUrl: (tabIndex: number) => void\n onToggleSidebar: () => void\n closeSidebar: () => void\n renameWorkspace: (name: string) => Promise<void>\n}) {\n const currentRoute = computed(() => router.currentRoute?.value)\n\n /**\n * Checks if the current route params match the specified operation meta.\n * Useful for determining if the sidebar or UI needs to be updated after changes to operations/examples.\n *\n * NOTE: It may be beneficial to compare to the active state instead of the router\n */\n const isRouteParamsMatch = ({\n documentName,\n path,\n method,\n exampleName,\n }: {\n documentName: string\n path?: string\n method?: HttpMethod\n exampleName?: string\n }) => {\n if (documentName !== undefined && documentName !== currentRoute.value?.params.documentSlug) {\n return false\n }\n if (path !== undefined && encodeURIComponent(path) !== currentRoute.value?.params.pathEncoded) {\n return false\n }\n if (method !== undefined && method !== currentRoute.value?.params.method) {\n return false\n }\n if (exampleName !== undefined && exampleName !== currentRoute.value?.params.exampleName) {\n return false\n }\n return true\n }\n\n initializeWorkspaceEventHandlers({\n eventBus,\n store,\n hooks: {\n //------------------------------------------------------------------------------------\n // Document Related Hooks\n //------------------------------------------------------------------------------------\n 'document:delete:document': {\n onAfterExecute: async (payload) => {\n // Redirect to the workspace environment page if the document was deleted\n if (currentRoute?.value?.params.documentSlug === payload.name) {\n await router.push({\n name: 'workspace.environment',\n })\n }\n },\n },\n //------------------------------------------------------------------------------------\n // Operation Related Hooks\n //------------------------------------------------------------------------------------\n 'operation:update:pathMethod': {\n onBeforeExecute: (payload) => ({\n ...payload,\n callback: async (status) => {\n // Redirect to the new example if the mutation was successful\n if (status === 'success') {\n // Rebuild the sidebar with the updated order\n rebuildSidebar(store.value?.workspace.activeDocument?.['x-scalar-navigation']?.name)\n\n // Now this redirect works for any example\n await router.replace({\n name: 'example',\n params: {\n method: payload.payload.method,\n pathEncoded: encodeURIComponent(payload.payload.path),\n exampleName: currentRoute.value?.params.exampleName,\n },\n })\n }\n\n payload.callback(status, payload.blurTargetSelector)\n },\n }),\n },\n 'operation:create:operation': {\n onAfterExecute: (payload) => {\n onAfterExampleCreation({\n path: payload.path,\n method: payload.method,\n exampleKey: 'default',\n documentName: payload.documentName,\n })\n },\n },\n 'operation:upsert:parameter': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n 'operation:update:extra-parameters': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n 'operation:reload:history': {\n onAfterExecute: (payload) => onAfterExampleCreation({ ...payload.meta, exampleKey: 'draft' }),\n },\n 'operation:delete:operation': {\n onAfterExecute: async (payload) => {\n rebuildSidebar(payload.documentName)\n const {\n documentName,\n meta: { path, method },\n } = payload\n // Navigate to the document overview page if the operation was deleted\n if (\n isRouteParamsMatch({\n documentName,\n path,\n method,\n })\n ) {\n await router.replace({\n name: 'document.overview',\n params: {\n documentSlug: documentName,\n },\n })\n }\n },\n },\n 'operation:create:draft-example': {\n onAfterExecute: async (payload) => {\n onAfterExampleCreation({ ...payload.meta, exampleKey: payload.exampleName })\n await router.push({\n name: 'example',\n params: {\n documentSlug: payload.documentName,\n pathEncoded: encodeURIComponent(payload.meta.path),\n method: payload.meta.method,\n exampleName: payload.exampleName,\n },\n })\n },\n },\n 'operation:delete:example': {\n onAfterExecute: async (payload) => {\n rebuildSidebar(payload.documentName)\n\n const {\n documentName,\n meta: { path, method, exampleKey },\n } = payload\n // Navigate to the default example if the example was deleted\n if (\n isRouteParamsMatch({\n documentName,\n path,\n method,\n exampleName: exampleKey,\n })\n ) {\n await router.replace({\n name: 'example',\n params: {\n pathEncoded: encodeURIComponent(path),\n method,\n documentSlug: documentName,\n exampleName: 'default',\n },\n })\n }\n },\n },\n 'operation:rename:example': {\n onAfterExecute: async ({ meta, payload, documentName }) => {\n // Refresh sidebar\n onAfterExampleCreation({ ...meta, exampleKey: payload.name, documentName })\n\n // Redirect to the new example if the mutation was successful and we are currently on the example\n if (\n isRouteParamsMatch({ documentName, path: meta.path, method: meta.method, exampleName: meta.exampleKey })\n ) {\n await router.replace({\n name: 'example',\n params: {\n documentSlug: documentName,\n pathEncoded: encodeURIComponent(meta.path),\n method: meta.method,\n exampleName: payload.name,\n },\n })\n }\n },\n },\n //------------------------------------------------------------------------------------\n // Operation Request Body Related Hooks\n //------------------------------------------------------------------------------------\n 'operation:update:requestBody:value': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n 'operation:update:requestBody:formValue': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n //------------------------------------------------------------------------------------\n // Tag Related Event Hooks\n //------------------------------------------------------------------------------------\n 'tag:create:tag': {\n onAfterExecute: (payload) => rebuildSidebar(payload.documentName),\n },\n 'tag:edit:tag': {\n onAfterExecute: async (payload) => {\n rebuildSidebar(payload.documentName)\n\n /**\n * If the currently viewed operation is a child of the renamed tag, redirect to\n * the same route so the sidebar and breadcrumbs reflect the new tag name\n */\n const isNestedUnderTag = payload.tag.children?.some(\n (child) =>\n child.type === 'operation' &&\n isRouteParamsMatch({\n documentName: payload.documentName,\n path: child.path,\n method: child.method,\n }),\n )\n\n if (isNestedUnderTag) {\n await router.replace({ ...currentRoute.value })\n }\n },\n },\n 'tag:delete:tag': {\n onAfterExecute: (payload) => rebuildSidebar(payload.documentName),\n },\n //------------------------------------------------------------------------------------\n // Tabs Related Event Hooks\n //------------------------------------------------------------------------------------\n 'tabs:add:tab': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:close:tab': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:focus:tab': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:focus:tab-last': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:navigate:previous': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:navigate:next': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:update:tabs': {\n onAfterExecute: navigateToCurrentTab,\n },\n },\n })\n\n // Worksapce rename event handler\n eventBus.on('workspace:update:name', (payload) => renameWorkspace(payload))\n\n //------------------------------------------------------------------------------------\n // Navigation Event Handlers\n //------------------------------------------------------------------------------------\n eventBus.on('scroll-to:nav-item', ({ id }) => onSelectSidebarItem(id))\n\n //------------------------------------------------------------------------------------\n // UI Related Event Handlers\n //------------------------------------------------------------------------------------\n // Note: Command palette handler is colocated with the command palette component\n\n eventBus.on('ui:toggle:sidebar', onToggleSidebar)\n\n /**\n * Bind the inernal navigation to a public api\n */\n eventBus.on('ui:navigate', async (payload) => {\n const { replace = false } = payload\n const fn = replace ? router.replace : router.push\n\n const execCallback = (result: NavigationFailure | void | undefined) => {\n if (!result) {\n // Close the sidebar if it is open\n closeSidebar()\n return payload.callback?.('success')\n }\n\n const navigationFailure: 16 = NavigationFailureType.duplicated\n\n if (result.type !== navigationFailure) {\n return payload.callback?.('error')\n }\n\n return payload.callback?.('success')\n }\n\n type ValidParams = Partial<Record<ScalarClientAppRouteParams, string>>\n\n if (payload.page === 'document') {\n const params = {\n documentSlug: payload.documentSlug,\n workspaceSlug: payload.workspaceSlug,\n namespace: payload.namespace,\n } satisfies ValidParams\n\n if (payload.path === 'overview') {\n return execCallback(await fn({ name: 'document.overview', params }))\n }\n if (payload.path === 'servers') {\n return execCallback(await fn({ name: 'document.servers', params }))\n }\n if (payload.path === 'environment') {\n return execCallback(await fn({ name: 'document.environment', params }))\n }\n if (payload.path === 'authentication') {\n return execCallback(await fn({ name: 'document.authentication', params }))\n }\n if (payload.path === 'cookies') {\n return execCallback(await fn({ name: 'document.cookies', params }))\n }\n if (payload.path === 'settings') {\n return execCallback(await fn({ name: 'document.settings', params }))\n }\n }\n\n if (payload.page === 'workspace') {\n const params = { workspaceSlug: payload.workspaceSlug, namespace: payload.namespace } satisfies ValidParams\n if (payload.path === 'environment') {\n return execCallback(await fn({ name: 'workspace.environment', params }))\n }\n if (payload.path === 'cookies') {\n return execCallback(await fn({ name: 'workspace.cookies', params }))\n }\n if (payload.path === 'settings') {\n return execCallback(await fn({ name: 'workspace.settings', params }))\n }\n }\n\n if (payload.page === 'example') {\n const params = {\n namespace: payload.namespace,\n workspaceSlug: payload.workspaceSlug,\n documentSlug: payload.documentSlug,\n pathEncoded: encodeURIComponent(payload.path),\n method: payload.method,\n exampleName: payload.exampleName,\n } satisfies ValidParams\n return execCallback(await fn({ name: 'example', params }))\n }\n\n if (payload.page === 'operation') {\n const params = {\n namespace: payload.namespace,\n workspaceSlug: payload.workspaceSlug,\n documentSlug: payload.documentSlug,\n pathEncoded: encodeURIComponent(payload.operationPath),\n method: payload.method,\n } satisfies ValidParams\n if (payload.path === 'overview') {\n return execCallback(await fn({ name: 'operation.overview', params }))\n }\n if (payload.path === 'servers') {\n return execCallback(await fn({ name: 'operation.servers', params }))\n }\n if (payload.path === 'authentication') {\n return execCallback(await fn({ name: 'operation.authentication', params }))\n }\n }\n })\n\n //------------------------------------------------------------------------------------\n // Tabs Related Event Handlers\n //------------------------------------------------------------------------------------\n eventBus.on('tabs:copy:url', (payload) => onCopyTabUrl(payload.index))\n}\n"],"mappings":";;;;AASA,SAAgB,2BAA2B,EACzC,U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AO,aAAa,MAAM,GAAG;GAAE,MAAM;GAAW,QARjC;IACb,WAAW,QAAQ;IACnB,eAAe,QAAQ;IACvB,cAAc,QAAQ;IACtB,aAAa,mBAAmB,QAAQ,KAAK;IAC7C,QAAQ,QAAQ;IAChB,aAAa,QAAQ;IACtB;GACuD,CAAC,CAAC;AAG5D,MAAI,QAAQ,SAAS,aAAa;GAChC,MAAM,SAAS;IACb,WAAW,QAAQ;IACnB,eAAe,QAAQ;IACvB,cAAc,QAAQ;IACtB,aAAa,mBAAmB,QAAQ,cAAc;IACtD,QAAQ,QAAQ;IACjB;AACD,OAAI,QAAQ,SAAS,WACnB,QAAO,aAAa,MAAM,GAAG;IAAE,MAAM;IAAsB;IAAQ,CAAC,CAAC;AAEvE,OAAI,QAAQ,SAAS,UACnB,QAAO,aAAa,MAAM,GAAG;IAAE,MAAM;IAAqB;IAAQ,CAAC,CAAC;AAEtE,OAAI,QAAQ,SAAS,iBACnB,QAAO,aAAa,MAAM,GAAG;IAAE,MAAM;IAA4B;IAAQ,CAAC,CAAC;;GAG/E;AAKF,UAAS,GAAG,kBAAkB,YAAY,aAAa,QAAQ,MAAM,CAAC"}
|
|
1
|
+
{"version":3,"file":"app-events.js","names":[],"sources":["../../../../src/v2/features/app/app-events.ts"],"sourcesContent":["import type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { OperationExampleMeta, WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport { type ShallowRef, computed } from 'vue'\nimport { type NavigationFailure, NavigationFailureType, type Router } from 'vue-router'\n\nimport type { ScalarClientAppRouteParams } from '@/v2/features/app/helpers/routes'\nimport { initializeWorkspaceEventHandlers } from '@/v2/workspace-events'\n\nexport function initializeAppEventHandlers({\n eventBus,\n store,\n router,\n rebuildSidebar,\n navigateToCurrentTab,\n onSelectSidebarItem,\n onAfterExampleCreation,\n onCopyTabUrl,\n onToggleSidebar,\n closeSidebar,\n renameWorkspace,\n}: {\n eventBus: WorkspaceEventBus\n store: ShallowRef<WorkspaceStore | null>\n router: Router\n rebuildSidebar: (documentName?: string) => void\n navigateToCurrentTab: () => Promise<void>\n onSelectSidebarItem: (id: string) => void\n onAfterExampleCreation: (o: OperationExampleMeta & { documentName?: string }) => void\n onCopyTabUrl: (tabIndex: number) => void\n onToggleSidebar: () => void\n closeSidebar: () => void\n renameWorkspace: (name: string) => Promise<void>\n}) {\n const currentRoute = computed(() => router.currentRoute?.value)\n\n /**\n * Checks if the current route params match the specified operation meta.\n * Useful for determining if the sidebar or UI needs to be updated after changes to operations/examples.\n *\n * NOTE: It may be beneficial to compare to the active state instead of the router\n */\n const isRouteParamsMatch = ({\n documentName,\n path,\n method,\n exampleName,\n }: {\n documentName: string\n path?: string\n method?: HttpMethod\n exampleName?: string\n }) => {\n if (documentName !== undefined && documentName !== currentRoute.value?.params.documentSlug) {\n return false\n }\n if (path !== undefined && encodeURIComponent(path) !== currentRoute.value?.params.pathEncoded) {\n return false\n }\n if (method !== undefined && method !== currentRoute.value?.params.method) {\n return false\n }\n if (exampleName !== undefined && exampleName !== currentRoute.value?.params.exampleName) {\n return false\n }\n return true\n }\n\n initializeWorkspaceEventHandlers({\n eventBus,\n store,\n hooks: {\n //------------------------------------------------------------------------------------\n // Document Related Hooks\n //------------------------------------------------------------------------------------\n 'document:delete:document': {\n onAfterExecute: async (payload) => {\n // Redirect to the workspace environment page if the document was deleted\n if (currentRoute?.value?.params.documentSlug === payload.name) {\n await router.push({\n name: 'workspace.environment',\n })\n }\n },\n },\n //------------------------------------------------------------------------------------\n // Operation Related Hooks\n //------------------------------------------------------------------------------------\n 'operation:update:pathMethod': {\n onBeforeExecute: (payload) => ({\n ...payload,\n callback: async (status) => {\n // Redirect to the new example if the mutation was successful\n if (status === 'success') {\n // Rebuild the sidebar with the updated order\n rebuildSidebar(store.value?.workspace.activeDocument?.['x-scalar-navigation']?.name)\n\n // Now this redirect works for any example\n await router.replace({\n name: 'example',\n params: {\n method: payload.payload.method,\n pathEncoded: encodeURIComponent(payload.payload.path),\n exampleName: currentRoute.value?.params.exampleName,\n },\n })\n }\n\n payload.callback(status, payload.blurTargetSelector)\n },\n }),\n },\n 'operation:create:operation': {\n onAfterExecute: (payload) => {\n onAfterExampleCreation({\n path: payload.path,\n method: payload.method,\n exampleKey: 'default',\n documentName: payload.documentName,\n })\n },\n },\n 'operation:upsert:parameter': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n 'operation:update:extra-parameters': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n 'operation:reload:history': {\n onAfterExecute: (payload) => onAfterExampleCreation({ ...payload.meta, exampleKey: 'draft' }),\n },\n 'operation:delete:operation': {\n onAfterExecute: async (payload) => {\n rebuildSidebar(payload.documentName)\n const {\n documentName,\n meta: { path, method },\n } = payload\n // Navigate to the document overview page if the operation was deleted\n if (\n isRouteParamsMatch({\n documentName,\n path,\n method,\n })\n ) {\n await router.replace({\n name: 'document.overview',\n params: {\n documentSlug: documentName,\n },\n })\n }\n },\n },\n 'operation:create:draft-example': {\n onAfterExecute: async (payload) => {\n onAfterExampleCreation({ ...payload.meta, exampleKey: payload.exampleName })\n await router.push({\n name: 'example',\n params: {\n documentSlug: payload.documentName,\n pathEncoded: encodeURIComponent(payload.meta.path),\n method: payload.meta.method,\n exampleName: payload.exampleName,\n },\n })\n },\n },\n 'operation:delete:example': {\n onAfterExecute: async (payload) => {\n rebuildSidebar(payload.documentName)\n\n const {\n documentName,\n meta: { path, method, exampleKey },\n } = payload\n // Navigate to the default example if the example was deleted\n if (\n isRouteParamsMatch({\n documentName,\n path,\n method,\n exampleName: exampleKey,\n })\n ) {\n await router.replace({\n name: 'example',\n params: {\n pathEncoded: encodeURIComponent(path),\n method,\n documentSlug: documentName,\n exampleName: 'default',\n },\n })\n }\n },\n },\n 'operation:rename:example': {\n onAfterExecute: async ({ meta, payload, documentName }) => {\n // Refresh sidebar\n onAfterExampleCreation({ ...meta, exampleKey: payload.name, documentName })\n\n // Redirect to the new example if the mutation was successful and we are currently on the example\n if (\n isRouteParamsMatch({ documentName, path: meta.path, method: meta.method, exampleName: meta.exampleKey })\n ) {\n await router.replace({\n name: 'example',\n params: {\n documentSlug: documentName,\n pathEncoded: encodeURIComponent(meta.path),\n method: meta.method,\n exampleName: payload.name,\n },\n })\n }\n },\n },\n //------------------------------------------------------------------------------------\n // Operation Request Body Related Hooks\n //------------------------------------------------------------------------------------\n 'operation:update:requestBody:value': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n 'operation:update:requestBody:formValue': {\n onAfterExecute: (payload) => onAfterExampleCreation(payload.meta),\n },\n //------------------------------------------------------------------------------------\n // Tag Related Event Hooks\n //------------------------------------------------------------------------------------\n 'tag:create:tag': {\n onAfterExecute: (payload) => rebuildSidebar(payload.documentName),\n },\n 'tag:edit:tag': {\n onAfterExecute: async (payload) => {\n rebuildSidebar(payload.documentName)\n\n /**\n * If the currently viewed operation is a child of the renamed tag, redirect to\n * the same route so the sidebar and breadcrumbs reflect the new tag name\n */\n const isNestedUnderTag = payload.tag.children?.some(\n (child) =>\n child.type === 'operation' &&\n isRouteParamsMatch({\n documentName: payload.documentName,\n path: child.path,\n method: child.method,\n }),\n )\n\n if (isNestedUnderTag) {\n await router.replace({ ...currentRoute.value })\n }\n },\n },\n 'tag:delete:tag': {\n onAfterExecute: (payload) => rebuildSidebar(payload.documentName),\n },\n //------------------------------------------------------------------------------------\n // Tabs Related Event Hooks\n //------------------------------------------------------------------------------------\n 'tabs:add:tab': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:close:tab': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:focus:tab': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:focus:tab-last': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:navigate:previous': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:navigate:next': {\n onAfterExecute: navigateToCurrentTab,\n },\n 'tabs:update:tabs': {\n onAfterExecute: navigateToCurrentTab,\n },\n },\n })\n\n // Worksapce rename event handler\n eventBus.on('workspace:update:name', (payload) => renameWorkspace(payload))\n\n //------------------------------------------------------------------------------------\n // Navigation Event Handlers\n //------------------------------------------------------------------------------------\n eventBus.on('scroll-to:nav-item', ({ id }) => onSelectSidebarItem(id))\n\n //------------------------------------------------------------------------------------\n // UI Related Event Handlers\n //------------------------------------------------------------------------------------\n // Note: Command palette handler is colocated with the command palette component\n\n eventBus.on('ui:toggle:sidebar', onToggleSidebar)\n\n /**\n * Bind the inernal navigation to a public api\n */\n eventBus.on('ui:navigate', async (payload) => {\n const { replace = false } = payload\n const fn = replace ? router.replace : router.push\n\n const execCallback = (result: NavigationFailure | void | undefined) => {\n if (!result) {\n // Close the sidebar if it is open\n closeSidebar()\n return payload.callback?.('success')\n }\n\n const navigationFailure: 16 = NavigationFailureType.duplicated\n\n if (result.type !== navigationFailure) {\n return payload.callback?.('error')\n }\n\n return payload.callback?.('success')\n }\n\n type ValidParams = Partial<Record<ScalarClientAppRouteParams, string>>\n\n if (payload.page === 'document') {\n const params = {\n documentSlug: payload.documentSlug,\n workspaceSlug: payload.workspaceSlug,\n namespace: payload.namespace,\n } satisfies ValidParams\n\n if (payload.path === 'overview') {\n return execCallback(await fn({ name: 'document.overview', params }))\n }\n if (payload.path === 'servers') {\n return execCallback(await fn({ name: 'document.servers', params }))\n }\n if (payload.path === 'environment') {\n return execCallback(await fn({ name: 'document.environment', params }))\n }\n if (payload.path === 'authentication') {\n return execCallback(await fn({ name: 'document.authentication', params }))\n }\n if (payload.path === 'cookies') {\n return execCallback(await fn({ name: 'document.cookies', params }))\n }\n if (payload.path === 'settings') {\n return execCallback(await fn({ name: 'document.settings', params }))\n }\n }\n\n if (payload.page === 'workspace') {\n const params = { workspaceSlug: payload.workspaceSlug, namespace: payload.namespace } satisfies ValidParams\n if (payload.path === 'get-started') {\n return execCallback(await fn({ name: 'workspace.get-started', params }))\n }\n if (payload.path === 'environment') {\n return execCallback(await fn({ name: 'workspace.environment', params }))\n }\n if (payload.path === 'cookies') {\n return execCallback(await fn({ name: 'workspace.cookies', params }))\n }\n if (payload.path === 'settings') {\n return execCallback(await fn({ name: 'workspace.settings', params }))\n }\n }\n\n if (payload.page === 'example') {\n const params = {\n namespace: payload.namespace,\n workspaceSlug: payload.workspaceSlug,\n documentSlug: payload.documentSlug,\n pathEncoded: encodeURIComponent(payload.path),\n method: payload.method,\n exampleName: payload.exampleName,\n } satisfies ValidParams\n return execCallback(await fn({ name: 'example', params }))\n }\n\n if (payload.page === 'operation') {\n const params = {\n namespace: payload.namespace,\n workspaceSlug: payload.workspaceSlug,\n documentSlug: payload.documentSlug,\n pathEncoded: encodeURIComponent(payload.operationPath),\n method: payload.method,\n } satisfies ValidParams\n if (payload.path === 'overview') {\n return execCallback(await fn({ name: 'operation.overview', params }))\n }\n if (payload.path === 'servers') {\n return execCallback(await fn({ name: 'operation.servers', params }))\n }\n if (payload.path === 'authentication') {\n return execCallback(await fn({ name: 'operation.authentication', params }))\n }\n }\n })\n\n //------------------------------------------------------------------------------------\n // Tabs Related Event Handlers\n //------------------------------------------------------------------------------------\n eventBus.on('tabs:copy:url', (payload) => onCopyTabUrl(payload.index))\n}\n"],"mappings":";;;;AASA,SAAgB,2BAA2B,EACzC,UACA,OACA,QACA,gBACA,sBACA,qBACA,wBACA,cACA,iBACA,cACA,mBAaC;CACD,MAAM,eAAe,eAAe,OAAO,cAAc,MAAM;;;;;;;CAQ/D,MAAM,sBAAsB,EAC1B,cACA,MACA,QACA,kBAMI;AACJ,MAAI,iBAAiB,KAAA,KAAa,iBAAiB,aAAa,OAAO,OAAO,aAC5E,QAAO;AAET,MAAI,SAAS,KAAA,KAAa,mBAAmB,KAAK,KAAK,aAAa,OAAO,OAAO,YAChF,QAAO;AAET,MAAI,WAAW,KAAA,KAAa,WAAW,aAAa,OAAO,OAAO,OAChE,QAAO;AAET,MAAI,gBAAgB,KAAA,KAAa,gBAAgB,aA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AmB,QAAQ,cAAc;IACtD,QAAQ,QAAQ;IACjB;AACD,OAAI,QAAQ,SAAS,WACnB,QAAO,aAAa,MAAM,GAAG;IAAE,MAAM;IAAsB;IAAQ,CAAC,CAAC;AAEvE,OAAI,QAAQ,SAAS,UACnB,QAAO,aAAa,MAAM,GAAG;IAAE,MAAM;IAAqB;IAAQ,CAAC,CAAC;AAEtE,OAAI,QAAQ,SAAS,iBACnB,QAAO,aAAa,MAAM,GAAG;IAAE,MAAM;IAA4B;IAAQ,CAAC,CAAC;;GAG/E;AAKF,UAAS,GAAG,kBAAkB,YAAY,aAAa,QAAQ,MAAM,CAAC"}
|
|
@@ -85,6 +85,12 @@ export type AppState = {
|
|
|
85
85
|
navigateToWorkspace: (namespace?: string, slug?: string) => Promise<void>;
|
|
86
86
|
/** Whether the workspace page is open */
|
|
87
87
|
isOpen: ComputedRef<boolean>;
|
|
88
|
+
/**
|
|
89
|
+
* Whether the currently active workspace is a team workspace (i.e. has a
|
|
90
|
+
* `teamUid` other than `'local'`). Useful for gating team-only UI such as
|
|
91
|
+
* the registry-backed document list and its loading state.
|
|
92
|
+
*/
|
|
93
|
+
isTeamWorkspace: ComputedRef<boolean>;
|
|
88
94
|
};
|
|
89
95
|
/** The workspace event bus for handling workspace-level events */
|
|
90
96
|
eventBus: WorkspaceEventBus;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"app-state.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/app-state.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAG7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAE7D,OAAO,EAAE,kBAAkB,EAAwB,MAAM,iBAAiB,CAAA;AAC1E,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAA;A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M,CAAA;SAAE,CAAC,CAAA;QAC/D,iFAAiF;QACjF,aAAa,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;QAClC,+BAA+B;QAC/B,YAAY,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAA;KACxC,CAAA;IACD,SAAS,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;CACxB,CAAA;AAaD,eAAO,MAAM,cAAc,GAAU,qFAOlC;IACD,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,CAAC,EAAE,YAAY,CAAA;IACzB,YAAY,CAAC,EAAE,gBAAgB,CAAC,KAAK,EAAE,CAAC,CAAA;IACxC,iBAAiB,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC5C,gBAAgB,CAAC,EAAE,OAAO,CAAA;IAC1B,kCAAkC;IAClC,OAAO,CAAC,EAAE,mBAAmB,CAAA;CAC9B,KAAG,OAAO,CAAC,QAAQ,CAs4BnB,CAAA"}
|
|
@@ -47,6 +47,19 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
|
|
|
47
47
|
const workspaces = ref([]);
|
|
48
48
|
const filteredWorkspaces = computed(() => filterWorkspacesByTeam(workspaces.value, teamUid.value));
|
|
49
49
|
const workspaceGroups = computed(() => groupWorkspacesByTeam(filteredWorkspaces.value, teamUid.value));
|
|
50
|
+
/**
|
|
51
|
+
* `true` when the active workspace is backed by a team (i.e. not the
|
|
52
|
+
* built-in `'local'` team). We look the workspace up in the full
|
|
53
|
+
* `workspaces` list because `activeWorkspace` only stores `{ id, label }`,
|
|
54
|
+
* whereas `WorkspaceOption` carries the `teamUid` we need. Consumers can
|
|
55
|
+
* read this via `app.workspace.isTeamWorkspace` to gate team-only UI.
|
|
56
|
+
*/
|
|
57
|
+
const isTeamWorkspace = computed(() => {
|
|
58
|
+
const id = activeWorkspace.value?.id;
|
|
59
|
+
if (!id) return false;
|
|
60
|
+
const workspace = workspaces.value.find((w) => w.id === id);
|
|
61
|
+
return Boolean(workspace && workspace.teamUid !== "local");
|
|
62
|
+
});
|
|
50
63
|
const store = shallowRef(null);
|
|
51
64
|
const persistedTelemetry = workspaceStorage.getTelemetry();
|
|
52
65
|
const telemetry = ref(persistedTelemetry !== null ? persistedTelemetry : Boolean(telemetryDefault));
|
|
@@ -603,7 +616,8 @@ var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "def
|
|
|
603
616
|
workspaceGroups,
|
|
604
617
|
activeWorkspace,
|
|
605
618
|
navigateToWorkspace,
|
|
606
|
-
isOpen: computed(() => Boolean(workspaceSlug.value && !documentSlug.value))
|
|
619
|
+
isOpen: computed(() => Boolean(workspaceSlug.value && !documentSlug.value)),
|
|
620
|
+
isTeamWorkspace
|
|
607
621
|
},
|
|
608
622
|
eventBus,
|
|
609
623
|
router,
|