@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,52 @@
|
|
|
1
|
+
import { defineComponent as c, ref as p, computed as m, onMounted as f, nextTick as h, withDirectives as b, createElementBlock as g, openBlock as v, mergeProps as w, withKeys as u, vModelText as y } from "vue";
|
|
2
|
+
const x = ["placeholder"], E = {
|
|
3
|
+
name: "CommandActionInput"
|
|
4
|
+
}, _ = /* @__PURE__ */ c({
|
|
5
|
+
...E,
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
props: {
|
|
8
|
+
modelValue: {},
|
|
9
|
+
placeholder: {},
|
|
10
|
+
autofocus: { type: Boolean, default: !0 }
|
|
11
|
+
},
|
|
12
|
+
emits: ["update:modelValue", "delete"],
|
|
13
|
+
setup(l, { emit: s }) {
|
|
14
|
+
const a = s, r = p(null), o = m({
|
|
15
|
+
get: () => l.modelValue ?? "",
|
|
16
|
+
set: (e) => a("update:modelValue", e)
|
|
17
|
+
});
|
|
18
|
+
f(() => {
|
|
19
|
+
h(() => {
|
|
20
|
+
l.autofocus && r.value?.focus();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
const d = (e) => {
|
|
24
|
+
if (e.shiftKey || !e.target)
|
|
25
|
+
return;
|
|
26
|
+
e.preventDefault();
|
|
27
|
+
const t = e.target, n = new Event("submit", { cancelable: !0 });
|
|
28
|
+
t.form?.dispatchEvent(n);
|
|
29
|
+
}, i = (e) => {
|
|
30
|
+
o.value === "" && (e.preventDefault(), e.stopPropagation(), a("delete", e));
|
|
31
|
+
};
|
|
32
|
+
return (e, t) => b((v(), g("textarea", w({
|
|
33
|
+
id: "command-action-input",
|
|
34
|
+
ref_key: "input",
|
|
35
|
+
ref: r,
|
|
36
|
+
"onUpdate:modelValue": t[0] || (t[0] = (n) => o.value = n),
|
|
37
|
+
class: "min-h-8 w-full flex-1 resize-none border border-transparent py-1.5 pl-8.5 text-sm outline-none focus:border-b-1",
|
|
38
|
+
placeholder: e.placeholder ?? "",
|
|
39
|
+
wrap: "hard"
|
|
40
|
+
}, e.$attrs, {
|
|
41
|
+
onKeydown: [
|
|
42
|
+
u(i, ["delete"]),
|
|
43
|
+
u(d, ["enter"])
|
|
44
|
+
]
|
|
45
|
+
}), null, 16, x)), [
|
|
46
|
+
[y, o.value]
|
|
47
|
+
]);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
export {
|
|
51
|
+
_ as default
|
|
52
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
+
/**
|
|
4
|
+
* Command Palette Document Component
|
|
5
|
+
*
|
|
6
|
+
* Provides a form for creating a new empty document in the workspace.
|
|
7
|
+
* Users can name the document and select an icon before creation.
|
|
8
|
+
* Validates that the name is not empty and not already in use.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* <CommandPaletteDocument
|
|
12
|
+
* :workspaceStore="workspaceStore"
|
|
13
|
+
* :eventBus="eventBus"
|
|
14
|
+
* @close="handleClose"
|
|
15
|
+
* @back="handleBack"
|
|
16
|
+
* />
|
|
17
|
+
*/
|
|
18
|
+
declare const _default: import("vue").DefineComponent<{
|
|
19
|
+
/** The workspace store for accessing existing documents */
|
|
20
|
+
workspaceStore: WorkspaceStore;
|
|
21
|
+
/** Event bus for emitting document creation events */
|
|
22
|
+
eventBus: WorkspaceEventBus;
|
|
23
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
24
|
+
close: () => any;
|
|
25
|
+
back: (keyboardEvent: KeyboardEvent) => any;
|
|
26
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
27
|
+
/** The workspace store for accessing existing documents */
|
|
28
|
+
workspaceStore: WorkspaceStore;
|
|
29
|
+
/** Event bus for emitting document creation events */
|
|
30
|
+
eventBus: WorkspaceEventBus;
|
|
31
|
+
}> & Readonly<{
|
|
32
|
+
onClose?: (() => any) | undefined;
|
|
33
|
+
onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
|
|
34
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
35
|
+
export default _default;
|
|
36
|
+
//# sourceMappingURL=CommandPaletteDocument.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteDocument.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteDocument.vue"],"names":[],"mappings":"AAuIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAUvE;;;;;;;;;;;;;;GAcG;;IAGD,2DAA2D;oBAC3C,cAAc;IAC9B,sDAAsD;cAC5C,iBAAiB;;;;;IAH3B,2DAA2D;oBAC3C,cAAc;IAC9B,sDAAsD;cAC5C,iBAAiB;;;;;AAL7B,wBA8MC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { defineComponent as k, ref as i, computed as d, createBlock as V, openBlock as x, withCtx as t, createVNode as n, createTextVNode as B, unref as f } from "vue";
|
|
2
|
+
import { ScalarButton as D } from "@scalar/components";
|
|
3
|
+
import { LibraryIcon as N } from "@scalar/icons/library";
|
|
4
|
+
import { useRouter as S } from "vue-router";
|
|
5
|
+
import w from "../../../../components/IconSelector.vue.js";
|
|
6
|
+
import C from "./CommandActionForm.vue.js";
|
|
7
|
+
import $ from "./CommandActionInput.vue.js";
|
|
8
|
+
const y = {}, L = /* @__PURE__ */ k({
|
|
9
|
+
...y,
|
|
10
|
+
__name: "CommandPaletteDocument",
|
|
11
|
+
props: {
|
|
12
|
+
workspaceStore: {},
|
|
13
|
+
eventBus: {}
|
|
14
|
+
},
|
|
15
|
+
emits: ["close", "back"],
|
|
16
|
+
setup(l, { emit: p }) {
|
|
17
|
+
const c = p, v = S(), m = i(""), o = d(() => m.value.trim()), a = i("interface-content-folder"), s = d(() => !o.value || l.workspaceStore.workspace.documents[o.value] !== void 0), b = () => {
|
|
18
|
+
s.value || (l.eventBus.emit("document:create:empty-document", {
|
|
19
|
+
name: o.value,
|
|
20
|
+
icon: a.value,
|
|
21
|
+
callback: (u) => {
|
|
22
|
+
u && v.push({
|
|
23
|
+
name: "document.overview",
|
|
24
|
+
params: {
|
|
25
|
+
documentSlug: o.value
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}), c("close"));
|
|
30
|
+
}, _ = (u) => {
|
|
31
|
+
c("back", u);
|
|
32
|
+
};
|
|
33
|
+
return (u, e) => (x(), V(C, {
|
|
34
|
+
disabled: s.value,
|
|
35
|
+
onSubmit: b
|
|
36
|
+
}, {
|
|
37
|
+
options: t(() => [
|
|
38
|
+
n(w, {
|
|
39
|
+
modelValue: a.value,
|
|
40
|
+
"onUpdate:modelValue": e[1] || (e[1] = (r) => a.value = r),
|
|
41
|
+
placement: "bottom-start"
|
|
42
|
+
}, {
|
|
43
|
+
default: t(() => [
|
|
44
|
+
n(f(D), {
|
|
45
|
+
class: "aspect-square h-auto px-0",
|
|
46
|
+
variant: "outlined"
|
|
47
|
+
}, {
|
|
48
|
+
default: t(() => [
|
|
49
|
+
n(f(N), {
|
|
50
|
+
class: "text-c-2 size-4 stroke-[1.75]",
|
|
51
|
+
src: a.value
|
|
52
|
+
}, null, 8, ["src"])
|
|
53
|
+
]),
|
|
54
|
+
_: 1
|
|
55
|
+
})
|
|
56
|
+
]),
|
|
57
|
+
_: 1
|
|
58
|
+
}, 8, ["modelValue"])
|
|
59
|
+
]),
|
|
60
|
+
submit: t(() => [...e[2] || (e[2] = [
|
|
61
|
+
B("Create Document", -1)
|
|
62
|
+
])]),
|
|
63
|
+
default: t(() => [
|
|
64
|
+
n($, {
|
|
65
|
+
modelValue: m.value,
|
|
66
|
+
"onUpdate:modelValue": e[0] || (e[0] = (r) => m.value = r),
|
|
67
|
+
label: "Document Name",
|
|
68
|
+
placeholder: "Document Name",
|
|
69
|
+
onDelete: _
|
|
70
|
+
}, null, 8, ["modelValue"])
|
|
71
|
+
]),
|
|
72
|
+
_: 1
|
|
73
|
+
}, 8, ["disabled"]));
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
export {
|
|
77
|
+
L as default
|
|
78
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
/**
|
|
3
|
+
* Command Palette Example Component
|
|
4
|
+
*
|
|
5
|
+
* Provides a form for creating a new example for an API operation.
|
|
6
|
+
* Users can name the example, select a document (collection), and choose an operation.
|
|
7
|
+
* Automatically navigates to the example route which creates the example.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* <CommandPaletteExample
|
|
11
|
+
* :workspaceStore="workspaceStore"
|
|
12
|
+
* @close="handleClose"
|
|
13
|
+
* @back="handleBack"
|
|
14
|
+
* />
|
|
15
|
+
*/
|
|
16
|
+
declare const _default: import("vue").DefineComponent<{
|
|
17
|
+
/** The workspace store for accessing documents and operations */
|
|
18
|
+
workspaceStore: WorkspaceStore;
|
|
19
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
20
|
+
close: () => any;
|
|
21
|
+
back: (keyboardEvent: KeyboardEvent) => any;
|
|
22
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
23
|
+
/** The workspace store for accessing documents and operations */
|
|
24
|
+
workspaceStore: WorkspaceStore;
|
|
25
|
+
}> & Readonly<{
|
|
26
|
+
onClose?: (() => any) | undefined;
|
|
27
|
+
onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
|
|
28
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
29
|
+
export default _default;
|
|
30
|
+
//# sourceMappingURL=CommandPaletteExample.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteExample.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteExample.vue"],"names":[],"mappings":"AAoRA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAcpE;;;;;;;;;;;;;GAaG;;IAGD,iEAAiE;oBACjD,cAAc;;;;;IAD9B,iEAAiE;oBACjD,cAAc;;;;;AAHhC,wBAubC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { defineComponent as O, ref as v, computed as m, watch as j, createBlock as f, openBlock as u, withCtx as n, createVNode as s, createTextVNode as z, createElementVNode as i, unref as c, normalizeClass as U, toDisplayString as h, createElementBlock as x, createCommentVNode as I, Fragment as L, renderList as R } from "vue";
|
|
2
|
+
import { ScalarListbox as T, ScalarButton as C, ScalarIcon as y, ScalarDropdown as A, ScalarDropdownItem as F } from "@scalar/components";
|
|
3
|
+
import { useRouter as P } from "vue-router";
|
|
4
|
+
import D from "../../../blocks/operation-code-sample/components/HttpMethod.vue.js";
|
|
5
|
+
import q from "./CommandActionForm.vue.js";
|
|
6
|
+
import G from "./CommandActionInput.vue.js";
|
|
7
|
+
const H = { class: "flex flex-1 gap-1" }, J = {
|
|
8
|
+
key: 0,
|
|
9
|
+
class: "text-c-1 truncate"
|
|
10
|
+
}, K = {
|
|
11
|
+
key: 1,
|
|
12
|
+
class: "text-c-3"
|
|
13
|
+
}, M = { class: "flex items-center gap-2" }, Q = { class: "custom-scroll max-h-40" }, W = { class: "truncate" }, X = {
|
|
14
|
+
name: "CommandPaletteExample"
|
|
15
|
+
}, oe = /* @__PURE__ */ O({
|
|
16
|
+
...X,
|
|
17
|
+
props: {
|
|
18
|
+
workspaceStore: {}
|
|
19
|
+
},
|
|
20
|
+
emits: ["close", "back"],
|
|
21
|
+
setup(b, { emit: V }) {
|
|
22
|
+
const _ = V, N = P(), d = v(""), w = m(() => d.value.trim()), k = m(
|
|
23
|
+
() => Object.entries(b.workspaceStore.workspace.documents).map(
|
|
24
|
+
([t, a]) => ({
|
|
25
|
+
id: t,
|
|
26
|
+
label: a.info.title || t
|
|
27
|
+
})
|
|
28
|
+
)
|
|
29
|
+
), l = v(
|
|
30
|
+
k.value[0] ?? void 0
|
|
31
|
+
), o = v(void 0), g = (t) => {
|
|
32
|
+
const a = [];
|
|
33
|
+
for (const e of t)
|
|
34
|
+
e.type === "operation" && a.push(e), "children" in e && e.children && a.push(...g(e.children));
|
|
35
|
+
return a;
|
|
36
|
+
}, p = m(() => {
|
|
37
|
+
if (!l.value)
|
|
38
|
+
return [];
|
|
39
|
+
const t = b.workspaceStore.workspace.documents[l.value.id];
|
|
40
|
+
if (!t || !t["x-scalar-navigation"])
|
|
41
|
+
return [];
|
|
42
|
+
const a = t["x-scalar-navigation"];
|
|
43
|
+
return g(a.children ?? []).map((r) => ({
|
|
44
|
+
id: r.id,
|
|
45
|
+
label: `${r.method.toUpperCase()} ${r.path}`,
|
|
46
|
+
path: r.path,
|
|
47
|
+
method: r.method
|
|
48
|
+
}));
|
|
49
|
+
});
|
|
50
|
+
j(
|
|
51
|
+
l,
|
|
52
|
+
() => {
|
|
53
|
+
o.value = p.value[0] ?? void 0;
|
|
54
|
+
},
|
|
55
|
+
{ immediate: !0 }
|
|
56
|
+
);
|
|
57
|
+
const E = (t) => {
|
|
58
|
+
t && (o.value = t);
|
|
59
|
+
}, S = m(() => !w.value || !l.value || !o.value), $ = () => {
|
|
60
|
+
S.value || !l.value || !o.value || (N.push({
|
|
61
|
+
name: "example",
|
|
62
|
+
params: {
|
|
63
|
+
documentSlug: l.value.id,
|
|
64
|
+
pathEncoded: encodeURIComponent(o.value.path),
|
|
65
|
+
method: o.value.method,
|
|
66
|
+
exampleName: w.value
|
|
67
|
+
}
|
|
68
|
+
}), _("close"));
|
|
69
|
+
}, B = (t) => {
|
|
70
|
+
_("back", t);
|
|
71
|
+
};
|
|
72
|
+
return (t, a) => (u(), f(q, {
|
|
73
|
+
disabled: S.value,
|
|
74
|
+
onSubmit: $
|
|
75
|
+
}, {
|
|
76
|
+
options: n(() => [
|
|
77
|
+
i("div", H, [
|
|
78
|
+
s(c(T), {
|
|
79
|
+
modelValue: l.value,
|
|
80
|
+
"onUpdate:modelValue": a[1] || (a[1] = (e) => l.value = e),
|
|
81
|
+
options: k.value
|
|
82
|
+
}, {
|
|
83
|
+
default: n(() => [
|
|
84
|
+
s(c(C), {
|
|
85
|
+
class: "hover:bg-b-2 max-h-8 w-[150px] min-w-[150px] justify-between gap-1 p-2 text-xs",
|
|
86
|
+
variant: "outlined"
|
|
87
|
+
}, {
|
|
88
|
+
default: n(() => [
|
|
89
|
+
i("span", {
|
|
90
|
+
class: U(l.value ? "text-c-1 truncate" : "text-c-3")
|
|
91
|
+
}, h(l.value ? l.value.label : "Select Document"), 3),
|
|
92
|
+
s(c(y), {
|
|
93
|
+
class: "text-c-3",
|
|
94
|
+
icon: "ChevronDown",
|
|
95
|
+
size: "md"
|
|
96
|
+
})
|
|
97
|
+
]),
|
|
98
|
+
_: 1
|
|
99
|
+
})
|
|
100
|
+
]),
|
|
101
|
+
_: 1
|
|
102
|
+
}, 8, ["modelValue", "options"]),
|
|
103
|
+
s(c(A), {
|
|
104
|
+
placement: "bottom",
|
|
105
|
+
resize: ""
|
|
106
|
+
}, {
|
|
107
|
+
items: n(() => [
|
|
108
|
+
i("div", Q, [
|
|
109
|
+
(u(!0), x(L, null, R(p.value, (e) => (u(), f(c(F), {
|
|
110
|
+
key: e.id,
|
|
111
|
+
class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
|
|
112
|
+
onClick: (r) => E(e)
|
|
113
|
+
}, {
|
|
114
|
+
default: n(() => [
|
|
115
|
+
i("span", W, h(e.path), 1),
|
|
116
|
+
s(D, {
|
|
117
|
+
method: e.method
|
|
118
|
+
}, null, 8, ["method"])
|
|
119
|
+
]),
|
|
120
|
+
_: 2
|
|
121
|
+
}, 1032, ["onClick"]))), 128))
|
|
122
|
+
])
|
|
123
|
+
]),
|
|
124
|
+
default: n(() => [
|
|
125
|
+
s(c(C), {
|
|
126
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
127
|
+
disabled: !p.value.length,
|
|
128
|
+
variant: "outlined"
|
|
129
|
+
}, {
|
|
130
|
+
default: n(() => [
|
|
131
|
+
o.value ? (u(), x("span", J, h(o.value.path), 1)) : (u(), x("span", K, " Select Operation ")),
|
|
132
|
+
i("div", M, [
|
|
133
|
+
o.value ? (u(), f(D, {
|
|
134
|
+
key: 0,
|
|
135
|
+
method: o.value.method
|
|
136
|
+
}, null, 8, ["method"])) : I("", !0),
|
|
137
|
+
s(c(y), {
|
|
138
|
+
class: "text-c-3",
|
|
139
|
+
icon: "ChevronDown",
|
|
140
|
+
size: "md"
|
|
141
|
+
})
|
|
142
|
+
])
|
|
143
|
+
]),
|
|
144
|
+
_: 1
|
|
145
|
+
}, 8, ["disabled"])
|
|
146
|
+
]),
|
|
147
|
+
_: 1
|
|
148
|
+
})
|
|
149
|
+
])
|
|
150
|
+
]),
|
|
151
|
+
submit: n(() => [...a[2] || (a[2] = [
|
|
152
|
+
z("Create Example", -1)
|
|
153
|
+
])]),
|
|
154
|
+
default: n(() => [
|
|
155
|
+
s(G, {
|
|
156
|
+
modelValue: d.value,
|
|
157
|
+
"onUpdate:modelValue": a[0] || (a[0] = (e) => d.value = e),
|
|
158
|
+
label: "Example Name",
|
|
159
|
+
placeholder: "Example Name",
|
|
160
|
+
onDelete: B
|
|
161
|
+
}, null, 8, ["modelValue"])
|
|
162
|
+
]),
|
|
163
|
+
_: 1
|
|
164
|
+
}, 8, ["disabled"]));
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
export {
|
|
168
|
+
oe as default
|
|
169
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
/**
|
|
3
|
+
* Command Palette Import Component
|
|
4
|
+
*
|
|
5
|
+
* Provides a form for importing API specifications from various sources:
|
|
6
|
+
* - OpenAPI/Swagger documents (URL, file, or pasted JSON/YAML)
|
|
7
|
+
* - Postman collections (URL, file, or pasted JSON)
|
|
8
|
+
* - cURL commands (automatically redirects to cURL import command)
|
|
9
|
+
*
|
|
10
|
+
* Supports watch mode for URL imports to automatically update when content changes.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <CommandPaletteImport
|
|
14
|
+
* :workspaceStore="workspaceStore"
|
|
15
|
+
* @close="handleClose"
|
|
16
|
+
* @back="handleBack"
|
|
17
|
+
* @open-command="handleOpenCommand"
|
|
18
|
+
* />
|
|
19
|
+
*/
|
|
20
|
+
declare const _default: import("vue").DefineComponent<{
|
|
21
|
+
/** The workspace store for adding documents */
|
|
22
|
+
workspaceStore: WorkspaceStore;
|
|
23
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
|
|
24
|
+
[x: string]: any;
|
|
25
|
+
} & {
|
|
26
|
+
[x: string]: any;
|
|
27
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
28
|
+
/** The workspace store for adding documents */
|
|
29
|
+
workspaceStore: WorkspaceStore;
|
|
30
|
+
}> & Readonly<{
|
|
31
|
+
[x: `on${Capitalize<any>}`]: ((...args: any) => any) | undefined;
|
|
32
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
33
|
+
export default _default;
|
|
34
|
+
//# sourceMappingURL=CommandPaletteImport.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteImport.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImport.vue"],"names":[],"mappings":"AAmYA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAmBpE;;;;;;;;;;;;;;;;;GAiBG;;IAMD,+CAA+C;oBAC/B,cAAc;;;;;;IAD9B,+CAA+C;oBAC/B,cAAc;;;;AANhC,wBAogBC"}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import { defineComponent as z, ref as L, computed as k, watch as J, createBlock as S, openBlock as a, unref as l, withCtx as m, createElementBlock as d, Fragment as p, createElementVNode as C, createCommentVNode as X, createVNode as v, createTextVNode as r, toDisplayString as P } from "vue";
|
|
2
|
+
import { useLoadingState as Y, ScalarButton as R, ScalarCodeBlock as G, ScalarIcon as H, ScalarTooltip as K } from "@scalar/components";
|
|
3
|
+
import { normalize as Q } from "@scalar/openapi-parser";
|
|
4
|
+
import { generateUniqueValue as Z } from "@scalar/workspace-store/helpers/generate-unique-value";
|
|
5
|
+
import { useRouter as ee } from "vue-router";
|
|
6
|
+
import { getOpenApiDocumentDetails as te } from "../helpers/get-openapi-document-details.js";
|
|
7
|
+
import { getOpenApiFromPostman as oe } from "../helpers/get-openapi-from-postman.js";
|
|
8
|
+
import { getPostmanDocumentDetails as ae } from "../helpers/get-postman-document-details.js";
|
|
9
|
+
import { isPostmanCollection as V } from "../helpers/is-postman-collection.js";
|
|
10
|
+
import { isUrl as F } from "../../../helpers/is-url.js";
|
|
11
|
+
import { slugify as ne } from "../../../helpers/slugify.js";
|
|
12
|
+
import se from "./CommandActionForm.vue.js";
|
|
13
|
+
import le from "./CommandActionInput.vue.js";
|
|
14
|
+
import re from "./WatchModeToggle.vue.js";
|
|
15
|
+
import { useFileDialog as ie } from "../../../../hooks/useFileDialog.js";
|
|
16
|
+
const ce = { class: "flex justify-between" }, ue = { class: "flex w-full flex-row items-center justify-between gap-3" }, me = {
|
|
17
|
+
name: "CommandPaletteImport"
|
|
18
|
+
}, Ie = /* @__PURE__ */ z({
|
|
19
|
+
...me,
|
|
20
|
+
props: {
|
|
21
|
+
workspaceStore: {}
|
|
22
|
+
},
|
|
23
|
+
emits: ["close", "back", "open-command"],
|
|
24
|
+
setup(g, { emit: T }) {
|
|
25
|
+
const w = T, E = 100, b = "document", O = ee(), y = Y(), o = L(""), x = L(!0), i = k(() => F(o.value)), n = k(() => V(o.value) ? ae(o.value) : te(o.value)), U = k(
|
|
26
|
+
() => n.value ? n.value.type : "json"
|
|
27
|
+
), _ = k(() => !o.value.trim());
|
|
28
|
+
J(i, (e) => {
|
|
29
|
+
x.value = e;
|
|
30
|
+
});
|
|
31
|
+
const j = (e) => !Object.keys(g.workspaceStore.workspace.documents).includes(e), h = async (e) => await Z({
|
|
32
|
+
defaultValue: e,
|
|
33
|
+
validation: j,
|
|
34
|
+
maxRetries: E,
|
|
35
|
+
transformation: ne
|
|
36
|
+
}), q = (e) => typeof e.info == "object" && e.info !== null && "title" in e.info && typeof e.info.title == "string" ? e.info.title : b, A = async (e) => {
|
|
37
|
+
if (F(e)) {
|
|
38
|
+
const s = await h(b);
|
|
39
|
+
return s ? { success: await g.workspaceStore.addDocument({
|
|
40
|
+
name: s,
|
|
41
|
+
url: e,
|
|
42
|
+
meta: {
|
|
43
|
+
"x-scalar-watch-mode": x.value
|
|
44
|
+
}
|
|
45
|
+
}), name: s } : (console.error("Failed to generate a unique name"), { success: !1 });
|
|
46
|
+
}
|
|
47
|
+
if (V(e)) {
|
|
48
|
+
const s = oe(e), f = s.info?.title ?? b, D = await h(f);
|
|
49
|
+
return D ? { success: await g.workspaceStore.addDocument({
|
|
50
|
+
name: D,
|
|
51
|
+
document: s
|
|
52
|
+
}), name: D } : (console.error("Failed to generate a unique name"), { success: !1 });
|
|
53
|
+
}
|
|
54
|
+
const t = Q(e), c = q(t), u = await h(c);
|
|
55
|
+
return u ? { success: await g.workspaceStore.addDocument({
|
|
56
|
+
name: u,
|
|
57
|
+
document: t
|
|
58
|
+
}), name: u } : (console.error("Failed to generate a unique name"), { success: !1 });
|
|
59
|
+
}, I = (e) => {
|
|
60
|
+
O.push({
|
|
61
|
+
name: "document.overview",
|
|
62
|
+
params: { documentSlug: e }
|
|
63
|
+
});
|
|
64
|
+
}, { open: B } = ie({
|
|
65
|
+
onChange: (e) => {
|
|
66
|
+
const [t] = e ?? [];
|
|
67
|
+
if (!t)
|
|
68
|
+
return;
|
|
69
|
+
const c = async (N) => {
|
|
70
|
+
const s = N.target?.result, f = await A(s);
|
|
71
|
+
f.success && I(f.name), w("close");
|
|
72
|
+
}, u = new FileReader();
|
|
73
|
+
u.onload = c, u.readAsText(t);
|
|
74
|
+
},
|
|
75
|
+
multiple: !1,
|
|
76
|
+
accept: ".json,.yaml,.yml"
|
|
77
|
+
}), M = async () => {
|
|
78
|
+
y.start();
|
|
79
|
+
const e = await A(o.value);
|
|
80
|
+
e.success ? (await y.clear(), I(e.name)) : await y.invalidate(), w("close");
|
|
81
|
+
}, W = (e) => {
|
|
82
|
+
if (e.trim().toLowerCase().startsWith("curl"))
|
|
83
|
+
return w("open-command", "import-curl-command", { curl: e });
|
|
84
|
+
o.value = e;
|
|
85
|
+
}, $ = (e) => {
|
|
86
|
+
w("back", e);
|
|
87
|
+
};
|
|
88
|
+
return (e, t) => (a(), S(se, {
|
|
89
|
+
disabled: _.value,
|
|
90
|
+
loader: l(y),
|
|
91
|
+
onSubmit: M
|
|
92
|
+
}, {
|
|
93
|
+
options: m(() => [
|
|
94
|
+
C("div", ue, [
|
|
95
|
+
v(l(R), {
|
|
96
|
+
class: "hover:bg-b-2 relative max-h-8 gap-1.5 p-2 text-xs",
|
|
97
|
+
variant: "outlined",
|
|
98
|
+
onClick: l(B)
|
|
99
|
+
}, {
|
|
100
|
+
default: m(() => [
|
|
101
|
+
t[4] || (t[4] = r(" JSON, or YAML File ", -1)),
|
|
102
|
+
v(l(H), {
|
|
103
|
+
class: "text-c-3",
|
|
104
|
+
icon: "Upload",
|
|
105
|
+
size: "md"
|
|
106
|
+
})
|
|
107
|
+
]),
|
|
108
|
+
_: 1
|
|
109
|
+
}, 8, ["onClick"]),
|
|
110
|
+
v(l(K), {
|
|
111
|
+
content: i.value ? "Watch mode automatically updates the API client when the OpenAPI URL content changes, ensuring your client remains up-to-date." : "Watch mode is only available for URL imports. When enabled it automatically updates the API client when the OpenAPI URL content changes.",
|
|
112
|
+
placement: "bottom"
|
|
113
|
+
}, {
|
|
114
|
+
default: m(() => [
|
|
115
|
+
v(re, {
|
|
116
|
+
modelValue: x.value,
|
|
117
|
+
"onUpdate:modelValue": t[1] || (t[1] = (c) => x.value = c),
|
|
118
|
+
disabled: !i.value
|
|
119
|
+
}, null, 8, ["modelValue", "disabled"])
|
|
120
|
+
]),
|
|
121
|
+
_: 1
|
|
122
|
+
}, 8, ["content"])
|
|
123
|
+
])
|
|
124
|
+
]),
|
|
125
|
+
submit: m(() => [
|
|
126
|
+
t[5] || (t[5] = r(" Import ", -1)),
|
|
127
|
+
i.value ? (a(), d(p, { key: 0 }, [
|
|
128
|
+
r("from URL")
|
|
129
|
+
], 64)) : n.value && U.value ? (a(), d(p, { key: 1 }, [
|
|
130
|
+
n.value.title ? (a(), d(p, { key: 0 }, [
|
|
131
|
+
r(' "' + P(n.value.title) + '" ', 1)
|
|
132
|
+
], 64)) : (a(), d(p, { key: 1 }, [
|
|
133
|
+
r(P(n.value.version), 1)
|
|
134
|
+
], 64))
|
|
135
|
+
], 64)) : (a(), d(p, { key: 2 }, [
|
|
136
|
+
r("Collection")
|
|
137
|
+
], 64))
|
|
138
|
+
]),
|
|
139
|
+
default: m(() => [
|
|
140
|
+
!n.value || i.value ? (a(), S(le, {
|
|
141
|
+
key: 0,
|
|
142
|
+
modelValue: o.value,
|
|
143
|
+
placeholder: "OpenAPI/Swagger/Postman URL or cURL",
|
|
144
|
+
onDelete: $,
|
|
145
|
+
"onUpdate:modelValue": W
|
|
146
|
+
}, null, 8, ["modelValue"])) : (a(), d(p, { key: 1 }, [
|
|
147
|
+
C("div", ce, [
|
|
148
|
+
t[3] || (t[3] = C("div", { class: "text-c-2 min-h-8 w-full py-2 pl-12 text-center text-xs" }, " Preview ", -1)),
|
|
149
|
+
v(l(R), {
|
|
150
|
+
class: "hover:bg-b-2 relative ml-auto max-h-8 gap-1.5 p-2 text-xs",
|
|
151
|
+
variant: "ghost",
|
|
152
|
+
onClick: t[0] || (t[0] = (c) => o.value = "")
|
|
153
|
+
}, {
|
|
154
|
+
default: m(() => [...t[2] || (t[2] = [
|
|
155
|
+
r(" Clear ", -1)
|
|
156
|
+
])]),
|
|
157
|
+
_: 1
|
|
158
|
+
})
|
|
159
|
+
]),
|
|
160
|
+
n.value && !i.value ? (a(), S(l(G), {
|
|
161
|
+
key: 0,
|
|
162
|
+
class: "bg-b-2 mt-1 max-h-[40dvh] rounded border px-2 py-1 text-sm",
|
|
163
|
+
content: o.value,
|
|
164
|
+
copy: !1,
|
|
165
|
+
lang: U.value
|
|
166
|
+
}, null, 8, ["content", "lang"])) : X("", !0)
|
|
167
|
+
], 64))
|
|
168
|
+
]),
|
|
169
|
+
_: 1
|
|
170
|
+
}, 8, ["disabled", "loader"]));
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
export {
|
|
174
|
+
Ie as default
|
|
175
|
+
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
3
|
+
/**
|
|
4
|
+
* Command Palette Import cURL Component
|
|
5
|
+
*
|
|
6
|
+
* Provides a form for importing API requests from cURL commands.
|
|
7
|
+
* Parses the cURL command to extract the HTTP method, URL, path, headers,
|
|
8
|
+
* and body, then creates a new operation in the selected document.
|
|
9
|
+
*
|
|
10
|
+
* Validates that no conflicting operation exists at the same path/method.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* <CommandPaletteImportCurl
|
|
14
|
+
* :workspaceStore="workspaceStore"
|
|
15
|
+
* :eventBus="eventBus"
|
|
16
|
+
* :curl="curlCommand"
|
|
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
|
+
/** The cURL command string to parse and import */
|
|
27
|
+
curl: string;
|
|
28
|
+
}, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
29
|
+
close: () => any;
|
|
30
|
+
back: (keyboardEvent: KeyboardEvent) => any;
|
|
31
|
+
}, string, import("vue").PublicProps, Readonly<{
|
|
32
|
+
/** The workspace store for accessing documents and operations */
|
|
33
|
+
workspaceStore: WorkspaceStore;
|
|
34
|
+
/** Event bus for emitting operation creation events */
|
|
35
|
+
eventBus: WorkspaceEventBus;
|
|
36
|
+
/** The cURL command string to parse and import */
|
|
37
|
+
curl: string;
|
|
38
|
+
}> & Readonly<{
|
|
39
|
+
onClose?: (() => any) | undefined;
|
|
40
|
+
onBack?: ((keyboardEvent: KeyboardEvent) => any) | undefined;
|
|
41
|
+
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
42
|
+
export default _default;
|
|
43
|
+
//# sourceMappingURL=CommandPaletteImportCurl.vue.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommandPaletteImportCurl.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/command-palette/components/CommandPaletteImportCurl.vue"],"names":[],"mappings":"AAuOA,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;IAC3B,kDAAkD;UAC5C,MAAM;;;;;IALZ,iEAAiE;oBACjD,cAAc;IAC9B,uDAAuD;cAC7C,iBAAiB;IAC3B,kDAAkD;UAC5C,MAAM;;;;;AAPd,wBA2TC"}
|