@scalar/api-client 2.14.1 → 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 +176 -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 +81 -65
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +1 -23
- 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-block/components/Header.vue2.js +29 -38
- 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 +202 -160
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts +2 -0
- package/dist/v2/blocks/request-block/components/RequestBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +60 -51
- 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 +2 -2
- 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/RequestTable.vue.d.ts +2 -4
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +3 -2
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +146 -147
- 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/create-parameter-handlers.d.ts +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +21 -15
- 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 +4 -15
- 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 +117 -71
- 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 +16 -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 +81 -65
- 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 +9 -5
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js +51 -46
- 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 +130 -143
- 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 +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue2.js +216 -106
- 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/ItemDecorator.vue.d.ts +22 -0
- package/dist/v2/features/app/components/ItemDecorator.vue.d.ts.map +1 -0
- package/dist/v2/features/app/components/ItemDecorator.vue.js +138 -0
- package/dist/v2/features/app/components/ItemDecorator.vue2.js +4 -0
- 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/features/app/hooks/use-workspace-client-app-events.js +156 -0
- 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/command-palette/components/CommandPaletteExample.vue.d.ts +8 -0
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +76 -68
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts +8 -0
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +83 -75
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts +4 -0
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +32 -34
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +16 -0
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +24 -21
- 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/features/settings/DocumentSettings.vue.js +2 -2
- package/dist/v2/features/settings/DocumentSettings.vue2.js +1 -1
- 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/helpers/storage.d.ts.map +1 -1
- package/dist/v2/helpers/storage.js +5 -5
- 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 +19 -19
- 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-client-events.js +0 -112
- 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,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
|
+
};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { HttpMethod } from '@scalar/helpers/http/http-methods';
|
|
2
|
+
import { createSidebarState } from '@scalar/sidebar';
|
|
3
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
4
|
+
import type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation';
|
|
5
|
+
import { type ComputedRef } from 'vue';
|
|
6
|
+
import type { RoutePayload } from '../../../../v2/features/modal/helpers/resolve-route-parameters.js';
|
|
7
|
+
export type UseModalSidebarReturn = {
|
|
8
|
+
handleSelectItem: (id: string) => void;
|
|
9
|
+
state: ReturnType<typeof createSidebarState<TraversedEntry>>;
|
|
10
|
+
getEntryByLocation: (location: {
|
|
11
|
+
document: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
method?: HttpMethod;
|
|
14
|
+
example?: string;
|
|
15
|
+
}) => TraversedEntry | undefined;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* useSidebarState - Custom hook to manage the sidebar state and navigation logic in the Scalar API client
|
|
19
|
+
*
|
|
20
|
+
* This composable manages the sidebar structure, synchronizes selection state
|
|
21
|
+
* with the current route, and provides a handler for selecting sidebar items.
|
|
22
|
+
*
|
|
23
|
+
* Example usage:
|
|
24
|
+
*
|
|
25
|
+
* const { handleSelectItem, sidebarState } = useSidebarState({
|
|
26
|
+
* workspaceStore,
|
|
27
|
+
* workspaceSlug,
|
|
28
|
+
* documentSlug,
|
|
29
|
+
* path,
|
|
30
|
+
* method,
|
|
31
|
+
* exampleName,
|
|
32
|
+
* })
|
|
33
|
+
*/
|
|
34
|
+
export declare const useModalSidebar: ({ workspaceStore, documentSlug, path, method, exampleName, route, }: {
|
|
35
|
+
workspaceStore: WorkspaceStore | null;
|
|
36
|
+
documentSlug: ComputedRef<string | undefined>;
|
|
37
|
+
path: ComputedRef<string | undefined>;
|
|
38
|
+
method: ComputedRef<HttpMethod | undefined>;
|
|
39
|
+
exampleName: ComputedRef<string | undefined>;
|
|
40
|
+
route: (payload: RoutePayload) => void;
|
|
41
|
+
}) => UseModalSidebarReturn;
|
|
42
|
+
//# sourceMappingURL=use-modal-sidebar.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-modal-sidebar.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/hooks/use-modal-sidebar.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mCAAmC,CAAA;AACnE,OAAO,EAAE,kBAAkB,EAAuC,MAAM,iBAAiB,CAAA;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AAEpE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4CAA4C,CAAA;AAChF,OAAO,EAAE,KAAK,WAAW,EAA4B,MAAM,KAAK,CAAA;AAEhE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sDAAsD,CAAA;AAGxF,MAAM,MAAM,qBAAqB,GAAG;IAClC,gBAAgB,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACtC,KAAK,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,cAAc,CAAC,CAAC,CAAA;IAC5D,kBAAkB,EAAE,CAAC,QAAQ,EAAE;QAC7B,QAAQ,EAAE,MAAM,CAAA;QAChB,IAAI,CAAC,EAAE,MAAM,CAAA;QACb,MAAM,CAAC,EAAE,UAAU,CAAA;QACnB,OAAO,CAAC,EAAE,MAAM,CAAA;KACjB,KAAK,cAAc,GAAG,SAAS,CAAA;CACjC,CAAA;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,eAAe,GAAI,qEAO7B;IACD,cAAc,EAAE,cAAc,GAAG,IAAI,CAAA;IACrC,YAAY,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC7C,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IACrC,MAAM,EAAE,WAAW,CAAC,UAAU,GAAG,SAAS,CAAC,CAAA;IAC3C,WAAW,EAAE,WAAW,CAAC,MAAM,GAAG,SAAS,CAAC,CAAA;IAC5C,KAAK,EAAE,CAAC,OAAO,EAAE,YAAY,KAAK,IAAI,CAAA;CACvC,KAAG,qBAwJH,CAAA"}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import { createSidebarState as S, generateReverseIndex as v, getChildEntry as I } from "@scalar/sidebar";
|
|
2
|
+
import { getParentEntry as l } from "@scalar/workspace-store/navigation";
|
|
3
|
+
import { computed as h, toValue as p, watch as b } from "vue";
|
|
4
|
+
import { generateLocationId as m } from "../../../helpers/generate-location-id.js";
|
|
5
|
+
const k = ({
|
|
6
|
+
workspaceStore: u,
|
|
7
|
+
documentSlug: o,
|
|
8
|
+
path: x,
|
|
9
|
+
method: y,
|
|
10
|
+
exampleName: f,
|
|
11
|
+
route: E
|
|
12
|
+
}) => {
|
|
13
|
+
const s = h(
|
|
14
|
+
() => u?.workspace.documents[p(o) ?? ""]?.["x-scalar-navigation"]?.children ?? []
|
|
15
|
+
), t = S(s), i = h(
|
|
16
|
+
() => v({
|
|
17
|
+
items: s.value,
|
|
18
|
+
nestedKey: "children",
|
|
19
|
+
filter: (e) => e.type === "operation" || e.type === "example",
|
|
20
|
+
getId: (e) => {
|
|
21
|
+
const r = l("operation", e);
|
|
22
|
+
return m({
|
|
23
|
+
document: p(o) ?? "",
|
|
24
|
+
path: r?.path,
|
|
25
|
+
method: r?.method,
|
|
26
|
+
example: e.type === "example" ? e.name : void 0
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
})
|
|
30
|
+
), c = (e) => {
|
|
31
|
+
const r = i.value.get(
|
|
32
|
+
m({
|
|
33
|
+
document: e.document,
|
|
34
|
+
path: e.path,
|
|
35
|
+
method: e.method,
|
|
36
|
+
example: e.example
|
|
37
|
+
})
|
|
38
|
+
);
|
|
39
|
+
return r || i.value.get(
|
|
40
|
+
m({
|
|
41
|
+
document: e.document,
|
|
42
|
+
path: e.path,
|
|
43
|
+
method: e.method
|
|
44
|
+
})
|
|
45
|
+
);
|
|
46
|
+
}, g = (e) => {
|
|
47
|
+
const r = t.getEntryById(e);
|
|
48
|
+
if (!r) {
|
|
49
|
+
console.warn(`Could not find sidebar entry with id ${e} to select`);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
if (r.type === "operation" || r.type === "example") {
|
|
53
|
+
if (t.isSelected(e)) {
|
|
54
|
+
t.setExpanded(e, !t.isExpanded(e));
|
|
55
|
+
return;
|
|
56
|
+
}
|
|
57
|
+
const a = l("operation", r), n = I("example", r);
|
|
58
|
+
return n ? (t.setSelected(n.id), t.setExpanded(n.id, !0)) : t.setSelected(e), a ? E({
|
|
59
|
+
documentSlug: p(o),
|
|
60
|
+
path: a.path,
|
|
61
|
+
method: a.method,
|
|
62
|
+
example: n?.name ?? "default"
|
|
63
|
+
}) : void 0;
|
|
64
|
+
}
|
|
65
|
+
t.setExpanded(e, !t.isExpanded(e));
|
|
66
|
+
};
|
|
67
|
+
return b(
|
|
68
|
+
[o, x, y, f],
|
|
69
|
+
([e, r, a, n]) => {
|
|
70
|
+
if (!e) {
|
|
71
|
+
t.setSelected(null);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
const d = c({
|
|
75
|
+
document: e,
|
|
76
|
+
path: r,
|
|
77
|
+
method: a,
|
|
78
|
+
example: n
|
|
79
|
+
});
|
|
80
|
+
d && (t.setSelected(d.id), t.setExpanded(d.id, !0));
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
immediate: !0
|
|
84
|
+
}
|
|
85
|
+
), {
|
|
86
|
+
handleSelectItem: g,
|
|
87
|
+
state: t,
|
|
88
|
+
getEntryByLocation: c
|
|
89
|
+
};
|
|
90
|
+
};
|
|
91
|
+
export {
|
|
92
|
+
k as useModalSidebar
|
|
93
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ModalState } from '@scalar/components';
|
|
2
|
+
import type { WorkspaceStore } from '@scalar/workspace-store/client';
|
|
3
|
+
import type { WorkspaceEventBus } from '@scalar/workspace-store/events';
|
|
4
|
+
import type { WorkspaceDocument } from '@scalar/workspace-store/schemas/workspace';
|
|
5
|
+
import type { ComputedRef, Ref } from 'vue';
|
|
6
|
+
import type { UseModalSidebarReturn } from '../../../../v2/features/modal/hooks/use-modal-sidebar.js';
|
|
7
|
+
/**
|
|
8
|
+
* Top level event handling for the modal client
|
|
9
|
+
*/
|
|
10
|
+
export declare const useWorkspaceClientModalEvents: ({ eventBus, document, isSidebarOpen, sidebarState, modalState, workspaceStore, }: {
|
|
11
|
+
eventBus: WorkspaceEventBus;
|
|
12
|
+
document: ComputedRef<WorkspaceDocument | null>;
|
|
13
|
+
isSidebarOpen: Ref<boolean>;
|
|
14
|
+
sidebarState: UseModalSidebarReturn;
|
|
15
|
+
modalState: ModalState;
|
|
16
|
+
workspaceStore: WorkspaceStore;
|
|
17
|
+
}) => void;
|
|
18
|
+
//# sourceMappingURL=use-workspace-client-modal-events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-workspace-client-modal-events.d.ts","sourceRoot":"","sources":["../../../../../src/v2/features/modal/hooks/use-workspace-client-modal-events.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAA;AACpE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AAuBvE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,2CAA2C,CAAA;AAClF,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAE3C,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAA;AAExF;;GAEG;AACH,eAAO,MAAM,6BAA6B,GAAI,kFAO3C;IACD,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,QAAQ,EAAE,WAAW,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAAA;IAC/C,aAAa,EAAE,GAAG,CAAC,OAAO,CAAC,CAAA;IAC3B,YAAY,EAAE,qBAAqB,CAAA;IACnC,UAAU,EAAE,UAAU,CAAA;IACtB,cAAc,EAAE,cAAc,CAAA;CAC/B,SAgEA,CAAA"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { deleteSecurityScheme as d, updateSelectedAuthTab as i, updateSecurityScheme as u, updateSelectedScopes as s, updateSelectedSecuritySchemes as y, addServer as c, updateServer as v, deleteServer as S, updateServerVariables as h, updateSelectedServer as n, addOperationParameter as R, updateOperationParameter as q, deleteOperationParameter as w, deleteAllOperationParameters as m, updateOperationRequestBodyContentType as O, updateOperationRequestBodyExample as f, addOperationRequestBodyFormRow as P, updateOperationRequestBodyFormRow as b, deleteOperationRequestBodyFormRow as k, updateSelectedClient as x } from "@scalar/workspace-store/mutators";
|
|
2
|
+
const F = ({
|
|
3
|
+
eventBus: a,
|
|
4
|
+
document: r,
|
|
5
|
+
isSidebarOpen: o,
|
|
6
|
+
sidebarState: t,
|
|
7
|
+
modalState: l,
|
|
8
|
+
workspaceStore: p
|
|
9
|
+
}) => {
|
|
10
|
+
a.on("scroll-to:nav-item", ({ id: e }) => t.handleSelectItem(e)), a.on("auth:delete:security-scheme", (e) => d(r.value, e)), a.on("auth:update:active-index", (e) => i(r.value, e)), a.on("auth:update:security-scheme", (e) => u(r.value, e)), a.on("auth:update:selected-scopes", (e) => s(r.value, e)), a.on(
|
|
11
|
+
"auth:update:selected-security-schemes",
|
|
12
|
+
async (e) => await y(r.value, e)
|
|
13
|
+
), a.on("server:add:server", () => c(r.value)), a.on("server:update:server", (e) => v(r.value, e)), a.on("server:delete:server", (e) => S(r.value, e)), a.on("server:update:variables", (e) => h(r.value, e)), a.on("server:update:selected", (e) => n(r.value, e)), a.on("operation:add:parameter", (e) => R(r.value, e)), a.on("operation:update:parameter", (e) => q(r.value, e)), a.on("operation:delete:parameter", (e) => w(r.value, e)), a.on("operation:delete-all:parameters", (e) => m(r.value, e)), a.on(
|
|
14
|
+
"operation:update:requestBody:contentType",
|
|
15
|
+
(e) => O(r.value, e)
|
|
16
|
+
), a.on("operation:update:requestBody:value", (e) => {
|
|
17
|
+
f(r.value, e);
|
|
18
|
+
}), a.on("operation:add:requestBody:formRow", (e) => {
|
|
19
|
+
P(r.value, e);
|
|
20
|
+
}), a.on(
|
|
21
|
+
"operation:update:requestBody:formRow",
|
|
22
|
+
(e) => b(r.value, e)
|
|
23
|
+
), a.on(
|
|
24
|
+
"operation:delete:requestBody:formRow",
|
|
25
|
+
(e) => k(r.value, e)
|
|
26
|
+
), a.on("ui:toggle:sidebar", () => o.value = !o.value), a.on("ui:close:client-modal", () => l.hide()), a.on("workspace:update:selected-client", (e) => x(p.workspace, e));
|
|
27
|
+
};
|
|
28
|
+
export {
|
|
29
|
+
F as useWorkspaceClientModalEvents
|
|
30
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Operation.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/operation/Operation.vue"],"names":[],"mappings":"AA2KA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAA;AAMlE;;;;;;;GAOG;;AACH,wBAmOC"}
|