@scalar/api-client 3.19.3 → 3.20.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 +45 -0
- package/dist/components/HttpMethod/HttpMethod.vue.d.ts +2 -2
- package/dist/components/SectionFilter.vue.d.ts +2 -0
- package/dist/components/SectionFilter.vue.d.ts.map +1 -1
- package/dist/components/SectionFilter.vue.js +1 -1
- package/dist/components/SectionFilter.vue.js.map +1 -1
- package/dist/components/SectionFilter.vue.script.js +11 -8
- package/dist/components/SectionFilter.vue.script.js.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.js.map +1 -1
- package/dist/components/Server/ServerVariablesSelect.vue.script.js +5 -3
- package/dist/components/Server/ServerVariablesSelect.vue.script.js.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.d.ts.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.js.map +1 -1
- package/dist/components/Server/ServerVariablesTextbox.vue.script.js +6 -3
- package/dist/components/Server/ServerVariablesTextbox.vue.script.js.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js.map +1 -1
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js +4 -2
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.script.js.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.d.ts.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js.map +1 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js +3 -1
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.script.js.map +1 -1
- package/dist/style.css +159 -135
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +2 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +9 -3
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js +10 -6
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js +4 -2
- package/dist/v2/blocks/operation-block/components/OpenApiClientButton.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.js +4 -3
- package/dist/v2/blocks/operation-block/helpers/send-request.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +2 -0
- 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.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js +51 -26
- package/dist/v2/blocks/request-block/RequestBlock.vue.script.js.map +1 -1
- 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.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js +28 -8
- package/dist/v2/blocks/request-block/components/RequestBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js +9 -3
- package/dist/v2/blocks/request-block/components/RequestBodyStructured.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js +6 -4
- package/dist/v2/blocks/request-block/components/RequestBodyViewToggle.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js +3 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js +7 -5
- package/dist/v2/blocks/request-block/components/RequestParams.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
- package/dist/v2/blocks/request-block/components/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/RequestTable.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js +40 -7
- package/dist/v2/blocks/request-block/components/RequestTable.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +12 -12
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js +24 -20
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js +6 -4
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +5 -4
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js +34 -13
- package/dist/v2/blocks/response-block/ResponseBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts +3 -3
- package/dist/v2/blocks/response-block/components/Headers.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/Headers.vue.script.js +5 -3
- package/dist/v2/blocks/response-block/components/Headers.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js +3 -1
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js +11 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js +8 -6
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts +1 -0
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js +109 -56
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js +5 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js +6 -3
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js +7 -5
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js +20 -15
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js +4 -2
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.d.ts.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js.map +1 -1
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js +11 -6
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.script.js.map +1 -1
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts +4 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js +100 -0
- package/dist/v2/blocks/response-block/helpers/response-stream-multipart.js.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.d.ts +13 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.d.ts.map +1 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.js +97 -0
- package/dist/v2/blocks/response-block/helpers/response-stream.js.map +1 -0
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +1 -1
- 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 +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js +39 -27
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts +6 -6
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js +7 -4
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js +21 -16
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.script.js.map +1 -1
- 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.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js +7 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js +7 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.script.js.map +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/OAuth2.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js +105 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js +10 -8
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js +14 -9
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js +6 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map +1 -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.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js +3 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map +1 -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.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js +40 -40
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.script.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts +108 -7
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +12 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js +8 -5
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-oauth2-metadata.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +2 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js +8 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-allowed-oauth-url.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts +3 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js +11 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-client-authorization.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts +19 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.d.ts.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js +117 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth-device-authorization.js.map +1 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +15 -11
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js +8 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth2-metadata-to-flows.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +6 -0
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts +2 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.d.ts.map +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +8 -6
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +4 -4
- package/dist/v2/components/code-input/CodeInput.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInput.vue.script.js +10 -10
- package/dist/v2/components/code-input/CodeInput.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.d.ts +4 -4
- package/dist/v2/components/code-input/CodeInputLite.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.js +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.js.map +1 -1
- package/dist/v2/components/code-input/CodeInputLite.vue.script.js +8 -5
- package/dist/v2/components/code-input/CodeInputLite.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts +4 -0
- package/dist/v2/components/code-input/PillTooltipHost.vue.d.ts.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.js.map +1 -1
- package/dist/v2/components/code-input/PillTooltipHost.vue.script.js +7 -3
- package/dist/v2/components/code-input/PillTooltipHost.vue.script.js.map +1 -1
- package/dist/v2/components/code-input/code-variable-widget.d.ts +3 -0
- package/dist/v2/components/code-input/code-variable-widget.d.ts.map +1 -1
- package/dist/v2/components/code-input/code-variable-widget.js +6 -3
- package/dist/v2/components/code-input/code-variable-widget.js.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts +0 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js +4 -2
- package/dist/v2/components/data-table/DataTableCheckbox.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInput.vue.script.js +5 -3
- package/dist/v2/components/data-table/DataTableInput.vue.script.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js.map +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js +12 -9
- package/dist/v2/components/data-table/DataTableInputSelect.vue.script.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.d.ts.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.js.map +1 -1
- package/dist/v2/components/forms/ConfirmationForm.vue.script.js +5 -3
- package/dist/v2/components/forms/ConfirmationForm.vue.script.js.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.d.ts.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.js.map +1 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.script.js +3 -1
- package/dist/v2/components/layout/CollapsibleSection.vue.script.js.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.js.map +1 -1
- package/dist/v2/components/modals/DeleteModal.vue.script.js +3 -1
- package/dist/v2/components/modals/DeleteModal.vue.script.js.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.d.ts.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.js.map +1 -1
- package/dist/v2/components/modals/ModalClientContainer.vue.script.js +5 -2
- package/dist/v2/components/modals/ModalClientContainer.vue.script.js.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.d.ts.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.js.map +1 -1
- package/dist/v2/components/server/ServerDropdown.vue.script.js +9 -5
- package/dist/v2/components/server/ServerDropdown.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.js.map +1 -1
- package/dist/v2/components/sidebar/Sidebar.vue.script.js +4 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.script.js +4 -2
- package/dist/v2/components/sidebar/SidebarMenu.vue.script.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.js.map +1 -1
- package/dist/v2/components/sidebar/SidebarToggle.vue.script.js +4 -2
- package/dist/v2/components/sidebar/SidebarToggle.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.d.ts.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js +4 -2
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.script.js.map +1 -1
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.d.ts +2 -2
- package/dist/v2/features/environments/EnvironmentsList.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.js.map +1 -1
- package/dist/v2/features/environments/EnvironmentsList.vue.script.js +4 -2
- package/dist/v2/features/environments/EnvironmentsList.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.js.map +1 -1
- package/dist/v2/features/environments/components/Environment.vue.script.js +12 -10
- package/dist/v2/features/environments/components/Environment.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js +5 -3
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js +9 -6
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js +6 -4
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.script.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.d.ts.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js.map +1 -1
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js +22 -10
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.script.js.map +1 -1
- package/dist/v2/features/localization/index.d.ts +18 -0
- package/dist/v2/features/localization/index.d.ts.map +1 -0
- package/dist/v2/features/localization/index.js +35 -0
- package/dist/v2/features/localization/index.js.map +1 -0
- package/dist/v2/features/localization/locales/ar.d.ts +385 -0
- package/dist/v2/features/localization/locales/ar.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/ar.js +345 -0
- package/dist/v2/features/localization/locales/ar.js.map +1 -0
- package/dist/v2/features/localization/locales/de.d.ts +385 -0
- package/dist/v2/features/localization/locales/de.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/de.js +345 -0
- package/dist/v2/features/localization/locales/de.js.map +1 -0
- package/dist/v2/features/localization/locales/es.d.ts +385 -0
- package/dist/v2/features/localization/locales/es.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/es.js +345 -0
- package/dist/v2/features/localization/locales/es.js.map +1 -0
- package/dist/v2/features/localization/locales/fr.d.ts +385 -0
- package/dist/v2/features/localization/locales/fr.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/fr.js +345 -0
- package/dist/v2/features/localization/locales/fr.js.map +1 -0
- package/dist/v2/features/localization/locales/pt.d.ts +385 -0
- package/dist/v2/features/localization/locales/pt.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/pt.js +345 -0
- package/dist/v2/features/localization/locales/pt.js.map +1 -0
- package/dist/v2/features/localization/locales/ru.d.ts +385 -0
- package/dist/v2/features/localization/locales/ru.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/ru.js +345 -0
- package/dist/v2/features/localization/locales/ru.js.map +1 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts +385 -0
- package/dist/v2/features/localization/locales/zh-cn.d.ts.map +1 -0
- package/dist/v2/features/localization/locales/zh-cn.js +345 -0
- package/dist/v2/features/localization/locales/zh-cn.js.map +1 -0
- package/dist/v2/features/localization/translations.d.ts +385 -0
- package/dist/v2/features/localization/translations.d.ts.map +1 -0
- package/dist/v2/features/localization/translations.js +345 -0
- package/dist/v2/features/localization/translations.js.map +1 -0
- package/dist/v2/features/modal/Modal.vue.d.ts.map +1 -1
- package/dist/v2/features/modal/Modal.vue.js.map +1 -1
- package/dist/v2/features/modal/Modal.vue.script.js +15 -4
- package/dist/v2/features/modal/Modal.vue.script.js.map +1 -1
- package/dist/v2/features/modal/use-lazy-api-client.d.ts +11 -0
- package/dist/v2/features/modal/use-lazy-api-client.d.ts.map +1 -0
- package/dist/v2/features/modal/use-lazy-api-client.js +48 -0
- package/dist/v2/features/modal/use-lazy-api-client.js.map +1 -0
- package/dist/v2/features/operation/Operation.vue.d.ts.map +1 -1
- package/dist/v2/features/operation/Operation.vue.js.map +1 -1
- package/dist/v2/features/operation/Operation.vue.script.js +22 -6
- package/dist/v2/features/operation/Operation.vue.script.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +12 -8
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -1
- package/dist/v2/features/search/components/SearchResult.vue.script.js +14 -10
- package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -1
- package/dist/v2/types/options.d.ts +1 -1
- package/dist/v2/types/options.d.ts.map +1 -1
- package/dist/v2/workspace-events.d.ts +2 -2
- package/dist/v2/workspace-events.d.ts.map +1 -1
- package/dist/v2/workspace-events.js +8 -1
- package/dist/v2/workspace-events.js.map +1 -1
- package/dist/vue-styles.css +124 -125
- package/package.json +22 -11
package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.script.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScopesAddModal.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n CommandActionForm,\n CommandActionInput,\n} from '@/v2/features/command-palette'\n\nconst {\n state,\n scopes,\n scope = null,\n} = defineProps<{\n state: ModalState\n /** Existing scope names on the flow, used to prevent duplicates */\n scopes: string[]\n /**\n * When provided, the modal switches to \"edit\" mode and is prefilled with this scope.\n * The original name is retained so the consumer can rename it.\n */\n scope?: { name: string; description: string } | null\n}>()\n\nconst emit = defineEmits<{\n (event: 'cancel'): void\n (\n event: 'submit',\n scopeData: {\n name: string\n description: string\n /** The original name on the flow, only set when editing an existing scope */\n oldName?: string\n },\n ): void\n}>()\n\nconst isEditMode = computed(() => scope !== null)\nconst title = computed(()
|
|
1
|
+
{"version":3,"file":"OAuthScopesAddModal.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarModal, type ModalState } from '@scalar/components/modal'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n CommandActionForm,\n CommandActionInput,\n} from '@/v2/features/command-palette'\nimport { useLocalization } from '@/v2/features/localization'\n\nconst {\n state,\n scopes,\n scope = null,\n} = defineProps<{\n state: ModalState\n /** Existing scope names on the flow, used to prevent duplicates */\n scopes: string[]\n /**\n * When provided, the modal switches to \"edit\" mode and is prefilled with this scope.\n * The original name is retained so the consumer can rename it.\n */\n scope?: { name: string; description: string } | null\n}>()\n\nconst emit = defineEmits<{\n (event: 'cancel'): void\n (\n event: 'submit',\n scopeData: {\n name: string\n description: string\n /** The original name on the flow, only set when editing an existing scope */\n oldName?: string\n },\n ): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst isEditMode = computed(() => scope !== null)\nconst title = computed(() =>\n isEditMode.value\n ? translate('apiClient.oauthScopesAddModal.edit')\n : translate('apiClient.oauthScopesAddModal.add'),\n)\nconst submitLabel = computed(() =>\n isEditMode.value\n ? translate('apiClient.oauthScopesAddModal.save')\n : translate('apiClient.oauthScopesAddModal.add'),\n)\n\nconst scopeData = ref({\n name: '',\n description: '',\n})\n\n/**\n * Tracks whether the user has interacted with the name field so we can defer the\n * \"name is required\" hint until after the first edit, rather than on initial render.\n */\nconst hasTouchedName = ref(false)\n\nwatch(\n () => scopeData.value.name,\n () => {\n hasTouchedName.value = true\n },\n)\n\nconst trimmedName = computed(() => scopeData.value.name.trim())\n\n/**\n * Whether the chosen name collides with an existing scope on the flow.\n * In edit mode we allow keeping the original name unchanged.\n */\nconst isDuplicateName = computed(() => {\n if (!trimmedName.value) {\n return false\n }\n if (isEditMode.value && trimmedName.value === scope?.name) {\n return false\n }\n return scopes.includes(trimmedName.value)\n})\n\n/** Human readable validation message rendered inline in the modal */\nconst validationError = computed<string | null>(() => {\n if (isDuplicateName.value) {\n return translate('apiClient.oauthScopesAddModal.duplicate', {\n name: trimmedName.value,\n })\n }\n if (hasTouchedName.value && !trimmedName.value) {\n return translate('apiClient.oauthScopesAddModal.required')\n }\n return null\n})\n\nconst isSubmitDisabled = computed(\n () => !trimmedName.value || isDuplicateName.value,\n)\n\nconst handleSubmit = () => {\n if (isSubmitDisabled.value) {\n return\n }\n\n emit('submit', {\n name: trimmedName.value,\n description: scopeData.value.description,\n ...(isEditMode.value && scope ? { oldName: scope.name } : {}),\n })\n state.hide()\n}\n\nwatch(\n () => state.open,\n (isOpen) => {\n if (!isOpen) {\n return\n }\n\n scopeData.value = scope\n ? { name: scope.name, description: scope.description }\n : { name: '', description: '' }\n // Clearing `name` schedules the `scopeData.name` watcher, which sets\n // `hasTouchedName` back to true in the same flush. Defer the reset so it\n // runs after that watcher and reopening add mode does not show a false\n // \"Scope name is required\" error.\n void nextTick(() => {\n hasTouchedName.value = false\n })\n },\n)\n</script>\n\n<template>\n <ScalarModal\n bodyClass=\"overflow-y-auto\"\n size=\"xs\"\n :state=\"state\"\n :title=\"title\">\n <CommandActionForm\n :disabled=\"isSubmitDisabled\"\n @cancel=\"emit('cancel')\"\n @submit=\"handleSubmit\">\n <!-- Name -->\n <div class=\"flex min-h-8 items-start gap-2 text-sm\">\n {{ translate('apiClient.oauthScopesAddModal.name')\n }}<CommandActionInput\n v-model=\"scopeData.name\"\n autofocus\n class=\"field-sizing-content !p-0\"\n placeholder=\"read:user\" />\n </div>\n\n <!-- Description -->\n <div class=\"flex min-h-8 items-start gap-2 text-sm\">\n {{ translate('apiClient.oauthScopesAddModal.description')\n }}<CommandActionInput\n v-model=\"scopeData.description\"\n :autofocus=\"false\"\n class=\"field-sizing-content !p-0\"\n :placeholder=\"\n translate('apiClient.oauthScopesAddModal.readUserData')\n \" />\n </div>\n\n <!-- Inline validation error -->\n <div\n v-if=\"validationError\"\n class=\"text-red text-xs\"\n role=\"alert\">\n {{ validationError }}\n </div>\n\n <template #submit>{{ submitLabel }}</template>\n </CommandActionForm>\n </ScalarModal>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;EAyBA,MAAM,OAAO;EAab,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,aAAa,eAAe,QAAA,UAAU,IAAI;EAChD,MAAM,QAAQ,eACZ,WAAW,QACP,UAAU,oCAAoC,IAC9C,UAAU,mCAAmC,CACnD;EACA,MAAM,cAAc,eAClB,WAAW,QACP,UAAU,oCAAoC,IAC9C,UAAU,mCAAmC,CACnD;EAEA,MAAM,YAAY,IAAI;GACpB,MAAM;GACN,aAAa;EACf,CAAC;;;;;EAMD,MAAM,iBAAiB,IAAI,KAAK;EAEhC,YACQ,UAAU,MAAM,YAChB;GACJ,eAAe,QAAQ;EACzB,CACF;EAEA,MAAM,cAAc,eAAe,UAAU,MAAM,KAAK,KAAK,CAAC;;;;;EAM9D,MAAM,kBAAkB,eAAe;GACrC,IAAI,CAAC,YAAY,OACf,OAAO;GAET,IAAI,WAAW,SAAS,YAAY,UAAU,QAAA,OAAO,MACnD,OAAO;GAET,OAAO,QAAA,OAAO,SAAS,YAAY,KAAK;EAC1C,CAAC;;EAGD,MAAM,kBAAkB,eAA8B;GACpD,IAAI,gBAAgB,OAClB,OAAO,UAAU,2CAA2C,EAC1D,MAAM,YAAY,MACpB,CAAC;GAEH,IAAI,eAAe,SAAS,CAAC,YAAY,OACvC,OAAO,UAAU,wCAAwC;GAE3D,OAAO;EACT,CAAC;EAED,MAAM,mBAAmB,eACjB,CAAC,YAAY,SAAS,gBAAgB,KAC9C;EAEA,MAAM,qBAAqB;GACzB,IAAI,iBAAiB,OACnB;GAGF,KAAK,UAAU;IACb,MAAM,YAAY;IAClB,aAAa,UAAU,MAAM;IAC7B,GAAI,WAAW,SAAS,QAAA,QAAQ,EAAE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ceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OAuthScopesInput.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"names":[],"mappings":"AAqYA,OAAO,KAAK,EACV,SAAS,EACT,gBAAgB,EACjB,MAAM,8DAA8D,CAAA;AAYrE,KAAK,WAAW,GAAG;IACjB,QAAQ,EAAE,MAAM,gBAAgB,CAAA;IAChC,IAAI,EAAE,SAAS,CAAA;IACf,cAAc,EAAE,MAAM,EAAE,CAAA;CACzB,CAAC;AAyvBF,QAAA,MAAM,YAAY;;iBAlvBM,MAAM,EAAE;gBAAU,MAAM;mBAAa,OAAO;;;;;;;;;;;;;;;;;iBAA5C,MAAM,EAAE;gBAAU,MAAM;mBAAa,OAAO;;;;;;;;;;;;;;;kFAqvBlE,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScopesInput.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: { scopes?: string[]; scope?: string; selected?: boolean },\n ): void\n (\n e: 'upsert:scope',\n payload: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n ): void\n (\n e: 'delete:scope',\n payload: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n ): void\n}>()\n\nconst searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </template>\n <template v-else> No Scopes Defined </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">–</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"`Edit ${label}`\"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${label}`\"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"`Select ${label} scope`\"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"OAuthScopesInput.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: { scopes?: string[]; scope?: string; selected?: boolean },\n ): void\n (\n e: 'upsert:scope',\n payload: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n ): void\n (\n e: 'delete:scope',\n payload: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n ): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n {{\n translate('apiClient.oauthScopesInput.selectedScopes', {\n count: selectedScopes.length,\n total: Object.keys(flow?.scopes ?? {}).length,\n })\n }}\n </template>\n <template v-else>\n {{ translate('apiClient.oauthScopesInput.noScopesDefined') }}\n </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n {{ translate('apiClient.oauthScopesInput.addScope') }}\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n {{ translate('apiClient.oauthScopesInput.deselectAll') }}\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n {{ translate('apiClient.oauthScopesInput.selectAll') }}\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">–</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"\n translate('apiClient.oauthScopesInput.editScope', {\n name: label,\n })\n \"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"\n translate('apiClient.oauthScopesInput.deleteScope', {\n name: label,\n })\n \"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"\n translate('apiClient.oauthScopesInput.selectScope', {\n name: label,\n })\n \"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":""}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../../features/localization/index.js";
|
|
1
2
|
import DataTableCell_default from "../../../components/data-table/DataTableCell.vue.js";
|
|
2
3
|
import DataTableCheckbox_default from "../../../components/data-table/DataTableCheckbox.vue.js";
|
|
3
4
|
import DataTableRow_default from "../../../components/data-table/DataTableRow.vue.js";
|
|
@@ -35,6 +36,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
35
36
|
],
|
|
36
37
|
setup(__props, { emit: __emit }) {
|
|
37
38
|
const emits = __emit;
|
|
39
|
+
const { translate } = useLocalization();
|
|
38
40
|
const searchQuery = ref("");
|
|
39
41
|
/**
|
|
40
42
|
* The scope currently being edited, used to switch the shared modal into edit mode.
|
|
@@ -138,7 +140,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
138
140
|
};
|
|
139
141
|
return (_ctx, _cache) => {
|
|
140
142
|
return openBlock(), createBlock(unref(DataTableCell_default), { class: "h-auto !max-h-[initial] min-h-8 items-center" }, {
|
|
141
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_1, [_cache[
|
|
143
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1, [_cache[4] || (_cache[4] = createElementVNode("div", { class: "text-c-1 h-full items-center" }, null, -1)), (openBlock(), createBlock(unref(Disclosure), {
|
|
142
144
|
key: remountKey.value,
|
|
143
145
|
as: "div",
|
|
144
146
|
class: "bl flex w-full flex-col",
|
|
@@ -152,7 +154,10 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
152
154
|
]),
|
|
153
155
|
disabled: !hasScopes.value
|
|
154
156
|
}, {
|
|
155
|
-
default: withCtx(() => [hasScopes.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(
|
|
157
|
+
default: withCtx(() => [hasScopes.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesInput.selectedScopes", {
|
|
158
|
+
count: __props.selectedScopes.length,
|
|
159
|
+
total: Object.keys(__props.flow?.scopes ?? {}).length
|
|
160
|
+
})), 1)], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesInput.noScopesDefined")), 1)], 64))]),
|
|
156
161
|
_: 1
|
|
157
162
|
}, 8, ["class", "disabled"]), createElementVNode("div", _hoisted_3, [
|
|
158
163
|
createVNode(unref(ScalarButton), {
|
|
@@ -161,7 +166,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
161
166
|
variant: "ghost",
|
|
162
167
|
onClick: withModifiers(openAddScopeModal, ["stop"])
|
|
163
168
|
}, {
|
|
164
|
-
default: withCtx(() => [
|
|
169
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesInput.addScope")), 1)]),
|
|
165
170
|
_: 1
|
|
166
171
|
}),
|
|
167
172
|
hasScopes.value && allScopesSelected.value ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
@@ -171,7 +176,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
171
176
|
variant: "ghost",
|
|
172
177
|
onClick: withModifiers(deselectAllScopes, ["stop"])
|
|
173
178
|
}, {
|
|
174
|
-
default: withCtx(() => [
|
|
179
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesInput.deselectAll")), 1)]),
|
|
175
180
|
_: 1
|
|
176
181
|
})) : createCommentVNode("", true),
|
|
177
182
|
hasScopes.value && !allScopesSelected.value ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
@@ -181,7 +186,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
181
186
|
variant: "ghost",
|
|
182
187
|
onClick: withModifiers(selectAllScopes, ["stop"])
|
|
183
188
|
}, {
|
|
184
|
-
default: withCtx(() => [
|
|
189
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.oauthScopesInput.selectAll")), 1)]),
|
|
185
190
|
_: 1
|
|
186
191
|
})) : createCommentVNode("", true),
|
|
187
192
|
hasScopes.value ? (openBlock(), createBlock(unref(DisclosureButton), {
|
|
@@ -208,12 +213,12 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
208
213
|
onClick: ($event) => setScope(id, !__props.selectedScopes.includes(id))
|
|
209
214
|
}, {
|
|
210
215
|
default: withCtx(() => [createVNode(unref(DataTableCell_default), { class: "box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0" }, {
|
|
211
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(label), 1), String(description ?? "").trim() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[
|
|
216
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_5, [createElementVNode("span", _hoisted_6, toDisplayString(label), 1), String(description ?? "").trim() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[3] || (_cache[3] = createElementVNode("span", { class: "shrink-0" }, "–", -1)), createElementVNode("span", _hoisted_7, toDisplayString(description), 1)], 64)) : createCommentVNode("", true)]), createElementVNode("div", {
|
|
212
217
|
class: "oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100",
|
|
213
218
|
onClick: _cache[1] || (_cache[1] = withModifiers(() => {}, ["stop"]))
|
|
214
219
|
}, [createVNode(unref(ScalarIconButton), {
|
|
215
220
|
icon: unref(ScalarIconPencilSimple),
|
|
216
|
-
label:
|
|
221
|
+
label: unref(translate)("apiClient.oauthScopesInput.editScope", { name: label }),
|
|
217
222
|
size: "sm",
|
|
218
223
|
onClick: withModifiers(($event) => openEditScopeModal({
|
|
219
224
|
id,
|
|
@@ -225,7 +230,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
225
230
|
"onClick"
|
|
226
231
|
]), createVNode(unref(ScalarIconButton), {
|
|
227
232
|
icon: unref(ScalarIconTrash),
|
|
228
|
-
label:
|
|
233
|
+
label: unref(translate)("apiClient.oauthScopesInput.deleteScope", { name: label }),
|
|
229
234
|
size: "sm",
|
|
230
235
|
onClick: withModifiers(($event) => handleDeleteScope(id), ["stop"])
|
|
231
236
|
}, null, 8, [
|
|
@@ -235,7 +240,7 @@ var OAuthScopesInput_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/
|
|
|
235
240
|
])])]),
|
|
236
241
|
_: 2
|
|
237
242
|
}, 1024), createVNode(unref(DataTableCheckbox_default), {
|
|
238
|
-
ariaLabel:
|
|
243
|
+
ariaLabel: unref(translate)("apiClient.oauthScopesInput.selectScope", { name: label }),
|
|
239
244
|
modelValue: __props.selectedScopes.includes(id),
|
|
240
245
|
onClick: _cache[2] || (_cache[2] = withModifiers(() => {}, ["stop"])),
|
|
241
246
|
"onUpdate:modelValue": ($event) => setScope(id, $event)
|
package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.script.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OAuthScopesInput.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: { scopes?: string[]; scope?: string; selected?: boolean },\n ): void\n (\n e: 'upsert:scope',\n payload: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n ): void\n (\n e: 'delete:scope',\n payload: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n ): void\n}>()\n\nconst searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n Scopes Selected\n {{ selectedScopes.length || 0 }} /\n {{ Object.keys(flow?.scopes ?? {}).length || 0 }}\n </template>\n <template v-else> No Scopes Defined </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n Add Scope\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n Deselect All\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n Select All\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">–</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"`Edit ${label}`\"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"`Delete ${label}`\"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"`Select ${label} scope`\"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA6BA,MAAM,QAAQ;EAed,MAAM,cAAc,IAAI,EAAE;;;;;EAM1B,MAAM,eAAe,IAAkD,IAAI;;EAG3E,MAAM,SAAS,eACb,OAAO,QAAQ,QAAA,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,UAAU;GACtD,IAAI;GACJ,OAAO;GACP,aAAa;EACf,EAAE,CACJ;EAEA,MAAM,aAAa,eAAe,OAAO,KAAK,QAAA,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC,MAAM;;EAGxE,MAAM,kBAA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oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;SACV,wBAAiB,WAAE,SAAS,IAAI,MAAM;;;;;;;;;;;;+BASrD,YAIoC,6BAAA;KAHjC,OAAO,aAAA;KACP,QAAQ,OAAO,KAAK,QAAA,KAAK,UAAM,CAAA,CAAA;KAC/B,OAAO,MAAA,cAAA;KACP,UAAQ"}
|
|
1
|
+
{"version":3,"file":"OAuthScopesInput.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { Disclosure, DisclosureButton, DisclosurePanel } from '@headlessui/vue'\nimport { ScalarButton } from '@scalar/components/button'\nimport { ScalarIcon } from '@scalar/components/icon'\nimport { ScalarIconButton } from '@scalar/components/icon-button'\nimport { useModal } from '@scalar/components/modal'\nimport { ScalarSearchInput } from '@scalar/components/search-input'\nimport { ScalarIconPencilSimple, ScalarIconTrash } from '@scalar/icons'\nimport type { ApiReferenceEvents } from '@scalar/workspace-store/events'\nimport type {\n OAuthFlow,\n OAuthFlowsObject,\n} from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed, nextTick, ref, watch } from 'vue'\n\nimport {\n DataTableCell,\n DataTableCheckbox,\n DataTableRow,\n} from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport OAuthScopesAddModal from './OAuthScopesAddModal.vue'\n\nconst { selectedScopes, flow, flowType } = defineProps<{\n flowType: keyof OAuthFlowsObject\n flow: OAuthFlow\n selectedScopes: string[]\n}>()\n\nconst emits = defineEmits<{\n (\n e: 'update:selectedScopes',\n payload: { scopes?: string[]; scope?: string; selected?: boolean },\n ): void\n (\n e: 'upsert:scope',\n payload: Omit<ApiReferenceEvents['auth:upsert:scopes'], 'name'>,\n ): void\n (\n e: 'delete:scope',\n payload: Omit<ApiReferenceEvents['auth:delete:scopes'], 'name'>,\n ): void\n}>()\n\nconst { translate } = useLocalization()\n\nconst searchQuery = ref('')\n\n/**\n * The scope currently being edited, used to switch the shared modal into edit mode.\n * Null means the modal is in \"add\" mode.\n */\nconst editingScope = ref<{ name: string; description: string } | null>(null)\n\n/** List of all available scopes */\nconst scopes = computed(() =>\n Object.entries(flow?.scopes ?? {}).map(([key, val]) => ({\n id: key,\n label: key,\n description: val,\n })),\n)\n\nconst scopeCount = computed(() => Object.keys(flow?.scopes ?? {}).length)\n\n/** Search is only useful once the list is long enough to scan */\nconst showScopeSearch = computed(() => scopeCount.value >= 10)\n\nconst filteredScopes = computed(() => {\n const query = showScopeSearch.value ? searchQuery.value : ''\n if (!query) {\n return scopes.value\n }\n\n const regex = new RegExp(\n query\n .split('')\n .map((c) => c.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&'))\n .join('.*'),\n 'i',\n )\n\n return scopes.value.filter(({ label, description }) =>\n regex.test(`${label} ${description}`),\n )\n})\n\nconst hasScopes = computed(() => Object.keys(flow?.scopes ?? {}).length > 0)\n\nconst allScopesSelected = computed(\n () => selectedScopes.length === Object.keys(flow?.scopes ?? {}).length,\n)\n\nconst setScope = (scopeKey: string, checked: boolean) => {\n // Emit a single-scope toggle rather than a freshly computed list. The store applies it\n // against the currently selected scopes, so two quick clicks cannot overwrite each other\n // with a list computed from a prop that has not updated yet.\n emits('update:selectedScopes', { scope: scopeKey, selected: checked })\n}\n\n/** Select all scopes */\nconst selectAllScopes = () =>\n emits('update:selectedScopes', { scopes: Object.keys(flow?.scopes ?? {}) })\n\n/** Deselect all scopes */\nconst deselectAllScopes = () => emits('update:selectedScopes', { scopes: [] })\n\nconst scopeFormModal = useModal()\n\n/**\n * Forces the Disclosure to remount with `defaultOpen` set so the panel auto-expands\n * the moment a brand-new scope is added. Bumping this counter is paired with toggling\n * `expandOnNextMount` so the remount opens the panel, then reverts to the default\n * closed-on-mount behavior for any future unrelated remounts (e.g. collapse on empty).\n *\n * The Disclosure `:key` is only this counter — not a separate `hasScopes` segment — so\n * adding the first scope does not remount twice (empty prefix → with-scopes prefix),\n * which would reopen with `defaultOpen=false` and collapse the panel right when rows appear.\n */\nconst remountKey = ref(0)\nconst expandOnNextMount = ref(false)\n\nwatch(hasScopes, (has, had) => {\n if (had && !has) {\n expandOnNextMount.value = false\n remountKey.value += 1\n }\n})\n\n/** Open the modal in \"add new scope\" mode */\nconst openAddScopeModal = () => {\n editingScope.value = null\n scopeFormModal.show()\n}\n\n/** Open the modal in \"edit scope\" mode prefilled with the chosen row */\nconst openEditScopeModal = (scope: { id: string; description: string }) => {\n editingScope.value = {\n name: scope.id,\n description: scope.description ?? '',\n }\n scopeFormModal.show()\n}\n\n/**\n * Submit handler shared by Add Scope and Edit Scope. For renames, the `upsertScope` mutator on\n * the workspace store rewrites the selection state in place, so the component does not need to\n * emit a follow-up `update:selectedScopes`.\n *\n * When adding a brand-new scope (no `oldName`), the payload sets `enable: true` so the\n * `upsertScope` mutator also adds the new scope to any selection requirement that references\n * this scheme. The Disclosure is then remounted with `defaultOpen=true` so the user\n * immediately sees (and sees selected) the scope they just added.\n */\nconst handleScopeFormSubmit = async (payload: {\n name: string\n description: string\n oldName?: string\n}) => {\n const isAdd = !payload.oldName\n\n emits('upsert:scope', {\n scope: payload.name,\n description: payload.description,\n flowType,\n ...(payload.oldName ? { oldScope: payload.oldName } : {}),\n ...(isAdd ? { enable: true } : {}),\n })\n\n if (!isAdd) {\n return\n }\n\n expandOnNextMount.value = true\n remountKey.value += 1\n // Reset after the remount so subsequent unrelated remounts (e.g. when the last\n // scope is deleted) still default to a closed panel.\n await nextTick()\n expandOnNextMount.value = false\n}\n\n/**\n * Remove the scope from the flow. Selection cleanup (dropping the deleted key from any\n * currently-selected scopes) is handled by the `deleteScope` mutator on the workspace store,\n * so the component does not need to emit a follow-up `update:selectedScopes` here.\n */\nconst handleDeleteScope = (scopeKey: string) => {\n emits('delete:scope', { scope: scopeKey, flowType })\n}\n</script>\n\n<template>\n <DataTableCell class=\"h-auto !max-h-[initial] min-h-8 items-center\">\n <div class=\"flex h-fit w-full\">\n <div class=\"text-c-1 h-full items-center\"></div>\n <Disclosure\n :key=\"remountKey\"\n as=\"div\"\n class=\"bl flex w-full flex-col\"\n :defaultOpen=\"expandOnNextMount\">\n <!--\n Keep Add Scope (and other actions) outside the summary DisclosureButton.\n When there are no scopes the summary control is disabled; a native disabled\n button blocks pointer events for all descendants, which would make Add Scope unusable.\n -->\n <div\n class=\"group/scopes-accordion flex h-auto min-h-8 items-center gap-1.5 pr-2.25 pl-3 text-left\">\n <DisclosureButton\n :class=\"[\n 'min-w-0 flex-1 text-left',\n hasScopes ? 'hover:text-c-1 cursor-pointer' : 'cursor-default',\n (selectedScopes.length || 0) > 0 ? 'text-c-1' : 'text-c-3',\n ]\"\n :disabled=\"!hasScopes\">\n <template v-if=\"hasScopes\">\n {{\n translate('apiClient.oauthScopesInput.selectedScopes', {\n count: selectedScopes.length,\n total: Object.keys(flow?.scopes ?? {}).length,\n })\n }}\n </template>\n <template v-else>\n {{ translate('apiClient.oauthScopesInput.noScopesDefined') }}\n </template>\n </DisclosureButton>\n\n <div class=\"flex shrink-0 items-center gap-1.75\">\n <!-- Add new scope -->\n <ScalarButton\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"openAddScopeModal\">\n {{ translate('apiClient.oauthScopesInput.addScope') }}\n </ScalarButton>\n\n <!-- Deselect All -->\n <ScalarButton\n v-if=\"hasScopes && allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"deselectAllScopes\">\n {{ translate('apiClient.oauthScopesInput.deselectAll') }}\n </ScalarButton>\n\n <!-- Select All -->\n <ScalarButton\n v-if=\"hasScopes && !allScopesSelected\"\n class=\"pr-0.75 pl-1 transition-none\"\n size=\"sm\"\n variant=\"ghost\"\n @click.stop=\"selectAllScopes\">\n {{ translate('apiClient.oauthScopesInput.selectAll') }}\n </ScalarButton>\n\n <DisclosureButton\n v-if=\"hasScopes\"\n v-slot=\"{ open }\"\n class=\"text-c-3 hover:text-c-2 -m-0.5 flex shrink-0 items-center justify-center rounded p-0.5 focus-visible:outline-offset-2\">\n <ScalarIcon\n class=\"group-hover/scopes-accordion:text-c-2\"\n :icon=\"open ? 'ChevronDown' : 'ChevronRight'\"\n size=\"md\" />\n </DisclosureButton>\n </div>\n </div>\n <!-- Scopes List -->\n <DisclosurePanel as=\"template\">\n <div>\n <ScalarSearchInput\n v-if=\"showScopeSearch\"\n v-model=\"searchQuery\"\n class=\"flex items-center text-xs\" />\n <table\n class=\"grid max-h-40 auto-rows-auto overflow-x-hidden overflow-y-auto\"\n :style=\"{ gridTemplateColumns: '1fr auto' }\">\n <DataTableRow\n v-for=\"{ id, label, description } in filteredScopes\"\n :key=\"id\"\n class=\"text-c-2 group/scope-row\"\n @click=\"setScope(id, !selectedScopes.includes(id))\">\n <DataTableCell\n class=\"box-border flex !max-h-[initial] w-full min-w-0 cursor-pointer items-stretch overflow-hidden px-0 py-0\">\n <!-- Text scrolls horizontally; action rail stays fixed -->\n <div\n class=\"no-scrollbar text-c-2 group-hover/scope-row:text-c-1 flex min-h-8 min-w-0 flex-1 items-center gap-1 overflow-x-auto px-3 py-1.5 pr-20 text-xs text-nowrap\">\n <span class=\"font-code shrink-0 text-xs\">{{ label }}</span>\n <template v-if=\"String(description ?? '').trim()\">\n <span class=\"shrink-0\">–</span>\n <span class=\"whitespace-nowrap\">{{ description }}</span>\n </template>\n </div>\n <div\n class=\"oauth-scope-row-action-rail absolute top-0 right-0 z-[1] flex h-full min-w-[4.5rem] items-center justify-end gap-0.5 py-1 pr-2 pl-4 opacity-0 transition-opacity group-focus-within/scope-row:opacity-100 group-hover/scope-row:opacity-100\"\n @click.stop>\n <ScalarIconButton\n :icon=\"ScalarIconPencilSimple\"\n :label=\"\n translate('apiClient.oauthScopesInput.editScope', {\n name: label,\n })\n \"\n size=\"sm\"\n @click.stop=\"\n openEditScopeModal({\n id,\n description: description ?? '',\n })\n \" />\n <ScalarIconButton\n :icon=\"ScalarIconTrash\"\n :label=\"\n translate('apiClient.oauthScopesInput.deleteScope', {\n name: label,\n })\n \"\n size=\"sm\"\n @click.stop=\"handleDeleteScope(id)\" />\n </div>\n </DataTableCell>\n <!--\n Stop the click here so it does not also bubble to the row's `@click`\n toggle. The checkbox already drives the change via `@update:modelValue`;\n letting the row fire too would toggle the scope a second time.\n -->\n <DataTableCheckbox\n :ariaLabel=\"\n translate('apiClient.oauthScopesInput.selectScope', {\n name: label,\n })\n \"\n :modelValue=\"selectedScopes.includes(id)\"\n @click.stop\n @update:modelValue=\"setScope(id, $event)\" />\n </DataTableRow>\n </table>\n </div>\n </DisclosurePanel>\n </Disclosure>\n </div>\n\n <!-- Shared add/edit scope modal -->\n <OAuthScopesAddModal\n :scope=\"editingScope\"\n :scopes=\"Object.keys(flow.scopes ?? {})\"\n :state=\"scopeFormModal\"\n @submit=\"handleScopeFormSubmit\" />\n </DataTableCell>\n</template>\n\n<style>\n/* Matches AddressBar.vue `.address-bar-bg-states` / `.fade-right` (header URL input). */\n.oauth-scope-row-action-rail {\n --oauth-scope-row-rail-bg: color-mix(\n in srgb,\n var(--scalar-background-1),\n var(--scalar-background-2)\n );\n background: linear-gradient(\n 90deg,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 100%) 0%,\n color-mix(in srgb, var(--oauth-scope-row-rail-bg), transparent 20%) 30%,\n var(--oauth-scope-row-rail-bg) 100%\n );\n}\n\n.no-scrollbar::-webkit-scrollbar {\n display: none;\n}\n\n.no-scrollbar {\n -ms-overflow-style: none;\n scrollbar-width: none;\n}\n</style>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA8BA,MAAM,QAAQ;EAed,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,cAAc,IAAI,EAAE;;;;;EAM1B,MAAM,eAAe,IAAkD,IAAI;;EAG3E,MAAM,SAAS,eACb,OAAO,QAAQ,QAAA,MAAM,UAAU,CAAC,CAAC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,OAAgC,MAAA,SAAA,CAAS,CAAA,0CAAA,EAAA,MAA6E,MAAA,CAAA;UAKvH,MAAK;UACJ,SAAK,eAAA,WAAO,kBAAkB,EAAE,GAAA,CAAA,MAAA,CAAA;;;;;;;kBAQvC,YAQ8C,MAAA,yBAAA,GAAA;SAP3C,WAAgC,MAAA,SAAA,CAAS,CAAA,0CAAA,EAAA,MAAyE,MAAA,CAAA;SAKlH,YAAY,QAAA,eAAe,SAAS,EAAE;SACtC,SAAK,OAAA,OAAA,OAAA,KAAA,oBAAN,CAAA,GAAW,CAAA,MAAA,CAAA;SACV,wBAAiB,WAAE,SAAS,IAAI,MAAM;;;;;;;;;;;;+BASrD,YAIoC,6BAAA;KAHjC,OAAO,aAAA;KACP,QAAQ,OAAO,KAAK,QAAA,KAAK,UAAM,CAAA,CAAA;KAC/B,OAAO,MAAA,cAAA;KACP,UAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenIDConnect.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"OpenIDConnect.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"names":[],"mappings":"AA6HA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAA;AACvE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,8DAA8D,CAAA;AAEvG,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kDAAkD,CAAA;AAQnF,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,kCAAkC;IAClC,oBAAoB,EAAE,MAAM,MAAM,GAAG,KAAK,CAAA;IAC1C,kCAAkC;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,4BAA4B;IAC5B,MAAM,EAAE,mBAAmB,CAAA;IAC3B,kFAAkF;IAClF,WAAW,CAAC,EAAE,WAAW,CAAA;CAC1B,CAAC;AA0LF,QAAA,MAAM,YAAY,kSAEhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenIDConnect.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message
|
|
1
|
+
{"version":3,"file":"OpenIDConnect.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst { translate } = useLocalization()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ??\n translate('apiClient.openIdConnect.failedToFetchConfiguration'),\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n {{ translate('apiClient.openIdConnect.discoveryUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n {{ translate('apiClient.openIdConnect.fetchConfiguration') }}\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":""}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import { useLocalization } from "../../../features/localization/index.js";
|
|
1
2
|
import DataTableRow_default from "../../../components/data-table/DataTableRow.vue.js";
|
|
2
3
|
import RequestAuthDataTableInput_default from "./RequestAuthDataTableInput.vue.js";
|
|
3
4
|
import { fetchOpenIDConnectDiscovery } from "../helpers/fetch-openid-connect-discovery.js";
|
|
4
5
|
import { openIDDiscoveryToFlows } from "../helpers/openid-discovery-to-flows.js";
|
|
5
|
-
import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, unref, withCtx } from "vue";
|
|
6
|
+
import { Fragment, createElementBlock, createElementVNode, createTextVNode, createVNode, defineComponent, openBlock, toDisplayString, unref, withCtx } from "vue";
|
|
6
7
|
import { ScalarButton } from "@scalar/components/button";
|
|
7
8
|
import { useToasts } from "@scalar/use-toasts";
|
|
8
9
|
import { useLoadingState } from "@scalar/components/loading";
|
|
@@ -20,6 +21,7 @@ var OpenIDConnect_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
20
21
|
customFetch: {}
|
|
21
22
|
},
|
|
22
23
|
setup(__props) {
|
|
24
|
+
const { translate } = useLocalization();
|
|
23
25
|
const loader = useLoadingState();
|
|
24
26
|
const { toast } = useToasts();
|
|
25
27
|
/**
|
|
@@ -32,7 +34,7 @@ var OpenIDConnect_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
32
34
|
await loader.clear();
|
|
33
35
|
if (error) {
|
|
34
36
|
console.error(error);
|
|
35
|
-
toast(error?.message ?? "
|
|
37
|
+
toast(error?.message ?? translate("apiClient.openIdConnect.failedToFetchConfiguration"), "error");
|
|
36
38
|
return;
|
|
37
39
|
}
|
|
38
40
|
/** Set the newly discovered params in the secret store */
|
|
@@ -60,7 +62,7 @@ var OpenIDConnect_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
60
62
|
required: "",
|
|
61
63
|
"onUpdate:modelValue": handleUpdateOpenIdConnectUrl
|
|
62
64
|
}, {
|
|
63
|
-
default: withCtx(() => [
|
|
65
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.openIdConnect.discoveryUrl")), 1)]),
|
|
64
66
|
_: 1
|
|
65
67
|
}, 8, [
|
|
66
68
|
"containerClass",
|
|
@@ -77,7 +79,7 @@ var OpenIDConnect_vue_vue_type_script_setup_true_lang_default = /*@__PURE__*/ de
|
|
|
77
79
|
variant: "outlined",
|
|
78
80
|
onClick: handleOpenIdConnect
|
|
79
81
|
}, {
|
|
80
|
-
default: withCtx(() => [
|
|
82
|
+
default: withCtx(() => [createTextVNode(toDisplayString(unref(translate)("apiClient.openIdConnect.fetchConfiguration")), 1)]),
|
|
81
83
|
_: 1
|
|
82
84
|
}, 8, ["disabled", "loader"])])]),
|
|
83
85
|
_: 1
|
package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.script.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenIDConnect.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message
|
|
1
|
+
{"version":3,"file":"OpenIDConnect.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport { ScalarButton } from '@scalar/components/button'\nimport { useLoadingState } from '@scalar/components/loading'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceEventBus } from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport { type OpenIdConnectObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\n\nimport type { CustomFetch } from '@/v2/blocks/operation-block/helpers/send-request'\nimport { fetchOpenIDConnectDiscovery } from '@/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery'\nimport { openIDDiscoveryToFlows } from '@/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows'\nimport { DataTableRow } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthDataTableInput from './RequestAuthDataTableInput.vue'\n\nconst {\n environment,\n eventBus,\n getStaticBorderClass,\n name,\n scheme,\n proxyUrl,\n customFetch,\n} = defineProps<{\n /** Current environment configuration */\n environment: XScalarEnvironment\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Get the static border class */\n getStaticBorderClass: () => string | false\n /** Name of the security scheme */\n name: string\n /** Proxy URL */\n proxyUrl: string\n /** OpenID Connect scheme */\n scheme: OpenIdConnectObject\n /** Optional fetch override (IPC-backed on desktop) used for discovery requests */\n customFetch?: CustomFetch\n}>()\n\nconst { translate } = useLocalization()\n\nconst loader = useLoadingState()\nconst { toast } = useToasts()\n\n/**\n * Fetches the OpenID Connect discovery document and triggers authorization\n */\nconst handleOpenIdConnect = async (): Promise<void> => {\n if (loader.isLoading || !scheme.openIdConnectUrl) {\n return\n }\n\n loader.start()\n const [error, _discovery] = await fetchOpenIDConnectDiscovery(\n scheme.openIdConnectUrl,\n proxyUrl,\n customFetch,\n )\n await loader.clear()\n\n // Toast for error\n if (error) {\n console.error(error)\n toast(\n error?.message ??\n translate('apiClient.openIdConnect.failedToFetchConfiguration'),\n 'error',\n )\n return\n }\n\n /** Set the newly discovered params in the secret store */\n const openIdConnect = openIDDiscoveryToFlows(_discovery)\n eventBus.emit('auth:update:security-scheme-secrets', {\n payload: openIdConnect,\n name,\n overwrite: true,\n })\n}\n\nconst handleUpdateOpenIdConnectUrl = (value: string): void =>\n eventBus.emit('auth:update:security-scheme', {\n payload: {\n type: 'openIdConnect',\n openIdConnectUrl: value,\n },\n name,\n })\n</script>\n\n<template>\n <DataTableRow>\n <RequestAuthDataTableInput\n :containerClass=\"getStaticBorderClass()\"\n :environment\n :modelValue=\"scheme.openIdConnectUrl\"\n placeholder=\"https://example.com/.well-known/openid-configuration\"\n required\n @update:modelValue=\"handleUpdateOpenIdConnectUrl\">\n {{ translate('apiClient.openIdConnect.discoveryUrl') }}\n </RequestAuthDataTableInput>\n </DataTableRow>\n\n <DataTableRow class=\"min-w-full\">\n <div class=\"flex h-8 w-full items-center justify-end border-t\">\n <ScalarButton\n class=\"mr-0.75 p-0 px-2 py-0.5\"\n :disabled=\"!scheme.openIdConnectUrl\"\n :loader\n size=\"sm\"\n variant=\"outlined\"\n @click=\"handleOpenIdConnect\">\n {{ translate('apiClient.openIdConnect.fetchConfiguration') }}\n </ScalarButton>\n </div>\n </DataTableRow>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;EAyCA,MAAM,EAAE,cAAc,gBAAgB;EAEtC,MAAM,SAAS,gBAAgB;EAC/B,MAAM,EAAE,UAAU,UAAU;;;;EAK5B,MAAM,sBAAsB,YAA2B;GACrD,IAAI,OAAO,aAAa,CAAC,QAAA,OAAO,kBAC9B;GAGF,OAAO,MAAM;GACb,MAAM,CAAC,OAAO,cAAc,MAAM,4BAChC,QAAA,OAAO,kBACP,QAAA,UACA,QAAA,WACF;GACA,MAAM,OAAO,MAAM;GAGnB,IAAI,OAAO;IACT,QAAQ,MAAM,KAAK;IACnB,MACE,OAAO,WACL,UAAU,oDAAoD,GAChE,OACF;IACA;GACF;;GAGA,MAAM,gBAAgB,uBAAuB,UAAU;GACvD,QAAA,SAAS,KAAK,uCAAuC;IACnD,SAAS;IACT,MAAG,QAAA;IACH,WAAW;GACb,CAAC;EACH;EAEA,MAAM,gCAAgC,UACpC,QAAA,SAAS,KAAK,+BAA+B;GAC3C,SAAS;IACP,MAAM;IACN,kBAAkB;GACpB;GACA,MAAG,QAAA;EACL,CAAC;;2DAID,YAUe,MAAA,oBAAA,GAAA,MAAA;2BADe,CAR5B,YAQ4B,mCAAA;KAPzB,gBAAgB,QAAA,qBAAoB;KACpC,aAAA,QAAA;KACA,YAAY,QAAA,OAAO;KACpB,aAAY;KACZ,UAAA;KACC,uBAAmB;;4BACmC,CAAA,gBAAA,gBAApD,MAAA,SAAA,CAAS,CAAA,sCAAA,CAAA,GAAA,CAAA,CAAA,CAAA;;;;;;;;OAIhB,YAYe,MAAA,oBAAA,GAAA,EAZD,OAAM,aAAY,GAAA;2BAWxB,CAVN,mBAUM,OAVN,YAUM,CATJ,YAQe,MAAA,YAAA,GAAA;KAPb,OAAM;KACL,UAAQ,CAAG,QAAA,OAAO;KAClB,QAAA,MAAA,MAAA;KACD,MAAK;KACL,SAAQ;KACP,SAAO;;4BACqD,CAAA,gBAAA,gBAA1D,MAAA,SAAA,CAAS,CAAA,4CAAA,CAAA,GAAA,CAAA,CAAA,CAAA"}
|
package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthDataTable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestAuthDataTable.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"names":[],"mappings":"AAqKA,OAAO,KAAK,EAEV,QAAQ,EACR,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AACvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,yCAAyC,CAAA;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AACnH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8DAA8D,CAAA;AAGhG,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8DAA8D,CAAA;AACjG,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,gEAAgE,CAAA;AAM1G,KAAK,WAAW,GAAG;IACjB,4CAA4C;IAC5C,WAAW,EAAE,kBAAkB,CAAA;IAC/B,mEAAmE;IACnE,QAAQ,EAAE,OAAO,CAAA;IACjB,8CAA8C;IAC9C,qBAAqB,EAAE,oBAAoB,EAAE,CAAA;IAC7C,uDAAuD;IACvD,eAAe,EAAE,MAAM,CAAA;IACvB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,0CAA0C;IAC1C,eAAe,EAAE,qBAAqB,CAAA;IACtC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,0CAA0C;IAC1C,IAAI,EAAE,QAAQ,CAAA;IACd,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACtC,CAAC;AAiQF,QAAA,MAAM,YAAY;;oPAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthDataTable.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n
|
|
1
|
+
{"version":3,"file":"RequestAuthDataTable.vue.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate } = useLocalization()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n {{ translate('apiClient.requestAuthDataTable.noauthenticationSelected') }}\n </div>\n </form>\n</template>\n"],"mappings":""}
|
package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { useLocalization } from "../../../features/localization/index.js";
|
|
1
2
|
import DataTable_default from "../../../components/data-table/DataTable.vue.js";
|
|
2
3
|
import RequestAuthTab_default from "./RequestAuthTab.vue.js";
|
|
3
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, normalizeClass, openBlock, renderList, toDisplayString, unref, withCtx, withModifiers } from "vue";
|
|
@@ -24,6 +25,7 @@ var RequestAuthDataTable_vue_vue_type_script_setup_true_lang_default = /*@__PURE
|
|
|
24
25
|
documentType: {}
|
|
25
26
|
},
|
|
26
27
|
setup(__props, { expose: __expose }) {
|
|
28
|
+
const { translate } = useLocalization();
|
|
27
29
|
/** Currently selected authentication scheme based on the active tab index */
|
|
28
30
|
const activeScheme = computed(() => __props.selectedSchemeOptions[__props.activeAuthIndex]);
|
|
29
31
|
/**
|
|
@@ -97,7 +99,7 @@ var RequestAuthDataTable_vue_vue_type_script_setup_true_lang_default = /*@__PURE
|
|
|
97
99
|
}, 8, ["class"])) : (openBlock(), createElementBlock("div", {
|
|
98
100
|
key: 2,
|
|
99
101
|
class: normalizeClass(["bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm", { "min-h-[calc(4rem+0.5px)] rounded-b-lg border": __props.isStatic }])
|
|
100
|
-
}, "
|
|
102
|
+
}, toDisplayString(unref(translate)("apiClient.requestAuthDataTable.noauthenticationSelected")), 3))], 32);
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
105
|
});
|
package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.script.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthDataTable.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n
|
|
1
|
+
{"version":3,"file":"RequestAuthDataTable.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport type {\n ApiReferenceEvents,\n AuthMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { MergedSecuritySchemes } from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.2/strict/openapi-document'\nimport { computed } from 'vue'\n\nimport type { OAuth2Options } from '@/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue'\nimport type { SecuritySchemeOption } from '@/v2/blocks/scalar-auth-selector-block/helpers/security-scheme'\nimport { DataTable } from '@/v2/components/data-table'\nimport { useLocalization } from '@/v2/features/localization'\n\nimport RequestAuthTab from './RequestAuthTab.vue'\n\nconst {\n environment,\n isStatic,\n selectedSchemeOptions,\n activeAuthIndex,\n securitySchemes = {},\n server,\n eventBus,\n meta,\n options,\n documentType,\n} = defineProps<{\n /** The current environment configuration */\n environment: XScalarEnvironment\n /** Controls border display for static (non-collapsible) layouts */\n isStatic: boolean\n /** Available authentication scheme options */\n selectedSchemeOptions: SecuritySchemeOption[]\n /** Index of the currently active authentication tab */\n activeAuthIndex: number\n /** Proxy URL */\n proxyUrl: string\n /** OpenAPI security scheme definitions */\n securitySchemes: MergedSecuritySchemes\n /** Current server configuration */\n server: ServerObject | null\n /** Event bus for authentication updates */\n eventBus: WorkspaceEventBus\n /** Metadata for authentication context */\n meta: AuthMeta\n /** Any config options required for the OAuth2 flow */\n options?: OAuth2Options\n /** Type of the document the schemes belong to, forwarded to the auth tab */\n documentType?: 'openapi' | 'asyncapi'\n}>()\n\nconst { translate } = useLocalization()\n\n/** Currently selected authentication scheme based on the active tab index */\nconst activeScheme = computed<SecuritySchemeOption | undefined>(\n () => selectedSchemeOptions[activeAuthIndex],\n)\n\n/**\n * Whether to display multiple authentication tabs.\n * Only shows tabs when there are 2 or more schemes available.\n */\nconst shouldShowTabs = computed<boolean>(() => selectedSchemeOptions.length > 1)\n\n/** Handles authentication tab selection */\nconst handleTabChange = (index: number) =>\n eventBus.emit('auth:update:active-index', {\n index,\n meta,\n })\n\n/** Handles updates to OAuth scope selection */\nconst handleScopesUpdate = (\n params: Omit<ApiReferenceEvents['auth:update:selected-scopes'], 'meta'>,\n): void =>\n eventBus.emit('auth:update:selected-scopes', {\n ...params,\n meta,\n })\n\n/** Handles scope-definition upserts (add / rename / description change) */\nconst handleScopeUpsert = (\n params: ApiReferenceEvents['auth:upsert:scopes'],\n): void => eventBus.emit('auth:upsert:scopes', params)\n\n/** Handles scope-definition deletes */\nconst handleScopeDelete = (\n params: ApiReferenceEvents['auth:delete:scopes'],\n): void => eventBus.emit('auth:delete:scopes', params)\n\n/** Determines if a tab is currently active */\nconst isTabActive = (index: number): boolean => activeAuthIndex === index\n\n/** Expose the active scheme for parent component access */\ndefineExpose({\n activeScheme,\n})\n</script>\n\n<template>\n <form @submit.prevent>\n <!-- Authentication Tabs -->\n <div\n v-if=\"shouldShowTabs\"\n class=\"box-content flex flex-wrap gap-x-2.5 overflow-hidden border-x border-t px-3\"\n :class=\"{ 'border-x-0': !isStatic }\"\n data-testid=\"auth-tabs\">\n <div\n v-for=\"(option, index) in selectedSchemeOptions\"\n :key=\"option.id\"\n class=\"relative z-1 -mb-[var(--scalar-border-width)] flex h-8\">\n <button\n class=\"floating-bg relative cursor-pointer border-b border-transparent py-1 text-sm font-medium transition-colors\"\n :class=\"isTabActive(index) ? 'text-c-1' : 'text-c-3'\"\n type=\"button\"\n @click=\"handleTabChange(index)\">\n <span class=\"relative z-10 font-medium whitespace-nowrap\">\n {{ option.label }}\n </span>\n </button>\n\n <!-- Active Tab Indicator -->\n <div\n v-if=\"isTabActive(index)\"\n class=\"absolute inset-x-1 bottom-[var(--scalar-border-width)] left-1/2 z-1 h-px w-full -translate-x-1/2 bg-current\" />\n </div>\n </div>\n\n <!-- Active Authentication Scheme Content -->\n <DataTable\n v-if=\"activeScheme\"\n class=\"flex-1\"\n :class=\"{ 'bg-b-1 rounded-b-lg border-x border-b': isStatic }\"\n :columns=\"['']\"\n presentational>\n <RequestAuthTab\n :documentType\n :environment\n :eventBus\n :isStatic\n :options\n :proxyUrl\n :securitySchemes\n :selectedSecuritySchemas=\"activeScheme.value\"\n :server\n @delete:scope=\"handleScopeDelete\"\n @update:selectedScopes=\"handleScopesUpdate\"\n @upsert:scope=\"handleScopeUpsert\" />\n </DataTable>\n\n <!-- Empty State -->\n <div\n v-else\n class=\"bg-b-1 text-c-3 flex min-h-16 items-center justify-center border-t px-4 text-sm\"\n :class=\"{ 'min-h-[calc(4rem+0.5px)] rounded-b-lg border': isStatic }\">\n {{ translate('apiClient.requestAuthDataTable.noau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A,IAAA,IAAA,CAAA,CAAA;mDAMpH,aAAA,SAAA,UAAA,GADR,YAmBY,MAAA,iBAAA,GAAA;;IAjBV,OAAK,eAAA,CAAC,UAAQ,EAAA,yCACqC,QAAA,SAAQ,CAAA,CAAA;IAC1D,SAAS,CAAA,EAAA;IACV,gBAAA;;2BAasC,CAZtC,YAYsC,wBAAA;KAXnC,cAAA,QAAA;KACA,aAAA,QAAA;KACA,UAAA,QAAA;KACA,UAAA,QAAA;KACA,SAAA,QAAA;KACA,UAAA,QAAA;KACA,iBAAA,QAAA;KACA,yBAAyB,aAAA,MAAa;KACtC,QAAA,QAAA;KACA,kBAAc;KACd,2BAAuB;KACvB,kBAAc;;;;;;;;;;;;;qCAInB,mBAKM,OAAA;;IAHJ,OAAK,eAAA,CAAC,mFAAiF,EAAA,gDAC7B,QAAA,SAAQ,CAAA,CAAA;sBAC/D,MAAA,SAAA,CAAS,CAAA,yDAAA,CAAA,GAAA,CAAA,EAAA,GAAA,EAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"RequestAuthTab.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue"],"names":[],"mappings":"AAqtBA,OAAO,KAAK,EAEV,iBAAiB,EAClB,MAAM,gCAAgC,CAAA;AAEvC,OAAO,EAEL,KAAK,qBAAqB,EAG3B,MAAM,yCAAyC,CAAA;AAChD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2EAA2E,CAAA;AAEnH,OAAO,KAAK,EAEV,yBAAyB,EACzB,YAAY,EACb,MAAM,8DAA8D,CAAA;AAiBrE,OAAe,EAAE,KAAK,aAAa,EAAE,MAAM,cAAc,CAAA;AAKzD,KAAK,WAAW,GAAG;IACjB,wCAAwC;IACxC,WAAW,EAAE,kBAAkB,CAAA;IAC/B,yFAAyF;IACzF,QAAQ,EAAE,OAAO,CAAA;IACjB,gBAAgB;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,+BAA+B;IAC/B,uBAAuB,EAAE,yBAAyB,CAAA;IAClD,oGAAoG;IACpG,eAAe,EAAE,qBAAqB,CAAA;IACtC,mCAAmC;IACnC,MAAM,EAAE,YAAY,GAAG,IAAI,CAAA;IAC3B,2CAA2C;IAC3C,QAAQ,EAAE,iBAAiB,CAAA;IAC3B,uDAAuD;IACvD,OAAO,CAAC,EAAE,aAAa,CAAA;IACvB,yFAAyF;IACzF,YAAY,CAAC,EAAE,SAAS,GAAG,UAAU,CAAA;CACtC,CAAC;AAgxCF,QAAA,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAGhB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|