@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,323 +1,489 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import rabbit_default from "../../../../assets/rabbit.ascii.virtual.js";
|
|
4
|
-
import rabbitjump_default from "../../../../assets/rabbitjump.ascii.virtual.js";
|
|
1
|
+
import Resize_default from "../../../components/resize/Resize.vue.js";
|
|
2
|
+
import DocumentSearchModal_default from "../../search/components/DocumentSearchModal.vue.js";
|
|
5
3
|
import DeleteSidebarListElement_default from "../../../../components/Sidebar/Actions/DeleteSidebarListElement.vue.js";
|
|
6
|
-
import DownloadAppButton_default from "./DownloadAppButton.vue.js";
|
|
7
4
|
import { createTempOperation } from "../helpers/create-temp-operation.js";
|
|
8
5
|
import SidebarItemMenu_default from "./SidebarItemMenu.vue.js";
|
|
6
|
+
import { loadRegistryDocument } from "../helpers/load-registry-document.js";
|
|
7
|
+
import { useDocumentFilter } from "../hooks/use-document-filter.js";
|
|
8
|
+
import { useSidebarContextMenu } from "../hooks/use-sidebar-context-menu.js";
|
|
9
|
+
import { useSidebarDocuments } from "../hooks/use-sidebar-documents.js";
|
|
9
10
|
import { dragHandleFactory } from "../../../helpers/drag-handle-factory.js";
|
|
10
|
-
import { Fragment,
|
|
11
|
-
import {
|
|
12
|
-
import { ScalarIconDotsThree, ScalarIconGearSix, ScalarIconPlus } from "@scalar/icons";
|
|
11
|
+
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, isRef, mergeModels, normalizeClass, normalizeStyle, onBeforeMount, onBeforeUnmount, openBlock, ref, renderList, renderSlot, toDisplayString, unref, useModel, withCtx, withKeys, withModifiers } from "vue";
|
|
12
|
+
import { ScalarIconButton, ScalarModal, ScalarSidebar, ScalarSidebarButton, ScalarSidebarItem, ScalarSidebarItems, ScalarSidebarNestedItems, ScalarSidebarSearchInput, ScalarSidebarSection, useModal } from "@scalar/components";
|
|
13
|
+
import { ScalarIconCaretLeft, ScalarIconDotsThree, ScalarIconFolderDashed, ScalarIconFunnel, ScalarIconGearSix, ScalarIconMagnifyingGlass, ScalarIconPlus } from "@scalar/icons";
|
|
14
|
+
import { useToasts } from "@scalar/use-toasts";
|
|
15
|
+
import { SidebarItem, filterItems } from "@scalar/sidebar";
|
|
13
16
|
import { getParentEntry } from "@scalar/workspace-store/navigation";
|
|
14
|
-
import { LibraryIcon } from "@scalar/icons/library";
|
|
15
|
-
import { isMacOS } from "@scalar/helpers/general/is-mac-os";
|
|
16
17
|
//#region src/v2/features/app/components/AppSidebar.vue?vue&type=script&setup=true&lang.ts
|
|
17
|
-
var _hoisted_1 = { class: "flex" };
|
|
18
|
-
var _hoisted_2 = {
|
|
19
|
-
var _hoisted_3 = {
|
|
18
|
+
var _hoisted_1 = { class: "flex flex-1" };
|
|
19
|
+
var _hoisted_2 = {
|
|
20
20
|
key: 0,
|
|
21
|
-
class: "
|
|
21
|
+
class: "flex flex-col gap-1.5 p-(--scalar-sidebar-padding)"
|
|
22
22
|
};
|
|
23
|
-
var
|
|
23
|
+
var _hoisted_3 = { class: "flex items-center gap-1" };
|
|
24
|
+
var _hoisted_4 = { class: "custom-scroll flex flex-1 flex-col" };
|
|
25
|
+
var _hoisted_5 = {
|
|
24
26
|
key: 0,
|
|
25
|
-
class: "
|
|
27
|
+
class: "text-c-3 flex flex-1 flex-col items-center justify-center gap-2 p-6 text-center select-none"
|
|
28
|
+
};
|
|
29
|
+
var _hoisted_6 = { class: "flex items-center gap-1" };
|
|
30
|
+
var _hoisted_7 = {
|
|
31
|
+
key: 1,
|
|
32
|
+
class: "text-c-3 px-3 py-1 text-xs"
|
|
26
33
|
};
|
|
27
|
-
var _hoisted_5 = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" };
|
|
28
|
-
var _hoisted_6 = { class: "flex flex-col gap-1.5 p-2" };
|
|
29
|
-
var _hoisted_7 = { class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase" };
|
|
30
34
|
var AppSidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
31
35
|
__name: "AppSidebar",
|
|
32
36
|
props: /* @__PURE__ */ mergeModels({
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
app: {},
|
|
38
|
+
indent: { default: 20 },
|
|
39
|
+
registryDocuments: { default: () => ({
|
|
40
|
+
status: "success",
|
|
41
|
+
documents: []
|
|
42
|
+
}) },
|
|
43
|
+
fetchRegistryDocument: { type: Function }
|
|
40
44
|
}, {
|
|
41
|
-
"isSidebarOpen": {
|
|
42
|
-
type: Boolean,
|
|
43
|
-
required: true
|
|
44
|
-
},
|
|
45
|
-
"isSidebarOpenModifiers": {},
|
|
46
45
|
"sidebarWidth": {
|
|
47
46
|
required: true,
|
|
48
47
|
default: 288
|
|
49
48
|
},
|
|
50
49
|
"sidebarWidthModifiers": {}
|
|
51
50
|
}),
|
|
52
|
-
emits:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
/** Controls the width of the sidebar */
|
|
65
|
-
const sidebarWidth = useModel(__props, "sidebarWidth");
|
|
66
|
-
/** Calculate if we should show the getting started section */
|
|
67
|
-
const showGettingStarted = computed(() => __props.sidebarState.items.value.length <= 1);
|
|
68
|
-
const dragHandlers = computed(() => dragHandleFactory({
|
|
69
|
-
store: __props.store,
|
|
70
|
-
sidebarState: __props.sidebarState
|
|
71
|
-
}));
|
|
72
|
-
const handleDragEnd = (draggingItem, hoveredItem) => {
|
|
73
|
-
return dragHandlers.value.handleDragEnd(draggingItem, hoveredItem);
|
|
74
|
-
};
|
|
75
|
-
const isDroppable = (draggingItem, hoveredItem) => {
|
|
76
|
-
return dragHandlers.value.isDroppable(draggingItem, hoveredItem);
|
|
77
|
-
};
|
|
78
|
-
/** The current target for the dropdown menu */
|
|
79
|
-
const menuTarget = ref(null);
|
|
80
|
-
const deleteModalState = useModal();
|
|
81
|
-
/** Computes the message for the delete modal */
|
|
82
|
-
const deleteMessage = computed(() => {
|
|
83
|
-
const item = menuTarget.value?.item;
|
|
84
|
-
if (item?.type === "document") return "This cannot be undone. You're about to delete the document and all tags and operations inside it.";
|
|
85
|
-
return `Are you sure you want to delete this ${item?.type ?? "item"}? This action cannot be undone.`;
|
|
51
|
+
emits: ["update:sidebarWidth"],
|
|
52
|
+
setup(__props) {
|
|
53
|
+
const { toast } = useToasts();
|
|
54
|
+
/**
|
|
55
|
+
* Whether the caller is still fetching the list of registry documents. We
|
|
56
|
+
* only surface the loading state on team workspaces because local workspaces
|
|
57
|
+
* never consult the registry
|
|
58
|
+
*/
|
|
59
|
+
const isLoadingRegistry = computed(() => __props.registryDocuments.status === "loading" && __props.app.workspace.isTeamWorkspace.value);
|
|
60
|
+
const { rest } = useSidebarDocuments({
|
|
61
|
+
app: __props.app,
|
|
62
|
+
managedDocs: () => __props.registryDocuments.documents ?? []
|
|
86
63
|
});
|
|
87
|
-
/**
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Whether the workspace truly has no documents to show. Distinct from the
|
|
66
|
+
* filter producing no results: we only surface the "No APIs yet" empty state
|
|
67
|
+
* when the workspace is genuinely empty so users see a clear call-to-action
|
|
68
|
+
* instead of a confusing blank space.
|
|
69
|
+
*/
|
|
70
|
+
const isEmpty = computed(() => !isLoadingRegistry.value && rest.value.length === 0);
|
|
71
|
+
/**
|
|
72
|
+
* Fuzzy filter over the top-level documents. Owns its own input visibility,
|
|
73
|
+
* query string and Fuse index. See `use-document-filter.ts` for details.
|
|
74
|
+
*/
|
|
75
|
+
const { isVisible: isFilterVisible, query: filterQuery, filteredItems: filteredRest, toggle: toggleFilter } = useDocumentFilter(rest);
|
|
76
|
+
const sidebarState = __props.app.sidebar.state;
|
|
77
|
+
/** Which registry documents are currently being fetched. */
|
|
78
|
+
const loadingKeys = ref({});
|
|
79
|
+
/**
|
|
80
|
+
* Check if the given {@link SidebarDocumentItem} is the currently active document (from the sidebar state).
|
|
81
|
+
*/
|
|
82
|
+
const isDocActive = (item) => {
|
|
83
|
+
if (!item.navigation) return false;
|
|
84
|
+
return sidebarState.selectedItem.value === item.navigation.id || Boolean(sidebarState.selectedItems.value[item.navigation.id]);
|
|
85
|
+
};
|
|
86
|
+
const handleDocumentClick = async (item) => {
|
|
87
|
+
if (item.navigation) {
|
|
88
|
+
__props.app.sidebar.handleSelectItem(item.navigation.id);
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
if (!item.registry || !__props.app.store.value) {
|
|
92
|
+
console.warn("Document does not have a sidebar navigation, skipping...");
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (!__props.fetchRegistryDocument) {
|
|
96
|
+
console.warn("You need to provide a fetchRegistryDocument function to load registry documents");
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
if (loadingKeys.value[item.key]) return;
|
|
100
|
+
loadingKeys.value[item.key] = true;
|
|
101
|
+
const result = await loadRegistryDocument({
|
|
102
|
+
fetcher: __props.fetchRegistryDocument,
|
|
103
|
+
workspaceStore: __props.app.store.value,
|
|
104
|
+
namespace: item.registry.namespace,
|
|
105
|
+
slug: item.registry.slug
|
|
99
106
|
});
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
method: operation.method,
|
|
105
|
-
path: operation.path
|
|
106
|
-
},
|
|
107
|
-
documentName: document.name
|
|
108
|
-
});
|
|
109
|
-
} else if (item.type === "example") {
|
|
110
|
-
if (!operation) return;
|
|
111
|
-
__props.eventBus.emit("operation:delete:example", {
|
|
112
|
-
meta: {
|
|
113
|
-
method: operation.method,
|
|
114
|
-
path: operation.path,
|
|
115
|
-
exampleKey: item.name
|
|
116
|
-
},
|
|
117
|
-
documentName: document.name
|
|
118
|
-
});
|
|
107
|
+
loadingKeys.value[item.key] = false;
|
|
108
|
+
if (!result.ok) {
|
|
109
|
+
toast(result.error, "error");
|
|
110
|
+
return;
|
|
119
111
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
112
|
+
__props.app.eventBus.emit("ui:navigate", {
|
|
113
|
+
page: "document",
|
|
114
|
+
path: "overview",
|
|
115
|
+
documentSlug: result.documentName
|
|
116
|
+
});
|
|
123
117
|
};
|
|
124
|
-
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
item,
|
|
129
|
-
el: event.currentTarget,
|
|
130
|
-
showMenu: true
|
|
131
|
-
};
|
|
132
|
-
await nextTick();
|
|
133
|
-
const cloned = event instanceof MouseEvent ? new MouseEvent(event.type, event) : new KeyboardEvent(event.type, event);
|
|
134
|
-
menuTarget.value?.el.dispatchEvent(cloned);
|
|
118
|
+
const isSelected = (id) => sidebarState.isSelected(id);
|
|
119
|
+
const isExpanded = (id) => sidebarState.isExpanded(id);
|
|
120
|
+
const handleSelectItem = (id) => {
|
|
121
|
+
__props.app.sidebar.handleSelectItem(id);
|
|
135
122
|
};
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if (menuTarget.value) menuTarget.value.showMenu = false;
|
|
123
|
+
const handleToggleGroup = (id) => {
|
|
124
|
+
sidebarState.setExpanded(id, !sidebarState.isExpanded(id));
|
|
139
125
|
};
|
|
140
126
|
/**
|
|
141
|
-
*
|
|
142
|
-
*
|
|
143
|
-
*
|
|
127
|
+
* Drag-and-drop handlers for sidebar items. The factory reads from the live
|
|
128
|
+
* workspace store and shared sidebar state, so it reflects the latest
|
|
129
|
+
* navigation tree on every drag. Mirrors the behaviour of the old
|
|
130
|
+
* `AppSidebar.vue` (documents, tags, and operations can be reordered, and
|
|
131
|
+
* operations can be moved between tags/documents).
|
|
132
|
+
*/
|
|
133
|
+
const dragHandlers = computed(() => dragHandleFactory({
|
|
134
|
+
store: __props.app.store,
|
|
135
|
+
sidebarState
|
|
136
|
+
}));
|
|
137
|
+
const handleDragEnd = (draggingItem, hoveredItem) => dragHandlers.value.handleDragEnd(draggingItem, hoveredItem);
|
|
138
|
+
const isDroppable = (draggingItem, hoveredItem) => dragHandlers.value.isDroppable(draggingItem, hoveredItem);
|
|
139
|
+
/**
|
|
140
|
+
* Contextual "more" dropdown for tags, operations and examples, together
|
|
141
|
+
* with the shared delete-confirmation modal it triggers.
|
|
142
|
+
*/
|
|
143
|
+
const { menuTarget, deleteModalState, deleteMessage, openMenu, closeMenu, handleDelete } = useSidebarContextMenu({
|
|
144
|
+
eventBus: __props.app.eventBus,
|
|
145
|
+
sidebarState
|
|
146
|
+
});
|
|
147
|
+
/**
|
|
148
|
+
* Create a new operation from an empty folder slot inside a tag or document.
|
|
149
|
+
* If the entry is a tag, the new operation inherits that tag so it stays
|
|
150
|
+
* grouped under the same folder.
|
|
144
151
|
*/
|
|
145
152
|
const handleAddEmptyFolder = (item) => {
|
|
146
|
-
const itemWithParent =
|
|
153
|
+
const itemWithParent = sidebarState.getEntryById(item.id);
|
|
147
154
|
const documentName = getParentEntry("document", itemWithParent)?.name;
|
|
148
155
|
const tagName = getParentEntry("tag", itemWithParent)?.name;
|
|
149
|
-
|
|
156
|
+
const store = __props.app.store.value;
|
|
157
|
+
if (!documentName || !store) {
|
|
150
158
|
console.error("Document name not found");
|
|
151
159
|
return;
|
|
152
160
|
}
|
|
153
161
|
createTempOperation(documentName, {
|
|
154
|
-
existingPaths: new Set(Object.keys(
|
|
155
|
-
eventBus: __props.eventBus,
|
|
162
|
+
existingPaths: new Set(Object.keys(store.workspace.documents[documentName]?.paths ?? {})),
|
|
163
|
+
eventBus: __props.app.eventBus,
|
|
156
164
|
tags: tagName ? [tagName] : void 0
|
|
157
165
|
});
|
|
158
166
|
};
|
|
167
|
+
const handleCreate = () => {
|
|
168
|
+
__props.app.eventBus.emit("ui:open:command-palette", {
|
|
169
|
+
action: "create-openapi-document",
|
|
170
|
+
payload: void 0
|
|
171
|
+
});
|
|
172
|
+
};
|
|
159
173
|
/**
|
|
160
|
-
*
|
|
161
|
-
*
|
|
174
|
+
* Create a new operation inside the given document and immediately navigate to
|
|
175
|
+
* it. Uses `createTempOperation` so the operation gets a unique `/temp…` path,
|
|
176
|
+
* then the sidebar focuses the new example and the address bar is focused so
|
|
177
|
+
* the user can start typing the real path right away.
|
|
162
178
|
*/
|
|
163
|
-
const
|
|
164
|
-
const
|
|
165
|
-
__props.
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
179
|
+
const handleCreateOperation = (item) => {
|
|
180
|
+
const documentName = item.documentName;
|
|
181
|
+
const store = __props.app.store.value;
|
|
182
|
+
if (!documentName || !store) {
|
|
183
|
+
console.warn("Cannot create an operation: no document loaded");
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
createTempOperation(documentName, {
|
|
187
|
+
existingPaths: new Set(Object.keys(store.workspace.documents[documentName]?.paths ?? {})),
|
|
188
|
+
eventBus: __props.app.eventBus
|
|
189
|
+
});
|
|
190
|
+
};
|
|
191
|
+
/**
|
|
192
|
+
* Navigates back to the workspace "Get started" page.
|
|
193
|
+
*/
|
|
194
|
+
const handleBack = () => {
|
|
195
|
+
__props.app.eventBus.emit("ui:navigate", {
|
|
196
|
+
page: "workspace",
|
|
197
|
+
path: "get-started"
|
|
171
198
|
});
|
|
172
199
|
};
|
|
200
|
+
/**
|
|
201
|
+
* True when the user is currently viewing a document (any of its subpages).
|
|
202
|
+
* When inside a document, the sidebar actions are scoped to that document:
|
|
203
|
+
* the gear icon opens the document (collection) settings and the filter icon
|
|
204
|
+
* becomes a search icon that focuses the search input.
|
|
205
|
+
*/
|
|
206
|
+
const isOnDocumentPage = computed(() => Boolean(__props.app.activeEntities.documentSlug.value));
|
|
207
|
+
const handleOpenSettings = () => {
|
|
208
|
+
if (isOnDocumentPage.value) {
|
|
209
|
+
__props.app.eventBus.emit("ui:navigate", {
|
|
210
|
+
page: "document",
|
|
211
|
+
path: "settings",
|
|
212
|
+
documentSlug: __props.app.activeEntities.documentSlug.value
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
__props.app.eventBus.emit("ui:navigate", {
|
|
217
|
+
page: "workspace",
|
|
218
|
+
path: "settings"
|
|
219
|
+
});
|
|
220
|
+
};
|
|
221
|
+
/**
|
|
222
|
+
* Controls the per-document search modal. Only used when the user is drilled
|
|
223
|
+
* into a single document and clicks the magnifying-glass icon.
|
|
224
|
+
*/
|
|
225
|
+
const searchModal = useModal();
|
|
226
|
+
/**
|
|
227
|
+
* The OpenAPI document currently selected in the workspace. The search modal
|
|
228
|
+
* scopes its Fuse index to this document so results never leak across
|
|
229
|
+
* collections.
|
|
230
|
+
*/
|
|
231
|
+
const activeDocument = computed(() => __props.app.store.value?.workspace.activeDocument);
|
|
232
|
+
const handleFilterOrSearch = () => {
|
|
233
|
+
if (isOnDocumentPage.value) {
|
|
234
|
+
searchModal.show();
|
|
235
|
+
return;
|
|
236
|
+
}
|
|
237
|
+
toggleFilter();
|
|
238
|
+
};
|
|
239
|
+
/**
|
|
240
|
+
* Handle the `ui:focus:search` event. Dispatch is driven by the shared
|
|
241
|
+
* `handleHotkeys` helper (Cmd/Ctrl+J) or by programmatic callers such as the
|
|
242
|
+
* workspace "Get started" page. When a `KeyboardEvent` is included we
|
|
243
|
+
* preventDefault to override the browser's Cmd+J (downloads panel), then
|
|
244
|
+
* delegate to `handleFilterOrSearch`, which already branches on whether the
|
|
245
|
+
* user is viewing a document or the workspace root.
|
|
246
|
+
*/
|
|
247
|
+
const handleSearchHotkey = (payload) => {
|
|
248
|
+
payload?.event.preventDefault();
|
|
249
|
+
handleFilterOrSearch();
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Handle the `ui:open:settings` event (Cmd/Ctrl+I). Same delegation model as
|
|
253
|
+
* `handleSearchHotkey`: preventDefault on the originating keyboard event (if
|
|
254
|
+
* any) and hand off to `handleOpenSettings`, which routes to the document-
|
|
255
|
+
* level settings page when a document is active and the workspace-level
|
|
256
|
+
* settings page otherwise.
|
|
257
|
+
*/
|
|
258
|
+
const handleSettingsHotkey = (payload) => {
|
|
259
|
+
payload?.event.preventDefault();
|
|
260
|
+
handleOpenSettings();
|
|
261
|
+
};
|
|
262
|
+
onBeforeMount(() => {
|
|
263
|
+
__props.app.eventBus.on("ui:focus:search", handleSearchHotkey);
|
|
264
|
+
__props.app.eventBus.on("ui:open:settings", handleSettingsHotkey);
|
|
265
|
+
});
|
|
266
|
+
onBeforeUnmount(() => {
|
|
267
|
+
__props.app.eventBus.off("ui:focus:search", handleSearchHotkey);
|
|
268
|
+
__props.app.eventBus.off("ui:open:settings", handleSettingsHotkey);
|
|
269
|
+
});
|
|
270
|
+
/**
|
|
271
|
+
* Navigate to the selected search result. `scroll-to:nav-item` is already
|
|
272
|
+
* wired up through the app event bus to update the sidebar + route, matching
|
|
273
|
+
* the behaviour used elsewhere in the app.
|
|
274
|
+
*/
|
|
275
|
+
const handleSearchSelect = (id) => {
|
|
276
|
+
__props.app.eventBus.emit("scroll-to:nav-item", { id });
|
|
277
|
+
};
|
|
278
|
+
/** Controls the width of the sidebar */
|
|
279
|
+
const sidebarWidth = useModel(__props, "sidebarWidth");
|
|
173
280
|
return (_ctx, _cache) => {
|
|
174
|
-
return openBlock(),
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
"onNavigate:to:settings": _cache[5] || (_cache[5] = ($event) => __props.eventBus.emit("ui:navigate", {
|
|
187
|
-
page: "workspace",
|
|
188
|
-
path: "settings"
|
|
189
|
-
})),
|
|
190
|
-
onReorder: _cache[6] || (_cache[6] = (draggingItem, hoveredItem) => handleDragEnd(draggingItem, hoveredItem)),
|
|
191
|
-
"onSelect:workspace": _cache[7] || (_cache[7] = (id) => emit("select:workspace", id)),
|
|
192
|
-
onSelectItem: _cache[8] || (_cache[8] = (id) => emit("selectItem", id))
|
|
193
|
-
}, createSlots({
|
|
194
|
-
sidebarMenuActions: withCtx(() => [renderSlot(_ctx.$slots, "sidebarMenuActions", {}, void 0, true)]),
|
|
195
|
-
workspaceButton: withCtx(() => [createVNode(unref(ScalarSidebarItem), {
|
|
196
|
-
is: "button",
|
|
197
|
-
active: __props.isWorkspaceOpen,
|
|
198
|
-
onClick: _cache[0] || (_cache[0] = ($event) => emit("click:workspace"))
|
|
281
|
+
return openBlock(), createBlock(unref(Resize_default), {
|
|
282
|
+
width: sidebarWidth.value,
|
|
283
|
+
"onUpdate:width": _cache[3] || (_cache[3] = ($event) => sidebarWidth.value = $event),
|
|
284
|
+
class: normalizeClass(["flex flex-col max-md:inset-y-0 max-md:z-2 max-md:w-full!", {
|
|
285
|
+
"max-md:absolute! max-md:flex!": __props.app.sidebar.isOpen.value,
|
|
286
|
+
"max-md:hidden!": !__props.app.sidebar.isOpen.value
|
|
287
|
+
}])
|
|
288
|
+
}, {
|
|
289
|
+
default: withCtx(() => [
|
|
290
|
+
createElementVNode("div", _hoisted_1, [createVNode(unref(ScalarSidebar), {
|
|
291
|
+
class: "flex min-h-0 flex-1 flex-col max-md:pt-12",
|
|
292
|
+
style: normalizeStyle({ "--scalar-sidebar-indent": __props.indent + "px" })
|
|
199
293
|
}, {
|
|
200
|
-
default: withCtx(() => [
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
294
|
+
default: withCtx(() => [
|
|
295
|
+
!isOnDocumentPage.value ? (openBlock(), createElementBlock("div", _hoisted_2, [createElementVNode("div", _hoisted_3, [
|
|
296
|
+
createVNode(unref(ScalarSidebarButton), {
|
|
297
|
+
is: "div",
|
|
298
|
+
class: "text-sidebar-c-1 font-sidebar-active flex-1",
|
|
299
|
+
disabled: ""
|
|
300
|
+
}, {
|
|
301
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode(" All Documents ", -1)])]),
|
|
302
|
+
_: 1
|
|
303
|
+
}),
|
|
304
|
+
createVNode(unref(ScalarIconButton), {
|
|
305
|
+
icon: unref(ScalarIconGearSix),
|
|
306
|
+
label: "Workspace settings",
|
|
307
|
+
size: "sm",
|
|
308
|
+
onClick: handleOpenSettings
|
|
309
|
+
}, null, 8, ["icon"]),
|
|
310
|
+
createVNode(unref(ScalarIconButton), {
|
|
311
|
+
icon: unref(ScalarIconFunnel),
|
|
312
|
+
label: "Filter documents",
|
|
313
|
+
size: "sm",
|
|
314
|
+
onClick: handleFilterOrSearch
|
|
315
|
+
}, null, 8, ["icon"]),
|
|
316
|
+
createVNode(unref(ScalarIconButton), {
|
|
317
|
+
class: "rounded-full border",
|
|
318
|
+
icon: unref(ScalarIconPlus),
|
|
319
|
+
label: "Add document",
|
|
320
|
+
size: "sm",
|
|
321
|
+
onClick: handleCreate
|
|
322
|
+
}, null, 8, ["icon"])
|
|
323
|
+
]), unref(isFilterVisible) ? (openBlock(), createBlock(unref(ScalarSidebarSearchInput), {
|
|
324
|
+
key: 0,
|
|
325
|
+
modelValue: unref(filterQuery),
|
|
326
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => isRef(filterQuery) ? filterQuery.value = $event : null),
|
|
327
|
+
autofocus: ""
|
|
328
|
+
}, null, 8, ["modelValue"])) : createCommentVNode("", true)])) : createCommentVNode("", true),
|
|
329
|
+
createElementVNode("div", _hoisted_4, [isEmpty.value && !isOnDocumentPage.value ? (openBlock(), createElementBlock("div", _hoisted_5, [createVNode(unref(ScalarIconFolderDashed), {
|
|
330
|
+
class: "size-10",
|
|
331
|
+
weight: "light"
|
|
332
|
+
}), _cache[5] || (_cache[5] = createElementVNode("p", { class: "text-sm font-medium" }, "No APIs yet", -1))])) : (openBlock(), createBlock(unref(ScalarSidebarItems), { key: 1 }, {
|
|
333
|
+
default: withCtx(() => [createVNode(unref(ScalarSidebarSection), null, {
|
|
334
|
+
items: withCtx(() => [isLoadingRegistry.value && !isOnDocumentPage.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, renderList(4, (n) => {
|
|
335
|
+
return createElementVNode("li", {
|
|
336
|
+
key: `registry-skeleton-${n}`,
|
|
337
|
+
"aria-hidden": "true",
|
|
338
|
+
class: "sidebar-skeleton-row px-(--scalar-sidebar-padding) py-1"
|
|
339
|
+
}, [..._cache[6] || (_cache[6] = [createElementVNode("span", { class: "bg-b-3 block h-6 rounded-md" }, null, -1)])]);
|
|
340
|
+
}), 64)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(unref(filteredRest), (item) => {
|
|
341
|
+
return openBlock(), createBlock(unref(ScalarSidebarNestedItems), {
|
|
342
|
+
key: item.key,
|
|
343
|
+
active: isDocActive(item),
|
|
344
|
+
controlled: "",
|
|
345
|
+
open: isDocActive(item),
|
|
346
|
+
onBack: handleBack,
|
|
347
|
+
onClick: ($event) => handleDocumentClick(item)
|
|
348
|
+
}, createSlots({
|
|
349
|
+
back: withCtx(() => [createElementVNode("div", _hoisted_6, [
|
|
350
|
+
createVNode(unref(ScalarSidebarButton), {
|
|
351
|
+
is: "button",
|
|
352
|
+
class: "text-sidebar-c-1 font-sidebar-active hover:text-sidebar-c-1 flex-1",
|
|
353
|
+
onClick: handleBack
|
|
354
|
+
}, {
|
|
355
|
+
icon: withCtx(() => [createVNode(unref(ScalarIconCaretLeft), { class: "text-sidebar-c-2 -m-px size-4" })]),
|
|
356
|
+
default: withCtx(() => [_cache[8] || (_cache[8] = createTextVNode(" Back ", -1))]),
|
|
357
|
+
_: 1
|
|
358
|
+
}),
|
|
359
|
+
createVNode(unref(ScalarIconButton), {
|
|
360
|
+
icon: unref(ScalarIconGearSix),
|
|
361
|
+
label: "Collection settings",
|
|
362
|
+
size: "sm",
|
|
363
|
+
onClick: handleOpenSettings
|
|
364
|
+
}, null, 8, ["icon"]),
|
|
365
|
+
createVNode(unref(ScalarIconButton), {
|
|
366
|
+
icon: unref(ScalarIconMagnifyingGlass),
|
|
367
|
+
label: "Search collection",
|
|
368
|
+
size: "sm",
|
|
369
|
+
onClick: handleFilterOrSearch
|
|
370
|
+
}, null, 8, ["icon"]),
|
|
371
|
+
createVNode(unref(ScalarIconButton), {
|
|
372
|
+
class: "rounded-full border",
|
|
373
|
+
icon: unref(ScalarIconPlus),
|
|
374
|
+
label: "Add operation",
|
|
375
|
+
size: "sm",
|
|
376
|
+
onClick: ($event) => handleCreateOperation(item)
|
|
377
|
+
}, null, 8, ["icon", "onClick"])
|
|
378
|
+
])]),
|
|
379
|
+
items: withCtx(() => [item.navigation?.children?.length ? (openBlock(true), createElementBlock(Fragment, { key: 0 }, renderList(unref(filterItems)("client", item.navigation.children), (child) => {
|
|
380
|
+
return openBlock(), createBlock(unref(SidebarItem), {
|
|
381
|
+
key: child.id,
|
|
382
|
+
isDroppable,
|
|
383
|
+
isExpanded,
|
|
384
|
+
isSelected,
|
|
385
|
+
item: child,
|
|
386
|
+
layout: "client",
|
|
387
|
+
onOnDragEnd: handleDragEnd,
|
|
388
|
+
onSelectItem: handleSelectItem,
|
|
389
|
+
onToggleGroup: handleToggleGroup
|
|
390
|
+
}, {
|
|
391
|
+
decorator: withCtx(({ item: entry }) => [createVNode(unref(ScalarIconButton), {
|
|
392
|
+
"aria-expanded": "false",
|
|
393
|
+
"aria-haspopup": "menu",
|
|
394
|
+
class: "bg-b-2",
|
|
395
|
+
icon: unref(ScalarIconDotsThree),
|
|
396
|
+
label: "More options",
|
|
397
|
+
size: "sm",
|
|
398
|
+
variant: "ghost",
|
|
399
|
+
weight: "bold",
|
|
400
|
+
onClick: withModifiers((e) => unref(openMenu)(e, entry), ["stop"]),
|
|
401
|
+
onKeydown: [
|
|
402
|
+
withKeys(withModifiers((e) => unref(openMenu)(e, entry), ["stop"]), ["down"]),
|
|
403
|
+
withKeys(withModifiers((e) => unref(openMenu)(e, entry), ["stop"]), ["enter"]),
|
|
404
|
+
withKeys(withModifiers((e) => unref(openMenu)(e, entry), ["stop"]), ["space"]),
|
|
405
|
+
withKeys(withModifiers((e) => unref(openMenu)(e, entry), ["stop"]), ["up"])
|
|
406
|
+
]
|
|
407
|
+
}, null, 8, [
|
|
408
|
+
"icon",
|
|
409
|
+
"onClick",
|
|
410
|
+
"onKeydown"
|
|
411
|
+
])]),
|
|
412
|
+
empty: withCtx(({ item: emptyItem }) => [createVNode(unref(ScalarSidebarItem), {
|
|
413
|
+
is: "button",
|
|
414
|
+
onClick: ($event) => handleAddEmptyFolder(emptyItem)
|
|
415
|
+
}, {
|
|
416
|
+
icon: withCtx(() => [createVNode(unref(ScalarIconPlus))]),
|
|
417
|
+
default: withCtx(() => [..._cache[9] || (_cache[9] = [createTextVNode("Add operation", -1)])]),
|
|
418
|
+
_: 1
|
|
419
|
+
}, 8, ["onClick"])]),
|
|
420
|
+
_: 1
|
|
421
|
+
}, 8, ["item"]);
|
|
422
|
+
}), 128)) : (openBlock(), createElementBlock("li", _hoisted_7, " Empty document "))]),
|
|
423
|
+
default: withCtx(() => [createElementVNode("span", null, toDisplayString(item.title), 1)]),
|
|
424
|
+
_: 2
|
|
425
|
+
}, [loadingKeys.value[item.key] ? {
|
|
426
|
+
name: "aside",
|
|
427
|
+
fn: withCtx(() => [_cache[7] || (_cache[7] = createElementVNode("span", { class: "text-c-3 text-xs" }, "Loading…", -1))]),
|
|
428
|
+
key: "0"
|
|
429
|
+
} : void 0]), 1032, [
|
|
430
|
+
"active",
|
|
431
|
+
"open",
|
|
432
|
+
"onClick"
|
|
433
|
+
]);
|
|
434
|
+
}), 128))]),
|
|
435
|
+
default: withCtx(() => [_cache[10] || (_cache[10] = createTextVNode(" All documents ", -1))]),
|
|
436
|
+
_: 1
|
|
437
|
+
})]),
|
|
438
|
+
_: 1
|
|
439
|
+
}))]),
|
|
440
|
+
renderSlot(_ctx.$slots, "footer", {}, void 0, true)
|
|
441
|
+
]),
|
|
442
|
+
_: 3
|
|
443
|
+
}, 8, ["style"])]),
|
|
444
|
+
createVNode(unref(DocumentSearchModal_default), {
|
|
445
|
+
document: activeDocument.value,
|
|
446
|
+
modalState: unref(searchModal),
|
|
447
|
+
onSelect: handleSearchSelect
|
|
448
|
+
}, null, 8, ["document", "modalState"]),
|
|
449
|
+
__props.app.store.value && unref(menuTarget)?.showMenu ? (openBlock(), createBlock(SidebarItemMenu_default, {
|
|
204
450
|
key: 0,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
"icon",
|
|
213
|
-
"onClick",
|
|
214
|
-
"onKeydown"
|
|
215
|
-
])) : createCommentVNode("", true), createVNode(unref(ScalarIconButton), {
|
|
216
|
-
"aria-expanded": "false",
|
|
217
|
-
"aria-haspopup": "menu",
|
|
218
|
-
icon: unref(ScalarIconDotsThree),
|
|
219
|
-
label: "More options",
|
|
220
|
-
size: "sm",
|
|
221
|
-
weight: "bold",
|
|
222
|
-
onClick: withModifiers((e) => openMenu(e, item), ["stop"]),
|
|
223
|
-
onKeydown: [
|
|
224
|
-
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["down"]),
|
|
225
|
-
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["enter"]),
|
|
226
|
-
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["space"]),
|
|
227
|
-
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["up"])
|
|
228
|
-
]
|
|
451
|
+
eventBus: __props.app.eventBus,
|
|
452
|
+
item: unref(menuTarget).item,
|
|
453
|
+
sidebarState: unref(sidebarState),
|
|
454
|
+
target: unref(menuTarget).el,
|
|
455
|
+
workspaceStore: __props.app.store.value,
|
|
456
|
+
onCloseMenu: unref(closeMenu),
|
|
457
|
+
onShowDeleteModal: _cache[1] || (_cache[1] = ($event) => unref(deleteModalState).show())
|
|
229
458
|
}, null, 8, [
|
|
230
|
-
"
|
|
231
|
-
"
|
|
232
|
-
"
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
459
|
+
"eventBus",
|
|
460
|
+
"item",
|
|
461
|
+
"sidebarState",
|
|
462
|
+
"target",
|
|
463
|
+
"workspaceStore",
|
|
464
|
+
"onCloseMenu"
|
|
465
|
+
])) : createCommentVNode("", true),
|
|
466
|
+
unref(menuTarget) ? (openBlock(), createBlock(unref(ScalarModal), {
|
|
467
|
+
key: 1,
|
|
468
|
+
size: "xxs",
|
|
469
|
+
state: unref(deleteModalState),
|
|
470
|
+
title: `Delete ${unref(menuTarget).item.title}`
|
|
241
471
|
}, {
|
|
242
|
-
|
|
243
|
-
|
|
472
|
+
default: withCtx(() => [createVNode(DeleteSidebarListElement_default, {
|
|
473
|
+
variableName: unref(menuTarget).item.title,
|
|
474
|
+
warningMessage: unref(deleteMessage),
|
|
475
|
+
onClose: _cache[2] || (_cache[2] = ($event) => unref(deleteModalState).hide()),
|
|
476
|
+
onDelete: unref(handleDelete)
|
|
477
|
+
}, null, 8, [
|
|
478
|
+
"variableName",
|
|
479
|
+
"warningMessage",
|
|
480
|
+
"onDelete"
|
|
481
|
+
])]),
|
|
244
482
|
_: 1
|
|
245
|
-
}, 8, ["
|
|
246
|
-
_: 2
|
|
247
|
-
}, [__props.layout !== "modal" ? {
|
|
248
|
-
name: "footer",
|
|
249
|
-
fn: withCtx(() => [createElementVNode("div", { class: normalizeClass({ "empty-sidebar-item border-t": showGettingStarted.value }) }, [showGettingStarted.value ? (openBlock(), createElementBlock("div", _hoisted_4, [createElementVNode("div", _hoisted_5, [createVNode(ScalarAsciiArt_default, {
|
|
250
|
-
art: unref(rabbit_default),
|
|
251
|
-
class: "rabbitsit font-bold"
|
|
252
|
-
}, null, 8, ["art"]), createVNode(ScalarAsciiArt_default, {
|
|
253
|
-
art: unref(rabbitjump_default),
|
|
254
|
-
class: "rabbitjump absolute top-0 left-0 font-bold"
|
|
255
|
-
}, null, 8, ["art"])]), _cache[13] || (_cache[13] = createElementVNode("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [createElementVNode("b", { class: "font-medium" }, "Let's Get Started"), createElementVNode("p", { class: "mt-2 leading-5" }, " Create request, folder, collection or import from OpenAPI/Postman ")], -1))])) : createCommentVNode("", true), createElementVNode("div", _hoisted_6, [
|
|
256
|
-
showGettingStarted.value ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
257
|
-
key: 0,
|
|
258
|
-
class: "w-full",
|
|
259
|
-
size: "sm",
|
|
260
|
-
onClick: _cache[1] || (_cache[1] = ($event) => __props.eventBus.emit("ui:open:command-palette", {
|
|
261
|
-
action: "import-from-openapi-swagger-postman-curl",
|
|
262
|
-
payload: void 0
|
|
263
|
-
}))
|
|
264
|
-
}, {
|
|
265
|
-
default: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode(" Import Collection ", -1)])]),
|
|
266
|
-
_: 1
|
|
267
|
-
})) : createCommentVNode("", true),
|
|
268
|
-
createVNode(unref(ScalarButton), {
|
|
269
|
-
class: "w-full",
|
|
270
|
-
hotkey: "K",
|
|
271
|
-
size: "sm",
|
|
272
|
-
variant: "outlined",
|
|
273
|
-
onClick: _cache[2] || (_cache[2] = ($event) => __props.eventBus.emit("ui:open:command-palette"))
|
|
274
|
-
}, {
|
|
275
|
-
default: withCtx(() => [_cache[20] || (_cache[20] = createTextVNode(" Add Item \xA0 ", -1)), createElementVNode("span", _hoisted_7, [unref(isMacOS)() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[15] || (_cache[15] = createElementVNode("span", { class: "sr-only" }, "Command", -1)), _cache[16] || (_cache[16] = createElementVNode("span", { "aria-hidden": "true" }, "⌘", -1))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [_cache[17] || (_cache[17] = createElementVNode("span", { class: "sr-only" }, "CTRL", -1)), _cache[18] || (_cache[18] = createElementVNode("span", { "aria-hidden": "true" }, "⌃", -1))], 64)), _cache[19] || (_cache[19] = createTextVNode(" K ", -1))])]),
|
|
276
|
-
_: 1
|
|
277
|
-
}),
|
|
278
|
-
__props.layout === "web" ? (openBlock(), createBlock(DownloadAppButton_default, { key: 1 })) : createCommentVNode("", true)
|
|
279
|
-
])], 2)]),
|
|
280
|
-
key: "0"
|
|
281
|
-
} : void 0]), 1032, [
|
|
282
|
-
"sidebarWidth",
|
|
283
|
-
"activeWorkspace",
|
|
284
|
-
"class",
|
|
285
|
-
"documents",
|
|
286
|
-
"layout",
|
|
287
|
-
"sidebarState",
|
|
288
|
-
"workspaces"
|
|
483
|
+
}, 8, ["state", "title"])) : createCommentVNode("", true)
|
|
289
484
|
]),
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
eventBus: __props.eventBus,
|
|
293
|
-
item: menuTarget.value.item,
|
|
294
|
-
sidebarState: __props.sidebarState,
|
|
295
|
-
target: menuTarget.value.el,
|
|
296
|
-
workspaceStore: __props.store,
|
|
297
|
-
onCloseMenu: closeMenu,
|
|
298
|
-
onShowDeleteModal: _cache[9] || (_cache[9] = ($event) => unref(deleteModalState).show())
|
|
299
|
-
}, null, 8, [
|
|
300
|
-
"eventBus",
|
|
301
|
-
"item",
|
|
302
|
-
"sidebarState",
|
|
303
|
-
"target",
|
|
304
|
-
"workspaceStore"
|
|
305
|
-
])) : createCommentVNode("", true),
|
|
306
|
-
menuTarget.value ? (openBlock(), createBlock(unref(ScalarModal), {
|
|
307
|
-
key: 1,
|
|
308
|
-
size: "xxs",
|
|
309
|
-
state: unref(deleteModalState),
|
|
310
|
-
title: `Delete ${menuTarget.value.item.title}`
|
|
311
|
-
}, {
|
|
312
|
-
default: withCtx(() => [createVNode(DeleteSidebarListElement_default, {
|
|
313
|
-
variableName: menuTarget.value.item.title,
|
|
314
|
-
warningMessage: deleteMessage.value,
|
|
315
|
-
onClose: _cache[10] || (_cache[10] = ($event) => unref(deleteModalState).hide()),
|
|
316
|
-
onDelete: handleDelete
|
|
317
|
-
}, null, 8, ["variableName", "warningMessage"])]),
|
|
318
|
-
_: 1
|
|
319
|
-
}, 8, ["state", "title"])) : createCommentVNode("", true)
|
|
320
|
-
]);
|
|
485
|
+
_: 3
|
|
486
|
+
}, 8, ["width", "class"]);
|
|
321
487
|
};
|
|
322
488
|
}
|
|
323
489
|
});
|