@scalar/api-client 2.15.0 → 2.17.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 +150 -0
- package/dist/hooks/useResponseBody.js +6 -6
- package/dist/libs/errors.d.ts +1 -0
- package/dist/libs/errors.d.ts.map +1 -1
- package/dist/libs/errors.js +1 -0
- package/dist/libs/send-request/create-request-operation.d.ts.map +1 -1
- package/dist/libs/send-request/create-request-operation.js +41 -35
- package/dist/style.css +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +28 -38
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +84 -45
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -11
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +2 -2
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +28 -35
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts +10 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-body.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +22 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts +31 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +31 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts +3 -9
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +56 -0
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +10 -3
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js +46 -0
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +45 -0
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/build-request.js +66 -0
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +9 -0
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts +16 -0
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js +4 -0
- package/dist/v2/blocks/operation-block/helpers/get-delimiter.js +17 -0
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts +9 -3
- package/dist/v2/blocks/operation-block/helpers/get-example.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/get-example.js +21 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +53 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -0
- package/dist/v2/blocks/operation-block/helpers/send-request.js +120 -0
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +1 -1
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +89 -110
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +2 -2
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +8 -13
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +22 -28
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +19 -8
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +30 -24
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +12 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js +20 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts +10 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.d.ts.map +1 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js +4 -0
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts +14 -12
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +191 -169
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +10 -10
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +2 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +15 -19
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +2 -2
- package/dist/v2/blocks/operation-code-sample/index.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts.map +1 -1
- package/dist/v2/blocks/operation-code-sample/types.d.ts +16 -0
- package/dist/v2/blocks/operation-code-sample/types.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +15 -10
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +158 -125
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +2 -2
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +59 -50
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +8 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +127 -0
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue2.js +4 -0
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js +24 -23
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +1 -0
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +148 -149
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts +1 -0
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue2.js +28 -27
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts +3 -2
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +13 -3
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +4 -4
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +3 -3
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +41 -45
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.js +27 -27
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js +1 -1
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts +18 -0
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js +12 -0
- package/dist/v2/blocks/response-block/helpers/process-response-body.js +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +0 -2
- 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 +97 -87
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts +19 -0
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +24 -0
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +3 -2
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +59 -56
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +26 -24
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +44 -43
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts +4 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +7 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +4 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -2
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +7 -6
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +2 -2
- package/dist/v2/components/code-input/CodeInput.vue2.js +61 -59
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +2 -2
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js +44 -44
- package/dist/v2/components/resize/index.d.ts +0 -1
- package/dist/v2/components/resize/index.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +5 -5
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +49 -47
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.d.ts +3 -0
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js +128 -139
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +3 -3
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +2 -2
- package/dist/v2/features/app/components/AppSidebar.vue2.js +103 -80
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts +1 -1
- package/dist/v2/features/app/components/DesktopTabs.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/WebTopNav.vue.d.ts +1 -1
- package/dist/v2/features/app/components/WebTopNav.vue.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +2 -2
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/create-api-client-app.js +8 -8
- package/dist/v2/features/app/helpers/routes.d.ts +32 -6
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +25 -16
- package/dist/v2/{hooks/use-sidebar-state.d.ts → features/app/hooks/use-app-sidebar.d.ts} +10 -11
- package/dist/v2/features/app/hooks/use-app-sidebar.d.ts.map +1 -0
- package/dist/v2/{hooks/use-sidebar-state.js → features/app/hooks/use-app-sidebar.js} +19 -19
- package/dist/v2/features/app/hooks/use-document-watcher.d.ts.map +1 -0
- package/dist/v2/{hooks → features/app/hooks}/use-sync-path.d.ts +2 -2
- package/dist/v2/features/app/hooks/use-sync-path.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-sync-path.js +52 -0
- package/dist/v2/{hooks → features/app/hooks}/use-tabs.d.ts +2 -2
- package/dist/v2/features/app/hooks/use-tabs.d.ts.map +1 -0
- package/dist/v2/{hooks → features/app/hooks}/use-tabs.js +1 -1
- package/dist/v2/{hooks/use-workspace-client-events.d.ts → features/app/hooks/use-workspace-client-app-events.d.ts} +5 -5
- package/dist/v2/features/app/hooks/use-workspace-client-app-events.d.ts.map +1 -0
- package/dist/v2/{hooks/use-workspace-client-events.js → features/app/hooks/use-workspace-client-app-events.js} +48 -45
- package/dist/v2/features/app/hooks/use-workspace-selector.d.ts.map +1 -0
- package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.js +1 -1
- package/dist/v2/features/collection/DocumentCollection.vue.js +92 -2
- package/dist/v2/features/collection/DocumentCollection.vue2.js +2 -91
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +42 -2
- package/dist/v2/features/collection/WorkspaceCollection.vue2.js +2 -41
- package/dist/v2/features/collection/components/Authentication.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.js +2 -2
- package/dist/v2/features/collection/components/Authentication.vue2.js +14 -12
- package/dist/v2/features/collection/components/Cookies.vue.js +30 -1
- package/dist/v2/features/collection/components/Cookies.vue2.js +1 -29
- package/dist/v2/features/collection/components/Environment.vue.js +32 -1
- package/dist/v2/features/collection/components/Environment.vue2.js +1 -31
- package/dist/v2/features/collection/components/Overview.vue2.js +5 -4
- package/dist/v2/features/collection/components/Servers.vue.js +142 -2
- package/dist/v2/features/collection/components/Servers.vue2.js +2 -141
- package/dist/v2/features/collection/components/Settings.vue.js +58 -2
- package/dist/v2/features/collection/components/Settings.vue2.js +2 -57
- package/dist/v2/features/modal/Modal.vue.d.ts +23 -1
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js +1 -1
- package/dist/v2/features/modal/Modal.vue2.js +118 -31
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +18 -32
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts.map +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +46 -26
- package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts +55 -0
- package/dist/v2/features/modal/helpers/resolve-route-parameters.d.ts.map +1 -0
- package/dist/v2/features/modal/helpers/resolve-route-parameters.js +29 -0
- package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +42 -0
- package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts.map +1 -0
- package/dist/v2/features/modal/hooks/use-modal-sidebar.js +93 -0
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts +18 -0
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.d.ts.map +1 -0
- package/dist/v2/features/modal/hooks/use-workspace-client-modal-events.js +30 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js +59 -28
- package/dist/v2/features/operation/helpers/get-operation-header.d.ts +17 -0
- package/dist/v2/features/operation/helpers/get-operation-header.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/get-operation-header.js +12 -0
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts +1 -1
- package/dist/v2/features/operation/helpers/get-security-requirements.d.ts.map +1 -1
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts +7 -0
- package/dist/v2/features/operation/helpers/get-selected-security.d.ts.map +1 -0
- package/dist/v2/features/operation/helpers/get-selected-security.js +19 -0
- package/dist/v2/features/operation/index.d.ts +0 -1
- package/dist/v2/features/operation/index.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchModal.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchModal.vue.js +3 -3
- package/dist/v2/features/search/components/SearchModal.vue2.js +45 -44
- package/dist/v2/helpers/generate-location-id.d.ts +19 -0
- package/dist/v2/helpers/generate-location-id.d.ts.map +1 -0
- package/dist/v2/helpers/generate-location-id.js +10 -0
- package/dist/v2/helpers/get-active-environment.d.ts +5 -0
- package/dist/v2/helpers/get-active-environment.d.ts.map +1 -0
- package/dist/v2/helpers/get-active-environment.js +22 -0
- package/dist/v2/helpers/get-tab-details.d.ts +2 -2
- package/dist/v2/helpers/get-tab-details.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +1 -1
- package/dist/v2/helpers/plugins.d.ts +59 -0
- package/dist/v2/helpers/plugins.d.ts.map +1 -0
- package/dist/v2/helpers/plugins.js +11 -0
- package/dist/v2/hooks/use-scroll-lock.d.ts +28 -0
- package/dist/v2/hooks/use-scroll-lock.d.ts.map +1 -0
- package/dist/v2/hooks/use-scroll-lock.js +21 -0
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +2 -0
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts.map +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +0 -1
- package/dist/views/Request/RequestSection/RequestAuth/index.d.ts.map +1 -1
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +1 -1
- package/package.json +18 -18
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts +0 -7
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.d.ts.map +0 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/get-example-value.js +0 -28
- package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts +0 -6
- package/dist/v2/blocks/request-block/helpers/get-parameter-example.d.ts.map +0 -1
- package/dist/v2/blocks/request-block/helpers/get-parameter-example.js +0 -12
- package/dist/v2/hooks/use-document-watcher.d.ts.map +0 -1
- package/dist/v2/hooks/use-sidebar-state.d.ts.map +0 -1
- package/dist/v2/hooks/use-sync-path.d.ts.map +0 -1
- package/dist/v2/hooks/use-sync-path.js +0 -51
- package/dist/v2/hooks/use-tabs.d.ts.map +0 -1
- package/dist/v2/hooks/use-workspace-client-events.d.ts.map +0 -1
- package/dist/v2/hooks/use-workspace-selector.d.ts.map +0 -1
- package/dist/v2/plugins.d.ts +0 -44
- package/dist/v2/plugins.d.ts.map +0 -1
- /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.d.ts +0 -0
- /package/dist/v2/{hooks → features/app/hooks}/use-document-watcher.js +0 -0
- /package/dist/v2/{hooks → features/app/hooks}/use-workspace-selector.d.ts +0 -0
|
@@ -1,4 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { defineComponent as u, createBlock as t, openBlock as a, unref as r } from "vue";
|
|
2
|
+
import { useRouter as i } from "vue-router";
|
|
3
|
+
import p from "../../settings/DocumentSettings.vue.js";
|
|
4
|
+
import h from "../../settings/CollectionSettings.vue.js";
|
|
5
|
+
const y = /* @__PURE__ */ u({
|
|
6
|
+
__name: "Settings",
|
|
7
|
+
props: {
|
|
8
|
+
documentSlug: {},
|
|
9
|
+
document: {},
|
|
10
|
+
eventBus: {},
|
|
11
|
+
layout: {},
|
|
12
|
+
path: {},
|
|
13
|
+
method: {},
|
|
14
|
+
exampleName: {},
|
|
15
|
+
environment: {},
|
|
16
|
+
workspaceStore: {},
|
|
17
|
+
activeWorkspace: {},
|
|
18
|
+
plugins: {},
|
|
19
|
+
collectionType: {}
|
|
20
|
+
},
|
|
21
|
+
setup(o) {
|
|
22
|
+
const c = (e) => {
|
|
23
|
+
o.eventBus.emit("document:update:watch-mode", e);
|
|
24
|
+
}, n = (e) => {
|
|
25
|
+
o.eventBus.emit("workspace:update:theme", e);
|
|
26
|
+
}, m = (e) => {
|
|
27
|
+
o.eventBus.emit("workspace:update:active-proxy", e);
|
|
28
|
+
}, d = (e) => {
|
|
29
|
+
o.eventBus.emit("workspace:update:color-mode", e);
|
|
30
|
+
}, l = i(), s = () => {
|
|
31
|
+
o.workspaceStore.deleteDocument(o.documentSlug), l.push({
|
|
32
|
+
name: "workspace.environment",
|
|
33
|
+
params: {
|
|
34
|
+
workspaceSlug: o.activeWorkspace.id
|
|
35
|
+
}
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
return (e, k) => e.collectionType === "document" ? (a(), t(r(p), {
|
|
39
|
+
key: 0,
|
|
40
|
+
documentUrl: e.document?.["x-scalar-original-source-url"],
|
|
41
|
+
isDraftDocument: e.documentSlug === "drafts",
|
|
42
|
+
title: e.document?.info.title ?? "",
|
|
43
|
+
watchMode: e.document?.["x-scalar-watch-mode"] ?? !0,
|
|
44
|
+
"onDelete:document": s,
|
|
45
|
+
"onUpdate:watchMode": c
|
|
46
|
+
}, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (a(), t(r(h), {
|
|
47
|
+
key: 1,
|
|
48
|
+
activeProxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"],
|
|
49
|
+
activeThemeId: e.workspaceStore.workspace["x-scalar-theme"] ?? "default",
|
|
50
|
+
colorMode: e.workspaceStore.workspace["x-scalar-color-mode"] ?? "system",
|
|
51
|
+
customProxyUrl: e.workspaceStore.config["x-scalar-reference-config"].settings.proxyUrl,
|
|
52
|
+
"onUpdate:colorMode": d,
|
|
53
|
+
"onUpdate:proxyUrl": m,
|
|
54
|
+
"onUpdate:themeId": n
|
|
55
|
+
}, null, 8, ["activeProxyUrl", "activeThemeId", "colorMode", "customProxyUrl"]));
|
|
56
|
+
}
|
|
57
|
+
});
|
|
2
58
|
export {
|
|
3
|
-
|
|
59
|
+
y as default
|
|
4
60
|
};
|
|
@@ -1,59 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { useRouter as i } from "vue-router";
|
|
3
|
-
import p from "../../settings/DocumentSettings.vue.js";
|
|
4
|
-
import h from "../../settings/CollectionSettings.vue.js";
|
|
5
|
-
const y = /* @__PURE__ */ u({
|
|
6
|
-
__name: "Settings",
|
|
7
|
-
props: {
|
|
8
|
-
documentSlug: {},
|
|
9
|
-
document: {},
|
|
10
|
-
eventBus: {},
|
|
11
|
-
layout: {},
|
|
12
|
-
path: {},
|
|
13
|
-
method: {},
|
|
14
|
-
exampleName: {},
|
|
15
|
-
environment: {},
|
|
16
|
-
workspaceStore: {},
|
|
17
|
-
activeWorkspace: {},
|
|
18
|
-
collectionType: {}
|
|
19
|
-
},
|
|
20
|
-
setup(o) {
|
|
21
|
-
const c = (e) => {
|
|
22
|
-
o.eventBus.emit("document:update:watch-mode", e);
|
|
23
|
-
}, n = (e) => {
|
|
24
|
-
o.eventBus.emit("workspace:update:theme", e);
|
|
25
|
-
}, m = (e) => {
|
|
26
|
-
o.eventBus.emit("workspace:update:active-proxy", e);
|
|
27
|
-
}, d = (e) => {
|
|
28
|
-
o.eventBus.emit("workspace:update:color-mode", e);
|
|
29
|
-
}, l = i(), s = () => {
|
|
30
|
-
o.workspaceStore.deleteDocument(o.documentSlug), l.push({
|
|
31
|
-
name: "workspace.environment",
|
|
32
|
-
params: {
|
|
33
|
-
workspaceSlug: o.activeWorkspace.id
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
};
|
|
37
|
-
return (e, k) => e.collectionType === "document" ? (a(), t(r(p), {
|
|
38
|
-
key: 0,
|
|
39
|
-
documentUrl: e.document?.["x-scalar-original-source-url"],
|
|
40
|
-
isDraftDocument: e.documentSlug === "drafts",
|
|
41
|
-
title: e.document?.info.title ?? "",
|
|
42
|
-
watchMode: e.document?.["x-scalar-watch-mode"] ?? !0,
|
|
43
|
-
"onDelete:document": s,
|
|
44
|
-
"onUpdate:watchMode": c
|
|
45
|
-
}, null, 8, ["documentUrl", "isDraftDocument", "title", "watchMode"])) : (a(), t(r(h), {
|
|
46
|
-
key: 1,
|
|
47
|
-
activeProxyUrl: e.workspaceStore.workspace["x-scalar-active-proxy"],
|
|
48
|
-
activeThemeId: e.workspaceStore.workspace["x-scalar-theme"] ?? "default",
|
|
49
|
-
colorMode: e.workspaceStore.workspace["x-scalar-color-mode"] ?? "system",
|
|
50
|
-
customProxyUrl: e.workspaceStore.config["x-scalar-reference-config"].settings.proxyUrl,
|
|
51
|
-
"onUpdate:colorMode": d,
|
|
52
|
-
"onUpdate:proxyUrl": m,
|
|
53
|
-
"onUpdate:themeId": n
|
|
54
|
-
}, null, 8, ["activeProxyUrl", "activeThemeId", "colorMode", "customProxyUrl"]));
|
|
55
|
-
}
|
|
56
|
-
});
|
|
1
|
+
import f from "./Settings.vue.js";
|
|
57
2
|
export {
|
|
58
|
-
|
|
3
|
+
f as default
|
|
59
4
|
};
|
|
@@ -1,14 +1,36 @@
|
|
|
1
1
|
import { type ModalState } from '@scalar/components';
|
|
2
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
3
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
|
+
import type { WorkspaceDocument } from '@scalar/workspace-store/schemas';
|
|
5
|
+
import { type ComputedRef } from 'vue';
|
|
6
|
+
import { type UseModalSidebarReturn } from '../../../v2/features/modal/hooks/use-modal-sidebar.js';
|
|
7
|
+
import type { ClientPlugin } from '../../../v2/helpers/plugins.js';
|
|
3
8
|
export type ModalProps = {
|
|
9
|
+
/** The workspace store must be initialized and passed in */
|
|
4
10
|
workspaceStore: WorkspaceStore;
|
|
11
|
+
/** The document must be initialized and passed in */
|
|
12
|
+
document: ComputedRef<WorkspaceDocument | null>;
|
|
13
|
+
/** The path must be initialized and passed in */
|
|
14
|
+
path: ComputedRef<string | undefined>;
|
|
15
|
+
/** The method must be initialized and passed in */
|
|
16
|
+
method: ComputedRef<HttpMethod | undefined>;
|
|
17
|
+
/** The example name must be initialized and passed in */
|
|
18
|
+
exampleName: ComputedRef<string | undefined>;
|
|
19
|
+
/** Controls the visibility of the modal */
|
|
5
20
|
modalState: ModalState;
|
|
21
|
+
/** The sidebar state must be initialized and passed in */
|
|
22
|
+
sidebarState: UseModalSidebarReturn;
|
|
23
|
+
/** Api client plugins to include in the modal */
|
|
24
|
+
plugins?: ClientPlugin[];
|
|
6
25
|
};
|
|
7
26
|
/**
|
|
8
27
|
* Scalar Api Client Modal
|
|
9
28
|
*
|
|
10
29
|
* This component is used to render the API Client Modal
|
|
11
30
|
*/
|
|
12
|
-
declare const _default: import("vue").DefineComponent<ModalProps, {
|
|
31
|
+
declare const _default: import("vue").DefineComponent<ModalProps, {
|
|
32
|
+
sidebarWidth: ComputedRef<number>;
|
|
33
|
+
environment: ComputedRef<import("@scalar/workspace-store/schemas/extensions/document/x-scalar-environments").XScalarEnvironment>;
|
|
34
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ModalProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
13
35
|
export default _default;
|
|
14
36
|
//# sourceMappingURL=Modal.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/Modal.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Modal.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/modal/Modal.vue"],"names":[],"mappings":"AAyXA,OAAO,EAGL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iCAAiC,CAAA;AAExE,OAAO,EAQL,KAAK,WAAW,EACjB,MAAM,KAAK,CAAA;AAIZ,OAAO,EAAE,KAAK,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAGxF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAQxD,MAAM,MAAM,UAAU,GAAG;IACvB,4DAA4D;IAC5D,cAAc,EAAE,cAAc,CAAA;IAC9B,qDAAqD;IACrD,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,iDAAiD;IACjD,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrC,mDAAmD;IACnD,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC3C,yDAAyD;IACzD,WAAW,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5C,2CAA2C;IAC3C,UAAU,EAAE,UAAU,CAAA;IACtB,0DAA0D;IAC1D,YAAY,EAAE,qBAAqB,CAAA;IACnC,iDAAiD;IACjD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;CACzB,CAAA;AAED;;;;GAIG;;;;;AACH,wBAgWC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import o from "./Modal.vue2.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
4
|
-
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
4
|
+
const m = /* @__PURE__ */ t(o, [["__scopeId", "data-v-3209f6ba"]]);
|
|
5
5
|
export {
|
|
6
6
|
m as default
|
|
7
7
|
};
|
|
@@ -1,56 +1,143 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { addScalarClassesToHeadless as
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { defineComponent as x, ref as w, useId as E, watch as I, nextTick as N, onBeforeMount as D, onBeforeUnmount as F, computed as k, withDirectives as h, createElementBlock as u, openBlock as c, createElementVNode as d, unref as o, createVNode as s, withCtx as U, vShow as b } from "vue";
|
|
2
|
+
import { addScalarClassesToHeadless as V, ScalarTeleportRoot as $ } from "@scalar/components";
|
|
3
|
+
import { ScalarToasts as A } from "@scalar/use-toasts";
|
|
4
|
+
import { createWorkspaceEventBus as M } from "@scalar/workspace-store/events";
|
|
5
|
+
import { useFocusTrap as H } from "@vueuse/integrations/useFocusTrap";
|
|
6
|
+
import L from "../operation/Operation.vue.js";
|
|
7
|
+
import { getActiveEnvironment as z } from "../../helpers/get-active-environment.js";
|
|
8
|
+
import { useColorMode as O } from "../../hooks/use-color-mode.js";
|
|
9
|
+
import { useGlobalHotKeys as R } from "../../hooks/use-global-hot-keys.js";
|
|
10
|
+
import { useScrollLock as j } from "../../hooks/use-scroll-lock.js";
|
|
11
|
+
import { useWorkspaceClientModalEvents as q } from "./hooks/use-workspace-client-modal-events.js";
|
|
12
|
+
import G from "../../components/sidebar/SidebarToggle.vue.js";
|
|
13
|
+
import K from "../../components/sidebar/Sidebar.vue.js";
|
|
14
|
+
const P = { class: "scalar scalar-app" }, J = { class: "scalar-container" }, Q = ["id"], X = {
|
|
15
|
+
key: 0,
|
|
16
|
+
class: "relative flex flex-1"
|
|
17
|
+
}, Y = {
|
|
18
|
+
key: 1,
|
|
19
|
+
class: "flex h-full w-full items-center justify-center"
|
|
20
|
+
}, Z = {}, me = /* @__PURE__ */ x({
|
|
21
|
+
...Z,
|
|
6
22
|
__name: "Modal",
|
|
7
23
|
props: {
|
|
8
24
|
workspaceStore: {},
|
|
9
|
-
|
|
25
|
+
document: {},
|
|
26
|
+
path: {},
|
|
27
|
+
method: {},
|
|
28
|
+
exampleName: {},
|
|
29
|
+
modalState: {},
|
|
30
|
+
sidebarState: {},
|
|
31
|
+
plugins: { default: () => [] }
|
|
10
32
|
},
|
|
11
|
-
setup(
|
|
12
|
-
|
|
33
|
+
setup(a, { expose: y }) {
|
|
34
|
+
typeof window < "u" && (window.dataDumpWorkspace = () => a.workspaceStore);
|
|
35
|
+
const l = M({
|
|
36
|
+
debug: !1
|
|
37
|
+
});
|
|
38
|
+
O({ workspaceStore: a.workspaceStore });
|
|
39
|
+
const m = {
|
|
40
|
+
name: "default",
|
|
41
|
+
id: "default"
|
|
42
|
+
}, n = w(!0);
|
|
43
|
+
q({
|
|
44
|
+
eventBus: l,
|
|
45
|
+
document: a.document,
|
|
46
|
+
workspaceStore: a.workspaceStore,
|
|
47
|
+
isSidebarOpen: n,
|
|
48
|
+
sidebarState: a.sidebarState,
|
|
49
|
+
modalState: a.modalState
|
|
50
|
+
}), R(l, "modal");
|
|
51
|
+
const p = w(null), f = E(), { activate: B, deactivate: g } = H(p, {
|
|
13
52
|
allowOutsideClick: !0,
|
|
14
|
-
fallbackFocus: `#${
|
|
15
|
-
}),
|
|
16
|
-
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
() =>
|
|
53
|
+
fallbackFocus: `#${f}`
|
|
54
|
+
}), v = () => {
|
|
55
|
+
g(), l.emit("operation:cancel:request");
|
|
56
|
+
}, T = j(() => typeof window < "u" ? window.document.body : null);
|
|
57
|
+
I(
|
|
58
|
+
() => a.modalState.open,
|
|
20
59
|
(e) => {
|
|
21
|
-
|
|
60
|
+
T.value = e, e ? B({ checkCanFocusTrap: () => N() }) : v();
|
|
22
61
|
}
|
|
23
|
-
),
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
62
|
+
), D(() => V()), F(() => v());
|
|
63
|
+
const W = 288, i = k(
|
|
64
|
+
() => a.workspaceStore?.workspace?.["x-scalar-sidebar-width"] ?? W
|
|
65
|
+
), C = (e) => a.workspaceStore?.update("x-scalar-sidebar-width", e), S = k(
|
|
66
|
+
() => z(a.workspaceStore, a.document.value)
|
|
67
|
+
);
|
|
68
|
+
return y({
|
|
69
|
+
sidebarWidth: i,
|
|
70
|
+
environment: S
|
|
71
|
+
}), (e, t) => h((c(), u("div", P, [
|
|
72
|
+
d("div", J, [
|
|
73
|
+
d("div", {
|
|
74
|
+
id: o(f),
|
|
29
75
|
ref_key: "client",
|
|
30
|
-
ref:
|
|
76
|
+
ref: p,
|
|
31
77
|
"aria-label": "API Client",
|
|
32
78
|
"aria-modal": "true",
|
|
33
79
|
class: "scalar-app-layout scalar-client flex",
|
|
34
80
|
role: "dialog",
|
|
35
81
|
tabindex: "-1"
|
|
36
82
|
}, [
|
|
37
|
-
|
|
38
|
-
default:
|
|
39
|
-
|
|
40
|
-
|
|
83
|
+
s(o($), null, {
|
|
84
|
+
default: U(() => [
|
|
85
|
+
s(o(A)),
|
|
86
|
+
e.document.value && e.path?.value && e.method?.value ? (c(), u("main", X, [
|
|
87
|
+
s(o(G), {
|
|
88
|
+
modelValue: n.value,
|
|
89
|
+
"onUpdate:modelValue": t[0] || (t[0] = (r) => n.value = r),
|
|
90
|
+
class: "absolute top-2 left-3 z-[10001]"
|
|
91
|
+
}, null, 8, ["modelValue"]),
|
|
92
|
+
h(s(o(K), {
|
|
93
|
+
sidebarWidth: i.value,
|
|
94
|
+
"onUpdate:sidebarWidth": [
|
|
95
|
+
t[1] || (t[1] = (r) => i.value = r),
|
|
96
|
+
C
|
|
97
|
+
],
|
|
98
|
+
activeWorkspace: m,
|
|
99
|
+
class: "z-[10000] h-full max-md:absolute! max-md:w-full!",
|
|
100
|
+
documents: [e.document.value],
|
|
101
|
+
eventBus: o(l),
|
|
102
|
+
isDroppable: () => !1,
|
|
103
|
+
layout: "modal",
|
|
104
|
+
sidebarState: e.sidebarState.state,
|
|
105
|
+
workspaces: [],
|
|
106
|
+
onSelectItem: e.sidebarState.handleSelectItem
|
|
107
|
+
}, null, 8, ["sidebarWidth", "documents", "eventBus", "sidebarState", "onSelectItem"]), [
|
|
108
|
+
[b, n.value]
|
|
109
|
+
]),
|
|
110
|
+
s(L, {
|
|
111
|
+
activeWorkspace: m,
|
|
112
|
+
class: "flex-1",
|
|
113
|
+
document: e.document.value,
|
|
114
|
+
documentSlug: e.document.value["x-scalar-navigation"]?.id ?? "",
|
|
115
|
+
environment: S.value,
|
|
116
|
+
eventBus: o(l),
|
|
117
|
+
exampleName: e.exampleName?.value,
|
|
118
|
+
layout: "modal",
|
|
119
|
+
method: e.method?.value,
|
|
120
|
+
path: e.path?.value,
|
|
121
|
+
plugins: e.plugins,
|
|
122
|
+
workspaceStore: e.workspaceStore
|
|
123
|
+
}, null, 8, ["document", "documentSlug", "environment", "eventBus", "exampleName", "method", "path", "plugins", "workspaceStore"])
|
|
124
|
+
])) : (c(), u("div", Y, [...t[3] || (t[3] = [
|
|
125
|
+
d("span", { class: "text-c-3" }, "No document selected", -1)
|
|
126
|
+
])]))
|
|
127
|
+
]),
|
|
41
128
|
_: 1
|
|
42
129
|
})
|
|
43
|
-
], 8,
|
|
44
|
-
|
|
130
|
+
], 8, Q),
|
|
131
|
+
d("div", {
|
|
45
132
|
class: "scalar-app-exit",
|
|
46
|
-
onClick: t[
|
|
133
|
+
onClick: t[2] || (t[2] = (r) => e.modalState.hide())
|
|
47
134
|
})
|
|
48
135
|
])
|
|
49
136
|
], 512)), [
|
|
50
|
-
[
|
|
137
|
+
[b, e.modalState.open]
|
|
51
138
|
]);
|
|
52
139
|
}
|
|
53
140
|
});
|
|
54
141
|
export {
|
|
55
|
-
|
|
142
|
+
me as default
|
|
56
143
|
};
|
|
@@ -1,53 +1,39 @@
|
|
|
1
1
|
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
2
|
+
import { type RoutePayload } from '../../../../v2/features/modal/helpers/resolve-route-parameters.js';
|
|
3
|
+
import type { ClientPlugin } from '../../../../v2/helpers/plugins.js';
|
|
2
4
|
export type CreateApiClientModalOptions = {
|
|
3
|
-
/** Element to mount the client modal to */
|
|
5
|
+
/** Element to mount the client modal to. */
|
|
4
6
|
el: HTMLElement | null;
|
|
5
7
|
/**
|
|
6
|
-
* Will attempt to mount the references immediately
|
|
7
|
-
* For SSR this may need to be disabled and handled manually on the client side
|
|
8
|
+
* Will attempt to mount the references immediately.
|
|
9
|
+
* For SSR this may need to be disabled and handled manually on the client side.
|
|
8
10
|
*/
|
|
9
11
|
mountOnInitialize?: boolean;
|
|
10
|
-
/** The workspace store must be initialized and passed in */
|
|
12
|
+
/** The workspace store must be initialized and passed in. */
|
|
11
13
|
workspaceStore: WorkspaceStore;
|
|
14
|
+
/** Api client plugins to include in the modal */
|
|
15
|
+
plugins?: ClientPlugin[];
|
|
12
16
|
};
|
|
13
|
-
/** Payload for routing and opening the API client modal */
|
|
14
|
-
type RoutePayload = {
|
|
15
|
-
path: string;
|
|
16
|
-
method: string;
|
|
17
|
-
example?: string;
|
|
18
|
-
documentSlug?: string;
|
|
19
|
-
};
|
|
20
|
-
export type ActiveEntities = Required<RoutePayload>;
|
|
21
17
|
/**
|
|
22
|
-
*
|
|
18
|
+
* Creates the API Client Modal.
|
|
23
19
|
*
|
|
24
|
-
* The
|
|
20
|
+
* The modal does not require a router. Instead, navigation is handled by setting
|
|
21
|
+
* active entities directly through the returned `route` function.
|
|
25
22
|
*/
|
|
26
|
-
export declare const createApiClientModal: ({ el, workspaceStore, mountOnInitialize }: CreateApiClientModalOptions) => {
|
|
27
|
-
/** The
|
|
23
|
+
export declare const createApiClientModal: ({ el, workspaceStore, mountOnInitialize, plugins, }: CreateApiClientModalOptions) => {
|
|
24
|
+
/** The Vue app instance for the modal. Use with caution. */
|
|
28
25
|
app: import("vue").App<Element>;
|
|
29
|
-
/** Open the
|
|
26
|
+
/** Open the modal and optionally navigate to a specific route. */
|
|
30
27
|
open: (payload?: RoutePayload) => void;
|
|
31
|
-
/** Mount the
|
|
28
|
+
/** Mount the modal to a given element. */
|
|
32
29
|
mount: (mountingEl?: HTMLElement | null) => void;
|
|
33
|
-
/**
|
|
34
|
-
route: (payload: RoutePayload) =>
|
|
35
|
-
|
|
36
|
-
method: string;
|
|
37
|
-
example: string;
|
|
38
|
-
documentSlug: string;
|
|
39
|
-
} & {
|
|
40
|
-
path: string;
|
|
41
|
-
method: string;
|
|
42
|
-
example: string;
|
|
43
|
-
documentSlug: string;
|
|
44
|
-
} & RoutePayload;
|
|
45
|
-
/** Controls the visibility of the modal */
|
|
30
|
+
/** Navigate to the specified path, method, and example. */
|
|
31
|
+
route: (payload: RoutePayload) => void;
|
|
32
|
+
/** Controls the visibility of the modal. */
|
|
46
33
|
modalState: {
|
|
47
34
|
open: boolean;
|
|
48
35
|
show: () => void;
|
|
49
36
|
hide: () => void;
|
|
50
37
|
};
|
|
51
38
|
};
|
|
52
|
-
export {};
|
|
53
39
|
//# sourceMappingURL=create-api-client-modal.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-api-client-modal.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/create-api-client-modal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;
|
|
1
|
+
{"version":3,"file":"create-api-client-modal.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/create-api-client-modal.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAGpE,OAAO,EAEL,KAAK,YAAY,EAElB,MAAM,sDAAsD,CAAA;AAG7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAKxD,MAAM,MAAM,2BAA2B,GAAG;IACxC,4CAA4C;IAC5C,EAAE,EAAE,WAAW,GAAG,IAAI,CAAA;IACtB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,6DAA6D;IAC7D,cAAc,EAAE,cAAc,CAAA;IAC9B,iDAAiD;IACjD,OAAO,CAAC,EAAE,YAAY,EAAE,CAAA;CACzB,CAAA;AAMD;;;;;GAKG;AACH,eAAO,MAAM,oBAAoB,GAAI,qDAKlC,2BAA2B;IAoE1B,4DAA4D;;IAE5D,kEAAkE;qBACjD,YAAY,KAAG,IAAI;IAMpC,0CAA0C;yBA1BjB,WAAW,GAAG,IAAI,KAAQ,IAAI;IA4BvD,2DAA2D;qBApErC,YAAY,KAAG,IAAI;IAsEzC,4CAA4C;;;;;;CAG/C,CAAA"}
|
|
@@ -1,18 +1,40 @@
|
|
|
1
|
-
import { useModal as
|
|
2
|
-
import { reactive as
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useModal as M } from "@scalar/components";
|
|
2
|
+
import { reactive as b, computed as t, createApp as P } from "vue";
|
|
3
|
+
import { resolveRouteParameters as A } from "./resolve-route-parameters.js";
|
|
4
|
+
import { useModalSidebar as C } from "../hooks/use-modal-sidebar.js";
|
|
5
|
+
import I from "../Modal.vue.js";
|
|
6
|
+
const N = ({
|
|
7
|
+
el: f,
|
|
8
|
+
workspaceStore: a,
|
|
9
|
+
mountOnInitialize: v = !0,
|
|
10
|
+
plugins: h
|
|
11
|
+
}) => {
|
|
12
|
+
const r = {
|
|
6
13
|
path: "default",
|
|
7
14
|
method: "default",
|
|
8
15
|
example: "default",
|
|
9
|
-
documentSlug:
|
|
10
|
-
},
|
|
11
|
-
|
|
12
|
-
|
|
16
|
+
documentSlug: a.workspace["x-scalar-active-document"] || "default"
|
|
17
|
+
}, m = b({ ...r }), c = (e) => {
|
|
18
|
+
Object.assign(m, r, e);
|
|
19
|
+
}, o = t(() => A(a, m)), s = t(() => o.value.documentSlug), u = t(() => o.value.path), d = t(() => o.value.method), i = t(() => o.value.example), g = t(() => a.workspace.documents[s.value ?? ""] ?? null), x = C({
|
|
20
|
+
workspaceStore: a,
|
|
21
|
+
documentSlug: s,
|
|
22
|
+
path: u,
|
|
23
|
+
method: d,
|
|
24
|
+
exampleName: i,
|
|
25
|
+
route: c
|
|
26
|
+
}), l = M(), n = P(I, {
|
|
27
|
+
workspaceStore: a,
|
|
28
|
+
document: g,
|
|
29
|
+
modalState: l,
|
|
30
|
+
sidebarState: x,
|
|
31
|
+
path: u,
|
|
32
|
+
method: d,
|
|
33
|
+
exampleName: i,
|
|
34
|
+
plugins: h
|
|
13
35
|
});
|
|
14
|
-
|
|
15
|
-
const
|
|
36
|
+
n.config.idPrefix = "scalar-client";
|
|
37
|
+
const p = (e = f) => {
|
|
16
38
|
if (!e) {
|
|
17
39
|
console.error(
|
|
18
40
|
"[@scalar/api-client] Could not create the API client Modal.",
|
|
@@ -21,25 +43,23 @@ const M = ({ el: n, workspaceStore: o, mountOnInitialize: l = !0 }) => {
|
|
|
21
43
|
);
|
|
22
44
|
return;
|
|
23
45
|
}
|
|
24
|
-
|
|
46
|
+
n.mount(e);
|
|
25
47
|
};
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
app: a,
|
|
31
|
-
/** Open the API client modal and optionally route to an example */
|
|
48
|
+
return v && p(), {
|
|
49
|
+
/** The Vue app instance for the modal. Use with caution. */
|
|
50
|
+
app: n,
|
|
51
|
+
/** Open the modal and optionally navigate to a specific route. */
|
|
32
52
|
open: (e) => {
|
|
33
|
-
|
|
53
|
+
l.open = !0, e && c(e);
|
|
34
54
|
},
|
|
35
|
-
/** Mount the
|
|
36
|
-
mount:
|
|
37
|
-
/**
|
|
38
|
-
route:
|
|
39
|
-
/** Controls the visibility of the modal */
|
|
40
|
-
modalState:
|
|
55
|
+
/** Mount the modal to a given element. */
|
|
56
|
+
mount: p,
|
|
57
|
+
/** Navigate to the specified path, method, and example. */
|
|
58
|
+
route: c,
|
|
59
|
+
/** Controls the visibility of the modal. */
|
|
60
|
+
modalState: l
|
|
41
61
|
};
|
|
42
62
|
};
|
|
43
63
|
export {
|
|
44
|
-
|
|
64
|
+
N as createApiClientModal
|
|
45
65
|
};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
3
|
+
import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
|
|
4
|
+
/** Payload for routing and opening the API client modal. */
|
|
5
|
+
export type RoutePayload = {
|
|
6
|
+
path: string;
|
|
7
|
+
method: HttpMethod;
|
|
8
|
+
example?: string;
|
|
9
|
+
documentSlug?: string;
|
|
10
|
+
};
|
|
11
|
+
/** Raw input values that may contain "default" placeholders. */
|
|
12
|
+
export type DefaultEntities = Record<keyof RoutePayload, string>;
|
|
13
|
+
/** Context for resolving route parameters from the workspace store. */
|
|
14
|
+
type ResolverContext = {
|
|
15
|
+
store: WorkspaceStore;
|
|
16
|
+
documentSlug: string | undefined;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the document slug from a raw input value.
|
|
20
|
+
*
|
|
21
|
+
* When "default" is specified and no document exists with that slug,
|
|
22
|
+
* we fall back to the active document or the first available document.
|
|
23
|
+
* This ensures a valid document is selected even when the caller does not know which documents exist.
|
|
24
|
+
*/
|
|
25
|
+
export declare const resolveDocumentSlug: (store: WorkspaceStore, slug: string | undefined) => string | undefined;
|
|
26
|
+
/**
|
|
27
|
+
* Resolves the path from a raw input value.
|
|
28
|
+
*
|
|
29
|
+
* When "default" is specified, returns the first available path in the document.
|
|
30
|
+
* This is useful for initial navigation when no specific path is requested.
|
|
31
|
+
*/
|
|
32
|
+
export declare const resolvePath: (ctx: ResolverContext, path: string | undefined) => string | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Resolves the HTTP method from a raw input value.
|
|
35
|
+
*
|
|
36
|
+
* When "default" is specified, returns the first valid HTTP method for the given path.
|
|
37
|
+
* This ensures we select a real method rather than metadata keys like "parameters" or "summary".
|
|
38
|
+
*/
|
|
39
|
+
export declare const resolveMethod: (ctx: ResolverContext, path: string | undefined, method: string | undefined) => HttpMethod | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Resolves the example name from a raw input value.
|
|
42
|
+
*
|
|
43
|
+
* When "default" is specified, returns the first available example name.
|
|
44
|
+
* Falls back to "default" when no examples exist, which signals to use the default request body.
|
|
45
|
+
*/
|
|
46
|
+
export declare const resolveExampleName: (ctx: ResolverContext, operation: TraversedEntry | undefined, exampleKey: string | undefined) => string;
|
|
47
|
+
/**
|
|
48
|
+
* Resolves all route parameters from raw input values to their actual values.
|
|
49
|
+
*
|
|
50
|
+
* This function handles "default" placeholders by looking up actual values from the workspace store.
|
|
51
|
+
* It ensures the modal can be opened even when the caller does not know specific paths, methods, or examples.
|
|
52
|
+
*/
|
|
53
|
+
export declare const resolveRouteParameters: (store: WorkspaceStore, params: DefaultEntities) => Partial<RoutePayload>;
|
|
54
|
+
export {};
|
|
55
|
+
//# sourceMappingURL=resolve-route-parameters.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve-route-parameters.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/helpers/resolve-route-parameters.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AAEnE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAoB,MAAM,4CAA4C,CAAA;AAElG,4DAA4D;AAC5D,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,UAAU,CAAA;IAClB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB,CAAA;AAED,gEAAgE;AAChE,MAAM,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,YAAY,EAAE,MAAM,CAAC,CAAA;AAEhE,uEAAuE;AACvE,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE,cAAc,CAAA;IACrB,YAAY,EAAE,MAAM,GAAG,SAAS,CAAA;CACjC,CAAA;AAWD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,cAAc,EAAE,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAS9F,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GAAI,KAAK,eAAe,EAAE,MAAM,MAAM,GAAG,SAAS,KAAG,MAAM,GAAG,SAYrF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,eAAe,EACpB,MAAM,MAAM,GAAG,SAAS,EACxB,QAAQ,MAAM,GAAG,SAAS,KACzB,UAAU,GAAG,SAaf,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAC7B,KAAK,eAAe,EACpB,WAAW,cAAc,GAAG,SAAS,EACrC,YAAY,MAAM,GAAG,SAAS,KAC7B,MAmBF,CAAA;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,OAAO,cAAc,EAAE,QAAQ,eAAe,KAAG,OAAO,CAAC,YAAY,CAkB3G,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { isHttpMethod as u } from "@scalar/helpers/http/is-http-method";
|
|
2
|
+
import { getOperationEntries as l } from "@scalar/workspace-store/navigation";
|
|
3
|
+
const p = (t) => t.type === "example", a = (t) => t.store.workspace.documents[t.documentSlug ?? ""], f = (t, e) => e !== "default" || t.workspace.documents[e] !== void 0 ? e : t.workspace["x-scalar-active-document"] || Object.keys(t.workspace.documents)[0], h = (t, e) => {
|
|
4
|
+
const n = a(t);
|
|
5
|
+
if (n)
|
|
6
|
+
return e === "default" ? Object.keys(n.paths ?? {})[0] : e;
|
|
7
|
+
}, v = (t, e, n) => {
|
|
8
|
+
const o = a(t);
|
|
9
|
+
if (!(!o || !e))
|
|
10
|
+
return n === "default" ? Object.keys(o.paths?.[e] ?? {}).find(u) : u(n) ? n : void 0;
|
|
11
|
+
}, x = (t, e, n) => {
|
|
12
|
+
if (!a(t) || e?.type !== "operation")
|
|
13
|
+
return "default";
|
|
14
|
+
const c = e.children?.filter(p) ?? [], r = c.find((s) => s.name === n);
|
|
15
|
+
return r ? r.name : n === "default" ? c[0]?.name ?? "default" : "default";
|
|
16
|
+
}, y = (t, e) => {
|
|
17
|
+
const n = f(t, e.documentSlug), o = { store: t, documentSlug: n }, c = h(o, e.path), r = v(o, c, e.method), s = a(o)?.["x-scalar-navigation"];
|
|
18
|
+
if (!s)
|
|
19
|
+
return { documentSlug: n, path: c, method: r, example: "default" };
|
|
20
|
+
const i = l(s).get(`${c}|${r}`)?.find((m) => m.type === "operation"), d = x(o, i, e.example);
|
|
21
|
+
return { documentSlug: n, path: c, method: r, example: d };
|
|
22
|
+
};
|
|
23
|
+
export {
|
|
24
|
+
f as resolveDocumentSlug,
|
|
25
|
+
x as resolveExampleName,
|
|
26
|
+
v as resolveMethod,
|
|
27
|
+
h as resolvePath,
|
|
28
|
+
y as resolveRouteParameters
|
|
29
|
+
};
|