@scalar/api-client 2.12.0 → 2.13.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 +42 -0
- package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
- package/dist/components/CodeInput/CodeInput.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts +2 -2
- package/dist/components/CommandPalette/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandActionForm.vue.js +14 -14
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +38 -38
- package/dist/components/EmptyState.vue.d.ts.map +1 -1
- package/dist/components/EmptyState.vue.js +2 -2
- package/dist/components/EmptyState.vue2.js +27 -16
- package/dist/components/TopNav/TopNav.vue.js +33 -33
- package/dist/layouts/App/create-api-client-app.d.ts +28 -28
- package/dist/layouts/Web/create-api-client-web.d.ts +28 -28
- package/dist/libs/create-client.d.ts +28 -28
- package/dist/libs/hot-keys.d.ts +2 -2
- package/dist/libs/send-request/create-fetch-body.d.ts +2 -2
- package/dist/store/active-entities.d.ts +2 -2
- package/dist/store/collections.d.ts +4 -4
- package/dist/store/index.d.ts +1 -1
- package/dist/store/index.d.ts.map +1 -1
- package/dist/store/index.js +8 -8
- package/dist/store/request-example.d.ts +12 -12
- package/dist/store/store.d.ts +28 -28
- package/dist/store/workspace.d.ts +12 -12
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +1 -2
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +9 -8
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +3 -3
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +14 -11
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +22 -22
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +18 -15
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +17 -17
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +17 -12
- package/dist/v2/blocks/scalar-address-bar-block/index.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +205 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +52 -52
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +205 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -2
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +126 -103
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +0 -2
- 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.vue2.js +56 -53
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts +26 -0
- package/dist/v2/features/app/components/DesktopTab.vue.d.ts.map +1 -0
- package/dist/v2/features/app/components/DesktopTab.vue.js +7 -0
- package/dist/v2/features/app/components/DesktopTab.vue2.js +134 -0
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +9 -4
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.js +47 -13
- package/dist/v2/features/app/components/DesktopTabs.vue2.js +2 -4
- package/dist/v2/features/app/components/SplashScreen.vue.js +2 -2
- package/dist/v2/features/app/components/SplashScreen.vue2.js +2 -2
- package/dist/v2/features/app/helpers/routes.js +1 -1
- package/dist/v2/features/collection/components/Settings.vue2.js +3 -3
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts +61 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js +48 -0
- package/dist/v2/features/command-palette/components/CommandActionForm.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +39 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.js +52 -0
- package/dist/v2/features/command-palette/components/CommandActionInput.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts +36 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue.js +78 -0
- package/dist/v2/features/command-palette/components/CommandPaletteDocument.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts +30 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +169 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts +34 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +175 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts +43 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +7 -0
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +115 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +39 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +213 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +38 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +89 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts +41 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue.js +7 -0
- package/dist/v2/features/command-palette/components/TheCommandPalette.vue2.js +172 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts +33 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.js +40 -0
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue2.js +4 -0
- package/dist/v2/features/command-palette/components/index.d.ts +2 -0
- package/dist/v2/features/command-palette/components/index.d.ts.map +1 -0
- package/dist/v2/features/command-palette/components/index.js +4 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts +23 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.js +31 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts +13 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +12 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts +26 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +70 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts +23 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +18 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts +11 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.d.ts.map +1 -0
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js +11 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +202 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +109 -0
- package/dist/v2/features/command-palette/types.d.ts +82 -0
- package/dist/v2/features/command-palette/types.d.ts.map +1 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +24 -20
- package/dist/v2/helpers/drag-handle-factory.d.ts +1 -2
- package/dist/v2/helpers/drag-handle-factory.d.ts.map +1 -1
- package/dist/v2/helpers/drag-handle-factory.js +74 -90
- package/dist/v2/helpers/get-tab-details.d.ts +43 -0
- package/dist/v2/helpers/get-tab-details.d.ts.map +1 -0
- package/dist/v2/helpers/get-tab-details.js +34 -0
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/v2/helpers/is-url.d.ts +2 -0
- package/dist/v2/helpers/is-url.d.ts.map +1 -0
- package/dist/v2/helpers/is-url.js +5 -0
- package/dist/v2/helpers/remove-circular.d.ts +15 -0
- package/dist/v2/helpers/remove-circular.d.ts.map +1 -0
- package/dist/v2/helpers/remove-circular.js +18 -0
- package/dist/v2/helpers/storage.d.ts +4 -6
- package/dist/v2/helpers/storage.d.ts.map +1 -1
- package/dist/v2/helpers/storage.js +8 -12
- package/dist/v2/hooks/use-sidebar-state.d.ts +12 -19
- package/dist/v2/hooks/use-sidebar-state.d.ts.map +1 -1
- package/dist/v2/hooks/use-sidebar-state.js +20 -18
- package/dist/v2/hooks/use-sync-path.d.ts +11 -0
- package/dist/v2/hooks/use-sync-path.d.ts.map +1 -0
- package/dist/v2/hooks/use-sync-path.js +51 -0
- package/dist/v2/hooks/use-tabs.d.ts +31 -0
- package/dist/v2/hooks/use-tabs.d.ts.map +1 -0
- package/dist/v2/hooks/use-tabs.js +44 -0
- package/dist/v2/hooks/use-workspace-client-events.d.ts +5 -2
- package/dist/v2/hooks/use-workspace-client-events.d.ts.map +1 -1
- package/dist/v2/hooks/use-workspace-client-events.js +91 -36
- package/dist/v2/hooks/use-workspace-selector.d.ts +16 -6
- package/dist/v2/hooks/use-workspace-selector.d.ts.map +1 -1
- package/dist/v2/hooks/use-workspace-selector.js +58 -64
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts.map +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +78 -78
- package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue.js +29 -29
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +2 -2
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +19 -19
- package/package.json +136 -46
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
import { defineComponent as y, ref as b, computed as i, createBlock as B, openBlock as N, withCtx as r, createVNode as n, createElementVNode as m, unref as l, toDisplayString as d, createTextVNode as D, normalizeClass as I } from "vue";
|
|
2
|
+
import { ScalarListbox as $, ScalarButton as K, ScalarIcon as R } from "@scalar/components";
|
|
3
|
+
import { useRouter as U } from "vue-router";
|
|
4
|
+
import j from "../../../blocks/operation-code-sample/components/HttpMethod.vue.js";
|
|
5
|
+
import z from "./CommandActionForm.vue.js";
|
|
6
|
+
import E from "./CommandActionInput.vue.js";
|
|
7
|
+
import { getOperationFromCurl as k } from "../helpers/get-operation-from-curl.js";
|
|
8
|
+
const O = { class: "flex flex-1 flex-col gap-2" }, T = { class: "flex h-9 flex-row items-center gap-2 rounded border p-[3px] text-sm" }, q = { class: "scroll-timeline-x whitespace-nowrap" }, F = { class: "flex items-center gap-2" }, L = {
|
|
9
|
+
name: "CommandPaletteImportCurl"
|
|
10
|
+
}, Q = /* @__PURE__ */ y({
|
|
11
|
+
...L,
|
|
12
|
+
props: {
|
|
13
|
+
workspaceStore: {},
|
|
14
|
+
eventBus: {},
|
|
15
|
+
curl: {}
|
|
16
|
+
},
|
|
17
|
+
emits: ["close", "back"],
|
|
18
|
+
setup(a, { emit: w }) {
|
|
19
|
+
const p = w, S = U(), u = b(""), c = i(() => u.value.trim()), { path: f, method: v, operation: C } = k(a.curl), x = i(
|
|
20
|
+
() => Object.keys(a.workspaceStore.workspace.documents).map((t) => ({
|
|
21
|
+
id: t,
|
|
22
|
+
label: t
|
|
23
|
+
}))
|
|
24
|
+
), o = b(
|
|
25
|
+
x.value[0]
|
|
26
|
+
), h = i(() => !!(!c.value || !o.value || a.workspaceStore.workspace.documents[o.value.id]?.paths?.[f]?.[v])), g = () => {
|
|
27
|
+
const t = o.value;
|
|
28
|
+
if (h.value || !t)
|
|
29
|
+
return;
|
|
30
|
+
const e = k(a.curl, c.value);
|
|
31
|
+
a.eventBus.emit("operation:create:operation", {
|
|
32
|
+
documentName: t.id,
|
|
33
|
+
path: e.path,
|
|
34
|
+
method: e.method,
|
|
35
|
+
operation: e.operation,
|
|
36
|
+
exampleKey: c.value,
|
|
37
|
+
callback: (s) => {
|
|
38
|
+
if (s) {
|
|
39
|
+
a.workspaceStore.buildSidebar(t.id);
|
|
40
|
+
const _ = e.path.startsWith("/") ? e.path : `/${e.path}`;
|
|
41
|
+
S.push({
|
|
42
|
+
name: "example",
|
|
43
|
+
params: {
|
|
44
|
+
documentSlug: t.id,
|
|
45
|
+
pathEncoded: encodeURIComponent(_),
|
|
46
|
+
method: e.method,
|
|
47
|
+
exampleName: c.value
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}), p("close");
|
|
53
|
+
}, V = (t) => {
|
|
54
|
+
p("back", t);
|
|
55
|
+
};
|
|
56
|
+
return (t, e) => (N(), B(z, {
|
|
57
|
+
disabled: h.value,
|
|
58
|
+
onSubmit: g
|
|
59
|
+
}, {
|
|
60
|
+
options: r(() => [
|
|
61
|
+
m("div", F, [
|
|
62
|
+
n(l($), {
|
|
63
|
+
modelValue: o.value,
|
|
64
|
+
"onUpdate:modelValue": e[1] || (e[1] = (s) => o.value = s),
|
|
65
|
+
options: x.value
|
|
66
|
+
}, {
|
|
67
|
+
default: r(() => [
|
|
68
|
+
n(l(K), {
|
|
69
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
70
|
+
variant: "outlined"
|
|
71
|
+
}, {
|
|
72
|
+
default: r(() => [
|
|
73
|
+
m("span", {
|
|
74
|
+
class: I(["whitespace-nowrap", o.value ? "text-c-1" : "text-c-3"])
|
|
75
|
+
}, d(o.value ? o.value.label : "Select Collection"), 3),
|
|
76
|
+
n(l(R), {
|
|
77
|
+
class: "text-c-3",
|
|
78
|
+
icon: "ChevronDown",
|
|
79
|
+
size: "md"
|
|
80
|
+
})
|
|
81
|
+
]),
|
|
82
|
+
_: 1
|
|
83
|
+
})
|
|
84
|
+
]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 8, ["modelValue", "options"])
|
|
87
|
+
])
|
|
88
|
+
]),
|
|
89
|
+
submit: r(() => [...e[2] || (e[2] = [
|
|
90
|
+
D("Import Request", -1)
|
|
91
|
+
])]),
|
|
92
|
+
default: r(() => [
|
|
93
|
+
n(E, {
|
|
94
|
+
modelValue: u.value,
|
|
95
|
+
"onUpdate:modelValue": e[0] || (e[0] = (s) => u.value = s),
|
|
96
|
+
placeholder: "Curl example key (e.g., example-1)",
|
|
97
|
+
onDelete: V
|
|
98
|
+
}, null, 8, ["modelValue"]),
|
|
99
|
+
m("div", O, [
|
|
100
|
+
m("div", T, [
|
|
101
|
+
n(j, {
|
|
102
|
+
class: "border-r-1 px-1",
|
|
103
|
+
method: l(v)
|
|
104
|
+
}, null, 8, ["method"]),
|
|
105
|
+
m("span", q, d(l(C).servers?.[0]?.url || "") + d(l(f)), 1)
|
|
106
|
+
])
|
|
107
|
+
])
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
}, 8, ["disabled"]));
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
export {
|
|
114
|
+
Q as default
|
|
115
|
+
};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
+
/**
|
|
4
|
+
* Command Palette Request Component
|
|
5
|
+
*
|
|
6
|
+
* Provides a form for creating a new API request (operation) in a document.
|
|
7
|
+
* Users can specify the request path, HTTP method, document (collection),
|
|
8
|
+
* and optionally assign it to a tag.
|
|
9
|
+
*
|
|
10
|
+
* Validates that no operation with the same path and method already exists
|
|
11
|
+
* in the selected document to prevent duplicates.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* <CommandPaletteRequest
|
|
15
|
+
* :workspaceStore="workspaceStore"
|
|
16
|
+
* :eventBus="eventBus"
|
|
17
|
+
* @close="handleClose"
|
|
18
|
+
* @back="handleBack"
|
|
19
|
+
* />
|
|
20
|
+
*/
|
|
21
|
+
declare const _default: import("vue").DefineComponent<{
|
|
22
|
+
/** The workspace store for accessing documents and operations */
|
|
23
|
+
workspaceStore: WorkspaceStore;
|
|
24
|
+
/** Event bus for emitting operation creation events */
|
|
25
|
+
eventBus: WorkspaceEventBus;
|
|
26
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
27
|
+
close: () => any;
|
|
28
|
+
back: (keyboardEvent: KeyboardEvent) => any;
|
|
29
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
30
|
+
/** The workspace store for accessing documents and operations */
|
|
31
|
+
workspaceStore: WorkspaceStore;
|
|
32
|
+
/** Event bus for emitting operation creation events */
|
|
33
|
+
eventBus: WorkspaceEventBus;
|
|
34
|
+
}> & Readonly<{
|
|
35
|
+
onClose?: (() => any) | undefined;
|
|
36
|
+
onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
|
|
37
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
38
|
+
export default _default;
|
|
39
|
+
//# sourceMappingURL=CommandPaletteRequest.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteRequest.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteRequest.vue"],"names":[],"mappings":"AAiWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE;;;;;;;;;;;;;;;;;GAiBG;;IAGD,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;IAH3B,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;;;;;AAL7B,wBAsjBC"}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { defineComponent as I, ref as p, computed as v, createBlock as f, openBlock as m, withCtx as o, createVNode as n, createTextVNode as O, createElementVNode as r, unref as s, normalizeClass as D, toDisplayString as b, createCommentVNode as H, createElementBlock as T, Fragment as V, renderList as y } from "vue";
|
|
2
|
+
import { ScalarListbox as L, ScalarButton as x, ScalarIcon as w, ScalarDropdown as z, ScalarDropdownItem as B } from "@scalar/components";
|
|
3
|
+
import { HTTP_METHODS as W } from "@scalar/helpers/http/http-methods";
|
|
4
|
+
import { useRouter as F } from "vue-router";
|
|
5
|
+
import N from "../../../blocks/operation-code-sample/components/HttpMethod.vue.js";
|
|
6
|
+
import A from "./CommandActionForm.vue.js";
|
|
7
|
+
import G from "./CommandActionInput.vue.js";
|
|
8
|
+
const J = { class: "flex flex-1 gap-1" }, K = { class: "flex items-center gap-2" }, Q = { class: "custom-scroll max-h-40" }, X = { class: "custom-scroll max-h-40" }, Y = { class: "truncate" }, Z = {
|
|
9
|
+
name: "CommandPaletteRequest"
|
|
10
|
+
}, ue = /* @__PURE__ */ I({
|
|
11
|
+
...Z,
|
|
12
|
+
props: {
|
|
13
|
+
workspaceStore: {},
|
|
14
|
+
eventBus: {}
|
|
15
|
+
},
|
|
16
|
+
emits: ["close", "back"],
|
|
17
|
+
setup(i, { emit: $ }) {
|
|
18
|
+
const k = $, P = F(), h = p("/"), u = v(() => h.value.trim()), S = v(
|
|
19
|
+
() => Object.entries(i.workspaceStore.workspace.documents).map(
|
|
20
|
+
([e, a]) => ({
|
|
21
|
+
id: e,
|
|
22
|
+
label: a.info.title || e
|
|
23
|
+
})
|
|
24
|
+
)
|
|
25
|
+
), _ = W.map((e) => ({
|
|
26
|
+
id: e,
|
|
27
|
+
label: e.toUpperCase(),
|
|
28
|
+
method: e
|
|
29
|
+
})), t = p(
|
|
30
|
+
S.value[0] ?? void 0
|
|
31
|
+
), c = p(
|
|
32
|
+
_.find((e) => e.method === "get")
|
|
33
|
+
), d = p(void 0), g = v(() => {
|
|
34
|
+
if (!t.value)
|
|
35
|
+
return [];
|
|
36
|
+
const e = i.workspaceStore.workspace.documents[t.value.id];
|
|
37
|
+
return e ? [
|
|
38
|
+
{ id: "", label: "No Tag" },
|
|
39
|
+
...e.tags?.map((a) => ({
|
|
40
|
+
id: a.name,
|
|
41
|
+
label: a.name
|
|
42
|
+
})) ?? []
|
|
43
|
+
] : [];
|
|
44
|
+
}), j = v(() => {
|
|
45
|
+
if (!t.value || !c.value || !u.value)
|
|
46
|
+
return !1;
|
|
47
|
+
const e = i.workspaceStore.workspace.documents[t.value.id], a = u.value.startsWith("/") ? u.value : `/${u.value}`;
|
|
48
|
+
return !!e?.paths?.[a]?.[c.value.method];
|
|
49
|
+
}), C = v(() => !!(!u.value || !t.value || !c.value || j.value)), q = (e) => {
|
|
50
|
+
e && (c.value = e);
|
|
51
|
+
}, E = (e) => {
|
|
52
|
+
e && (d.value = e);
|
|
53
|
+
}, R = () => {
|
|
54
|
+
C.value || !t.value || !c.value || !i.workspaceStore.workspace.documents[t.value.id] || (i.eventBus.emit("operation:create:operation", {
|
|
55
|
+
documentName: t.value.id,
|
|
56
|
+
path: u.value,
|
|
57
|
+
method: c.value.method,
|
|
58
|
+
operation: {
|
|
59
|
+
tags: d.value?.id ? [d.value.id] : void 0
|
|
60
|
+
},
|
|
61
|
+
callback: (a) => {
|
|
62
|
+
if (a) {
|
|
63
|
+
i.workspaceStore.buildSidebar(t.value?.id ?? "");
|
|
64
|
+
const l = u.value.startsWith("/") ? u.value : `/${u.value}`;
|
|
65
|
+
P.push({
|
|
66
|
+
name: "example",
|
|
67
|
+
params: {
|
|
68
|
+
documentSlug: t.value?.id,
|
|
69
|
+
pathEncoded: encodeURIComponent(l),
|
|
70
|
+
method: c.value?.method,
|
|
71
|
+
exampleName: "default"
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}), k("close"));
|
|
77
|
+
}, M = (e) => {
|
|
78
|
+
k("back", e);
|
|
79
|
+
};
|
|
80
|
+
return (e, a) => (m(), f(A, {
|
|
81
|
+
disabled: C.value,
|
|
82
|
+
onSubmit: R
|
|
83
|
+
}, {
|
|
84
|
+
options: o(() => [
|
|
85
|
+
r("div", J, [
|
|
86
|
+
n(s(L), {
|
|
87
|
+
modelValue: t.value,
|
|
88
|
+
"onUpdate:modelValue": a[1] || (a[1] = (l) => t.value = l),
|
|
89
|
+
options: S.value
|
|
90
|
+
}, {
|
|
91
|
+
default: o(() => [
|
|
92
|
+
n(s(x), {
|
|
93
|
+
class: "hover:bg-b-2 max-h-8 w-[150px] min-w-[150px] justify-between gap-1 p-2 text-xs",
|
|
94
|
+
variant: "outlined"
|
|
95
|
+
}, {
|
|
96
|
+
default: o(() => [
|
|
97
|
+
r("span", {
|
|
98
|
+
class: D(t.value ? "text-c-1 truncate" : "text-c-3")
|
|
99
|
+
}, b(t.value ? t.value.label : "Select Document"), 3),
|
|
100
|
+
n(s(w), {
|
|
101
|
+
class: "text-c-3",
|
|
102
|
+
icon: "ChevronDown",
|
|
103
|
+
size: "md"
|
|
104
|
+
})
|
|
105
|
+
]),
|
|
106
|
+
_: 1
|
|
107
|
+
})
|
|
108
|
+
]),
|
|
109
|
+
_: 1
|
|
110
|
+
}, 8, ["modelValue", "options"]),
|
|
111
|
+
n(s(z), {
|
|
112
|
+
placement: "bottom",
|
|
113
|
+
resize: ""
|
|
114
|
+
}, {
|
|
115
|
+
items: o(() => [
|
|
116
|
+
r("div", Q, [
|
|
117
|
+
(m(!0), T(V, null, y(s(_), (l) => (m(), f(s(B), {
|
|
118
|
+
key: l.id,
|
|
119
|
+
class: "flex h-7 w-full items-center justify-center px-1",
|
|
120
|
+
onClick: (U) => q(l)
|
|
121
|
+
}, {
|
|
122
|
+
default: o(() => [
|
|
123
|
+
n(N, {
|
|
124
|
+
method: l.method
|
|
125
|
+
}, null, 8, ["method"])
|
|
126
|
+
]),
|
|
127
|
+
_: 2
|
|
128
|
+
}, 1032, ["onClick"]))), 128))
|
|
129
|
+
])
|
|
130
|
+
]),
|
|
131
|
+
default: o(() => [
|
|
132
|
+
n(s(x), {
|
|
133
|
+
class: "hover:bg-b-2 max-h-8 w-[100px] min-w-[100px] justify-between gap-1 p-2 text-xs",
|
|
134
|
+
variant: "outlined"
|
|
135
|
+
}, {
|
|
136
|
+
default: o(() => [
|
|
137
|
+
r("div", K, [
|
|
138
|
+
c.value ? (m(), f(N, {
|
|
139
|
+
key: 0,
|
|
140
|
+
method: c.value.method
|
|
141
|
+
}, null, 8, ["method"])) : H("", !0),
|
|
142
|
+
n(s(w), {
|
|
143
|
+
class: "text-c-3",
|
|
144
|
+
icon: "ChevronDown",
|
|
145
|
+
size: "md"
|
|
146
|
+
})
|
|
147
|
+
])
|
|
148
|
+
]),
|
|
149
|
+
_: 1
|
|
150
|
+
})
|
|
151
|
+
]),
|
|
152
|
+
_: 1
|
|
153
|
+
}),
|
|
154
|
+
n(s(z), {
|
|
155
|
+
placement: "bottom",
|
|
156
|
+
resize: ""
|
|
157
|
+
}, {
|
|
158
|
+
items: o(() => [
|
|
159
|
+
r("div", X, [
|
|
160
|
+
(m(!0), T(V, null, y(g.value, (l) => (m(), f(s(B), {
|
|
161
|
+
key: l.id,
|
|
162
|
+
class: "flex h-7 w-full items-center px-1",
|
|
163
|
+
onClick: (U) => E(l)
|
|
164
|
+
}, {
|
|
165
|
+
default: o(() => [
|
|
166
|
+
r("span", Y, b(l.label), 1)
|
|
167
|
+
]),
|
|
168
|
+
_: 2
|
|
169
|
+
}, 1032, ["onClick"]))), 128))
|
|
170
|
+
])
|
|
171
|
+
]),
|
|
172
|
+
default: o(() => [
|
|
173
|
+
n(s(x), {
|
|
174
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
175
|
+
disabled: !g.value.length,
|
|
176
|
+
variant: "outlined"
|
|
177
|
+
}, {
|
|
178
|
+
default: o(() => [
|
|
179
|
+
r("span", {
|
|
180
|
+
class: D(d.value ? "text-c-1 truncate" : "text-c-3")
|
|
181
|
+
}, b(d.value ? d.value.label : "Select Tag (Optional)"), 3),
|
|
182
|
+
n(s(w), {
|
|
183
|
+
class: "text-c-3",
|
|
184
|
+
icon: "ChevronDown",
|
|
185
|
+
size: "md"
|
|
186
|
+
})
|
|
187
|
+
]),
|
|
188
|
+
_: 1
|
|
189
|
+
}, 8, ["disabled"])
|
|
190
|
+
]),
|
|
191
|
+
_: 1
|
|
192
|
+
})
|
|
193
|
+
])
|
|
194
|
+
]),
|
|
195
|
+
submit: o(() => [...a[2] || (a[2] = [
|
|
196
|
+
O("Create Request", -1)
|
|
197
|
+
])]),
|
|
198
|
+
default: o(() => [
|
|
199
|
+
n(G, {
|
|
200
|
+
modelValue: h.value,
|
|
201
|
+
"onUpdate:modelValue": a[0] || (a[0] = (l) => h.value = l),
|
|
202
|
+
label: "Request Path",
|
|
203
|
+
placeholder: "/users",
|
|
204
|
+
onDelete: M
|
|
205
|
+
}, null, 8, ["modelValue"])
|
|
206
|
+
]),
|
|
207
|
+
_: 1
|
|
208
|
+
}, 8, ["disabled"]));
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
export {
|
|
212
|
+
ue as default
|
|
213
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
+
/**
|
|
4
|
+
* Command Palette Tag Component
|
|
5
|
+
*
|
|
6
|
+
* Provides a form for creating a new tag in a document (collection).
|
|
7
|
+
* Tags are used to organize and group related API operations.
|
|
8
|
+
*
|
|
9
|
+
* Validates that the tag name does not already exist in the selected document
|
|
10
|
+
* to prevent duplicates.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <CommandPaletteTag
|
|
14
|
+
* :workspaceStore="workspaceStore"
|
|
15
|
+
* :eventBus="eventBus"
|
|
16
|
+
* @close="handleClose"
|
|
17
|
+
* @back="handleBack"
|
|
18
|
+
* />
|
|
19
|
+
*/
|
|
20
|
+
declare const _default: import("vue").DefineComponent<{
|
|
21
|
+
/** The workspace store for accessing documents and tags */
|
|
22
|
+
workspaceStore: WorkspaceStore;
|
|
23
|
+
/** Event bus for emitting tag creation events */
|
|
24
|
+
eventBus: WorkspaceEventBus;
|
|
25
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
26
|
+
close: () => any;
|
|
27
|
+
back: (keyboardEvent: KeyboardEvent) => any;
|
|
28
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
29
|
+
/** The workspace store for accessing documents and tags */
|
|
30
|
+
workspaceStore: WorkspaceStore;
|
|
31
|
+
/** Event bus for emitting tag creation events */
|
|
32
|
+
eventBus: WorkspaceEventBus;
|
|
33
|
+
}> & Readonly<{
|
|
34
|
+
onClose?: (() => any) | undefined;
|
|
35
|
+
onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
|
|
36
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
37
|
+
export default _default;
|
|
38
|
+
//# sourceMappingURL=CommandPaletteTag.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteTag.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteTag.vue"],"names":[],"mappings":"AA4JA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAOvE;;;;;;;;;;;;;;;;GAgBG;;IAGD,2DAA2D;oBAC3C,cAAc;IAC9B,iDAAiD;cACvC,iBAAiB;;;;;IAH3B,2DAA2D;oBAC3C,cAAc;IAC9B,iDAAiD;cACvC,iBAAiB;;;;;AAL7B,wBA8OC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { defineComponent as S, ref as f, computed as i, createBlock as x, openBlock as g, withCtx as l, createVNode as n, createTextVNode as w, unref as m, createElementVNode as V, normalizeClass as C, toDisplayString as B } from "vue";
|
|
2
|
+
import { ScalarListbox as D, ScalarButton as N, ScalarIcon as T } from "@scalar/components";
|
|
3
|
+
import _ from "./CommandActionForm.vue.js";
|
|
4
|
+
import h from "./CommandActionInput.vue.js";
|
|
5
|
+
const j = {
|
|
6
|
+
name: "CommandPaletteTag"
|
|
7
|
+
}, E = /* @__PURE__ */ S({
|
|
8
|
+
...j,
|
|
9
|
+
props: {
|
|
10
|
+
workspaceStore: {},
|
|
11
|
+
eventBus: {}
|
|
12
|
+
},
|
|
13
|
+
emits: ["close", "back"],
|
|
14
|
+
setup(o, { emit: p }) {
|
|
15
|
+
const c = p, u = f(""), r = i(() => u.value.trim()), d = i(
|
|
16
|
+
() => Object.entries(o.workspaceStore.workspace.documents).map(
|
|
17
|
+
([t, a]) => ({
|
|
18
|
+
id: t,
|
|
19
|
+
label: a.info.title || t
|
|
20
|
+
})
|
|
21
|
+
)
|
|
22
|
+
), e = f(
|
|
23
|
+
d.value[0] ?? void 0
|
|
24
|
+
), v = i(() => {
|
|
25
|
+
if (!r.value || !e.value)
|
|
26
|
+
return !0;
|
|
27
|
+
const t = o.workspaceStore.workspace.documents[e.value.id];
|
|
28
|
+
return !!(!t || t.tags?.some((a) => a.name === r.value));
|
|
29
|
+
}), b = () => {
|
|
30
|
+
v.value || !e.value || (o.eventBus.emit("tag:create:tag", {
|
|
31
|
+
name: r.value,
|
|
32
|
+
documentName: e.value.id,
|
|
33
|
+
callback: (t) => {
|
|
34
|
+
t && o.workspaceStore.buildSidebar(e.value?.id ?? "");
|
|
35
|
+
}
|
|
36
|
+
}), c("close"));
|
|
37
|
+
}, k = (t) => {
|
|
38
|
+
c("back", t);
|
|
39
|
+
};
|
|
40
|
+
return (t, a) => (g(), x(_, {
|
|
41
|
+
disabled: v.value,
|
|
42
|
+
onSubmit: b
|
|
43
|
+
}, {
|
|
44
|
+
options: l(() => [
|
|
45
|
+
n(m(D), {
|
|
46
|
+
modelValue: e.value,
|
|
47
|
+
"onUpdate:modelValue": a[1] || (a[1] = (s) => e.value = s),
|
|
48
|
+
options: d.value
|
|
49
|
+
}, {
|
|
50
|
+
default: l(() => [
|
|
51
|
+
n(m(N), {
|
|
52
|
+
class: "hover:bg-b-2 max-h-8 w-fit justify-between gap-1 p-2 text-xs",
|
|
53
|
+
variant: "outlined"
|
|
54
|
+
}, {
|
|
55
|
+
default: l(() => [
|
|
56
|
+
V("span", {
|
|
57
|
+
class: C(e.value ? "text-c-1" : "text-c-3")
|
|
58
|
+
}, B(e.value ? e.value.label : "Select Collection"), 3),
|
|
59
|
+
n(m(T), {
|
|
60
|
+
class: "text-c-3",
|
|
61
|
+
icon: "ChevronDown",
|
|
62
|
+
size: "md"
|
|
63
|
+
})
|
|
64
|
+
]),
|
|
65
|
+
_: 1
|
|
66
|
+
})
|
|
67
|
+
]),
|
|
68
|
+
_: 1
|
|
69
|
+
}, 8, ["modelValue", "options"])
|
|
70
|
+
]),
|
|
71
|
+
submit: l(() => [...a[2] || (a[2] = [
|
|
72
|
+
w("Create Tag", -1)
|
|
73
|
+
])]),
|
|
74
|
+
default: l(() => [
|
|
75
|
+
n(h, {
|
|
76
|
+
modelValue: u.value,
|
|
77
|
+
"onUpdate:modelValue": a[0] || (a[0] = (s) => u.value = s),
|
|
78
|
+
label: "Tag Name",
|
|
79
|
+
placeholder: "Tag Name",
|
|
80
|
+
onDelete: k
|
|
81
|
+
}, null, 8, ["modelValue"])
|
|
82
|
+
]),
|
|
83
|
+
_: 1
|
|
84
|
+
}, 8, ["disabled"]));
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
export {
|
|
88
|
+
E as default
|
|
89
|
+
};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
+
import type { UseCommandPaletteStateReturn } from '../../../../v2/features/command-palette/hooks/use-command-palette-state.js';
|
|
4
|
+
/**
|
|
5
|
+
* The Command Palette Component
|
|
6
|
+
*
|
|
7
|
+
* A keyboard-driven command menu for quick access to common actions like:
|
|
8
|
+
* - Creating documents, requests, tags, and examples
|
|
9
|
+
* - Importing from OpenAPI, Swagger, Postman, or cURL
|
|
10
|
+
* - Navigating to different routes
|
|
11
|
+
*
|
|
12
|
+
* Supports:
|
|
13
|
+
* - Fuzzy search filtering
|
|
14
|
+
* - Keyboard navigation (arrow keys, enter, escape)
|
|
15
|
+
* - Command grouping and organization
|
|
16
|
+
* - Dynamic command components with props
|
|
17
|
+
*
|
|
18
|
+
* @example
|
|
19
|
+
* <TheCommandPalette
|
|
20
|
+
* :paletteState="paletteState"
|
|
21
|
+
* :workspaceStore="workspaceStore"
|
|
22
|
+
* :eventBus="eventBus"
|
|
23
|
+
* />
|
|
24
|
+
*/
|
|
25
|
+
declare const _default: import("vue").DefineComponent<{
|
|
26
|
+
/** The command palette state management hook */
|
|
27
|
+
paletteState: UseCommandPaletteStateReturn;
|
|
28
|
+
/** The workspace store for accessing documents and operations */
|
|
29
|
+
workspaceStore: WorkspaceStore;
|
|
30
|
+
/** Event bus for emitting workspace events */
|
|
31
|
+
eventBus: WorkspaceEventBus;
|
|
32
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
33
|
+
/** The command palette state management hook */
|
|
34
|
+
paletteState: UseCommandPaletteStateReturn;
|
|
35
|
+
/** The workspace store for accessing documents and operations */
|
|
36
|
+
workspaceStore: WorkspaceStore;
|
|
37
|
+
/** Event bus for emitting workspace events */
|
|
38
|
+
eventBus: WorkspaceEventBus;
|
|
39
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
40
|
+
export default _default;
|
|
41
|
+
//# sourceMappingURL=TheCommandPalette.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TheCommandPalette.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/TheCommandPalette.vue"],"names":[],"mappings":"AAoXA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE,OAAO,KAAK,EAKV,4BAA4B,EAC7B,MAAM,+DAA+D,CAAA;AAItE;;;;;;;;;;;;;;;;;;;;GAoBG;;IAGD,gDAAgD;kBAClC,4BAA4B;IAC1C,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;IAL3B,gDAAgD;kBAClC,4BAA4B;IAC1C,iEAAiE;oBACjD,cAAc;IAC9B,8CAA8C;cACpC,iBAAiB;;AAP7B,wBA8dC"}
|