@scalar/api-client 2.38.0 → 2.38.2
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 +33 -0
- package/dist/AddressBar-B4xnl66I.js +302 -0
- package/dist/AddressBar-B4xnl66I.js.map +1 -0
- package/dist/App-BVH4lIe8.js +533 -0
- package/dist/App-BVH4lIe8.js.map +1 -0
- package/dist/App-CvClwSlM.js +2510 -0
- package/dist/App-CvClwSlM.js.map +1 -0
- package/dist/CodeInput-C-igR77V.js +694 -0
- package/dist/CodeInput-C-igR77V.js.map +1 -0
- package/dist/CodeSnippet-D7Heh1nd.js +218 -0
- package/dist/CodeSnippet-D7Heh1nd.js.map +1 -0
- package/dist/Collection-4MT9WmDD.js +219 -0
- package/dist/Collection-4MT9WmDD.js.map +1 -0
- package/dist/CollectionAuthentication-MHWQpw74.js +56 -0
- package/dist/CollectionAuthentication-MHWQpw74.js.map +1 -0
- package/dist/CollectionCookies-DyjPPMdt.js +19 -0
- package/dist/CollectionCookies-DyjPPMdt.js.map +1 -0
- package/dist/CollectionEnvironment-Dw35vIqo.js +514 -0
- package/dist/CollectionEnvironment-Dw35vIqo.js.map +1 -0
- package/dist/CollectionOverview-TUdDIu5f.js +131 -0
- package/dist/CollectionOverview-TUdDIu5f.js.map +1 -0
- package/dist/CollectionScripts-CMNlBlby.js +19 -0
- package/dist/CollectionScripts-CMNlBlby.js.map +1 -0
- package/dist/CollectionServers-BrjTCfDe.js +168 -0
- package/dist/CollectionServers-BrjTCfDe.js.map +1 -0
- package/dist/CollectionSettings-HVSlp2Gv.js +87 -0
- package/dist/CollectionSettings-HVSlp2Gv.js.map +1 -0
- package/dist/CollectionSync-CAflc5yW.js +19 -0
- package/dist/CollectionSync-CAflc5yW.js.map +1 -0
- package/dist/CommandActionInput-TkcAx6E8.js +97 -0
- package/dist/CommandActionInput-TkcAx6E8.js.map +1 -0
- package/dist/CommandPalette-CL8k4CoN.js +964 -0
- package/dist/CommandPalette-CL8k4CoN.js.map +1 -0
- package/dist/CommandPaletteImport-Diu5dDIY.js +622 -0
- package/dist/CommandPaletteImport-Diu5dDIY.js.map +1 -0
- package/dist/Cookies-DbOKTi1f.js +284 -0
- package/dist/Cookies-DbOKTi1f.js.map +1 -0
- package/dist/DataTable-BqbZKW3K.js +62 -0
- package/dist/DataTable-BqbZKW3K.js.map +1 -0
- package/dist/DataTableHeader-DJVB0jCZ.js +21 -0
- package/dist/DataTableHeader-DJVB0jCZ.js.map +1 -0
- package/dist/DataTableInput-yaU5g-kP.js +166 -0
- package/dist/DataTableInput-yaU5g-kP.js.map +1 -0
- package/dist/DataTableRow-c3XveEUO.js +57 -0
- package/dist/DataTableRow-c3XveEUO.js.map +1 -0
- package/dist/DeleteSidebarListElement-C-p87d03.js +78 -0
- package/dist/DeleteSidebarListElement-C-p87d03.js.map +1 -0
- package/dist/EditSidebarListElement-CodWPnM6.js +32 -0
- package/dist/EditSidebarListElement-CodWPnM6.js.map +1 -0
- package/dist/Editor-BomsGWHx.js +909 -0
- package/dist/Editor-BomsGWHx.js.map +1 -0
- package/dist/EmptyState-Cnm7hGW5.js +46 -0
- package/dist/EmptyState-Cnm7hGW5.js.map +1 -0
- package/dist/Environment-DJatRQIg.js +416 -0
- package/dist/Environment-DJatRQIg.js.map +1 -0
- package/dist/EnvironmentModal-DBEJ4Kzj.js +288 -0
- package/dist/EnvironmentModal-DBEJ4Kzj.js.map +1 -0
- package/dist/Form-CSKzyHGO.js +83 -0
- package/dist/Form-CSKzyHGO.js.map +1 -0
- package/dist/HttpMethod-rnWEgC3T.js +78 -0
- package/dist/HttpMethod-rnWEgC3T.js.map +1 -0
- package/dist/IconSelector-BDC_GQXv.js +67 -0
- package/dist/IconSelector-BDC_GQXv.js.map +1 -0
- package/dist/ImportCollection-DfX1UQ5u.js +804 -0
- package/dist/ImportCollection-DfX1UQ5u.js.map +1 -0
- package/dist/IntegrationLogo-B9EDW8db.js +51 -0
- package/dist/IntegrationLogo-B9EDW8db.js.map +1 -0
- package/dist/MainLayout-BEFMl1ud.js +281 -0
- package/dist/MainLayout-BEFMl1ud.js.map +1 -0
- package/dist/Modal-sQ9vH6MN.js +67 -0
- package/dist/Modal-sQ9vH6MN.js.map +1 -0
- package/dist/ModalClientContainer-qHsZi4wQ.js +65 -0
- package/dist/ModalClientContainer-qHsZi4wQ.js.map +1 -0
- package/dist/Request-gscRsGQ8.js +212 -0
- package/dist/Request-gscRsGQ8.js.map +1 -0
- package/dist/RequestAuth-BzBfIysT.js +989 -0
- package/dist/RequestAuth-BzBfIysT.js.map +1 -0
- package/dist/RequestRoot-3Bj8JZD-.js +1611 -0
- package/dist/RequestRoot-3Bj8JZD-.js.map +1 -0
- package/dist/RequestSection-HhdJj9hW.js +1582 -0
- package/dist/RequestSection-HhdJj9hW.js.map +1 -0
- package/dist/ResponseSection-DMJ0tw8E.js +949 -0
- package/dist/ResponseSection-DMJ0tw8E.js.map +1 -0
- package/dist/ScalarAsciiArt-BjuSnj8e.js +45 -0
- package/dist/ScalarAsciiArt-BjuSnj8e.js.map +1 -0
- package/dist/SectionFilter-hrtoRLwj.js +99 -0
- package/dist/SectionFilter-hrtoRLwj.js.map +1 -0
- package/dist/Server-DnA_BzPS.js +303 -0
- package/dist/Server-DnA_BzPS.js.map +1 -0
- package/dist/ServerVariablesForm-BRZ9XC8o.js +145 -0
- package/dist/ServerVariablesForm-BRZ9XC8o.js.map +1 -0
- package/dist/Settings-CYZzdJPO.js +347 -0
- package/dist/Settings-CYZzdJPO.js.map +1 -0
- package/dist/Sidebar-C6AdX6-N.js +73 -0
- package/dist/Sidebar-C6AdX6-N.js.map +1 -0
- package/dist/SidebarButton-BAagdMDe.js +37 -0
- package/dist/SidebarButton-BAagdMDe.js.map +1 -0
- package/dist/SidebarListElement-BfTPiihc.js +232 -0
- package/dist/SidebarListElement-BfTPiihc.js.map +1 -0
- package/dist/TheCommandPalette-Dl9TAeke.js +204 -0
- package/dist/TheCommandPalette-Dl9TAeke.js.map +1 -0
- package/dist/ValueEmitter-QYkZ9Hdc.js +20 -0
- package/dist/ValueEmitter-QYkZ9Hdc.js.map +1 -0
- package/dist/ViewLayout-BOXN0IYo.js +17 -0
- package/dist/ViewLayout-BOXN0IYo.js.map +1 -0
- package/dist/ViewLayoutCollapse-CiTb-Uml.js +86 -0
- package/dist/ViewLayoutCollapse-CiTb-Uml.js.map +1 -0
- package/dist/ViewLayoutContent-CvMoJYPF.js +13 -0
- package/dist/ViewLayoutContent-CvMoJYPF.js.map +1 -0
- package/dist/ViewLayoutSection-mUqKbQry.js +23 -0
- package/dist/ViewLayoutSection-mUqKbQry.js.map +1 -0
- package/dist/WatchModeToggle-D_eAiTWJ.js +41 -0
- package/dist/WatchModeToggle-D_eAiTWJ.js.map +1 -0
- package/dist/_plugin-vue_export-helper-BmmBcIzD.js +8 -0
- package/dist/analytics-BZimCWcw.js +7 -0
- package/dist/analytics-BZimCWcw.js.map +1 -0
- package/dist/build-request-security-BQjNr2MD.js +41 -0
- package/dist/build-request-security-BQjNr2MD.js.map +1 -0
- package/dist/code-input-iq-moLxi.js +775 -0
- package/dist/code-input-iq-moLxi.js.map +1 -0
- package/dist/components/AddressBar/AddressBar.vue.d.ts +1 -1
- package/dist/components/AddressBar/index.d.ts +1 -1
- package/dist/components/AddressBar/index.js +5 -4
- package/dist/components/CodeInput/CodeInput.vue.d.ts +1 -1
- package/dist/components/CodeInput/codeVariableWidget.d.ts +1 -1
- package/dist/components/CodeInput/index.d.ts +1 -1
- package/dist/components/CodeInput/index.js +2 -4
- package/dist/components/CommandPalette/index.d.ts +1 -1
- package/dist/components/CommandPalette/index.js +3 -4
- package/dist/components/DataTable/DataTableInput.vue.d.ts +2 -2
- package/dist/components/DataTable/index.d.ts +8 -8
- package/dist/components/DataTable/index.js +6 -18
- package/dist/components/Form/LabelInput.vue.d.ts +1 -1
- package/dist/components/HttpMethod/index.d.ts +1 -1
- package/dist/components/HttpMethod/index.js +2 -4
- package/dist/components/ImportCollection/index.d.ts +1 -1
- package/dist/components/ImportCollection/index.js +2 -4
- package/dist/components/ImportCollection/utils/import-collection.d.ts +1 -1
- package/dist/components/ImportCollection/utils/workspace-store-is-empty.d.ts +1 -1
- package/dist/components/Server/ServerVariablesForm.vue.d.ts +1 -1
- package/dist/components/Server/index.d.ts +3 -3
- package/dist/components/Server/index.js +3 -8
- package/dist/components/Sidebar/index.d.ts +1 -1
- package/dist/components/Sidebar/index.js +2 -4
- package/dist/components/ViewLayout/index.d.ts +1 -1
- package/dist/components/ViewLayout/index.js +2 -4
- package/dist/components/index.d.ts +3 -3
- package/dist/components/index.js +7 -8
- package/dist/components-CSxJTn6F.js +183 -0
- package/dist/components-CSxJTn6F.js.map +1 -0
- package/dist/components-ChixwQhN.js +61 -0
- package/dist/components-ChixwQhN.js.map +1 -0
- package/dist/computer-D7VW3Ruy.js +562 -0
- package/dist/computer-D7VW3Ruy.js.map +1 -0
- package/dist/consts-CyGRb9dl.js +318 -0
- package/dist/consts-CyGRb9dl.js.map +1 -0
- package/dist/curl-nbw1OxbV.js +54 -0
- package/dist/curl-nbw1OxbV.js.map +1 -0
- package/dist/data-table-PL7e8NRO.js +282 -0
- package/dist/data-table-PL7e8NRO.js.map +1 -0
- package/dist/editor-BZ_J0eze.js +466 -0
- package/dist/editor-BZ_J0eze.js.map +1 -0
- package/dist/environments-ByLK9lnC.js +592 -0
- package/dist/environments-ByLK9lnC.js.map +1 -0
- package/dist/formatters-DOGXZq9R.js +36 -0
- package/dist/formatters-DOGXZq9R.js.map +1 -0
- package/dist/forms-CZX6cFDS.js +42 -0
- package/dist/forms-CZX6cFDS.js.map +1 -0
- package/dist/get-active-environment-CkxyQ1dM.js +19 -0
- package/dist/get-active-environment-CkxyQ1dM.js.map +1 -0
- package/dist/get-resolved-url-BUCwrBzc.js +30 -0
- package/dist/get-resolved-url-BUCwrBzc.js.map +1 -0
- package/dist/get-server-url-o3On8CEr.js +32 -0
- package/dist/get-server-url-o3On8CEr.js.map +1 -0
- package/dist/get-servers-B_WNlQWB.js +106 -0
- package/dist/get-servers-B_WNlQWB.js.map +1 -0
- package/dist/get-snippet-DBRUSfZ2.js +39 -0
- package/dist/get-snippet-DBRUSfZ2.js.map +1 -0
- package/dist/global-cookies-D3ZS9ON3.js +184 -0
- package/dist/global-cookies-D3ZS9ON3.js.map +1 -0
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +3 -11
- package/dist/hooks/useSidebar.d.ts +1 -1
- package/dist/hooks-BvZxH4XB.js +80 -0
- package/dist/hooks-BvZxH4XB.js.map +1 -0
- package/dist/index.d.ts +3 -3
- package/dist/index.js +8 -12
- package/dist/layout-BWiL7dfb.js +81 -0
- package/dist/layout-BWiL7dfb.js.map +1 -0
- package/dist/layouts/App/create-api-client-app.d.ts +9 -9
- package/dist/layouts/App/index.d.ts +2 -2
- package/dist/layouts/App/index.js +5 -7
- package/dist/layouts/Modal/create-api-client-modal.d.ts +1 -1
- package/dist/layouts/Modal/index.d.ts +2 -2
- package/dist/layouts/Modal/index.js +3 -4
- package/dist/layouts/Web/create-api-client-web.d.ts +9 -9
- package/dist/layouts/Web/index.d.ts +2 -2
- package/dist/layouts/Web/index.js +101 -6
- package/dist/layouts/Web/index.js.map +1 -0
- package/dist/libs/create-client.d.ts +9 -9
- package/dist/libs/create-client.d.ts.map +1 -1
- package/dist/libs/environment-parser.d.ts +1 -1
- package/dist/libs/get-request-uid-by-path-method.d.ts +1 -1
- package/dist/libs/hot-keys.d.ts +1 -1
- package/dist/libs/importers/index.d.ts +1 -1
- package/dist/libs/importers/index.js +2 -4
- package/dist/libs/index.d.ts +15 -15
- package/dist/libs/index.js +6 -45
- package/dist/libs/local-storage.d.ts +1 -1
- package/dist/libs/send-request/create-request-operation.d.ts +3 -3
- package/dist/libs/send-request/index.d.ts +3 -3
- package/dist/libs/send-request/index.js +3 -8
- package/dist/libs-spbv4P0g.js +249 -0
- package/dist/libs-spbv4P0g.js.map +1 -0
- package/dist/monacoeditorwork/json.worker.bundle.js +8 -8
- package/dist/monacoeditorwork/yaml.worker.bundle.js +151 -151
- package/dist/operation-block-BnMIKAOh.js +1624 -0
- package/dist/operation-block-BnMIKAOh.js.map +1 -0
- package/dist/operation-code-sample-ZUTueV3v.js +1726 -0
- package/dist/operation-code-sample-ZUTueV3v.js.map +1 -0
- package/dist/parse-curl-BtypQT3D.js +106 -0
- package/dist/parse-curl-BtypQT3D.js.map +1 -0
- package/dist/plugins/hooks/usePluginManager.d.ts +1 -1
- package/dist/plugins/index.d.ts +2 -2
- package/dist/plugins/index.js +2 -7
- package/dist/plugins/plugin-manager.d.ts +10 -4
- package/dist/plugins/plugin-manager.d.ts.map +1 -1
- package/dist/plugins-B52hCIyZ.js +50 -0
- package/dist/plugins-B52hCIyZ.js.map +1 -0
- package/dist/rabbitjump-CMZXAR6d.js +9 -0
- package/dist/rabbitjump-CMZXAR6d.js.map +1 -0
- package/dist/request-block-DwsGy64Q.js +1466 -0
- package/dist/request-block-DwsGy64Q.js.map +1 -0
- package/dist/resize-D2IYvVdh.js +114 -0
- package/dist/resize-D2IYvVdh.js.map +1 -0
- package/dist/response-block-DmkaDZYs.js +1188 -0
- package/dist/response-block-DmkaDZYs.js.map +1 -0
- package/dist/scalar-address-bar-block--Vs6IBU1.js +425 -0
- package/dist/scalar-address-bar-block--Vs6IBU1.js.map +1 -0
- package/dist/scalar-auth-selector-block-DI3DLag9.js +1886 -0
- package/dist/scalar-auth-selector-block-DI3DLag9.js.map +1 -0
- package/dist/search-CmsQQkjn.js +151 -0
- package/dist/search-CmsQQkjn.js.map +1 -0
- package/dist/send-request-BsTfRiBC.js +348 -0
- package/dist/send-request-BsTfRiBC.js.map +1 -0
- package/dist/server-tcI-OCyx.js +140 -0
- package/dist/server-tcI-OCyx.js.map +1 -0
- package/dist/set-request-cookies-BJJhsU4A.js +88 -0
- package/dist/set-request-cookies-BJJhsU4A.js.map +1 -0
- package/dist/settings-BKk_1lcH.js +455 -0
- package/dist/settings-BKk_1lcH.js.map +1 -0
- package/dist/sidebar-ceSbYmnt.js +217 -0
- package/dist/sidebar-ceSbYmnt.js.map +1 -0
- package/dist/store/collections.d.ts +1 -1
- package/dist/store/environment.d.ts +1 -1
- package/dist/store/events.d.ts +8 -8
- package/dist/store/import-spec.d.ts +2 -2
- package/dist/store/index.d.ts +2 -2
- package/dist/store/index.js +2 -10
- package/dist/store/request-example.d.ts +1 -1
- package/dist/store/requests.d.ts +1 -1
- package/dist/store/security-schemes.d.ts +1 -1
- package/dist/store/servers.d.ts +1 -1
- package/dist/store/store.d.ts +7 -7
- package/dist/store/tags.d.ts +1 -1
- package/dist/store/workspace.d.ts +1 -1
- package/dist/store-DpSUVhjp.js +1512 -0
- package/dist/store-DpSUVhjp.js.map +1 -0
- package/dist/string-template-sS5PtY6T.js +64 -0
- package/dist/string-template-sS5PtY6T.js.map +1 -0
- package/dist/style.css +10372 -1
- package/dist/types/index.js +0 -1
- package/dist/use-global-hot-keys-D8Ai8Qbm.js +274 -0
- package/dist/use-global-hot-keys-D8Ai8Qbm.js.map +1 -0
- package/dist/useSidebar-DLTwHDI-.js +45 -0
- package/dist/useSidebar-DLTwHDI-.js.map +1 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts +3 -3
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -2
- package/dist/v2/blocks/operation-block/helpers/build-request-security.d.ts +2 -2
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts +2 -2
- package/dist/v2/blocks/operation-block/helpers/build-request.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.d.ts +1 -1
- package/dist/v2/blocks/operation-block/helpers/send-request.d.ts +1 -1
- package/dist/v2/blocks/operation-block/index.d.ts +4 -4
- package/dist/v2/blocks/operation-block/index.js +20 -11
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.d.ts +2 -2
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.d.ts +2 -2
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.d.ts +2 -2
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.d.ts +1 -1
- package/dist/v2/blocks/operation-code-sample/index.d.ts +6 -6
- package/dist/v2/blocks/operation-code-sample/index.js +2 -16
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts +4 -4
- package/dist/v2/blocks/request-block/RequestBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.d.ts +1 -1
- package/dist/v2/blocks/request-block/components/RequestParams.vue.d.ts +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +1 -1
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.d.ts +1 -1
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts +3 -2
- package/dist/v2/blocks/request-block/helpers/get-default-headers.d.ts.map +1 -1
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.d.ts +1 -1
- package/dist/v2/blocks/request-block/index.d.ts +1 -1
- package/dist/v2/blocks/request-block/index.js +9 -4
- package/dist/v2/blocks/response-block/ResponseBlock.vue.d.ts +1 -1
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.d.ts +1 -1
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +1 -1
- package/dist/v2/blocks/response-block/index.d.ts +1 -1
- package/dist/v2/blocks/response-block/index.js +6 -4
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.d.ts +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/index.d.ts +2 -2
- package/dist/v2/blocks/scalar-address-bar-block/index.js +5 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.d.ts +5 -3
- 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/OAuth2.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.d.ts +2 -2
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.d.ts +1 -1
- package/dist/v2/blocks/scalar-auth-selector-block/index.d.ts +4 -4
- package/dist/v2/blocks/scalar-auth-selector-block/index.js +6 -8
- package/dist/v2/components/code-input/CodeInput.vue.d.ts +1 -1
- package/dist/v2/components/code-input/index.d.ts +1 -1
- package/dist/v2/components/code-input/index.js +2 -4
- package/dist/v2/components/data-table/DataTableInput.vue.d.ts +1 -1
- package/dist/v2/components/data-table/DataTableInputSelect.vue.d.ts +1 -1
- package/dist/v2/components/data-table/index.d.ts +8 -8
- package/dist/v2/components/data-table/index.js +3 -18
- package/dist/v2/components/forms/index.d.ts +1 -1
- package/dist/v2/components/forms/index.js +2 -4
- package/dist/v2/components/layout/index.d.ts +1 -1
- package/dist/v2/components/layout/index.js +2 -4
- package/dist/v2/components/modals/index.d.ts +1 -1
- package/dist/v2/components/modals/index.js +37 -3
- package/dist/v2/components/modals/index.js.map +1 -0
- package/dist/v2/components/resize/index.d.ts +2 -2
- package/dist/v2/components/resize/index.js +2 -6
- package/dist/v2/components/server/ServerDropdown.vue.d.ts +1 -1
- package/dist/v2/components/server/index.d.ts +1 -1
- package/dist/v2/components/server/index.js +2 -4
- package/dist/v2/components/sidebar/Sidebar.vue.d.ts +1 -1
- package/dist/v2/components/sidebar/SidebarMenu.vue.d.ts.map +1 -1
- package/dist/v2/components/sidebar/index.d.ts +3 -3
- package/dist/v2/components/sidebar/index.js +3 -8
- package/dist/v2/features/app/App.vue.d.ts +4 -4
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +1 -1
- package/dist/v2/features/app/components/index.d.ts +1 -1
- package/dist/v2/features/app/components/index.js +10 -5
- package/dist/v2/features/app/helpers/create-api-client-app.d.ts +3 -3
- package/dist/v2/features/app/helpers/get-route-param.d.ts +1 -1
- package/dist/v2/features/app/helpers/routes.d.ts +5 -5
- package/dist/v2/features/app/hooks/use-theme.d.ts +1 -1
- package/dist/v2/features/app/index.d.ts +8 -8
- package/dist/v2/features/app/index.js +3161 -19
- package/dist/v2/features/app/index.js.map +1 -0
- package/dist/v2/features/collection/DocumentCollection.vue.d.ts +1 -1
- package/dist/v2/features/collection/OperationCollection.vue.d.ts +1 -1
- package/dist/v2/features/collection/WorkspaceCollection.vue.d.ts +1 -1
- package/dist/v2/features/collection/components/Authentication.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Cookies.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Editor/Editor.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Editor/index.d.ts +1 -1
- package/dist/v2/features/collection/components/Editor/index.js +2 -4
- package/dist/v2/features/collection/components/Environment.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Form.vue.d.ts +1 -0
- package/dist/v2/features/collection/components/Form.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Overview.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Servers.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Servers.vue.d.ts.map +1 -1
- package/dist/v2/features/collection/components/Settings.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Tabs.vue.d.ts +1 -1
- package/dist/v2/features/command-palette/TheCommandPalette.vue.d.ts +1 -1
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts +10 -45
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.d.ts.map +1 -1
- package/dist/v2/features/command-palette/index.d.ts +2 -2
- package/dist/v2/features/command-palette/index.js +3 -6
- package/dist/v2/features/editor/helpers/json/create-json-model.d.ts +1 -1
- package/dist/v2/features/editor/helpers/json/get-json-ast-node-from-path.d.ts +1 -1
- package/dist/v2/features/editor/helpers/json/json-pointer-path.d.ts +1 -1
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.d.ts +1 -1
- package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.d.ts +1 -1
- package/dist/v2/features/editor/hooks/use-editor.d.ts +1 -1
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.d.ts +1 -1
- package/dist/v2/features/editor/index.d.ts +4 -4
- package/dist/v2/features/editor/index.js +2 -10
- package/dist/v2/features/environments/index.d.ts +1 -1
- package/dist/v2/features/environments/index.js +4 -4
- package/dist/v2/features/global-cookies/index.d.ts +1 -1
- package/dist/v2/features/global-cookies/index.js +4 -4
- package/dist/v2/features/modal/Modal.vue.d.ts +1 -1
- package/dist/v2/features/modal/helpers/create-api-client-modal.d.ts +2 -2
- package/dist/v2/features/modal/hooks/use-modal-sidebar.d.ts +1 -1
- package/dist/v2/features/modal/index.d.ts +3 -3
- package/dist/v2/features/modal/index.js +639 -7
- package/dist/v2/features/modal/index.js.map +1 -0
- package/dist/v2/features/modal/modal-events.d.ts +1 -1
- package/dist/v2/features/operation/Operation.vue.d.ts +2 -2
- package/dist/v2/features/operation/index.d.ts +5 -5
- package/dist/v2/features/operation/index.js +19 -12
- package/dist/v2/features/search/helpers/create-fuse-instance.d.ts +1 -1
- package/dist/v2/features/search/helpers/create-search-index.d.ts +1 -1
- package/dist/v2/features/search/index.d.ts +1 -1
- package/dist/v2/features/search/index.js +2 -4
- package/dist/v2/features/settings/components/Section.vue.d.ts.map +1 -1
- package/dist/v2/features/settings/index.d.ts +2 -2
- package/dist/v2/features/settings/index.js +2 -6
- package/dist/v2/helpers/get-active-proxy-url.d.ts +1 -1
- package/dist/v2/helpers/get-tab-details.d.ts +1 -1
- package/dist/v2/helpers/handle-hotkeys.d.ts +1 -1
- package/dist/v2/helpers/index.d.ts +2 -2
- package/dist/v2/helpers/index.js +3 -6
- package/dist/v2/hooks/use-global-hot-keys.d.ts +1 -1
- package/dist/views/Collection/components/EnvironmentForm.vue.d.ts +1 -1
- package/dist/views/Collection/components/MarkdownInput.vue.d.ts +1 -1
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.d.ts +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.d.ts +1 -1
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.d.ts +1 -1
- package/dist/views/Components/CodeSnippet/index.d.ts +4 -4
- package/dist/views/Components/CodeSnippet/index.js +3 -10
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.d.ts +1 -1
- package/dist/views/Environment/handle-drag.d.ts +1 -1
- package/dist/views/Request/Request.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.d.ts +2 -2
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestAuth/index.d.ts +3 -3
- package/dist/views/Request/RequestSection/RequestAuth/index.js +4 -8
- package/dist/views/Request/RequestSection/RequestBody.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestParams.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestPathParams.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestSection.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/RequestTable.vue.d.ts +1 -1
- package/dist/views/Request/RequestSection/helpers/update-scheme.d.ts +1 -1
- package/dist/views/Request/RequestSection/index.d.ts +2 -2
- package/dist/views/Request/RequestSection/index.js +42 -5
- package/dist/views/Request/RequestSection/index.js.map +1 -0
- package/dist/views/Request/RequestSidebarItem.vue.d.ts +1 -1
- package/dist/views/Request/RequestSidebarItemMenu.vue.d.ts +3 -3
- package/dist/views/Request/RequestSubpageHeader.vue.d.ts +1 -1
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.d.ts +1 -1
- package/dist/views/Request/ResponseSection/ResponseSection.vue.d.ts +1 -1
- package/dist/views/Request/ResponseSection/index.d.ts +2 -2
- package/dist/views/Request/ResponseSection/index.js +7 -6
- package/dist/views/Request/components/index.d.ts +1 -1
- package/dist/views/Request/components/index.js +2 -4
- package/dist/views/Request/consts/index.d.ts +2 -2
- package/dist/views/Request/consts/index.js +2 -10
- package/dist/views/Request/handle-drag.d.ts +2 -2
- package/dist/views/Request/libs/auth.d.ts +1 -1
- package/dist/views/Request/libs/index.d.ts +3 -3
- package/dist/views/Request/libs/index.js +3 -22
- package/dist/views/Request/libs/oauth2.d.ts +1 -1
- package/dist/views/Request/libs/watch-mode.d.ts +2 -2
- package/dist/views/Request/types/index.js +0 -1
- package/dist/watch-mode-Dbaqd9bG.js +375 -0
- package/dist/watch-mode-Dbaqd9bG.js.map +1 -0
- package/package.json +29 -33
- package/dist/_virtual/_plugin-vue_export-helper.js +0 -9
- package/dist/analytics.js +0 -9
- package/dist/assets/computer.ascii.js +0 -34
- package/dist/assets/keycap.ascii.js +0 -25
- package/dist/assets/rabbit.ascii.js +0 -11
- package/dist/assets/rabbitjump.ascii.js +0 -11
- package/dist/components/AddressBar/AddressBar.vue.js +0 -7
- package/dist/components/AddressBar/AddressBar.vue2.js +0 -160
- package/dist/components/AddressBar/AddressBarHistory.vue.js +0 -7
- package/dist/components/AddressBar/AddressBarHistory.vue2.js +0 -98
- package/dist/components/AddressBar/httpStatusCodeColors.js +0 -38
- package/dist/components/CodeInput/CodeInput.vue.js +0 -8
- package/dist/components/CodeInput/CodeInput.vue2.js +0 -209
- package/dist/components/CodeInput/codeVariableWidget.js +0 -111
- package/dist/components/CommandPalette/CommandActionForm.vue.js +0 -44
- package/dist/components/CommandPalette/CommandActionForm.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandActionInput.vue.js +0 -52
- package/dist/components/CommandPalette/CommandActionInput.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteCollection.vue.js +0 -80
- package/dist/components/CommandPalette/CommandPaletteCollection.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteExample.vue.js +0 -116
- package/dist/components/CommandPalette/CommandPaletteExample.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteImport.vue.js +0 -217
- package/dist/components/CommandPalette/CommandPaletteImport.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue.js +0 -7
- package/dist/components/CommandPalette/CommandPaletteImportCurl.vue2.js +0 -136
- package/dist/components/CommandPalette/CommandPaletteServer.vue.js +0 -123
- package/dist/components/CommandPalette/CommandPaletteServer.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteTag.vue.js +0 -84
- package/dist/components/CommandPalette/CommandPaletteTag.vue2.js +0 -4
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue.js +0 -48
- package/dist/components/CommandPalette/CommandPaletteWorkspace.vue2.js +0 -4
- package/dist/components/CommandPalette/TheCommandPalette.vue.js +0 -7
- package/dist/components/CommandPalette/TheCommandPalette.vue2.js +0 -305
- package/dist/components/CommandPalette/WatchModeToggle.vue.js +0 -39
- package/dist/components/CommandPalette/WatchModeToggle.vue2.js +0 -4
- package/dist/components/DataTable/DataTable.vue.js +0 -38
- package/dist/components/DataTable/DataTable.vue2.js +0 -4
- package/dist/components/DataTable/DataTableCell.vue.js +0 -26
- package/dist/components/DataTable/DataTableCell.vue2.js +0 -4
- package/dist/components/DataTable/DataTableCheckbox.vue.js +0 -53
- package/dist/components/DataTable/DataTableCheckbox.vue2.js +0 -4
- package/dist/components/DataTable/DataTableHeader.vue.js +0 -18
- package/dist/components/DataTable/DataTableHeader.vue2.js +0 -4
- package/dist/components/DataTable/DataTableInput.vue.js +0 -7
- package/dist/components/DataTable/DataTableInput.vue2.js +0 -124
- package/dist/components/DataTable/DataTableInputSelect.vue.js +0 -146
- package/dist/components/DataTable/DataTableInputSelect.vue2.js +0 -4
- package/dist/components/DataTable/DataTableRow.vue.js +0 -12
- package/dist/components/DataTable/DataTableText.vue.js +0 -23
- package/dist/components/DataTable/DataTableText.vue2.js +0 -4
- package/dist/components/EmptyState.vue.js +0 -7
- package/dist/components/EmptyState.vue2.js +0 -42
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue.js +0 -113
- package/dist/components/EnvironmentSelector/EnvironmentSelector.vue2.js +0 -4
- package/dist/components/Form/Form.vue.js +0 -83
- package/dist/components/Form/Form.vue2.js +0 -4
- package/dist/components/Form/LabelInput.vue.js +0 -7
- package/dist/components/Form/LabelInput.vue2.js +0 -42
- package/dist/components/HelpfulLink.vue.js +0 -20
- package/dist/components/HelpfulLink.vue2.js +0 -4
- package/dist/components/HttpMethod/HttpMethod.vue.js +0 -7
- package/dist/components/HttpMethod/HttpMethod.vue2.js +0 -62
- package/dist/components/IconSelector.vue.js +0 -75
- package/dist/components/IconSelector.vue2.js +0 -4
- package/dist/components/ImportCollection/DropEventListener.vue.js +0 -81
- package/dist/components/ImportCollection/DropEventListener.vue2.js +0 -4
- package/dist/components/ImportCollection/ImportCollectionListener.vue.js +0 -77
- package/dist/components/ImportCollection/ImportCollectionListener.vue2.js +0 -4
- package/dist/components/ImportCollection/ImportCollectionModal.vue.js +0 -208
- package/dist/components/ImportCollection/ImportCollectionModal.vue3.js +0 -5
- package/dist/components/ImportCollection/ImportNowButton.vue.js +0 -73
- package/dist/components/ImportCollection/ImportNowButton.vue2.js +0 -4
- package/dist/components/ImportCollection/IntegrationLogo.vue.js +0 -44
- package/dist/components/ImportCollection/IntegrationLogo.vue2.js +0 -4
- package/dist/components/ImportCollection/PasteEventListener.vue.js +0 -24
- package/dist/components/ImportCollection/PasteEventListener.vue2.js +0 -4
- package/dist/components/ImportCollection/PrefetchError.vue.js +0 -27
- package/dist/components/ImportCollection/PrefetchError.vue2.js +0 -4
- package/dist/components/ImportCollection/UrlQueryParameterChecker.vue.js +0 -20
- package/dist/components/ImportCollection/UrlQueryParameterChecker.vue2.js +0 -4
- package/dist/components/ImportCollection/WorkspaceSelector.vue.js +0 -134
- package/dist/components/ImportCollection/WorkspaceSelector.vue2.js +0 -4
- package/dist/components/ImportCollection/hooks/useUrlPrefetcher.js +0 -106
- package/dist/components/ImportCollection/utils/get-openapi-version.js +0 -20
- package/dist/components/ImportCollection/utils/import-collection.js +0 -29
- package/dist/components/ImportCollection/utils/is-document.js +0 -9
- package/dist/components/ImportCollection/utils/is-url.js +0 -9
- package/dist/components/ImportCollection/utils/workspace-store-is-empty.js +0 -7
- package/dist/components/OpenApiClientButton.vue.js +0 -7
- package/dist/components/OpenApiClientButton.vue2.js +0 -48
- package/dist/components/ScalarAsciiArt.vue.js +0 -7
- package/dist/components/ScalarAsciiArt.vue2.js +0 -37
- package/dist/components/Search/useSearch.js +0 -78
- package/dist/components/SectionFilter.vue.js +0 -7
- package/dist/components/SectionFilter.vue2.js +0 -64
- package/dist/components/SectionFilterButton.vue.js +0 -23
- package/dist/components/SectionFilterButton.vue2.js +0 -4
- package/dist/components/Server/ServerDropdown.vue.js +0 -132
- package/dist/components/Server/ServerDropdown.vue2.js +0 -4
- package/dist/components/Server/ServerDropdownItem.vue.js +0 -7
- package/dist/components/Server/ServerDropdownItem.vue2.js +0 -84
- package/dist/components/Server/ServerSelector.vue.js +0 -82
- package/dist/components/Server/ServerSelector.vue2.js +0 -4
- package/dist/components/Server/ServerVariablesForm.vue.js +0 -49
- package/dist/components/Server/ServerVariablesForm.vue2.js +0 -4
- package/dist/components/Server/ServerVariablesSelect.vue.js +0 -54
- package/dist/components/Server/ServerVariablesSelect.vue2.js +0 -4
- package/dist/components/Server/ServerVariablesTextbox.vue.js +0 -29
- package/dist/components/Server/ServerVariablesTextbox.vue2.js +0 -4
- package/dist/components/SideNav/DownloadAppButton.vue.js +0 -7
- package/dist/components/SideNav/DownloadAppButton.vue2.js +0 -33
- package/dist/components/SideNav/SideHelp.vue.js +0 -127
- package/dist/components/SideNav/SideHelp.vue2.js +0 -4
- package/dist/components/SideNav/SideNav.vue.js +0 -96
- package/dist/components/SideNav/SideNav.vue2.js +0 -4
- package/dist/components/SideNav/SideNavGroup.vue.js +0 -16
- package/dist/components/SideNav/SideNavGroup.vue2.js +0 -4
- package/dist/components/SideNav/SideNavLink.vue.js +0 -39
- package/dist/components/SideNav/SideNavLink.vue2.js +0 -4
- package/dist/components/SideNav/SideNavRouterLink.vue.js +0 -27
- package/dist/components/SideNav/SideNavRouterLink.vue2.js +0 -4
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue.js +0 -30
- package/dist/components/Sidebar/Actions/DeleteSidebarListElement.vue2.js +0 -4
- package/dist/components/Sidebar/Actions/EditSidebarListCollection.vue.js +0 -58
- package/dist/components/Sidebar/Actions/EditSidebarListCollection.vue2.js +0 -4
- package/dist/components/Sidebar/Actions/EditSidebarListElement.vue.js +0 -29
- package/dist/components/Sidebar/Actions/EditSidebarListElement.vue2.js +0 -4
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue.js +0 -46
- package/dist/components/Sidebar/Actions/SidebarListElementForm.vue2.js +0 -4
- package/dist/components/Sidebar/Sidebar.vue.js +0 -7
- package/dist/components/Sidebar/Sidebar.vue2.js +0 -63
- package/dist/components/Sidebar/SidebarButton.vue.js +0 -33
- package/dist/components/Sidebar/SidebarButton.vue2.js +0 -4
- package/dist/components/Sidebar/SidebarList.vue.js +0 -12
- package/dist/components/Sidebar/SidebarListElement.vue.js +0 -8
- package/dist/components/Sidebar/SidebarListElement.vue2.js +0 -94
- package/dist/components/Sidebar/SidebarListElementActions.vue.js +0 -86
- package/dist/components/Sidebar/SidebarListElementActions.vue2.js +0 -4
- package/dist/components/Sidebar/SidebarToggle.vue.js +0 -49
- package/dist/components/Sidebar/SidebarToggle.vue2.js +0 -4
- package/dist/components/TopNav/TopNav.vue.js +0 -210
- package/dist/components/TopNav/TopNav.vue2.js +0 -4
- package/dist/components/TopNav/TopNavItem.vue.js +0 -7
- package/dist/components/TopNav/TopNavItem.vue2.js +0 -138
- package/dist/components/ViewLayout/ViewLayout.vue.js +0 -18
- package/dist/components/ViewLayout/ViewLayout.vue2.js +0 -4
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue.js +0 -92
- package/dist/components/ViewLayout/ViewLayoutCollapse.vue2.js +0 -4
- package/dist/components/ViewLayout/ViewLayoutContent.vue.js +0 -12
- package/dist/components/ViewLayout/ViewLayoutSection.vue.js +0 -23
- package/dist/components/ViewLayout/ViewLayoutSection.vue2.js +0 -4
- package/dist/constants.js +0 -40
- package/dist/data/httpHeaders.js +0 -537
- package/dist/hooks/useAnalytics.js +0 -11
- package/dist/hooks/useClientConfig.js +0 -7
- package/dist/hooks/useFileDialog.js +0 -21
- package/dist/hooks/useLayout.js +0 -8
- package/dist/hooks/useResponseBody.js +0 -20
- package/dist/hooks/useSidebar.js +0 -28
- package/dist/layouts/App/ApiClientApp.vue.js +0 -70
- package/dist/layouts/App/ApiClientApp.vue3.js +0 -5
- package/dist/layouts/App/MainLayout.vue.js +0 -26
- package/dist/layouts/App/MainLayout.vue2.js +0 -4
- package/dist/layouts/App/create-api-client-app.js +0 -35
- package/dist/layouts/App/hotkeys.js +0 -21
- package/dist/layouts/Modal/ApiClientModal.vue.js +0 -30
- package/dist/layouts/Modal/ApiClientModal.vue2.js +0 -4
- package/dist/layouts/Modal/create-api-client-modal.js +0 -32
- package/dist/layouts/Web/ApiClientWeb.vue.js +0 -64
- package/dist/layouts/Web/ApiClientWeb.vue3.js +0 -5
- package/dist/layouts/Web/create-api-client-web.js +0 -32
- package/dist/libs/create-client.js +0 -189
- package/dist/libs/electron.js +0 -4
- package/dist/libs/env-helpers.js +0 -6
- package/dist/libs/environment-parser.js +0 -18
- package/dist/libs/errors.js +0 -16
- package/dist/libs/event-bus.js +0 -32
- package/dist/libs/extractAttachmentFilename.js +0 -18
- package/dist/libs/find-request.js +0 -23
- package/dist/libs/formatters.js +0 -10
- package/dist/libs/get-request-uid-by-path-method.js +0 -18
- package/dist/libs/getOpenApiDocumentDetails.js +0 -40
- package/dist/libs/hot-keys.js +0 -44
- package/dist/libs/importers/curl.js +0 -53
- package/dist/libs/isUrl.js +0 -7
- package/dist/libs/local-storage.js +0 -41
- package/dist/libs/normalize-headers.js +0 -27
- package/dist/libs/parse-curl.js +0 -59
- package/dist/libs/postman.js +0 -37
- package/dist/libs/send-request/build-request-security.js +0 -35
- package/dist/libs/send-request/create-fetch-body.js +0 -25
- package/dist/libs/send-request/create-fetch-headers.js +0 -11
- package/dist/libs/send-request/create-fetch-query-params.js +0 -33
- package/dist/libs/send-request/create-request-operation.js +0 -140
- package/dist/libs/send-request/decode-buffer.js +0 -9
- package/dist/libs/send-request/set-request-cookies.js +0 -58
- package/dist/libs/string-template.js +0 -42
- package/dist/libs/validate-parameters.js +0 -16
- package/dist/plugins/hooks/usePluginManager.js +0 -10
- package/dist/plugins/plugin-manager.js +0 -26
- package/dist/routes.js +0 -210
- package/dist/store/active-entities.js +0 -118
- package/dist/store/collections.js +0 -73
- package/dist/store/cookies.js +0 -13
- package/dist/store/environment.js +0 -32
- package/dist/store/events.js +0 -35
- package/dist/store/import-spec.js +0 -55
- package/dist/store/request-example.js +0 -43
- package/dist/store/requests.js +0 -97
- package/dist/store/router-params.js +0 -22
- package/dist/store/security-schemes.js +0 -55
- package/dist/store/servers.js +0 -39
- package/dist/store/store.js +0 -144
- package/dist/store/tags.js +0 -45
- package/dist/store/workspace.js +0 -52
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js +0 -242
- package/dist/v2/blocks/operation-block/OperationBlock.vue2.js +0 -4
- package/dist/v2/blocks/operation-block/components/Header.vue.js +0 -7
- package/dist/v2/blocks/operation-block/components/Header.vue2.js +0 -100
- package/dist/v2/blocks/operation-block/helpers/build-request-body.js +0 -40
- package/dist/v2/blocks/operation-block/helpers/build-request-cookie-header.js +0 -31
- package/dist/v2/blocks/operation-block/helpers/build-request-parameters.js +0 -107
- package/dist/v2/blocks/operation-block/helpers/build-request-security.js +0 -46
- package/dist/v2/blocks/operation-block/helpers/build-request.js +0 -70
- package/dist/v2/blocks/operation-block/helpers/de-serialize-parameter.js +0 -25
- package/dist/v2/blocks/operation-block/helpers/decode-buffer.js +0 -9
- package/dist/v2/blocks/operation-block/helpers/filter-global-cookies.js +0 -14
- package/dist/v2/blocks/operation-block/helpers/get-cookie-header-keys.js +0 -4
- package/dist/v2/blocks/operation-block/helpers/get-environment-variables.js +0 -7
- package/dist/v2/blocks/operation-block/helpers/get-example.js +0 -36
- package/dist/v2/blocks/operation-block/helpers/get-resolved-url.js +0 -17
- package/dist/v2/blocks/operation-block/helpers/get-selected-body-content-type.js +0 -4
- package/dist/v2/blocks/operation-block/helpers/get-server-url.js +0 -12
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-request.js +0 -31
- package/dist/v2/blocks/operation-block/helpers/har-to-fetch-response.js +0 -43
- package/dist/v2/blocks/operation-block/helpers/response-cache.js +0 -12
- package/dist/v2/blocks/operation-block/helpers/send-request.js +0 -122
- package/dist/v2/blocks/operation-block/helpers/serialize-parameter.js +0 -49
- package/dist/v2/blocks/operation-block/helpers/validate-path-parameters.js +0 -17
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue.js +0 -56
- package/dist/v2/blocks/operation-code-sample/components/ExamplePicker.vue2.js +0 -4
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue.js +0 -30
- package/dist/v2/blocks/operation-code-sample/components/HttpMethod.vue2.js +0 -4
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue.js +0 -7
- package/dist/v2/blocks/operation-code-sample/components/OperationCodeSample.vue2.js +0 -227
- package/dist/v2/blocks/operation-code-sample/helpers/find-client.js +0 -22
- package/dist/v2/blocks/operation-code-sample/helpers/generate-client-options.js +0 -27
- package/dist/v2/blocks/operation-code-sample/helpers/generate-code-snippet.js +0 -40
- package/dist/v2/blocks/operation-code-sample/helpers/get-clients.js +0 -20
- package/dist/v2/blocks/operation-code-sample/helpers/get-custom-code-samples.js +0 -4
- package/dist/v2/blocks/operation-code-sample/helpers/get-example-from-schema.js +0 -302
- package/dist/v2/blocks/operation-code-sample/helpers/get-resolved-ref-deep.js +0 -28
- package/dist/v2/blocks/operation-code-sample/helpers/get-secrets.js +0 -10
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/operation-to-har.js +0 -67
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-body.js +0 -66
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-parameters.js +0 -172
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-security-schemes.js +0 -55
- package/dist/v2/blocks/operation-code-sample/helpers/operation-to-har/process-server-url.js +0 -18
- package/dist/v2/blocks/request-block/RequestBlock.vue.js +0 -7
- package/dist/v2/blocks/request-block/RequestBlock.vue2.js +0 -344
- package/dist/v2/blocks/request-block/components/RequestBody.vue.js +0 -7
- package/dist/v2/blocks/request-block/components/RequestBody.vue2.js +0 -191
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue.js +0 -84
- package/dist/v2/blocks/request-block/components/RequestBodyForm.vue2.js +0 -4
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue.js +0 -135
- package/dist/v2/blocks/request-block/components/RequestCodeSnippet.vue2.js +0 -4
- package/dist/v2/blocks/request-block/components/RequestParams.vue.js +0 -78
- package/dist/v2/blocks/request-block/components/RequestParams.vue2.js +0 -4
- package/dist/v2/blocks/request-block/components/RequestTable.vue.js +0 -7
- package/dist/v2/blocks/request-block/components/RequestTable.vue2.js +0 -74
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.js +0 -204
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue2.js +0 -4
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue.js +0 -7
- package/dist/v2/blocks/request-block/components/RequestTableTooltip.vue2.js +0 -63
- package/dist/v2/blocks/request-block/helpers/create-parameter-handlers.js +0 -55
- package/dist/v2/blocks/request-block/helpers/files.js +0 -7
- package/dist/v2/blocks/request-block/helpers/get-default-headers.js +0 -26
- package/dist/v2/blocks/request-block/helpers/get-form-body-rows.js +0 -29
- package/dist/v2/blocks/request-block/helpers/get-parameter-content.js +0 -9
- package/dist/v2/blocks/request-block/helpers/get-parameter-schema.js +0 -6
- package/dist/v2/blocks/request-block/helpers/get-request-body-example.js +0 -16
- package/dist/v2/blocks/request-block/helpers/group-by.js +0 -10
- package/dist/v2/blocks/request-block/helpers/is-param-disabled.js +0 -7
- package/dist/v2/blocks/request-block/helpers/validate-parameter.js +0 -32
- package/dist/v2/blocks/response-block/ResponseBlock.vue.js +0 -7
- package/dist/v2/blocks/response-block/ResponseBlock.vue2.js +0 -180
- package/dist/v2/blocks/response-block/components/Headers.vue.js +0 -96
- package/dist/v2/blocks/response-block/components/Headers.vue2.js +0 -4
- package/dist/v2/blocks/response-block/components/ResponseBody.vue.js +0 -7
- package/dist/v2/blocks/response-block/components/ResponseBody.vue2.js +0 -87
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue.js +0 -36
- package/dist/v2/blocks/response-block/components/ResponseBodyDownload.vue2.js +0 -4
- package/dist/v2/blocks/response-block/components/ResponseBodyInfo.vue.js +0 -14
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue.js +0 -7
- package/dist/v2/blocks/response-block/components/ResponseBodyPreview.vue2.js +0 -63
- package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue.js +0 -7
- package/dist/v2/blocks/response-block/components/ResponseBodyRaw.vue2.js +0 -41
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue.js +0 -94
- package/dist/v2/blocks/response-block/components/ResponseBodyStreaming.vue2.js +0 -4
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue.js +0 -25
- package/dist/v2/blocks/response-block/components/ResponseBodyToggle.vue2.js +0 -4
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue.js +0 -52
- package/dist/v2/blocks/response-block/components/ResponseBodyVirtual.vue3.js +0 -5
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue.js +0 -54
- package/dist/v2/blocks/response-block/components/ResponseCookies.vue2.js +0 -4
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.js +0 -7
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue2.js +0 -79
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue.js +0 -7
- package/dist/v2/blocks/response-block/components/ResponseLoadingOverlay.vue2.js +0 -46
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue.js +0 -67
- package/dist/v2/blocks/response-block/components/ResponseMetaInformation.vue2.js +0 -4
- package/dist/v2/blocks/response-block/helpers/extract-filename.js +0 -18
- package/dist/v2/blocks/response-block/helpers/get-content-length.js +0 -12
- package/dist/v2/blocks/response-block/helpers/media-types.js +0 -126
- package/dist/v2/blocks/response-block/helpers/parse-set-cookie.js +0 -12
- package/dist/v2/blocks/response-block/helpers/process-response-body.js +0 -16
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue.js +0 -7
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBar.vue2.js +0 -208
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue.js +0 -7
- package/dist/v2/blocks/scalar-address-bar-block/components/AddressBarHistory.vue2.js +0 -95
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue.js +0 -145
- package/dist/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue2.js +0 -4
- package/dist/v2/blocks/scalar-address-bar-block/components/httpStatusCodeColors.js +0 -38
- package/dist/v2/blocks/scalar-address-bar-block/hooks/use-loading-animation.js +0 -25
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue.js +0 -182
- package/dist/v2/blocks/scalar-auth-selector-block/components/AuthSelector.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue.js +0 -51
- package/dist/v2/blocks/scalar-auth-selector-block/components/DeleteRequestAuthModal.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue.js +0 -330
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuth2.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue.js +0 -7
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesAddModal.vue2.js +0 -76
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue.js +0 -165
- package/dist/v2/blocks/scalar-auth-selector-block/components/OAuthScopesInput.vue3.js +0 -5
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue.js +0 -91
- package/dist/v2/blocks/scalar-auth-selector-block/components/OpenIDConnect.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue.js +0 -83
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTable.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue.js +0 -46
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthDataTableInput.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue.js +0 -244
- package/dist/v2/blocks/scalar-auth-selector-block/components/RequestAuthTab.vue2.js +0 -4
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/auth-options.js +0 -97
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/extract-security-scheme-secrets.js +0 -135
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/fetch-openid-connect-discovery.js +0 -35
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/is-auth-optional.js +0 -7
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/merge-security.js +0 -23
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/oauth.js +0 -139
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/openid-discovery-to-flows.js +0 -27
- package/dist/v2/blocks/scalar-auth-selector-block/helpers/security-scheme.js +0 -64
- package/dist/v2/components/callout/Callout.vue.js +0 -7
- package/dist/v2/components/callout/Callout.vue2.js +0 -43
- package/dist/v2/components/code-input/CodeInput.vue.js +0 -8
- package/dist/v2/components/code-input/CodeInput.vue2.js +0 -213
- package/dist/v2/components/code-input/code-variable-widget.js +0 -106
- package/dist/v2/components/data-table/DataTable.vue.js +0 -38
- package/dist/v2/components/data-table/DataTable.vue2.js +0 -4
- package/dist/v2/components/data-table/DataTableCell.vue.js +0 -26
- package/dist/v2/components/data-table/DataTableCell.vue2.js +0 -4
- package/dist/v2/components/data-table/DataTableCheckbox.vue.js +0 -53
- package/dist/v2/components/data-table/DataTableCheckbox.vue2.js +0 -4
- package/dist/v2/components/data-table/DataTableHeader.vue.js +0 -18
- package/dist/v2/components/data-table/DataTableHeader.vue2.js +0 -4
- package/dist/v2/components/data-table/DataTableInput.vue.js +0 -7
- package/dist/v2/components/data-table/DataTableInput.vue2.js +0 -121
- package/dist/v2/components/data-table/DataTableInputSelect.vue.js +0 -149
- package/dist/v2/components/data-table/DataTableInputSelect.vue2.js +0 -4
- package/dist/v2/components/data-table/DataTableRow.vue.js +0 -12
- package/dist/v2/components/data-table/DataTableText.vue.js +0 -23
- package/dist/v2/components/data-table/DataTableText.vue2.js +0 -4
- package/dist/v2/components/forms/ConfirmationForm.vue.js +0 -45
- package/dist/v2/components/forms/ConfirmationForm.vue2.js +0 -4
- package/dist/v2/components/layout/CollapsibleSection.vue.js +0 -89
- package/dist/v2/components/layout/CollapsibleSection.vue2.js +0 -4
- package/dist/v2/components/layout/ValueEmitter.vue.js +0 -21
- package/dist/v2/components/layout/ValueEmitter.vue2.js +0 -4
- package/dist/v2/components/modals/DeleteModal.vue.js +0 -31
- package/dist/v2/components/modals/DeleteModal.vue2.js +0 -4
- package/dist/v2/components/modals/ModalClientContainer.vue.js +0 -7
- package/dist/v2/components/modals/ModalClientContainer.vue2.js +0 -60
- package/dist/v2/components/resize/Resize.vue.js +0 -8
- package/dist/v2/components/resize/Resize.vue2.js +0 -36
- package/dist/v2/components/resize/use-split-resize.js +0 -57
- package/dist/v2/components/server/ServerDropdown.vue.js +0 -91
- package/dist/v2/components/server/ServerDropdown.vue2.js +0 -4
- package/dist/v2/components/server/ServerDropdownItem.vue.js +0 -7
- package/dist/v2/components/server/ServerDropdownItem.vue2.js +0 -49
- package/dist/v2/components/sidebar/Sidebar.vue.js +0 -115
- package/dist/v2/components/sidebar/Sidebar.vue2.js +0 -4
- package/dist/v2/components/sidebar/SidebarMenu.vue.js +0 -50
- package/dist/v2/components/sidebar/SidebarMenu.vue2.js +0 -4
- package/dist/v2/components/sidebar/SidebarToggle.vue.js +0 -52
- package/dist/v2/components/sidebar/SidebarToggle.vue2.js +0 -4
- package/dist/v2/features/app/App.vue.js +0 -152
- package/dist/v2/features/app/App.vue3.js +0 -5
- package/dist/v2/features/app/app-events.js +0 -251
- package/dist/v2/features/app/app-state.js +0 -415
- package/dist/v2/features/app/components/AppSidebar.vue.js +0 -7
- package/dist/v2/features/app/components/AppSidebar.vue2.js +0 -304
- package/dist/v2/features/app/components/CreateWorkspaceModal.vue.js +0 -56
- package/dist/v2/features/app/components/CreateWorkspaceModal.vue2.js +0 -4
- package/dist/v2/features/app/components/DesktopTab.vue.js +0 -7
- package/dist/v2/features/app/components/DesktopTab.vue2.js +0 -134
- package/dist/v2/features/app/components/DesktopTabs.vue.js +0 -56
- package/dist/v2/features/app/components/DesktopTabs.vue2.js +0 -4
- package/dist/v2/features/app/components/DownloadAppButton.vue.js +0 -7
- package/dist/v2/features/app/components/DownloadAppButton.vue2.js +0 -19
- package/dist/v2/features/app/components/SidebarItemMenu.vue.js +0 -185
- package/dist/v2/features/app/components/SidebarItemMenu.vue2.js +0 -4
- package/dist/v2/features/app/components/SplashScreen.vue.js +0 -7
- package/dist/v2/features/app/components/SplashScreen.vue2.js +0 -18
- package/dist/v2/features/app/helpers/create-api-client-app.js +0 -36
- package/dist/v2/features/app/helpers/filter-workspaces.js +0 -5
- package/dist/v2/features/app/helpers/get-route-param.js +0 -9
- package/dist/v2/features/app/helpers/group-workspaces.js +0 -23
- package/dist/v2/features/app/helpers/routes.js +0 -157
- package/dist/v2/features/app/hooks/use-document-watcher.js +0 -66
- package/dist/v2/features/app/hooks/use-theme.js +0 -48
- package/dist/v2/features/collection/DocumentCollection.vue.js +0 -336
- package/dist/v2/features/collection/DocumentCollection.vue3.js +0 -5
- package/dist/v2/features/collection/OperationCollection.vue.js +0 -86
- package/dist/v2/features/collection/OperationCollection.vue2.js +0 -4
- package/dist/v2/features/collection/WorkspaceCollection.vue.js +0 -68
- package/dist/v2/features/collection/WorkspaceCollection.vue2.js +0 -4
- package/dist/v2/features/collection/components/Authentication.vue.js +0 -7
- package/dist/v2/features/collection/components/Authentication.vue2.js +0 -154
- package/dist/v2/features/collection/components/Cookies.vue.js +0 -52
- package/dist/v2/features/collection/components/Cookies.vue2.js +0 -4
- package/dist/v2/features/collection/components/Editor/Editor.vue.js +0 -7
- package/dist/v2/features/collection/components/Editor/Editor.vue2.js +0 -344
- package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue.js +0 -78
- package/dist/v2/features/collection/components/Editor/components/EditorDiagnosticsPanel.vue2.js +0 -4
- package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue.js +0 -83
- package/dist/v2/features/collection/components/Editor/components/EditorSavePanel.vue2.js +0 -4
- package/dist/v2/features/collection/components/Editor/helpers/get-diagnostic-counts.js +0 -10
- package/dist/v2/features/collection/components/Editor/helpers/get-operation-context.js +0 -5
- package/dist/v2/features/collection/components/Editor/helpers/get-visible-diagnostics.js +0 -5
- package/dist/v2/features/collection/components/Editor/helpers/parse-editor-object.js +0 -21
- package/dist/v2/features/collection/components/Editor/helpers/stringify-document.js +0 -5
- package/dist/v2/features/collection/components/Editor/hooks/use-editor-state.js +0 -25
- package/dist/v2/features/collection/components/Environment.vue.js +0 -54
- package/dist/v2/features/collection/components/Environment.vue2.js +0 -4
- package/dist/v2/features/collection/components/Form.vue.js +0 -78
- package/dist/v2/features/collection/components/Form.vue2.js +0 -4
- package/dist/v2/features/collection/components/LabelInput.vue.js +0 -7
- package/dist/v2/features/collection/components/LabelInput.vue2.js +0 -35
- package/dist/v2/features/collection/components/Overview.vue.js +0 -7
- package/dist/v2/features/collection/components/Overview.vue2.js +0 -208
- package/dist/v2/features/collection/components/Servers.vue.js +0 -209
- package/dist/v2/features/collection/components/Servers.vue2.js +0 -4
- package/dist/v2/features/collection/components/Settings.vue.js +0 -61
- package/dist/v2/features/collection/components/Settings.vue2.js +0 -4
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue.js +0 -7
- package/dist/v2/features/collection/components/SyncConflictResolutionEditor.vue2.js +0 -136
- package/dist/v2/features/collection/components/Tabs.vue.js +0 -44
- package/dist/v2/features/collection/components/Tabs.vue2.js +0 -4
- package/dist/v2/features/collection/helpers/get-default-operation-security-toggle.js +0 -13
- package/dist/v2/features/command-palette/TheCommandPalette.vue.js +0 -7
- package/dist/v2/features/command-palette/TheCommandPalette.vue2.js +0 -152
- package/dist/v2/features/command-palette/components/CommandActionForm.vue.js +0 -48
- package/dist/v2/features/command-palette/components/CommandActionForm.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/CommandActionInput.vue.js +0 -52
- package/dist/v2/features/command-palette/components/CommandActionInput.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue.js +0 -211
- package/dist/v2/features/command-palette/components/CommandPaletteExample.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue.js +0 -182
- package/dist/v2/features/command-palette/components/CommandPaletteImport.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue.js +0 -7
- package/dist/v2/features/command-palette/components/CommandPaletteImportCurl.vue2.js +0 -115
- package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue.js +0 -78
- package/dist/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue.js +0 -221
- package/dist/v2/features/command-palette/components/CommandPaletteRequest.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue.js +0 -114
- package/dist/v2/features/command-palette/components/CommandPaletteTag.vue2.js +0 -4
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue.js +0 -40
- package/dist/v2/features/command-palette/components/WatchModeToggle.vue2.js +0 -4
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.js +0 -11
- package/dist/v2/features/command-palette/helpers/get-openapi-document-details.js +0 -31
- package/dist/v2/features/command-palette/helpers/get-openapi-from-postman.js +0 -11
- package/dist/v2/features/command-palette/helpers/get-operation-from-curl.js +0 -76
- package/dist/v2/features/command-palette/helpers/get-postman-document-details.js +0 -18
- package/dist/v2/features/command-palette/helpers/import-document-to-workspace.js +0 -33
- package/dist/v2/features/command-palette/helpers/is-postman-collection.js +0 -11
- package/dist/v2/features/command-palette/helpers/load-document-from-source.js +0 -52
- package/dist/v2/features/command-palette/hooks/use-command-palette-state.js +0 -139
- package/dist/v2/features/editor/config.js +0 -16
- package/dist/v2/features/editor/helpers/configure-language-support.js +0 -39
- package/dist/v2/features/editor/helpers/ensure-monaco-environment.js +0 -20
- package/dist/v2/features/editor/helpers/json/create-json-model.js +0 -19
- package/dist/v2/features/editor/helpers/json/get-json-ast-node-from-path.js +0 -9
- package/dist/v2/features/editor/helpers/json/json-ast.js +0 -24
- package/dist/v2/features/editor/helpers/json/json-pointer-links.js +0 -72
- package/dist/v2/features/editor/helpers/json/json-pointer-path.js +0 -21
- package/dist/v2/features/editor/helpers/range-to-whole-line.js +0 -8
- package/dist/v2/features/editor/helpers/theme/apply-scalar-theme.js +0 -56
- package/dist/v2/features/editor/helpers/theme/load-css-variables.js +0 -21
- package/dist/v2/features/editor/helpers/yaml/create-yaml-model.js +0 -19
- package/dist/v2/features/editor/helpers/yaml/get-yaml-node-range-from-path.js +0 -50
- package/dist/v2/features/editor/hooks/use-editor-markers.js +0 -34
- package/dist/v2/features/editor/hooks/use-editor.js +0 -107
- package/dist/v2/features/editor/hooks/use-json-pointer-link-support.js +0 -27
- package/dist/v2/features/editor/hooks/use-three-way-merge-editor.js +0 -316
- package/dist/v2/features/editor/schemas/openapi-3.1-schema.json.js +0 -25
- package/dist/v2/features/environments/EnvironmentsList.vue.js +0 -68
- package/dist/v2/features/environments/EnvironmentsList.vue2.js +0 -4
- package/dist/v2/features/environments/components/Environment.vue.js +0 -66
- package/dist/v2/features/environments/components/Environment.vue2.js +0 -4
- package/dist/v2/features/environments/components/EnvironmentColors.vue.js +0 -121
- package/dist/v2/features/environments/components/EnvironmentColors.vue2.js +0 -4
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue.js +0 -85
- package/dist/v2/features/environments/components/EnvironmentCreateModal.vue2.js +0 -4
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue.js +0 -53
- package/dist/v2/features/environments/components/EnvironmentDeleteModal.vue2.js +0 -4
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue.js +0 -109
- package/dist/v2/features/environments/components/EnvironmentVariablesDropdown.vue2.js +0 -4
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue.js +0 -7
- package/dist/v2/features/environments/components/EnvironmentVariablesTable.vue2.js +0 -136
- package/dist/v2/features/global-cookies/components/CookiesTable.vue.js +0 -7
- package/dist/v2/features/global-cookies/components/CookiesTable.vue2.js +0 -189
- package/dist/v2/features/modal/Modal.vue.js +0 -122
- package/dist/v2/features/modal/Modal.vue2.js +0 -4
- package/dist/v2/features/modal/helpers/create-api-client-modal.js +0 -89
- package/dist/v2/features/modal/helpers/map-hidden-clients-config.js +0 -36
- package/dist/v2/features/modal/helpers/resolve-route-parameters.js +0 -29
- package/dist/v2/features/modal/helpers/restore-workspace-state.js +0 -36
- package/dist/v2/features/modal/hooks/use-modal-sidebar.js +0 -93
- package/dist/v2/features/modal/modal-events.js +0 -44
- package/dist/v2/features/operation/Operation.vue.js +0 -126
- package/dist/v2/features/operation/Operation.vue2.js +0 -4
- package/dist/v2/features/operation/helpers/combine-params.js +0 -14
- package/dist/v2/features/operation/helpers/get-security-requirements.js +0 -4
- package/dist/v2/features/operation/helpers/get-selected-security.js +0 -18
- package/dist/v2/features/operation/helpers/get-selected-server.js +0 -4
- package/dist/v2/features/search/helpers/create-fuse-instance.js +0 -43
- package/dist/v2/features/search/helpers/create-search-index.js +0 -63
- package/dist/v2/features/search/hooks/use-search-index.js +0 -18
- package/dist/v2/features/settings/CollectionSettings.vue.js +0 -275
- package/dist/v2/features/settings/CollectionSettings.vue2.js +0 -4
- package/dist/v2/features/settings/DocumentSettings.vue.js +0 -115
- package/dist/v2/features/settings/DocumentSettings.vue2.js +0 -4
- package/dist/v2/features/settings/components/Appearance.vue.js +0 -88
- package/dist/v2/features/settings/components/Appearance.vue2.js +0 -4
- package/dist/v2/features/settings/components/Section.vue.js +0 -35
- package/dist/v2/features/settings/components/Section.vue2.js +0 -4
- package/dist/v2/features/settings/helpers/get-theme-colors.js +0 -16
- package/dist/v2/helpers/drag-handle-factory.js +0 -120
- package/dist/v2/helpers/generate-location-id.js +0 -10
- package/dist/v2/helpers/get-active-environment.js +0 -22
- package/dist/v2/helpers/get-active-proxy-url.js +0 -5
- package/dist/v2/helpers/get-servers.js +0 -66
- package/dist/v2/helpers/get-tab-details.js +0 -34
- package/dist/v2/helpers/handle-hotkeys.js +0 -54
- package/dist/v2/helpers/is-url.js +0 -5
- package/dist/v2/helpers/slugify.js +0 -4
- package/dist/v2/helpers/storage.js +0 -16
- package/dist/v2/hooks/use-color-mode.js +0 -24
- package/dist/v2/hooks/use-global-hot-keys.js +0 -11
- package/dist/v2/hooks/use-scroll-lock.js +0 -21
- package/dist/v2/workspace-events.js +0 -252
- package/dist/views/Collection/Collection.vue.js +0 -4
- package/dist/views/Collection/Collection.vue2.js +0 -49
- package/dist/views/Collection/CollectionAuthentication.vue.js +0 -7
- package/dist/views/Collection/CollectionAuthentication.vue2.js +0 -56
- package/dist/views/Collection/CollectionCookies.vue.js +0 -4
- package/dist/views/Collection/CollectionCookies.vue2.js +0 -16
- package/dist/views/Collection/CollectionEnvironment.vue.js +0 -5
- package/dist/views/Collection/CollectionEnvironment.vue2.js +0 -229
- package/dist/views/Collection/CollectionInfoForm.vue.js +0 -7
- package/dist/views/Collection/CollectionInfoForm.vue2.js +0 -63
- package/dist/views/Collection/CollectionNavigation.vue.js +0 -133
- package/dist/views/Collection/CollectionNavigation.vue2.js +0 -4
- package/dist/views/Collection/CollectionOverview.vue.js +0 -4
- package/dist/views/Collection/CollectionOverview.vue2.js +0 -34
- package/dist/views/Collection/CollectionScripts.vue.js +0 -4
- package/dist/views/Collection/CollectionScripts.vue2.js +0 -16
- package/dist/views/Collection/CollectionServerForm.vue.js +0 -75
- package/dist/views/Collection/CollectionServerForm.vue2.js +0 -4
- package/dist/views/Collection/CollectionServers.vue.js +0 -4
- package/dist/views/Collection/CollectionServers.vue2.js +0 -94
- package/dist/views/Collection/CollectionSettings.vue.js +0 -4
- package/dist/views/Collection/CollectionSettings.vue2.js +0 -118
- package/dist/views/Collection/CollectionSync.vue.js +0 -4
- package/dist/views/Collection/CollectionSync.vue2.js +0 -16
- package/dist/views/Collection/components/EnvironmentForm.vue.js +0 -7
- package/dist/views/Collection/components/EnvironmentForm.vue2.js +0 -270
- package/dist/views/Collection/components/MarkdownInput.vue.js +0 -7
- package/dist/views/Collection/components/MarkdownInput.vue2.js +0 -100
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue.js +0 -50
- package/dist/views/Components/CodeSnippet/CodeSnippet.vue2.js +0 -4
- package/dist/views/Components/CodeSnippet/helpers/convert-to-har-request.js +0 -62
- package/dist/views/Components/CodeSnippet/helpers/get-har-request.js +0 -82
- package/dist/views/Components/CodeSnippet/helpers/get-snippet.js +0 -30
- package/dist/views/Cookies/CookieForm.vue.js +0 -34
- package/dist/views/Cookies/CookieForm.vue2.js +0 -4
- package/dist/views/Cookies/CookieModal.vue.js +0 -7
- package/dist/views/Cookies/CookieModal.vue2.js +0 -88
- package/dist/views/Cookies/Cookies.vue.js +0 -4
- package/dist/views/Cookies/Cookies.vue2.js +0 -162
- package/dist/views/Environment/Environment.vue.js +0 -4
- package/dist/views/Environment/Environment.vue2.js +0 -402
- package/dist/views/Environment/EnvironmentColorModal.vue.js +0 -42
- package/dist/views/Environment/EnvironmentColorModal.vue2.js +0 -4
- package/dist/views/Environment/EnvironmentColors.vue.js +0 -118
- package/dist/views/Environment/EnvironmentColors.vue2.js +0 -4
- package/dist/views/Environment/EnvironmentModal.vue.js +0 -131
- package/dist/views/Environment/EnvironmentModal.vue2.js +0 -4
- package/dist/views/Environment/EnvironmentVariableDropdown.vue.js +0 -129
- package/dist/views/Environment/EnvironmentVariableDropdown.vue2.js +0 -4
- package/dist/views/Environment/handle-drag.js +0 -32
- package/dist/views/Request/Request.vue.js +0 -7
- package/dist/views/Request/Request.vue2.js +0 -105
- package/dist/views/Request/RequestRoot.vue.js +0 -7
- package/dist/views/Request/RequestRoot.vue2.js +0 -123
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue.js +0 -52
- package/dist/views/Request/RequestSection/RequestAuth/DeleteRequestAuthModal.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue.js +0 -246
- package/dist/views/Request/RequestSection/RequestAuth/OAuth2.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue.js +0 -135
- package/dist/views/Request/RequestSection/RequestAuth/OAuthScopesInput.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuth.vue2.js +0 -209
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTable.vue2.js +0 -116
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue.js +0 -50
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthDataTableInput.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue.js +0 -219
- package/dist/views/Request/RequestSection/RequestAuth/RequestAuthTab.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestAuth/helpers/restore-auth-from-local-storage.js +0 -28
- package/dist/views/Request/RequestSection/RequestBody.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestBody.vue2.js +0 -451
- package/dist/views/Request/RequestSection/RequestCodeExample.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestCodeExample.vue2.js +0 -170
- package/dist/views/Request/RequestSection/RequestParams.vue.js +0 -162
- package/dist/views/Request/RequestSection/RequestParams.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestPathParams.vue.js +0 -96
- package/dist/views/Request/RequestSection/RequestPathParams.vue2.js +0 -4
- package/dist/views/Request/RequestSection/RequestSection.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestSection.vue2.js +0 -247
- package/dist/views/Request/RequestSection/RequestTable.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestTable.vue2.js +0 -227
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue.js +0 -7
- package/dist/views/Request/RequestSection/RequestTableTooltip.vue2.js +0 -61
- package/dist/views/Request/RequestSection/helpers/filter-security-requirements.js +0 -29
- package/dist/views/Request/RequestSection/helpers/getting-started.js +0 -13
- package/dist/views/Request/RequestSection/helpers/update-scheme.js +0 -16
- package/dist/views/Request/RequestSidebar.vue.js +0 -7
- package/dist/views/Request/RequestSidebar.vue2.js +0 -341
- package/dist/views/Request/RequestSidebarItem.vue.js +0 -8
- package/dist/views/Request/RequestSidebarItem.vue2.js +0 -464
- package/dist/views/Request/RequestSidebarItemMenu.vue.js +0 -7
- package/dist/views/Request/RequestSidebarItemMenu.vue2.js +0 -236
- package/dist/views/Request/RequestSubpageHeader.vue.js +0 -7
- package/dist/views/Request/RequestSubpageHeader.vue2.js +0 -79
- package/dist/views/Request/ResponseSection/RequestHeaders.vue.js +0 -96
- package/dist/views/Request/ResponseSection/RequestHeaders.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBody.vue.js +0 -7
- package/dist/views/Request/ResponseSection/ResponseBody.vue2.js +0 -83
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue.js +0 -36
- package/dist/views/Request/ResponseSection/ResponseBodyDownload.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyInfo.vue.js +0 -14
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue.js +0 -7
- package/dist/views/Request/ResponseSection/ResponseBodyPreview.vue2.js +0 -63
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue.js +0 -7
- package/dist/views/Request/ResponseSection/ResponseBodyRaw.vue2.js +0 -42
- package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue.js +0 -74
- package/dist/views/Request/ResponseSection/ResponseBodyStreaming.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue.js +0 -25
- package/dist/views/Request/ResponseSection/ResponseBodyToggle.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue.js +0 -50
- package/dist/views/Request/ResponseSection/ResponseBodyVirtual.vue3.js +0 -5
- package/dist/views/Request/ResponseSection/ResponseCookies.vue.js +0 -51
- package/dist/views/Request/ResponseSection/ResponseCookies.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue.js +0 -7
- package/dist/views/Request/ResponseSection/ResponseEmpty.vue2.js +0 -103
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue.js +0 -96
- package/dist/views/Request/ResponseSection/ResponseHeaders.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue.js +0 -7
- package/dist/views/Request/ResponseSection/ResponseLoadingOverlay.vue2.js +0 -38
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue.js +0 -67
- package/dist/views/Request/ResponseSection/ResponseMetaInformation.vue2.js +0 -4
- package/dist/views/Request/ResponseSection/ResponseSection.vue.js +0 -7
- package/dist/views/Request/ResponseSection/ResponseSection.vue2.js +0 -189
- package/dist/views/Request/components/WorkspaceDropdown.vue.js +0 -182
- package/dist/views/Request/components/WorkspaceDropdown.vue2.js +0 -4
- package/dist/views/Request/consts/mediaTypes.js +0 -131
- package/dist/views/Request/consts/new-auth-options.js +0 -100
- package/dist/views/Request/handle-drag.js +0 -42
- package/dist/views/Request/hooks/useOpenApiWatcher.js +0 -57
- package/dist/views/Request/libs/auth.js +0 -52
- package/dist/views/Request/libs/oauth2.js +0 -127
- package/dist/views/Request/libs/request.js +0 -40
- package/dist/views/Request/libs/watch-mode.js +0 -337
- package/dist/views/Settings/Settings.vue.js +0 -4
- package/dist/views/Settings/Settings.vue2.js +0 -29
- package/dist/views/Settings/SettingsGeneral.vue.js +0 -286
- package/dist/views/Settings/SettingsGeneral.vue2.js +0 -4
- package/dist/views/Settings/components/SettingsAppearance.vue.js +0 -85
- package/dist/views/Settings/components/SettingsAppearance.vue2.js +0 -4
- package/dist/views/Settings/components/SettingsSection.vue.js +0 -24
- package/dist/views/Settings/components/SettingsSection.vue2.js +0 -4
|
@@ -1,20 +1,3162 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
import
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import { t as parseCurlCommand } from "../../../parse-curl-BtypQT3D.js";
|
|
2
|
+
import { t as _plugin_vue_export_helper_default } from "../../../_plugin-vue_export-helper-BmmBcIzD.js";
|
|
3
|
+
import { t as IconSelector_default } from "../../../IconSelector-BDC_GQXv.js";
|
|
4
|
+
import "../../../HttpMethod-rnWEgC3T.js";
|
|
5
|
+
import "../../../CodeInput-C-igR77V.js";
|
|
6
|
+
import { t as ServerVariablesForm_default } from "../../../ServerVariablesForm-BRZ9XC8o.js";
|
|
7
|
+
import "../../../Server-DnA_BzPS.js";
|
|
8
|
+
import "../../../AddressBar-B4xnl66I.js";
|
|
9
|
+
import "../../../components-ChixwQhN.js";
|
|
10
|
+
import "../../../Sidebar-C6AdX6-N.js";
|
|
11
|
+
import "../../../DataTableInput-yaU5g-kP.js";
|
|
12
|
+
import { n as Operation_default, o as getSelectedSecurity, r as getActiveProxyUrl } from "../../../operation-block-BnMIKAOh.js";
|
|
13
|
+
import { u as HttpMethod_default } from "../../../operation-code-sample-ZUTueV3v.js";
|
|
14
|
+
import "../../../request-block-DwsGy64Q.js";
|
|
15
|
+
import "../../../SectionFilter-hrtoRLwj.js";
|
|
16
|
+
import { t as ViewLayoutSection_default } from "../../../ViewLayoutSection-mUqKbQry.js";
|
|
17
|
+
import { t as CodeInput_default } from "../../../code-input-iq-moLxi.js";
|
|
18
|
+
import { n as DataTableRow_default, r as DataTableInput_default, s as DataTable_default } from "../../../data-table-PL7e8NRO.js";
|
|
19
|
+
import { n as AuthSelector_default } from "../../../scalar-auth-selector-block-DI3DLag9.js";
|
|
20
|
+
import "../../../response-block-DmkaDZYs.js";
|
|
21
|
+
import "../../../ScalarAsciiArt-BjuSnj8e.js";
|
|
22
|
+
import "../../../scalar-address-bar-block--Vs6IBU1.js";
|
|
23
|
+
import "../../../server-tcI-OCyx.js";
|
|
24
|
+
import { t as getServers } from "../../../get-servers-B_WNlQWB.js";
|
|
25
|
+
import { t as useSplitResize } from "../../../resize-D2IYvVdh.js";
|
|
26
|
+
import { i as workspaceStorage, n as CreateWorkspaceModal_default, r as createAppState, t as App_default } from "../../../App-CvClwSlM.js";
|
|
27
|
+
import "../../../TheCommandPalette-Dl9TAeke.js";
|
|
28
|
+
import { n as CommandActionInput_default, r as CommandActionForm_default, t as CommandPaletteImport_default } from "../../../CommandPaletteImport-Diu5dDIY.js";
|
|
29
|
+
import { a as rangeToWholeLine, n as ensureJsonPointerLinkSupport, r as parseJsonPointerPath } from "../../../editor-BZ_J0eze.js";
|
|
30
|
+
import { t as DeleteSidebarListElement_default } from "../../../DeleteSidebarListElement-C-p87d03.js";
|
|
31
|
+
import { n as CollectionSettings_default, r as Section_default, t as DocumentSettings_default } from "../../../settings-BKk_1lcH.js";
|
|
32
|
+
import { t as CookiesTable_default } from "../../../global-cookies-D3ZS9ON3.js";
|
|
33
|
+
import { n as createJsonModel, t as Editor_default } from "../../../Editor-BomsGWHx.js";
|
|
34
|
+
import { t as EnvironmentsList_default } from "../../../environments-ByLK9lnC.js";
|
|
35
|
+
import { Fragment, capitalize, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeStyle, onMounted, onUnmounted, openBlock, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toValue, unref, useId, useModel, useSlots, useTemplateRef, vModelText, watch, watchEffect, withCtx, withDirectives, withKeys } from "vue";
|
|
36
|
+
import { ScalarButton, ScalarDropdown, ScalarDropdownItem, ScalarIcon, ScalarListbox, ScalarMarkdown, ScalarModal, ScalarToggle, useModal } from "@scalar/components";
|
|
37
|
+
import { useToasts } from "@scalar/use-toasts";
|
|
38
|
+
import { RouterLink, RouterView, createRouter, createWebHashHistory, createWebHistory, useRouter } from "vue-router";
|
|
39
|
+
import { LibraryIcon } from "@scalar/icons/library";
|
|
40
|
+
import { mergeSearchParams } from "@scalar/helpers/url/merge-urls";
|
|
41
|
+
import { ScalarIconArrowSquareIn, ScalarIconArrowUpRight, ScalarIconBracketsCurly, ScalarIconCheckCircle, ScalarIconCloudArrowDown, ScalarIconCookie, ScalarIconFloppyDisk, ScalarIconFolder, ScalarIconInfo, ScalarIconPackage, ScalarIconPencil, ScalarIconPlus, ScalarIconPuzzlePiece, ScalarIconSlidersHorizontal, ScalarIconSpinner, ScalarIconTrash, ScalarIconWarning, ScalarIconWarningCircle } from "@scalar/icons";
|
|
42
|
+
import Fuse from "fuse.js";
|
|
43
|
+
import { getResolvedRef } from "@scalar/workspace-store/helpers/get-resolved-ref";
|
|
44
|
+
import { unpackProxyObject } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
45
|
+
import { deepClone } from "@scalar/workspace-store/helpers/deep-clone";
|
|
46
|
+
import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
|
|
47
|
+
import { HTTP_METHODS } from "@scalar/helpers/http/http-methods";
|
|
48
|
+
import * as monaco from "monaco-editor";
|
|
49
|
+
import { debounce } from "@scalar/helpers/general/debounce";
|
|
50
|
+
import { apply } from "@scalar/json-magic/diff";
|
|
51
|
+
//#region src/v2/features/command-palette/components/CommandPaletteExample.vue?vue&type=script&setup=true&lang.ts
|
|
52
|
+
var _hoisted_1$13 = {
|
|
53
|
+
key: 0,
|
|
54
|
+
class: "flex flex-1 gap-1"
|
|
20
55
|
};
|
|
56
|
+
var _hoisted_2$12 = {
|
|
57
|
+
key: 0,
|
|
58
|
+
class: "text-c-1 truncate"
|
|
59
|
+
};
|
|
60
|
+
var _hoisted_3$11 = {
|
|
61
|
+
key: 1,
|
|
62
|
+
class: "text-c-3"
|
|
63
|
+
};
|
|
64
|
+
var _hoisted_4$10 = { class: "flex items-center gap-2" };
|
|
65
|
+
var _hoisted_5$8 = { class: "custom-scroll max-h-40" };
|
|
66
|
+
var _hoisted_6$4 = { class: "truncate" };
|
|
67
|
+
//#endregion
|
|
68
|
+
//#region src/v2/features/command-palette/components/CommandPaletteExample.vue
|
|
69
|
+
var CommandPaletteExample_default = /* @__PURE__ */ defineComponent({
|
|
70
|
+
name: "CommandPaletteExample",
|
|
71
|
+
props: {
|
|
72
|
+
workspaceStore: {},
|
|
73
|
+
eventBus: {},
|
|
74
|
+
documentName: {},
|
|
75
|
+
operationId: {},
|
|
76
|
+
example: {}
|
|
77
|
+
},
|
|
78
|
+
emits: ["close", "back"],
|
|
79
|
+
setup(__props, { emit: __emit }) {
|
|
80
|
+
const emit = __emit;
|
|
81
|
+
/** Operation option type for selectors */
|
|
82
|
+
const isEditMode = computed(() => __props.example !== void 0);
|
|
83
|
+
const exampleName = ref(__props.example?.name ?? "");
|
|
84
|
+
const exampleNameTrimmed = computed(() => exampleName.value.trim());
|
|
85
|
+
/** All available documents (collections) in the workspace */
|
|
86
|
+
const availableDocuments = computed(() => Object.entries(__props.workspaceStore.workspace.documents).map(([name, document]) => ({
|
|
87
|
+
id: name,
|
|
88
|
+
label: document.info.title || name
|
|
89
|
+
})));
|
|
90
|
+
const selectedDocument = ref(__props.documentName ? availableDocuments.value.find((document) => document.id === __props.documentName) : availableDocuments.value[0] ?? void 0);
|
|
91
|
+
/**
|
|
92
|
+
* Recursively traverse navigation entries to find all operations.
|
|
93
|
+
* Operations can be nested under tags or at the document level.
|
|
94
|
+
*/
|
|
95
|
+
const getAllOperations = (entries) => {
|
|
96
|
+
const operations = [];
|
|
97
|
+
for (const entry of entries) {
|
|
98
|
+
if (entry.type === "operation") operations.push(entry);
|
|
99
|
+
/** Recursively traverse child entries if they exist */
|
|
100
|
+
if ("children" in entry && entry.children) operations.push(...getAllOperations(entry.children));
|
|
101
|
+
}
|
|
102
|
+
return operations;
|
|
103
|
+
};
|
|
104
|
+
/** All available operations for the selected document */
|
|
105
|
+
const availableOperations = computed(() => {
|
|
106
|
+
if (!selectedDocument.value) return [];
|
|
107
|
+
const document = __props.workspaceStore.workspace.documents[selectedDocument.value.id];
|
|
108
|
+
if (!document || !document["x-scalar-navigation"]) return [];
|
|
109
|
+
const navigation = document["x-scalar-navigation"];
|
|
110
|
+
return getAllOperations(navigation.children ?? []).map((operation) => ({
|
|
111
|
+
id: operation.id,
|
|
112
|
+
label: `${operation.method.toUpperCase()} ${operation.path}`,
|
|
113
|
+
path: operation.path,
|
|
114
|
+
method: operation.method,
|
|
115
|
+
exampleNames: operation.children?.filter((child) => child.type === "example").map((child) => child.name) ?? []
|
|
116
|
+
}));
|
|
117
|
+
});
|
|
118
|
+
const selectedOperation = ref(__props.operationId ? availableOperations.value.find((operation) => operation.id === __props.operationId) : void 0);
|
|
119
|
+
/** Reset operation selection when document changes */
|
|
120
|
+
watch(selectedDocument, () => {
|
|
121
|
+
selectedOperation.value = __props.operationId ? availableOperations.value.find((operation) => operation.id === __props.operationId) : availableOperations.value[0] ?? void 0;
|
|
122
|
+
}, { immediate: true });
|
|
123
|
+
/** Handle operation selection from dropdown */
|
|
124
|
+
const handleSelect = (operation) => {
|
|
125
|
+
if (operation) selectedOperation.value = operation;
|
|
126
|
+
};
|
|
127
|
+
/**
|
|
128
|
+
* Check if the form should be disabled.
|
|
129
|
+
* Disabled when any required field is missing or empty.
|
|
130
|
+
*/
|
|
131
|
+
const isDisabled = computed(() => {
|
|
132
|
+
if (!exampleNameTrimmed.value || !selectedDocument.value || !selectedOperation.value) return true;
|
|
133
|
+
if (isEditMode.value && __props.example) {
|
|
134
|
+
if (exampleNameTrimmed.value === __props.example.name) return true;
|
|
135
|
+
}
|
|
136
|
+
if (selectedOperation.value.exampleNames.some((name) => name === exampleNameTrimmed.value && name !== __props.example?.name)) return true;
|
|
137
|
+
return false;
|
|
138
|
+
});
|
|
139
|
+
/**
|
|
140
|
+
* Navigate to the example route which will create it automatically.
|
|
141
|
+
* The route handler will create the example with the provided details.
|
|
142
|
+
*/
|
|
143
|
+
const handleSubmit = () => {
|
|
144
|
+
if (isDisabled.value || !selectedDocument.value || !selectedOperation.value) return;
|
|
145
|
+
if (isEditMode.value && __props.example) {
|
|
146
|
+
__props.eventBus.emit("operation:rename:example", {
|
|
147
|
+
documentName: selectedDocument.value.id,
|
|
148
|
+
meta: {
|
|
149
|
+
path: selectedOperation.value.path,
|
|
150
|
+
method: selectedOperation.value.method,
|
|
151
|
+
exampleKey: __props.example.name
|
|
152
|
+
},
|
|
153
|
+
payload: { name: exampleNameTrimmed.value }
|
|
154
|
+
});
|
|
155
|
+
emit("close");
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
__props.eventBus.emit("operation:create:draft-example", {
|
|
159
|
+
documentName: selectedDocument.value.id,
|
|
160
|
+
meta: {
|
|
161
|
+
path: selectedOperation.value.path,
|
|
162
|
+
method: selectedOperation.value.method
|
|
163
|
+
},
|
|
164
|
+
exampleName: exampleNameTrimmed.value
|
|
165
|
+
});
|
|
166
|
+
emit("close");
|
|
167
|
+
};
|
|
168
|
+
/** Handle back navigation when user presses backspace on empty input */
|
|
169
|
+
const handleBack = (event) => {
|
|
170
|
+
if (isEditMode.value) return;
|
|
171
|
+
emit("back", event);
|
|
172
|
+
};
|
|
173
|
+
/** Handle cancel action in edit mode */
|
|
174
|
+
const handleCancel = () => {
|
|
175
|
+
emit("close");
|
|
176
|
+
};
|
|
177
|
+
return (_ctx, _cache) => {
|
|
178
|
+
return openBlock(), createBlock(CommandActionForm_default, {
|
|
179
|
+
disabled: isDisabled.value,
|
|
180
|
+
onSubmit: handleSubmit
|
|
181
|
+
}, {
|
|
182
|
+
options: withCtx(() => [!isEditMode.value ? (openBlock(), createElementBlock("div", _hoisted_1$13, [createVNode(unref(ScalarListbox), {
|
|
183
|
+
modelValue: selectedDocument.value,
|
|
184
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedDocument.value = $event),
|
|
185
|
+
options: availableDocuments.value
|
|
186
|
+
}, {
|
|
187
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
188
|
+
class: "hover:bg-b-2 max-h-8 w-[150px] min-w-[150px] justify-between gap-1 p-2 text-xs",
|
|
189
|
+
variant: "outlined"
|
|
190
|
+
}, {
|
|
191
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(selectedDocument.value ? "text-c-1 truncate" : "text-c-3") }, toDisplayString(selectedDocument.value ? selectedDocument.value.label : "Select Document"), 3), createVNode(unref(ScalarIcon), {
|
|
192
|
+
class: "text-c-3",
|
|
193
|
+
icon: "ChevronDown",
|
|
194
|
+
size: "md"
|
|
195
|
+
})]),
|
|
196
|
+
_: 1
|
|
197
|
+
})]),
|
|
198
|
+
_: 1
|
|
199
|
+
}, 8, ["modelValue", "options"]), createVNode(unref(ScalarDropdown), {
|
|
200
|
+
placement: "bottom",
|
|
201
|
+
resize: ""
|
|
202
|
+
}, {
|
|
203
|
+
items: withCtx(() => [createElementVNode("div", _hoisted_5$8, [(openBlock(true), createElementBlock(Fragment, null, renderList(availableOperations.value, (operation) => {
|
|
204
|
+
return openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
205
|
+
key: operation.id,
|
|
206
|
+
class: "flex h-7 w-full items-center justify-between px-1 pr-[26px]",
|
|
207
|
+
onClick: ($event) => handleSelect(operation)
|
|
208
|
+
}, {
|
|
209
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_6$4, toDisplayString(operation.path), 1), createVNode(HttpMethod_default, { method: operation.method }, null, 8, ["method"])]),
|
|
210
|
+
_: 2
|
|
211
|
+
}, 1032, ["onClick"]);
|
|
212
|
+
}), 128))])]),
|
|
213
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
214
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
215
|
+
disabled: !availableOperations.value.length,
|
|
216
|
+
variant: "outlined"
|
|
217
|
+
}, {
|
|
218
|
+
default: withCtx(() => [selectedOperation.value ? (openBlock(), createElementBlock("span", _hoisted_2$12, toDisplayString(selectedOperation.value.path), 1)) : (openBlock(), createElementBlock("span", _hoisted_3$11, " Select Operation ")), createElementVNode("div", _hoisted_4$10, [selectedOperation.value ? (openBlock(), createBlock(HttpMethod_default, {
|
|
219
|
+
key: 0,
|
|
220
|
+
method: selectedOperation.value.method
|
|
221
|
+
}, null, 8, ["method"])) : createCommentVNode("", true), createVNode(unref(ScalarIcon), {
|
|
222
|
+
class: "text-c-3",
|
|
223
|
+
icon: "ChevronDown",
|
|
224
|
+
size: "md"
|
|
225
|
+
})])]),
|
|
226
|
+
_: 1
|
|
227
|
+
}, 8, ["disabled"])]),
|
|
228
|
+
_: 1
|
|
229
|
+
})])) : (openBlock(), createBlock(unref(ScalarButton), {
|
|
230
|
+
key: 1,
|
|
231
|
+
class: "max-h-8 px-3 text-xs",
|
|
232
|
+
variant: "outlined",
|
|
233
|
+
onClick: handleCancel
|
|
234
|
+
}, {
|
|
235
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode(" Cancel ", -1)])]),
|
|
236
|
+
_: 1
|
|
237
|
+
}))]),
|
|
238
|
+
submit: withCtx(() => [createTextVNode(toDisplayString(isEditMode.value ? "Save" : "Create Example"), 1)]),
|
|
239
|
+
default: withCtx(() => [createVNode(CommandActionInput_default, {
|
|
240
|
+
modelValue: exampleName.value,
|
|
241
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => exampleName.value = $event),
|
|
242
|
+
label: "Example Name",
|
|
243
|
+
placeholder: "Example Name",
|
|
244
|
+
onDelete: handleBack
|
|
245
|
+
}, null, 8, ["modelValue"])]),
|
|
246
|
+
_: 1
|
|
247
|
+
}, 8, ["disabled"]);
|
|
248
|
+
};
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
//#endregion
|
|
252
|
+
//#region src/v2/features/command-palette/helpers/get-operation-from-curl.ts
|
|
253
|
+
/**
|
|
254
|
+
* Parses request body data from a string.
|
|
255
|
+
* Attempts JSON parsing first, then falls back to form-encoded parsing.
|
|
256
|
+
*
|
|
257
|
+
* Form-encoded data is expected in the format: key1=value1&key2=value2
|
|
258
|
+
*/
|
|
259
|
+
var parseRequestBodyData = (data) => {
|
|
260
|
+
try {
|
|
261
|
+
return JSON.parse(data);
|
|
262
|
+
} catch {
|
|
263
|
+
const result = {};
|
|
264
|
+
data.split("&").forEach((pair) => {
|
|
265
|
+
const [key, value] = pair.split("=");
|
|
266
|
+
if (key && value) result[decodeURIComponent(key)] = decodeURIComponent(value);
|
|
267
|
+
});
|
|
268
|
+
return result;
|
|
269
|
+
}
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Determines the content type based on the request body structure.
|
|
273
|
+
* Returns form-encoded if the body looks like form data, JSON if the body looks like JSON,
|
|
274
|
+
* otherwise uses the header value.
|
|
275
|
+
*/
|
|
276
|
+
var detectContentType = (body, headers) => {
|
|
277
|
+
if (headers["Content-Type"]) return headers["Content-Type"];
|
|
278
|
+
const trimmedBody = body.trim();
|
|
279
|
+
if (trimmedBody.startsWith("{") || trimmedBody.startsWith("[")) return "application/json";
|
|
280
|
+
return body.includes("=") && !trimmedBody.startsWith("{") ? "application/x-www-form-urlencoded" : "";
|
|
281
|
+
};
|
|
282
|
+
/**
|
|
283
|
+
* Infers a JSON Schema type from a JavaScript value.
|
|
284
|
+
* Maps JavaScript typeof results to JSON Schema primitive types.
|
|
285
|
+
*/
|
|
286
|
+
var inferSchemaType = (value) => {
|
|
287
|
+
const jsType = typeof value;
|
|
288
|
+
if (jsType === "string") return "string";
|
|
289
|
+
if (jsType === "number") return "number";
|
|
290
|
+
if (jsType === "boolean") return "boolean";
|
|
291
|
+
if (value === null) return "null";
|
|
292
|
+
if (Array.isArray(value)) return "array";
|
|
293
|
+
if (jsType === "object") return "object";
|
|
294
|
+
return "string";
|
|
295
|
+
};
|
|
296
|
+
/**
|
|
297
|
+
* Creates query and header parameters from parsed cURL data.
|
|
298
|
+
* Each parameter includes a schema with inferred type and an example value.
|
|
299
|
+
*/
|
|
300
|
+
var createParameters = (queryParameters, headers, exampleKey) => {
|
|
301
|
+
const queryParams = Array.isArray(queryParameters) ? queryParameters.map(({ key, value }) => ({
|
|
302
|
+
name: key,
|
|
303
|
+
in: "query",
|
|
304
|
+
schema: { type: inferSchemaType(value) },
|
|
305
|
+
examples: { [exampleKey]: { value } }
|
|
306
|
+
})) : [];
|
|
307
|
+
const headerParams = Object.entries(headers || {}).map(([key, value]) => ({
|
|
308
|
+
name: key,
|
|
309
|
+
in: "header",
|
|
310
|
+
schema: { type: inferSchemaType(value) },
|
|
311
|
+
examples: { [exampleKey]: { value } }
|
|
312
|
+
}));
|
|
313
|
+
return [...queryParams, ...headerParams];
|
|
314
|
+
};
|
|
315
|
+
/**
|
|
316
|
+
* Creates a request body schema from parsed data.
|
|
317
|
+
* Generates an object schema with properties inferred from the data structure.
|
|
318
|
+
*/
|
|
319
|
+
var createRequestBodySchema = (data) => {
|
|
320
|
+
return {
|
|
321
|
+
type: "object",
|
|
322
|
+
properties: Object.fromEntries(Object.entries(data).map(([key, value]) => [key, { type: inferSchemaType(value) }]))
|
|
323
|
+
};
|
|
324
|
+
};
|
|
325
|
+
/** Don't want to throw for invalid URLs */
|
|
326
|
+
var safePathname = (url) => {
|
|
327
|
+
try {
|
|
328
|
+
return new URL(url).pathname;
|
|
329
|
+
} catch {
|
|
330
|
+
return "/";
|
|
331
|
+
}
|
|
332
|
+
};
|
|
333
|
+
/**
|
|
334
|
+
* Converts a cURL command string into an OpenAPI operation object.
|
|
335
|
+
*
|
|
336
|
+
* This function parses a cURL command and extracts all relevant information
|
|
337
|
+
* (path, method, headers, query parameters, request body) to create a complete
|
|
338
|
+
* OpenAPI operation that can be used to populate a request in the API client.
|
|
339
|
+
*
|
|
340
|
+
* The exampleKey is used to namespace the example values in the operation object,
|
|
341
|
+
* allowing multiple examples to coexist if needed.
|
|
342
|
+
*/
|
|
343
|
+
var getOperationFromCurl = (curl, exampleKey = "curl") => {
|
|
344
|
+
const { method = "get", url, body = "", headers = {}, servers = [], queryParameters = [] } = parseCurlCommand(curl);
|
|
345
|
+
const path = safePathname(url);
|
|
346
|
+
const contentType = detectContentType(body, headers);
|
|
347
|
+
const requestBodyData = body ? parseRequestBodyData(body) : {};
|
|
348
|
+
const parameters = createParameters(queryParameters, headers, exampleKey);
|
|
349
|
+
const serverObjects = servers.map((server) => ({ url: server }));
|
|
350
|
+
return {
|
|
351
|
+
path,
|
|
352
|
+
method,
|
|
353
|
+
operation: {
|
|
354
|
+
parameters,
|
|
355
|
+
requestBody: {
|
|
356
|
+
content: { [contentType]: {
|
|
357
|
+
schema: createRequestBodySchema(requestBodyData),
|
|
358
|
+
examples: { [exampleKey]: { value: requestBodyData } }
|
|
359
|
+
} },
|
|
360
|
+
"x-scalar-selected-content-type": { [exampleKey]: contentType }
|
|
361
|
+
},
|
|
362
|
+
servers: serverObjects.length ? serverObjects : void 0
|
|
363
|
+
}
|
|
364
|
+
};
|
|
365
|
+
};
|
|
366
|
+
//#endregion
|
|
367
|
+
//#region src/v2/features/command-palette/components/CommandPaletteImportCurl.vue?vue&type=script&setup=true&lang.ts
|
|
368
|
+
var _hoisted_1$12 = { class: "flex flex-1 flex-col gap-2" };
|
|
369
|
+
var _hoisted_2$11 = { class: "flex h-9 flex-row items-center gap-2 rounded border p-[3px] text-sm" };
|
|
370
|
+
var _hoisted_3$10 = { class: "scroll-timeline-x whitespace-nowrap" };
|
|
371
|
+
var _hoisted_4$9 = { class: "flex items-center gap-2" };
|
|
372
|
+
//#endregion
|
|
373
|
+
//#region src/v2/features/command-palette/components/CommandPaletteImportCurl.vue
|
|
374
|
+
var CommandPaletteImportCurl_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
375
|
+
name: "CommandPaletteImportCurl",
|
|
376
|
+
props: {
|
|
377
|
+
workspaceStore: {},
|
|
378
|
+
eventBus: {},
|
|
379
|
+
inputValue: {}
|
|
380
|
+
},
|
|
381
|
+
emits: ["close", "back"],
|
|
382
|
+
setup(__props, { emit: __emit }) {
|
|
383
|
+
const emit = __emit;
|
|
384
|
+
const router = useRouter();
|
|
385
|
+
const exampleKey = ref("");
|
|
386
|
+
/** Trimmed version of the example key for validation and submission */
|
|
387
|
+
const exampleKeyTrimmed = computed(() => exampleKey.value.trim());
|
|
388
|
+
/** Parse the cURL command to extract path, method, and operation details */
|
|
389
|
+
const { path, method, operation } = getOperationFromCurl(__props.inputValue);
|
|
390
|
+
/** List of all available documents (collections) in the workspace */
|
|
391
|
+
const documents = computed(() => Object.keys(__props.workspaceStore.workspace.documents).map((document) => ({
|
|
392
|
+
id: document,
|
|
393
|
+
label: document
|
|
394
|
+
})));
|
|
395
|
+
const selectedDocument = ref(documents.value[0]);
|
|
396
|
+
/**
|
|
397
|
+
* Check if the form should be disabled.
|
|
398
|
+
* Disabled when:
|
|
399
|
+
* - Example key is empty
|
|
400
|
+
* - No document is selected
|
|
401
|
+
* - An operation with the same path and method already exists in the selected document
|
|
402
|
+
*/
|
|
403
|
+
const isDisabled = computed(() => {
|
|
404
|
+
if (!exampleKeyTrimmed.value || !selectedDocument.value) return true;
|
|
405
|
+
if (__props.workspaceStore.workspace.documents[selectedDocument.value.id]?.paths?.[path]?.[method]) return true;
|
|
406
|
+
return false;
|
|
407
|
+
});
|
|
408
|
+
/**
|
|
409
|
+
* Handle the import submission.
|
|
410
|
+
* Creates a new operation in the selected document from the parsed cURL command.
|
|
411
|
+
*/
|
|
412
|
+
const handleImportClick = () => {
|
|
413
|
+
const documentName = selectedDocument.value;
|
|
414
|
+
if (isDisabled.value || !documentName) return;
|
|
415
|
+
/** Re-parse with the example key to include it in the operation */
|
|
416
|
+
const result = getOperationFromCurl(__props.inputValue, exampleKeyTrimmed.value);
|
|
417
|
+
__props.eventBus.emit("operation:create:operation", {
|
|
418
|
+
documentName: documentName.id,
|
|
419
|
+
path: result.path,
|
|
420
|
+
method: result.method,
|
|
421
|
+
operation: result.operation,
|
|
422
|
+
exampleKey: exampleKeyTrimmed.value,
|
|
423
|
+
callback: (success) => {
|
|
424
|
+
if (success) {
|
|
425
|
+
__props.workspaceStore.buildSidebar(documentName.id);
|
|
426
|
+
const path = result.path.startsWith("/") ? result.path : `/${result.path}`;
|
|
427
|
+
router.push({
|
|
428
|
+
name: "example",
|
|
429
|
+
params: {
|
|
430
|
+
documentSlug: documentName.id,
|
|
431
|
+
pathEncoded: encodeURIComponent(path),
|
|
432
|
+
method: result.method,
|
|
433
|
+
exampleName: exampleKeyTrimmed.value
|
|
434
|
+
}
|
|
435
|
+
});
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
});
|
|
439
|
+
emit("close");
|
|
440
|
+
};
|
|
441
|
+
/** Handle back navigation when user presses backspace on empty input */
|
|
442
|
+
const handleBack = (event) => {
|
|
443
|
+
emit("back", event);
|
|
444
|
+
};
|
|
445
|
+
return (_ctx, _cache) => {
|
|
446
|
+
return openBlock(), createBlock(CommandActionForm_default, {
|
|
447
|
+
disabled: isDisabled.value,
|
|
448
|
+
onSubmit: handleImportClick
|
|
449
|
+
}, {
|
|
450
|
+
options: withCtx(() => [createElementVNode("div", _hoisted_4$9, [createVNode(unref(ScalarListbox), {
|
|
451
|
+
modelValue: selectedDocument.value,
|
|
452
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedDocument.value = $event),
|
|
453
|
+
options: documents.value
|
|
454
|
+
}, {
|
|
455
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
456
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
457
|
+
variant: "outlined"
|
|
458
|
+
}, {
|
|
459
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(["whitespace-nowrap", selectedDocument.value ? "text-c-1" : "text-c-3"]) }, toDisplayString(selectedDocument.value ? selectedDocument.value.label : "Select Collection"), 3), createVNode(unref(ScalarIcon), {
|
|
460
|
+
class: "text-c-3",
|
|
461
|
+
icon: "ChevronDown",
|
|
462
|
+
size: "md"
|
|
463
|
+
})]),
|
|
464
|
+
_: 1
|
|
465
|
+
})]),
|
|
466
|
+
_: 1
|
|
467
|
+
}, 8, ["modelValue", "options"])])]),
|
|
468
|
+
submit: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Import Request", -1)])]),
|
|
469
|
+
default: withCtx(() => [createVNode(CommandActionInput_default, {
|
|
470
|
+
modelValue: exampleKey.value,
|
|
471
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => exampleKey.value = $event),
|
|
472
|
+
placeholder: "Curl example key (e.g., example-1)",
|
|
473
|
+
onDelete: handleBack
|
|
474
|
+
}, null, 8, ["modelValue"]), createElementVNode("div", _hoisted_1$12, [createElementVNode("div", _hoisted_2$11, [createVNode(HttpMethod_default, {
|
|
475
|
+
class: "border-r-1 px-1",
|
|
476
|
+
method: unref(method)
|
|
477
|
+
}, null, 8, ["method"]), createElementVNode("span", _hoisted_3$10, toDisplayString(unref(operation).servers?.[0]?.url || "") + toDisplayString(unref(path)), 1)])])]),
|
|
478
|
+
_: 1
|
|
479
|
+
}, 8, ["disabled"]);
|
|
480
|
+
};
|
|
481
|
+
}
|
|
482
|
+
}), [["__scopeId", "data-v-f4568236"]]);
|
|
483
|
+
//#endregion
|
|
484
|
+
//#region src/v2/features/command-palette/components/CommandPaletteOpenApiDocument.vue
|
|
485
|
+
var CommandPaletteOpenApiDocument_default = /* @__PURE__ */ defineComponent({
|
|
486
|
+
__name: "CommandPaletteOpenApiDocument",
|
|
487
|
+
props: {
|
|
488
|
+
workspaceStore: {},
|
|
489
|
+
eventBus: {}
|
|
490
|
+
},
|
|
491
|
+
emits: ["close", "back"],
|
|
492
|
+
setup(__props, { emit: __emit }) {
|
|
493
|
+
const emit = __emit;
|
|
494
|
+
const router = useRouter();
|
|
495
|
+
const documentName = ref("");
|
|
496
|
+
const documentNameTrimmed = computed(() => documentName.value.trim());
|
|
497
|
+
/** Default icon for new documents (folder icon) */
|
|
498
|
+
const documentIcon = ref("interface-content-folder");
|
|
499
|
+
/**
|
|
500
|
+
* Check if the form should be disabled.
|
|
501
|
+
* Disabled when the name is empty or when a document with that name already exists.
|
|
502
|
+
*/
|
|
503
|
+
const isDisabled = computed(() => {
|
|
504
|
+
if (!documentNameTrimmed.value) return true;
|
|
505
|
+
/** Prevent duplicate document names in the workspace */
|
|
506
|
+
if (__props.workspaceStore.workspace.documents[documentNameTrimmed.value] !== void 0) return true;
|
|
507
|
+
return false;
|
|
508
|
+
});
|
|
509
|
+
/** Handle form submission to create a new document */
|
|
510
|
+
const handleSubmit = () => {
|
|
511
|
+
if (isDisabled.value) return;
|
|
512
|
+
__props.eventBus.emit("document:create:empty-document", {
|
|
513
|
+
name: documentNameTrimmed.value,
|
|
514
|
+
icon: documentIcon.value,
|
|
515
|
+
callback: (success) => {
|
|
516
|
+
if (success) router.push({
|
|
517
|
+
name: "document.overview",
|
|
518
|
+
params: { documentSlug: documentNameTrimmed.value }
|
|
519
|
+
});
|
|
520
|
+
}
|
|
521
|
+
});
|
|
522
|
+
emit("close");
|
|
523
|
+
};
|
|
524
|
+
/** Handle back navigation when user presses backspace on empty input */
|
|
525
|
+
const handleBack = (event) => {
|
|
526
|
+
emit("back", event);
|
|
527
|
+
};
|
|
528
|
+
return (_ctx, _cache) => {
|
|
529
|
+
return openBlock(), createBlock(CommandActionForm_default, {
|
|
530
|
+
disabled: isDisabled.value,
|
|
531
|
+
onSubmit: handleSubmit
|
|
532
|
+
}, {
|
|
533
|
+
options: withCtx(() => [createVNode(IconSelector_default, {
|
|
534
|
+
modelValue: documentIcon.value,
|
|
535
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => documentIcon.value = $event),
|
|
536
|
+
placement: "bottom-start"
|
|
537
|
+
}, {
|
|
538
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
539
|
+
class: "aspect-square h-auto px-0",
|
|
540
|
+
variant: "outlined"
|
|
541
|
+
}, {
|
|
542
|
+
default: withCtx(() => [createVNode(unref(LibraryIcon), {
|
|
543
|
+
class: "text-c-2 size-4 stroke-[1.75]",
|
|
544
|
+
src: documentIcon.value
|
|
545
|
+
}, null, 8, ["src"])]),
|
|
546
|
+
_: 1
|
|
547
|
+
})]),
|
|
548
|
+
_: 1
|
|
549
|
+
}, 8, ["modelValue"])]),
|
|
550
|
+
submit: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Create Document", -1)])]),
|
|
551
|
+
default: withCtx(() => [createVNode(CommandActionInput_default, {
|
|
552
|
+
modelValue: documentName.value,
|
|
553
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => documentName.value = $event),
|
|
554
|
+
label: "Document Name",
|
|
555
|
+
placeholder: "Document Name",
|
|
556
|
+
onDelete: handleBack
|
|
557
|
+
}, null, 8, ["modelValue"])]),
|
|
558
|
+
_: 1
|
|
559
|
+
}, 8, ["disabled"]);
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
});
|
|
563
|
+
//#endregion
|
|
564
|
+
//#region src/v2/features/command-palette/components/CommandPaletteRequest.vue?vue&type=script&setup=true&lang.ts
|
|
565
|
+
var _hoisted_1$11 = { class: "flex flex-1 gap-1" };
|
|
566
|
+
var _hoisted_2$10 = { class: "flex items-center gap-2" };
|
|
567
|
+
var _hoisted_3$9 = { class: "custom-scroll max-h-40" };
|
|
568
|
+
var _hoisted_4$8 = { class: "custom-scroll max-h-40" };
|
|
569
|
+
var _hoisted_5$7 = { class: "truncate" };
|
|
570
|
+
//#endregion
|
|
571
|
+
//#region src/v2/features/command-palette/components/CommandPaletteRequest.vue
|
|
572
|
+
var CommandPaletteRequest_default = /* @__PURE__ */ defineComponent({
|
|
573
|
+
name: "CommandPaletteRequest",
|
|
574
|
+
props: {
|
|
575
|
+
workspaceStore: {},
|
|
576
|
+
eventBus: {},
|
|
577
|
+
documentName: {},
|
|
578
|
+
tagId: {}
|
|
579
|
+
},
|
|
580
|
+
emits: ["close", "back"],
|
|
581
|
+
setup(__props, { emit: __emit }) {
|
|
582
|
+
const emit = __emit;
|
|
583
|
+
/** HTTP method option type for selectors */
|
|
584
|
+
const router = useRouter();
|
|
585
|
+
const requestPath = ref("/");
|
|
586
|
+
const requestPathTrimmed = computed(() => requestPath.value.trim());
|
|
587
|
+
/** All available documents (collections) in the workspace */
|
|
588
|
+
const availableDocuments = computed(() => Object.entries(__props.workspaceStore.workspace.documents).map(([name, document]) => ({
|
|
589
|
+
id: name,
|
|
590
|
+
label: document.info.title || name
|
|
591
|
+
})));
|
|
592
|
+
/** Available HTTP methods for the dropdown (GET, POST, PUT, etc.) */
|
|
593
|
+
const availableMethods = HTTP_METHODS.map((method) => ({
|
|
594
|
+
id: method,
|
|
595
|
+
label: method.toUpperCase(),
|
|
596
|
+
method
|
|
597
|
+
}));
|
|
598
|
+
const selectedDocument = ref(__props.documentName ? availableDocuments.value.find((document) => document.id === __props.documentName) : availableDocuments.value[0] ?? void 0);
|
|
599
|
+
const selectedMethod = ref(availableMethods.find((method) => method.method === "get"));
|
|
600
|
+
/**
|
|
601
|
+
* All available tags for the selected document.
|
|
602
|
+
* Includes a "No Tag" option for operations without a tag assignment.
|
|
603
|
+
*/
|
|
604
|
+
const availableTags = computed(() => {
|
|
605
|
+
if (!selectedDocument.value) return [];
|
|
606
|
+
const document = __props.workspaceStore.workspace.documents[selectedDocument.value.id];
|
|
607
|
+
if (!document) return [];
|
|
608
|
+
return [{
|
|
609
|
+
id: "",
|
|
610
|
+
label: "No Tag"
|
|
611
|
+
}, ...document.tags?.map((tag) => ({
|
|
612
|
+
id: tag.name,
|
|
613
|
+
label: tag.name
|
|
614
|
+
})) ?? []];
|
|
615
|
+
});
|
|
616
|
+
const selectedTag = ref(__props.tagId ? availableTags.value.find((tag) => tag.id === __props.tagId) : void 0);
|
|
617
|
+
watch(selectedDocument, () => {
|
|
618
|
+
selectedTag.value = availableTags.value.find((tag) => tag.id === "");
|
|
619
|
+
});
|
|
620
|
+
/**
|
|
621
|
+
* Check if an operation with the same path and method already exists.
|
|
622
|
+
* Used to prevent creating duplicate operations.
|
|
623
|
+
*/
|
|
624
|
+
const operationExists = computed(() => {
|
|
625
|
+
if (!selectedDocument.value || !selectedMethod.value || !requestPathTrimmed.value) return false;
|
|
626
|
+
const document = __props.workspaceStore.workspace.documents[selectedDocument.value.id];
|
|
627
|
+
/** Ensure path starts with '/' for consistent lookup */
|
|
628
|
+
const normalizedPath = requestPathTrimmed.value.startsWith("/") ? requestPathTrimmed.value : `/${requestPathTrimmed.value}`;
|
|
629
|
+
return !!document?.paths?.[normalizedPath]?.[selectedMethod.value.method];
|
|
630
|
+
});
|
|
631
|
+
/**
|
|
632
|
+
* Check if the form should be disabled.
|
|
633
|
+
* Disabled when any required field is missing or operation already exists.
|
|
634
|
+
*/
|
|
635
|
+
const isDisabled = computed(() => {
|
|
636
|
+
if (!requestPathTrimmed.value || !selectedDocument.value || !selectedMethod.value) return true;
|
|
637
|
+
/** Prevent creating duplicate operations */
|
|
638
|
+
if (operationExists.value) return true;
|
|
639
|
+
return false;
|
|
640
|
+
});
|
|
641
|
+
/** Handle HTTP method selection from dropdown */
|
|
642
|
+
const handleSelectMethod = (method) => {
|
|
643
|
+
if (method) selectedMethod.value = method;
|
|
644
|
+
};
|
|
645
|
+
/** Handle tag selection from dropdown */
|
|
646
|
+
const handleSelectTag = (tag) => {
|
|
647
|
+
if (tag) selectedTag.value = tag;
|
|
648
|
+
};
|
|
649
|
+
/**
|
|
650
|
+
* Create the request and close the command palette.
|
|
651
|
+
* Emits an event to create a new operation with the specified details.
|
|
652
|
+
*/
|
|
653
|
+
const handleSubmit = () => {
|
|
654
|
+
if (isDisabled.value || !selectedDocument.value || !selectedMethod.value) return;
|
|
655
|
+
if (!__props.workspaceStore.workspace.documents[selectedDocument.value.id]) return;
|
|
656
|
+
__props.eventBus.emit("operation:create:operation", {
|
|
657
|
+
documentName: selectedDocument.value.id,
|
|
658
|
+
path: requestPathTrimmed.value,
|
|
659
|
+
method: selectedMethod.value.method,
|
|
660
|
+
operation: { tags: selectedTag.value?.id ? [selectedTag.value.id] : void 0 },
|
|
661
|
+
callback: (success) => {
|
|
662
|
+
if (success) {
|
|
663
|
+
/** Build the sidebar */
|
|
664
|
+
__props.workspaceStore.buildSidebar(selectedDocument.value?.id ?? "");
|
|
665
|
+
const path = requestPathTrimmed.value.startsWith("/") ? requestPathTrimmed.value : `/${requestPathTrimmed.value}`;
|
|
666
|
+
/** Navigate to the example */
|
|
667
|
+
router.push({
|
|
668
|
+
name: "example",
|
|
669
|
+
params: {
|
|
670
|
+
documentSlug: selectedDocument.value?.id,
|
|
671
|
+
pathEncoded: encodeURIComponent(path),
|
|
672
|
+
method: selectedMethod.value?.method,
|
|
673
|
+
exampleName: "default"
|
|
674
|
+
}
|
|
675
|
+
});
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
});
|
|
679
|
+
emit("close");
|
|
680
|
+
};
|
|
681
|
+
/** Handle back navigation when user presses backspace on empty input */
|
|
682
|
+
const handleBack = (event) => {
|
|
683
|
+
emit("back", event);
|
|
684
|
+
};
|
|
685
|
+
return (_ctx, _cache) => {
|
|
686
|
+
return openBlock(), createBlock(CommandActionForm_default, {
|
|
687
|
+
disabled: isDisabled.value,
|
|
688
|
+
onSubmit: handleSubmit
|
|
689
|
+
}, {
|
|
690
|
+
options: withCtx(() => [createElementVNode("div", _hoisted_1$11, [
|
|
691
|
+
createVNode(unref(ScalarListbox), {
|
|
692
|
+
modelValue: selectedDocument.value,
|
|
693
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedDocument.value = $event),
|
|
694
|
+
options: availableDocuments.value
|
|
695
|
+
}, {
|
|
696
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
697
|
+
class: "hover:bg-b-2 max-h-8 w-[150px] min-w-[150px] justify-between gap-1 p-2 text-xs",
|
|
698
|
+
variant: "outlined"
|
|
699
|
+
}, {
|
|
700
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(selectedDocument.value ? "text-c-1 truncate" : "text-c-3") }, toDisplayString(selectedDocument.value ? selectedDocument.value.label : "Select Document"), 3), createVNode(unref(ScalarIcon), {
|
|
701
|
+
class: "text-c-3",
|
|
702
|
+
icon: "ChevronDown",
|
|
703
|
+
size: "md"
|
|
704
|
+
})]),
|
|
705
|
+
_: 1
|
|
706
|
+
})]),
|
|
707
|
+
_: 1
|
|
708
|
+
}, 8, ["modelValue", "options"]),
|
|
709
|
+
createVNode(unref(ScalarDropdown), {
|
|
710
|
+
placement: "bottom",
|
|
711
|
+
resize: ""
|
|
712
|
+
}, {
|
|
713
|
+
items: withCtx(() => [createElementVNode("div", _hoisted_3$9, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(availableMethods), (method) => {
|
|
714
|
+
return openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
715
|
+
key: method.id,
|
|
716
|
+
class: "flex h-7 w-full items-center justify-center px-1",
|
|
717
|
+
onClick: ($event) => handleSelectMethod(method)
|
|
718
|
+
}, {
|
|
719
|
+
default: withCtx(() => [createVNode(HttpMethod_default, { method: method.method }, null, 8, ["method"])]),
|
|
720
|
+
_: 2
|
|
721
|
+
}, 1032, ["onClick"]);
|
|
722
|
+
}), 128))])]),
|
|
723
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
724
|
+
class: "hover:bg-b-2 max-h-8 w-[100px] min-w-[100px] justify-between gap-1 p-2 text-xs",
|
|
725
|
+
variant: "outlined"
|
|
726
|
+
}, {
|
|
727
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2$10, [selectedMethod.value ? (openBlock(), createBlock(HttpMethod_default, {
|
|
728
|
+
key: 0,
|
|
729
|
+
method: selectedMethod.value.method
|
|
730
|
+
}, null, 8, ["method"])) : createCommentVNode("", true), createVNode(unref(ScalarIcon), {
|
|
731
|
+
class: "text-c-3",
|
|
732
|
+
icon: "ChevronDown",
|
|
733
|
+
size: "md"
|
|
734
|
+
})])]),
|
|
735
|
+
_: 1
|
|
736
|
+
})]),
|
|
737
|
+
_: 1
|
|
738
|
+
}),
|
|
739
|
+
createVNode(unref(ScalarDropdown), {
|
|
740
|
+
placement: "bottom",
|
|
741
|
+
resize: ""
|
|
742
|
+
}, {
|
|
743
|
+
items: withCtx(() => [createElementVNode("div", _hoisted_4$8, [(openBlock(true), createElementBlock(Fragment, null, renderList(availableTags.value, (tag) => {
|
|
744
|
+
return openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
745
|
+
key: tag.id,
|
|
746
|
+
class: "flex h-7 w-full items-center px-1",
|
|
747
|
+
onClick: ($event) => handleSelectTag(tag)
|
|
748
|
+
}, {
|
|
749
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_5$7, toDisplayString(tag.label), 1)]),
|
|
750
|
+
_: 2
|
|
751
|
+
}, 1032, ["onClick"]);
|
|
752
|
+
}), 128))])]),
|
|
753
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
754
|
+
class: "hover:bg-b-2 max-h-8 w-full justify-between gap-1 p-2 text-xs",
|
|
755
|
+
disabled: !availableTags.value.length,
|
|
756
|
+
variant: "outlined"
|
|
757
|
+
}, {
|
|
758
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(selectedTag.value ? "text-c-1 truncate" : "text-c-3") }, toDisplayString(selectedTag.value ? selectedTag.value.label : "Select Tag (Optional)"), 3), createVNode(unref(ScalarIcon), {
|
|
759
|
+
class: "text-c-3",
|
|
760
|
+
icon: "ChevronDown",
|
|
761
|
+
size: "md"
|
|
762
|
+
})]),
|
|
763
|
+
_: 1
|
|
764
|
+
}, 8, ["disabled"])]),
|
|
765
|
+
_: 1
|
|
766
|
+
})
|
|
767
|
+
])]),
|
|
768
|
+
submit: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode("Create Request", -1)])]),
|
|
769
|
+
default: withCtx(() => [createVNode(CommandActionInput_default, {
|
|
770
|
+
modelValue: requestPath.value,
|
|
771
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => requestPath.value = $event),
|
|
772
|
+
label: "Request Path",
|
|
773
|
+
placeholder: "/users",
|
|
774
|
+
onDelete: handleBack
|
|
775
|
+
}, null, 8, ["modelValue"])]),
|
|
776
|
+
_: 1
|
|
777
|
+
}, 8, ["disabled"]);
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
});
|
|
781
|
+
//#endregion
|
|
782
|
+
//#region src/v2/features/command-palette/components/CommandPaletteTag.vue
|
|
783
|
+
var CommandPaletteTag_default = /* @__PURE__ */ defineComponent({
|
|
784
|
+
name: "CommandPaletteTag",
|
|
785
|
+
props: {
|
|
786
|
+
workspaceStore: {},
|
|
787
|
+
eventBus: {},
|
|
788
|
+
documentName: {},
|
|
789
|
+
tag: {}
|
|
790
|
+
},
|
|
791
|
+
emits: ["close", "back"],
|
|
792
|
+
setup(__props, { emit: __emit }) {
|
|
793
|
+
const emit = __emit;
|
|
794
|
+
const isEditMode = computed(() => __props.tag !== void 0);
|
|
795
|
+
const name = ref(__props.tag?.name ?? "");
|
|
796
|
+
const nameTrimmed = computed(() => name.value.trim());
|
|
797
|
+
/** All available documents (collections) in the workspace */
|
|
798
|
+
const availableDocuments = computed(() => Object.entries(__props.workspaceStore.workspace.documents).map(([name, document]) => ({
|
|
799
|
+
id: name,
|
|
800
|
+
label: document.info.title || name
|
|
801
|
+
})));
|
|
802
|
+
const selectedDocument = ref(__props.documentName ? availableDocuments.value.find((document) => document.id === __props.documentName) : availableDocuments.value[0] ?? void 0);
|
|
803
|
+
/**
|
|
804
|
+
* Check if the form should be disabled.
|
|
805
|
+
*
|
|
806
|
+
* In edit mode, disabled when:
|
|
807
|
+
* - Tag name is empty
|
|
808
|
+
* - Name is unchanged from the original
|
|
809
|
+
* - The new name conflicts with an existing tag in the same document
|
|
810
|
+
*
|
|
811
|
+
* In create mode, disabled when:
|
|
812
|
+
* - Tag name is empty
|
|
813
|
+
* - No collection is selected
|
|
814
|
+
* - The selected document does not exist
|
|
815
|
+
* - A tag with the same name already exists in the selected document
|
|
816
|
+
*/
|
|
817
|
+
const isDisabled = computed(() => {
|
|
818
|
+
const document = __props.workspaceStore.workspace.documents[selectedDocument.value?.id ?? ""];
|
|
819
|
+
if (!nameTrimmed.value || !selectedDocument.value || !document) return true;
|
|
820
|
+
if (isEditMode.value) {
|
|
821
|
+
if (nameTrimmed.value === __props.tag?.name) return true;
|
|
822
|
+
}
|
|
823
|
+
if (document.tags?.some((tag) => tag.name === nameTrimmed.value)) return true;
|
|
824
|
+
return false;
|
|
825
|
+
});
|
|
826
|
+
/**
|
|
827
|
+
* Handle form submission.
|
|
828
|
+
* In edit mode, emits the new name. In create mode, creates the tag via the event bus.
|
|
829
|
+
*/
|
|
830
|
+
const handleSubmit = () => {
|
|
831
|
+
if (isDisabled.value || !selectedDocument.value) return;
|
|
832
|
+
if (isEditMode.value && __props.tag) {
|
|
833
|
+
__props.eventBus.emit("tag:edit:tag", {
|
|
834
|
+
tag: __props.tag,
|
|
835
|
+
documentName: selectedDocument.value.id,
|
|
836
|
+
newName: nameTrimmed.value
|
|
837
|
+
}, { skipUnpackProxy: true });
|
|
838
|
+
emit("close");
|
|
839
|
+
return;
|
|
840
|
+
}
|
|
841
|
+
__props.eventBus.emit("tag:create:tag", {
|
|
842
|
+
name: nameTrimmed.value,
|
|
843
|
+
documentName: selectedDocument.value.id
|
|
844
|
+
});
|
|
845
|
+
emit("close");
|
|
846
|
+
};
|
|
847
|
+
/** Handle back navigation when user presses backspace on empty input */
|
|
848
|
+
const handleBack = (event) => {
|
|
849
|
+
if (isEditMode.value) return;
|
|
850
|
+
emit("back", event);
|
|
851
|
+
};
|
|
852
|
+
/** Handle cancel action in edit mode */
|
|
853
|
+
const handleCancel = () => {
|
|
854
|
+
emit("close");
|
|
855
|
+
};
|
|
856
|
+
return (_ctx, _cache) => {
|
|
857
|
+
return openBlock(), createBlock(CommandActionForm_default, {
|
|
858
|
+
disabled: isDisabled.value,
|
|
859
|
+
onSubmit: handleSubmit
|
|
860
|
+
}, {
|
|
861
|
+
options: withCtx(() => [!isEditMode.value ? (openBlock(), createBlock(unref(ScalarListbox), {
|
|
862
|
+
key: 0,
|
|
863
|
+
modelValue: selectedDocument.value,
|
|
864
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = ($event) => selectedDocument.value = $event),
|
|
865
|
+
options: availableDocuments.value
|
|
866
|
+
}, {
|
|
867
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
868
|
+
class: "hover:bg-b-2 max-h-8 w-fit justify-between gap-1 p-2 text-xs",
|
|
869
|
+
variant: "outlined"
|
|
870
|
+
}, {
|
|
871
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(selectedDocument.value ? "text-c-1" : "text-c-3") }, toDisplayString(selectedDocument.value ? selectedDocument.value.label : "Select Collection"), 3), createVNode(unref(ScalarIcon), {
|
|
872
|
+
class: "text-c-3",
|
|
873
|
+
icon: "ChevronDown",
|
|
874
|
+
size: "md"
|
|
875
|
+
})]),
|
|
876
|
+
_: 1
|
|
877
|
+
})]),
|
|
878
|
+
_: 1
|
|
879
|
+
}, 8, ["modelValue", "options"])) : createCommentVNode("", true), isEditMode.value ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
880
|
+
key: 1,
|
|
881
|
+
class: "max-h-8 px-3 text-xs",
|
|
882
|
+
variant: "outlined",
|
|
883
|
+
onClick: handleCancel
|
|
884
|
+
}, {
|
|
885
|
+
default: withCtx(() => [..._cache[2] || (_cache[2] = [createTextVNode(" Cancel ", -1)])]),
|
|
886
|
+
_: 1
|
|
887
|
+
})) : createCommentVNode("", true)]),
|
|
888
|
+
submit: withCtx(() => [createTextVNode(toDisplayString(isEditMode.value ? "Save" : "Create Tag"), 1)]),
|
|
889
|
+
default: withCtx(() => [createVNode(CommandActionInput_default, {
|
|
890
|
+
modelValue: name.value,
|
|
891
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => name.value = $event),
|
|
892
|
+
label: "Tag Name",
|
|
893
|
+
placeholder: "Tag Name",
|
|
894
|
+
onDelete: handleBack
|
|
895
|
+
}, null, 8, ["modelValue"])]),
|
|
896
|
+
_: 1
|
|
897
|
+
}, 8, ["disabled"]);
|
|
898
|
+
};
|
|
899
|
+
}
|
|
900
|
+
});
|
|
901
|
+
//#endregion
|
|
902
|
+
//#region src/v2/features/command-palette/hooks/use-command-palette-state.ts
|
|
903
|
+
/**
|
|
904
|
+
* Composable for managing command palette state.
|
|
905
|
+
*
|
|
906
|
+
* Centralizes all state management for the command palette including:
|
|
907
|
+
* - Open/closed state
|
|
908
|
+
* - Filter/search query
|
|
909
|
+
* - Command filtering logic
|
|
910
|
+
*
|
|
911
|
+
* @example
|
|
912
|
+
* const palette = useCommandPaletteState()
|
|
913
|
+
*
|
|
914
|
+
* // Open the palette
|
|
915
|
+
* palette.open()
|
|
916
|
+
*
|
|
917
|
+
* // Open with a specific command
|
|
918
|
+
* palette.open('create-openapi-document')
|
|
919
|
+
*
|
|
920
|
+
* // Open with command props
|
|
921
|
+
* palette.open('import-curl-command', { curl: 'curl https://api.example.com' })
|
|
922
|
+
*
|
|
923
|
+
* // Update filter query (automatically filters commands)
|
|
924
|
+
* palette.setFilterQuery('import')
|
|
925
|
+
*
|
|
926
|
+
* // Access filtered results
|
|
927
|
+
* console.log(palette.filteredCommands.value)
|
|
928
|
+
*
|
|
929
|
+
* // Close and reset
|
|
930
|
+
* palette.close()
|
|
931
|
+
*/
|
|
932
|
+
var useCommandPaletteState = (actions = baseClientActions, routes = baseRoutes) => {
|
|
933
|
+
const modalState = useModal();
|
|
934
|
+
const filterQuery = ref("");
|
|
935
|
+
const activeCommand = shallowRef(null);
|
|
936
|
+
const activeCommandProps = ref(null);
|
|
937
|
+
/** Whether the command palette is currently open */
|
|
938
|
+
const isOpen = computed(() => modalState.open);
|
|
939
|
+
const fuseActions = computed(() => new Fuse(toValue(actions), {
|
|
940
|
+
keys: ["name"],
|
|
941
|
+
threshold: .2
|
|
942
|
+
}));
|
|
943
|
+
const fuseRoutes = computed(() => new Fuse(toValue(routes), {
|
|
944
|
+
keys: ["name"],
|
|
945
|
+
threshold: .2
|
|
946
|
+
}));
|
|
947
|
+
/**
|
|
948
|
+
* Filtered commands based on the current search query.
|
|
949
|
+
* When no query is present, returns all visible commands (excluding hidden-folder).
|
|
950
|
+
* When a query exists, filters commands by name (case-insensitive) and excludes hidden-folder.
|
|
951
|
+
* Empty groups are excluded from the results.
|
|
952
|
+
*/
|
|
953
|
+
const filteredActions = computed(() => {
|
|
954
|
+
const query = filterQuery.value.toLowerCase().trim();
|
|
955
|
+
return (query ? fuseActions.value.search(query).map((a) => a.item) : toValue(actions)).filter((a) => !a.hidden);
|
|
956
|
+
});
|
|
957
|
+
const filteredRoutes = computed(() => {
|
|
958
|
+
const query = filterQuery.value.toLowerCase().trim();
|
|
959
|
+
return query ? fuseRoutes.value.search(query).map((a) => a.item) : toValue(routes);
|
|
960
|
+
});
|
|
961
|
+
/**
|
|
962
|
+
* Opens the command palette, optionally with a specific command active.
|
|
963
|
+
* If a commandId is provided, that command will be opened immediately.
|
|
964
|
+
* Props are type-safe and checked against the command's expected props.
|
|
965
|
+
*/
|
|
966
|
+
const open = (commandId, ...args) => {
|
|
967
|
+
if (commandId) {
|
|
968
|
+
activeCommand.value = toValue(actions).find((a) => a.id === commandId) ?? null;
|
|
969
|
+
activeCommandProps.value = args[0] ?? null;
|
|
970
|
+
}
|
|
971
|
+
modalState.show();
|
|
972
|
+
};
|
|
973
|
+
/** Closes the command palette and resets all state */
|
|
974
|
+
const close = () => {
|
|
975
|
+
modalState.hide();
|
|
976
|
+
reset();
|
|
977
|
+
};
|
|
978
|
+
/** Updates the filter query for searching commands */
|
|
979
|
+
const setFilterQuery = (query) => {
|
|
980
|
+
filterQuery.value = query;
|
|
981
|
+
};
|
|
982
|
+
/** Resets all internal state to initial values */
|
|
983
|
+
const reset = () => {
|
|
984
|
+
filterQuery.value = "";
|
|
985
|
+
activeCommand.value = null;
|
|
986
|
+
activeCommandProps.value = null;
|
|
987
|
+
};
|
|
988
|
+
return {
|
|
989
|
+
isOpen,
|
|
990
|
+
activeCommand,
|
|
991
|
+
activeCommandProps,
|
|
992
|
+
filterQuery,
|
|
993
|
+
filteredCommands: computed(() => [{
|
|
994
|
+
label: "",
|
|
995
|
+
commands: filteredActions.value
|
|
996
|
+
}, {
|
|
997
|
+
label: "Pages",
|
|
998
|
+
commands: filteredRoutes.value
|
|
999
|
+
}]),
|
|
1000
|
+
open,
|
|
1001
|
+
close,
|
|
1002
|
+
setFilterQuery,
|
|
1003
|
+
reset
|
|
1004
|
+
};
|
|
1005
|
+
};
|
|
1006
|
+
/**
|
|
1007
|
+
* The base naviation routes used in the command palette.
|
|
1008
|
+
* This object can be extended and passed to the useCommandPaletteState hook to add custom routes
|
|
1009
|
+
*/
|
|
1010
|
+
var baseRoutes = [
|
|
1011
|
+
{
|
|
1012
|
+
type: "route",
|
|
1013
|
+
id: "environment",
|
|
1014
|
+
name: "Environment",
|
|
1015
|
+
icon: ScalarIconBracketsCurly,
|
|
1016
|
+
to: { name: "workspace.environment" }
|
|
1017
|
+
},
|
|
1018
|
+
{
|
|
1019
|
+
type: "route",
|
|
1020
|
+
id: "cookies",
|
|
1021
|
+
name: "Cookies",
|
|
1022
|
+
icon: ScalarIconCookie,
|
|
1023
|
+
to: { name: "workspace.cookies" }
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
type: "route",
|
|
1027
|
+
id: "settings",
|
|
1028
|
+
name: "Settings",
|
|
1029
|
+
icon: ScalarIconSlidersHorizontal,
|
|
1030
|
+
to: { name: "workspace.settings" }
|
|
1031
|
+
}
|
|
1032
|
+
];
|
|
1033
|
+
/**
|
|
1034
|
+
* The internal client command palette actions
|
|
1035
|
+
* This object can be extended and passed to the useCommandPaletteState hook to add custom actions
|
|
1036
|
+
*/
|
|
1037
|
+
var baseClientActions = [
|
|
1038
|
+
{
|
|
1039
|
+
id: "import-from-openapi-swagger-postman-curl",
|
|
1040
|
+
name: "Import from OpenAPI/Swagger/Postman/cURL",
|
|
1041
|
+
component: CommandPaletteImport_default,
|
|
1042
|
+
icon: ScalarIconArrowSquareIn
|
|
1043
|
+
},
|
|
1044
|
+
{
|
|
1045
|
+
id: "create-openapi-document",
|
|
1046
|
+
name: "Create OpenAPI Document",
|
|
1047
|
+
component: CommandPaletteOpenApiDocument_default,
|
|
1048
|
+
icon: ScalarIconPackage
|
|
1049
|
+
},
|
|
1050
|
+
{
|
|
1051
|
+
id: "add-tag",
|
|
1052
|
+
name: "Add Tag",
|
|
1053
|
+
component: CommandPaletteTag_default,
|
|
1054
|
+
icon: ScalarIconFolder
|
|
1055
|
+
},
|
|
1056
|
+
{
|
|
1057
|
+
id: "create-request",
|
|
1058
|
+
name: "Create Request",
|
|
1059
|
+
component: CommandPaletteRequest_default,
|
|
1060
|
+
icon: ScalarIconArrowUpRight
|
|
1061
|
+
},
|
|
1062
|
+
{
|
|
1063
|
+
id: "add-example",
|
|
1064
|
+
name: "Add Example",
|
|
1065
|
+
component: CommandPaletteExample_default,
|
|
1066
|
+
icon: ScalarIconPuzzlePiece
|
|
1067
|
+
},
|
|
1068
|
+
{
|
|
1069
|
+
id: "import-curl-command",
|
|
1070
|
+
name: "Import cURL Command",
|
|
1071
|
+
hidden: true,
|
|
1072
|
+
component: CommandPaletteImportCurl_default
|
|
1073
|
+
},
|
|
1074
|
+
{
|
|
1075
|
+
id: "edit-tag",
|
|
1076
|
+
name: "Edit Tag",
|
|
1077
|
+
hidden: true,
|
|
1078
|
+
component: CommandPaletteTag_default
|
|
1079
|
+
},
|
|
1080
|
+
{
|
|
1081
|
+
id: "edit-example",
|
|
1082
|
+
name: "Edit Example",
|
|
1083
|
+
hidden: true,
|
|
1084
|
+
component: CommandPaletteExample_default
|
|
1085
|
+
}
|
|
1086
|
+
];
|
|
1087
|
+
//#endregion
|
|
1088
|
+
//#region src/v2/features/collection/helpers/get-default-operation-security-toggle.ts
|
|
1089
|
+
/**
|
|
1090
|
+
* Determines the default toggle state for operation security.
|
|
1091
|
+
* Returns false for 'document' type, undefined if path/method is missing,
|
|
1092
|
+
* otherwise checks if there are selected auth schemas for the operation.
|
|
1093
|
+
*/
|
|
1094
|
+
var getDefaultOperationSecurityToggle = ({ authStore, documentName, ...payload }) => {
|
|
1095
|
+
if (payload.type === "document") return false;
|
|
1096
|
+
return authStore.getAuthSelectedSchemas({
|
|
1097
|
+
type: "operation",
|
|
1098
|
+
documentName,
|
|
1099
|
+
path: payload.path,
|
|
1100
|
+
method: payload.method
|
|
1101
|
+
}) !== void 0;
|
|
1102
|
+
};
|
|
1103
|
+
//#endregion
|
|
1104
|
+
//#region src/v2/features/collection/components/Authentication.vue?vue&type=script&setup=true&lang.ts
|
|
1105
|
+
var _hoisted_1$10 = { class: "flex h-8 items-center" };
|
|
1106
|
+
//#endregion
|
|
1107
|
+
//#region src/v2/features/collection/components/Authentication.vue
|
|
1108
|
+
var Authentication_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1109
|
+
__name: "Authentication",
|
|
1110
|
+
props: {
|
|
1111
|
+
documentSlug: {},
|
|
1112
|
+
document: {},
|
|
1113
|
+
eventBus: {},
|
|
1114
|
+
layout: {},
|
|
1115
|
+
path: {},
|
|
1116
|
+
method: {},
|
|
1117
|
+
exampleName: {},
|
|
1118
|
+
environment: {},
|
|
1119
|
+
securitySchemes: {},
|
|
1120
|
+
workspaceStore: {},
|
|
1121
|
+
activeWorkspace: {},
|
|
1122
|
+
plugins: {},
|
|
1123
|
+
customThemes: {},
|
|
1124
|
+
currentTheme: {},
|
|
1125
|
+
isDarkMode: { type: Boolean },
|
|
1126
|
+
fetchRegistryDocument: { type: Function },
|
|
1127
|
+
collectionType: {}
|
|
1128
|
+
},
|
|
1129
|
+
setup(__props) {
|
|
1130
|
+
/**
|
|
1131
|
+
* Compute the authentication metadata based on the current collection type.
|
|
1132
|
+
* If we're working with an operation, include its path and method; otherwise, use the document scope.
|
|
1133
|
+
*/
|
|
1134
|
+
const authMeta = computed(() => {
|
|
1135
|
+
if (__props.collectionType === "operation") return {
|
|
1136
|
+
type: "operation",
|
|
1137
|
+
path: __props.path ?? "",
|
|
1138
|
+
method: __props.method ?? "get"
|
|
1139
|
+
};
|
|
1140
|
+
return { type: "document" };
|
|
1141
|
+
});
|
|
1142
|
+
/**
|
|
1143
|
+
* Compute the operation object based on the current collection type.
|
|
1144
|
+
*/
|
|
1145
|
+
const operation = computed(() => {
|
|
1146
|
+
if (__props.collectionType === "operation") {
|
|
1147
|
+
if (!__props.path || !isHttpMethod(__props.method)) return null;
|
|
1148
|
+
return getResolvedRef(__props.document?.paths?.[__props.path]?.[__props.method]);
|
|
1149
|
+
}
|
|
1150
|
+
return null;
|
|
1151
|
+
});
|
|
1152
|
+
/**
|
|
1153
|
+
* If enabled we use/set the selected security schemes on the operation level
|
|
1154
|
+
*/
|
|
1155
|
+
const useOperationSecurity = ref(false);
|
|
1156
|
+
watchEffect(() => {
|
|
1157
|
+
useOperationSecurity.value = getDefaultOperationSecurityToggle({
|
|
1158
|
+
authStore: __props.workspaceStore.auth,
|
|
1159
|
+
documentName: __props.documentSlug,
|
|
1160
|
+
...authMeta.value
|
|
1161
|
+
});
|
|
1162
|
+
});
|
|
1163
|
+
/** Resolved selected security for the current collection (operation or document), with defaults applied */
|
|
1164
|
+
const selectedSecurity = computed(() => {
|
|
1165
|
+
if (__props.collectionType === "operation") return getSelectedSecurity(void 0, __props.workspaceStore.auth.getAuthSelectedSchemas({
|
|
1166
|
+
type: "operation",
|
|
1167
|
+
documentName: __props.documentSlug,
|
|
1168
|
+
path: __props.path ?? "",
|
|
1169
|
+
method: __props.method ?? "get"
|
|
1170
|
+
}), operation.value?.security ?? []);
|
|
1171
|
+
return getSelectedSecurity(__props.workspaceStore.auth.getAuthSelectedSchemas({
|
|
1172
|
+
type: "document",
|
|
1173
|
+
documentName: __props.documentSlug
|
|
1174
|
+
}), void 0, __props.document?.security ?? []);
|
|
1175
|
+
});
|
|
1176
|
+
/** Compute the security requirements for the operation or document based on the current collection type */
|
|
1177
|
+
const securityRequirements = computed(() => {
|
|
1178
|
+
if (__props.collectionType === "operation") return operation.value?.security ?? [];
|
|
1179
|
+
return __props.document?.security ?? [];
|
|
1180
|
+
});
|
|
1181
|
+
/** Compute the proxy URL for the current layout (for the electron we don't want to use the proxy by default) */
|
|
1182
|
+
const proxyUrl = computed(() => getActiveProxyUrl(__props.workspaceStore.workspace["x-scalar-active-proxy"], __props.layout) ?? "");
|
|
1183
|
+
const servers = computed(() => {
|
|
1184
|
+
return getServers(operation.value?.servers ?? __props.document?.servers, { documentUrl: __props.document?.["x-scalar-original-source-url"] });
|
|
1185
|
+
});
|
|
1186
|
+
/** Grab the currently selected server for relative auth URIs */
|
|
1187
|
+
const server = computed(() => {
|
|
1188
|
+
const documentServer = __props.document?.["x-scalar-selected-server"];
|
|
1189
|
+
const selectedServerUrl = operation.value?.["x-scalar-selected-server"] ?? documentServer;
|
|
1190
|
+
return servers.value.find(({ url }) => url === selectedServerUrl) ?? servers.value[0] ?? null;
|
|
1191
|
+
});
|
|
1192
|
+
/**
|
|
1193
|
+
* Handles toggling operation-level security authentication. (Only for operation collections)
|
|
1194
|
+
* When enabled (`value` is true), overrides document-level authentication for the current operation.
|
|
1195
|
+
* When disabled (`value` is false), reverts to using document-level authentication instead.
|
|
1196
|
+
*/
|
|
1197
|
+
const handleToggleOperationSecurity = (value) => {
|
|
1198
|
+
if (authMeta.value.type !== "operation") return;
|
|
1199
|
+
useOperationSecurity.value = value;
|
|
1200
|
+
if (value) {
|
|
1201
|
+
const { selectedSchemes } = selectedSecurity.value;
|
|
1202
|
+
return __props.eventBus.emit("auth:update:selected-security-schemes", {
|
|
1203
|
+
selectedRequirements: unpackProxyObject(selectedSchemes, { depth: 1 }),
|
|
1204
|
+
newSchemes: [],
|
|
1205
|
+
meta: authMeta.value
|
|
1206
|
+
});
|
|
1207
|
+
}
|
|
1208
|
+
return __props.eventBus.emit("auth:clear:selected-security-schemes", { meta: authMeta.value });
|
|
1209
|
+
};
|
|
1210
|
+
return (_ctx, _cache) => {
|
|
1211
|
+
return openBlock(), createBlock(Section_default, null, createSlots({
|
|
1212
|
+
title: withCtx(() => [_cache[0] || (_cache[0] = createTextVNode("Authentication", -1))]),
|
|
1213
|
+
description: withCtx(() => [__props.collectionType === "operation" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1214
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "block" }, " Override authentication for this operation with the toggle. ", -1)),
|
|
1215
|
+
_cache[2] || (_cache[2] = createElementVNode("span", { class: "mt-1 block" }, [createElementVNode("strong", null, "On"), createTextVNode(" — Authentication below applies only to this operation. ")], -1)),
|
|
1216
|
+
_cache[3] || (_cache[3] = createElementVNode("span", { class: "mt-1 block" }, [createElementVNode("strong", null, "Off"), createTextVNode(" — This operation uses document-level authentication from the OpenAPI spec. ")], -1))
|
|
1217
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(" Configure authentication for this document. Selected authentication applies to all operations unless overridden at the operation level. ")], 64))]),
|
|
1218
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(__props.collectionType === "operation" && !useOperationSecurity.value && "cursor-not-allowed") }, [createVNode(unref(AuthSelector_default), {
|
|
1219
|
+
class: normalizeClass(["scalar-collection-auth border-none!", __props.collectionType === "operation" && !useOperationSecurity.value && "pointer-events-none opacity-50 mix-blend-luminosity"]),
|
|
1220
|
+
createAnySecurityScheme: true,
|
|
1221
|
+
environment: __props.environment,
|
|
1222
|
+
eventBus: __props.eventBus,
|
|
1223
|
+
isStatic: "",
|
|
1224
|
+
meta: authMeta.value,
|
|
1225
|
+
proxyUrl: proxyUrl.value,
|
|
1226
|
+
securityRequirements: securityRequirements.value,
|
|
1227
|
+
securitySchemes: __props.securitySchemes,
|
|
1228
|
+
selectedSecurity: selectedSecurity.value,
|
|
1229
|
+
server: server.value,
|
|
1230
|
+
title: "Authentication"
|
|
1231
|
+
}, null, 8, [
|
|
1232
|
+
"class",
|
|
1233
|
+
"environment",
|
|
1234
|
+
"eventBus",
|
|
1235
|
+
"meta",
|
|
1236
|
+
"proxyUrl",
|
|
1237
|
+
"securityRequirements",
|
|
1238
|
+
"securitySchemes",
|
|
1239
|
+
"selectedSecurity",
|
|
1240
|
+
"server"
|
|
1241
|
+
])], 2)]),
|
|
1242
|
+
_: 2
|
|
1243
|
+
}, [__props.collectionType === "operation" ? {
|
|
1244
|
+
name: "actions",
|
|
1245
|
+
fn: withCtx(() => [createElementVNode("div", _hoisted_1$10, [createVNode(unref(ScalarToggle), {
|
|
1246
|
+
class: "w-4",
|
|
1247
|
+
modelValue: useOperationSecurity.value,
|
|
1248
|
+
"onUpdate:modelValue": handleToggleOperationSecurity
|
|
1249
|
+
}, null, 8, ["modelValue"])])]),
|
|
1250
|
+
key: "0"
|
|
1251
|
+
} : void 0]), 1024);
|
|
1252
|
+
};
|
|
1253
|
+
}
|
|
1254
|
+
}), [["__scopeId", "data-v-1550f6bf"]]);
|
|
1255
|
+
//#endregion
|
|
1256
|
+
//#region src/v2/features/collection/components/Cookies.vue
|
|
1257
|
+
var Cookies_default = /* @__PURE__ */ defineComponent({
|
|
1258
|
+
name: "Cookies",
|
|
1259
|
+
props: {
|
|
1260
|
+
documentSlug: {},
|
|
1261
|
+
document: {},
|
|
1262
|
+
eventBus: {},
|
|
1263
|
+
layout: {},
|
|
1264
|
+
path: {},
|
|
1265
|
+
method: {},
|
|
1266
|
+
exampleName: {},
|
|
1267
|
+
environment: {},
|
|
1268
|
+
securitySchemes: {},
|
|
1269
|
+
workspaceStore: {},
|
|
1270
|
+
activeWorkspace: {},
|
|
1271
|
+
plugins: {},
|
|
1272
|
+
customThemes: {},
|
|
1273
|
+
currentTheme: {},
|
|
1274
|
+
isDarkMode: { type: Boolean },
|
|
1275
|
+
fetchRegistryDocument: { type: Function },
|
|
1276
|
+
collectionType: {}
|
|
1277
|
+
},
|
|
1278
|
+
setup(__props) {
|
|
1279
|
+
const cookies = computed(() => {
|
|
1280
|
+
return (__props.collectionType === "document" ? __props.document["x-scalar-cookies"] : __props.workspaceStore.workspace["x-scalar-cookies"]) ?? [];
|
|
1281
|
+
});
|
|
1282
|
+
return (_ctx, _cache) => {
|
|
1283
|
+
return __props.collectionType !== "operation" ? (openBlock(), createBlock(Section_default, { key: 0 }, {
|
|
1284
|
+
title: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Cookies", -1)])]),
|
|
1285
|
+
description: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
1286
|
+
createTextVNode(" Manage your collection's cookies here.", -1),
|
|
1287
|
+
createElementVNode("br", null, null, -1),
|
|
1288
|
+
createTextVNode("Cookies allow you to store and send key-value data with your API requests—often used for things like session tokens, authentication, and saving user preferences.", -1),
|
|
1289
|
+
createElementVNode("br", null, null, -1)
|
|
1290
|
+
])]),
|
|
1291
|
+
default: withCtx(() => [createVNode(unref(CookiesTable_default), {
|
|
1292
|
+
collectionType: __props.collectionType,
|
|
1293
|
+
cookies: cookies.value,
|
|
1294
|
+
eventBus: __props.eventBus
|
|
1295
|
+
}, null, 8, [
|
|
1296
|
+
"collectionType",
|
|
1297
|
+
"cookies",
|
|
1298
|
+
"eventBus"
|
|
1299
|
+
])]),
|
|
1300
|
+
_: 1
|
|
1301
|
+
})) : createCommentVNode("", true);
|
|
1302
|
+
};
|
|
1303
|
+
}
|
|
1304
|
+
});
|
|
1305
|
+
//#endregion
|
|
1306
|
+
//#region src/v2/features/collection/components/Environment.vue
|
|
1307
|
+
var Environment_default = /* @__PURE__ */ defineComponent({
|
|
1308
|
+
name: "Environment",
|
|
1309
|
+
props: {
|
|
1310
|
+
documentSlug: {},
|
|
1311
|
+
document: {},
|
|
1312
|
+
eventBus: {},
|
|
1313
|
+
layout: {},
|
|
1314
|
+
path: {},
|
|
1315
|
+
method: {},
|
|
1316
|
+
exampleName: {},
|
|
1317
|
+
environment: {},
|
|
1318
|
+
securitySchemes: {},
|
|
1319
|
+
workspaceStore: {},
|
|
1320
|
+
activeWorkspace: {},
|
|
1321
|
+
plugins: {},
|
|
1322
|
+
customThemes: {},
|
|
1323
|
+
currentTheme: {},
|
|
1324
|
+
isDarkMode: { type: Boolean },
|
|
1325
|
+
fetchRegistryDocument: { type: Function },
|
|
1326
|
+
collectionType: {}
|
|
1327
|
+
},
|
|
1328
|
+
setup(__props) {
|
|
1329
|
+
/** Document or workspace environments */
|
|
1330
|
+
const environments = computed(() => (__props.collectionType === "document" ? __props.document["x-scalar-environments"] : __props.workspaceStore.workspace["x-scalar-environments"]) ?? {});
|
|
1331
|
+
const activeEnvironment = computed(() => {
|
|
1332
|
+
return __props.workspaceStore.workspace["x-scalar-active-environment"];
|
|
1333
|
+
});
|
|
1334
|
+
return (_ctx, _cache) => {
|
|
1335
|
+
return __props.collectionType !== "operation" ? (openBlock(), createBlock(Section_default, { key: 0 }, {
|
|
1336
|
+
title: withCtx(() => [..._cache[0] || (_cache[0] = [createTextVNode("Environment Variables", -1)])]),
|
|
1337
|
+
description: withCtx(() => [..._cache[1] || (_cache[1] = [
|
|
1338
|
+
createTextVNode(" Set environment variables at your collection level. Use ", -1),
|
|
1339
|
+
createElementVNode("code", { class: "font-code text-c-2" }, " {{ variable }} ", -1),
|
|
1340
|
+
createTextVNode(" to add / search among the selected environment's variables in your request inputs. ", -1)
|
|
1341
|
+
])]),
|
|
1342
|
+
default: withCtx(() => [createVNode(unref(EnvironmentsList_default), {
|
|
1343
|
+
activeEnvironment: activeEnvironment.value,
|
|
1344
|
+
collectionType: __props.collectionType,
|
|
1345
|
+
environments: environments.value,
|
|
1346
|
+
eventBus: __props.eventBus
|
|
1347
|
+
}, null, 8, [
|
|
1348
|
+
"activeEnvironment",
|
|
1349
|
+
"collectionType",
|
|
1350
|
+
"environments",
|
|
1351
|
+
"eventBus"
|
|
1352
|
+
])]),
|
|
1353
|
+
_: 1
|
|
1354
|
+
})) : createCommentVNode("", true);
|
|
1355
|
+
};
|
|
1356
|
+
}
|
|
1357
|
+
});
|
|
1358
|
+
//#endregion
|
|
1359
|
+
//#region src/v2/features/collection/components/Overview.vue?vue&type=script&setup=true&lang.ts
|
|
1360
|
+
var _hoisted_1$9 = { class: "flex flex-col gap-8" };
|
|
1361
|
+
var _hoisted_2$9 = { class: "has-focus-visible:bg-b-1 group rounded-lg" };
|
|
1362
|
+
var _hoisted_3$8 = {
|
|
1363
|
+
key: 1,
|
|
1364
|
+
class: "text-c-3 flex items-center justify-center rounded-lg border p-4"
|
|
1365
|
+
};
|
|
1366
|
+
var _hoisted_4$7 = { class: "flex items-center justify-between gap-4 rounded-lg p-4" };
|
|
1367
|
+
var _hoisted_5$6 = { class: "min-w-0 flex-1" };
|
|
1368
|
+
var _hoisted_6$3 = { class: "bg-b-2 flex items-center justify-between gap-4 rounded-lg border border-(--scalar-background-3) p-4 text-sm" };
|
|
1369
|
+
//#endregion
|
|
1370
|
+
//#region src/v2/features/collection/components/Overview.vue
|
|
1371
|
+
var Overview_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1372
|
+
__name: "Overview",
|
|
1373
|
+
props: {
|
|
1374
|
+
documentSlug: {},
|
|
1375
|
+
document: {},
|
|
1376
|
+
eventBus: {},
|
|
1377
|
+
layout: {},
|
|
1378
|
+
path: {},
|
|
1379
|
+
method: {},
|
|
1380
|
+
exampleName: {},
|
|
1381
|
+
environment: {},
|
|
1382
|
+
securitySchemes: {},
|
|
1383
|
+
workspaceStore: {},
|
|
1384
|
+
activeWorkspace: {},
|
|
1385
|
+
plugins: {},
|
|
1386
|
+
customThemes: {},
|
|
1387
|
+
currentTheme: {},
|
|
1388
|
+
isDarkMode: { type: Boolean },
|
|
1389
|
+
fetchRegistryDocument: { type: Function },
|
|
1390
|
+
collectionType: {}
|
|
1391
|
+
},
|
|
1392
|
+
setup(__props) {
|
|
1393
|
+
const operationLabel = computed(() => {
|
|
1394
|
+
if (!__props.method || !__props.path) return "this operation";
|
|
1395
|
+
return `${typeof __props.method === "string" ? __props.method.toUpperCase() : __props.method} ${__props.path}`;
|
|
1396
|
+
});
|
|
1397
|
+
const description = computed(() => {
|
|
1398
|
+
if (__props.collectionType === "operation") {
|
|
1399
|
+
if (!__props.path || !__props.method || !isHttpMethod(__props.method)) return "";
|
|
1400
|
+
return __props.document?.paths?.[__props.path]?.[__props.method]?.description ?? "";
|
|
1401
|
+
}
|
|
1402
|
+
return __props.document?.info?.description ?? "";
|
|
1403
|
+
});
|
|
1404
|
+
const deprecated = computed(() => {
|
|
1405
|
+
if (__props.collectionType !== "operation" || !__props.path || !isHttpMethod(__props.method)) return false;
|
|
1406
|
+
return (__props.document?.paths?.[__props.path]?.[__props.method])?.deprecated ?? false;
|
|
1407
|
+
});
|
|
1408
|
+
const mode = ref("preview");
|
|
1409
|
+
const codeInputRef = useTemplateRef("codeInputRef");
|
|
1410
|
+
/**
|
|
1411
|
+
* Switch between edit and preview modes.
|
|
1412
|
+
* When switching to edit mode, focus the input after the DOM updates.
|
|
1413
|
+
*/
|
|
1414
|
+
const switchMode = async (newMode) => {
|
|
1415
|
+
mode.value = newMode;
|
|
1416
|
+
if (newMode === "edit") {
|
|
1417
|
+
await nextTick();
|
|
1418
|
+
codeInputRef.value?.focus();
|
|
1419
|
+
}
|
|
1420
|
+
};
|
|
1421
|
+
/**
|
|
1422
|
+
* Updates the description of the collection
|
|
1423
|
+
* @param payload - The new description
|
|
1424
|
+
* @returns void
|
|
1425
|
+
*/
|
|
1426
|
+
const handleDescriptionUpdate = async (payload) => {
|
|
1427
|
+
await switchMode("preview");
|
|
1428
|
+
/** If the collection type is a document, update the description of the document */
|
|
1429
|
+
if (__props.collectionType === "document") return __props.eventBus.emit("document:update:info", { description: payload });
|
|
1430
|
+
/** If the collection type is an operation, update the description of the operation */
|
|
1431
|
+
if (__props.collectionType === "operation") {
|
|
1432
|
+
if (!__props.path || !__props.method) {
|
|
1433
|
+
console.error("Invalid path or method", {
|
|
1434
|
+
path: __props.path,
|
|
1435
|
+
method: __props.method
|
|
1436
|
+
});
|
|
1437
|
+
return;
|
|
1438
|
+
}
|
|
1439
|
+
return __props.eventBus.emit("operation:update:meta", {
|
|
1440
|
+
meta: {
|
|
1441
|
+
path: __props.path,
|
|
1442
|
+
method: __props.method
|
|
1443
|
+
},
|
|
1444
|
+
payload: { description: payload }
|
|
1445
|
+
});
|
|
1446
|
+
}
|
|
1447
|
+
console.error("Invalid collection type", { collectionType: __props.collectionType });
|
|
1448
|
+
};
|
|
1449
|
+
const handleDeprecatedChange = (value) => {
|
|
1450
|
+
if (__props.collectionType !== "operation" || !__props.path || !__props.method) return;
|
|
1451
|
+
__props.eventBus.emit("operation:update:meta", {
|
|
1452
|
+
meta: {
|
|
1453
|
+
path: __props.path,
|
|
1454
|
+
method: __props.method
|
|
1455
|
+
},
|
|
1456
|
+
payload: { deprecated: value }
|
|
1457
|
+
});
|
|
1458
|
+
};
|
|
1459
|
+
const deleteOperationModal = useModal();
|
|
1460
|
+
const handleDeleteOperation = () => {
|
|
1461
|
+
if (__props.collectionType !== "operation" || !__props.path || !__props.method || !__props.documentSlug) return;
|
|
1462
|
+
__props.eventBus.emit("operation:delete:operation", {
|
|
1463
|
+
documentName: __props.documentSlug,
|
|
1464
|
+
meta: {
|
|
1465
|
+
path: __props.path,
|
|
1466
|
+
method: __props.method
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
deleteOperationModal.hide();
|
|
1470
|
+
};
|
|
1471
|
+
return (_ctx, _cache) => {
|
|
1472
|
+
return openBlock(), createElementBlock(Fragment, null, [createElementVNode("div", _hoisted_1$9, [createVNode(Section_default, null, {
|
|
1473
|
+
title: withCtx(() => [..._cache[5] || (_cache[5] = [createTextVNode("Description", -1)])]),
|
|
1474
|
+
actions: withCtx(() => [mode.value === "preview" ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
1475
|
+
key: 0,
|
|
1476
|
+
class: "text-c-2 hover:text-c-1 flex items-center gap-2",
|
|
1477
|
+
size: "sm",
|
|
1478
|
+
type: "button",
|
|
1479
|
+
variant: "outlined",
|
|
1480
|
+
onClick: _cache[0] || (_cache[0] = ($event) => switchMode("edit"))
|
|
1481
|
+
}, {
|
|
1482
|
+
default: withCtx(() => [createVNode(unref(ScalarIconPencil), {
|
|
1483
|
+
size: "sm",
|
|
1484
|
+
thickness: "1.5"
|
|
1485
|
+
}), _cache[6] || (_cache[6] = createElementVNode("span", null, "Edit", -1))]),
|
|
1486
|
+
_: 1
|
|
1487
|
+
})) : createCommentVNode("", true)]),
|
|
1488
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2$9, [mode.value === "preview" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [description.value.trim().length ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(ScalarMarkdown), {
|
|
1489
|
+
class: "flex-1 rounded border border-transparent p-1.5 hover:border-(--scalar-background-3)",
|
|
1490
|
+
value: description.value,
|
|
1491
|
+
withImages: "",
|
|
1492
|
+
onDblclick: _cache[1] || (_cache[1] = ($event) => switchMode("edit"))
|
|
1493
|
+
}, null, 8, ["value"]), _cache[7] || (_cache[7] = createElementVNode("div", { class: "brightness-lifted bg-b-1 absolute inset-0 -z-1 hidden rounded group-hover:block group-has-focus-visible:hidden" }, null, -1))], 64)) : (openBlock(), createElementBlock("div", _hoisted_3$8, [createVNode(unref(ScalarButton), {
|
|
1494
|
+
class: "hover:bg-b-2 hover:text-c-1 text-c-2 flex items-center gap-2",
|
|
1495
|
+
size: "sm",
|
|
1496
|
+
variant: "ghost",
|
|
1497
|
+
onClick: _cache[2] || (_cache[2] = ($event) => switchMode("edit"))
|
|
1498
|
+
}, {
|
|
1499
|
+
default: withCtx(() => [createVNode(unref(ScalarIconPencil), {
|
|
1500
|
+
size: "sm",
|
|
1501
|
+
thickness: "1.5"
|
|
1502
|
+
}), _cache[8] || (_cache[8] = createElementVNode("span", null, "Write a description", -1))]),
|
|
1503
|
+
_: 1
|
|
1504
|
+
})]))], 64)) : (openBlock(), createBlock(unref(CodeInput_default), {
|
|
1505
|
+
key: 1,
|
|
1506
|
+
ref_key: "codeInputRef",
|
|
1507
|
+
ref: codeInputRef,
|
|
1508
|
+
class: "border px-0.5 py-0",
|
|
1509
|
+
environment: void 0,
|
|
1510
|
+
layout: __props.layout,
|
|
1511
|
+
modelValue: description.value,
|
|
1512
|
+
onBlur: handleDescriptionUpdate
|
|
1513
|
+
}, null, 8, ["layout", "modelValue"]))])]),
|
|
1514
|
+
_: 1
|
|
1515
|
+
}), __props.collectionType === "operation" ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(Section_default, null, {
|
|
1516
|
+
title: withCtx(() => [..._cache[9] || (_cache[9] = [createTextVNode("Status", -1)])]),
|
|
1517
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(["rounded-lg border text-sm transition-colors", deprecated.value ? "border-(--scalar-color-alert) bg-(--scalar-background-alert)" : "bg-b-2 border-(--scalar-background-3)"]) }, [createElementVNode("div", _hoisted_4$7, [createElementVNode("div", _hoisted_5$6, [createElementVNode("h4", { class: normalizeClass(["font-medium", deprecated.value ? "text-(--scalar-color-alert)" : "text-c-1"]) }, " Deprecated ", 2), _cache[10] || (_cache[10] = createElementVNode("p", { class: "text-c-2 mt-1.5" }, " Mark this operation as deprecated. Consumers SHOULD refrain from using it. ", -1))]), createVNode(unref(ScalarToggle), {
|
|
1518
|
+
class: "shrink-0",
|
|
1519
|
+
modelValue: deprecated.value,
|
|
1520
|
+
"onUpdate:modelValue": handleDeprecatedChange
|
|
1521
|
+
}, null, 8, ["modelValue"])])], 2)]),
|
|
1522
|
+
_: 1
|
|
1523
|
+
}), createVNode(Section_default, null, {
|
|
1524
|
+
title: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode("Danger Zone", -1)])]),
|
|
1525
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_6$3, [_cache[13] || (_cache[13] = createElementVNode("div", { class: "min-w-0 flex-1" }, [createElementVNode("h4", { class: "text-c-1 font-medium" }, "Delete Operation"), createElementVNode("p", { class: "text-c-2 mt-1.5" }, " Be careful, my friend. Once deleted, there is no way to recover the operation. ")], -1)), createVNode(unref(ScalarButton), {
|
|
1526
|
+
class: "shrink-0",
|
|
1527
|
+
size: "sm",
|
|
1528
|
+
variant: "danger",
|
|
1529
|
+
onClick: _cache[3] || (_cache[3] = ($event) => unref(deleteOperationModal).show())
|
|
1530
|
+
}, {
|
|
1531
|
+
default: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" Delete Operation ", -1)])]),
|
|
1532
|
+
_: 1
|
|
1533
|
+
})])]),
|
|
1534
|
+
_: 1
|
|
1535
|
+
})], 64)) : createCommentVNode("", true)]), createVNode(unref(ScalarModal), {
|
|
1536
|
+
size: "xxs",
|
|
1537
|
+
state: unref(deleteOperationModal),
|
|
1538
|
+
title: `Delete ${operationLabel.value}`
|
|
1539
|
+
}, {
|
|
1540
|
+
default: withCtx(() => [createVNode(DeleteSidebarListElement_default, {
|
|
1541
|
+
variableName: operationLabel.value,
|
|
1542
|
+
warningMessage: "This action cannot be undone.",
|
|
1543
|
+
onClose: _cache[4] || (_cache[4] = ($event) => unref(deleteOperationModal).hide()),
|
|
1544
|
+
onDelete: handleDeleteOperation
|
|
1545
|
+
}, null, 8, ["variableName"])]),
|
|
1546
|
+
_: 1
|
|
1547
|
+
}, 8, ["state", "title"])], 64);
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
}), [["__scopeId", "data-v-d486ea71"]]);
|
|
1551
|
+
//#endregion
|
|
1552
|
+
//#region src/v2/features/collection/components/Form.vue?vue&type=script&setup=true&lang.ts
|
|
1553
|
+
var _hoisted_1$8 = { key: 0 };
|
|
1554
|
+
var _hoisted_2$8 = { class: "flex flex-1 flex-col gap-1.5" };
|
|
1555
|
+
var _hoisted_3$7 = ["for"];
|
|
1556
|
+
var _hoisted_4$6 = { class: "centered-y bg-b-2 flex-center absolute right-1 z-1 rounded px-1 py-0.5" };
|
|
1557
|
+
//#endregion
|
|
1558
|
+
//#region src/v2/features/collection/components/Form.vue
|
|
1559
|
+
var Form_default = /* @__PURE__ */ defineComponent({
|
|
1560
|
+
__name: "Form",
|
|
1561
|
+
props: {
|
|
1562
|
+
title: {},
|
|
1563
|
+
options: {},
|
|
1564
|
+
data: {},
|
|
1565
|
+
onUpdate: { type: Function },
|
|
1566
|
+
environment: {}
|
|
1567
|
+
},
|
|
1568
|
+
setup(__props) {
|
|
1569
|
+
const id = useId();
|
|
1570
|
+
return (_ctx, _cache) => {
|
|
1571
|
+
return openBlock(), createBlock(ViewLayoutSection_default, { class: "last:rounded-b-lg" }, createSlots({
|
|
1572
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2$8, [Object.keys(__props.data).length > 0 ? (openBlock(), createBlock(DataTable_default, {
|
|
1573
|
+
key: 0,
|
|
1574
|
+
class: "rounded-b-lg",
|
|
1575
|
+
columns: [""]
|
|
1576
|
+
}, {
|
|
1577
|
+
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.options, (option, index) => {
|
|
1578
|
+
return openBlock(), createBlock(DataTableRow_default, { key: index }, {
|
|
1579
|
+
default: withCtx(() => [createVNode(DataTableInput_default, {
|
|
1580
|
+
id: unref(id),
|
|
1581
|
+
class: "pr-9",
|
|
1582
|
+
environment: __props.environment,
|
|
1583
|
+
lineWrapping: option.lineWrapping ?? false,
|
|
1584
|
+
modelValue: __props.data[option.key] ?? "",
|
|
1585
|
+
placeholder: option.placeholder,
|
|
1586
|
+
"onUpdate:modelValue": ($event) => __props.onUpdate(option.key, $event)
|
|
1587
|
+
}, createSlots({
|
|
1588
|
+
default: withCtx(() => [createElementVNode("label", { for: unref(id) }, toDisplayString(option.label), 9, _hoisted_3$7)]),
|
|
1589
|
+
_: 2
|
|
1590
|
+
}, [option.key === "description" ? {
|
|
1591
|
+
name: "icon",
|
|
1592
|
+
fn: withCtx(() => [createElementVNode("div", _hoisted_4$6, [createVNode(unref(ScalarIcon), {
|
|
1593
|
+
icon: "Markdown",
|
|
1594
|
+
size: "lg"
|
|
1595
|
+
})])]),
|
|
1596
|
+
key: "0"
|
|
1597
|
+
} : void 0]), 1032, [
|
|
1598
|
+
"id",
|
|
1599
|
+
"environment",
|
|
1600
|
+
"lineWrapping",
|
|
1601
|
+
"modelValue",
|
|
1602
|
+
"placeholder",
|
|
1603
|
+
"onUpdate:modelValue"
|
|
1604
|
+
])]),
|
|
1605
|
+
_: 2
|
|
1606
|
+
}, 1024);
|
|
1607
|
+
}), 128))]),
|
|
1608
|
+
_: 1
|
|
1609
|
+
})) : createCommentVNode("", true)])]),
|
|
1610
|
+
_: 2
|
|
1611
|
+
}, [__props.title || _ctx.$slots.title ? {
|
|
1612
|
+
name: "title",
|
|
1613
|
+
fn: withCtx(() => [__props.title ? (openBlock(), createElementBlock("span", _hoisted_1$8, toDisplayString(__props.title), 1)) : renderSlot(_ctx.$slots, "title", { key: 1 })]),
|
|
1614
|
+
key: "0"
|
|
1615
|
+
} : void 0]), 1024);
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
//#endregion
|
|
1620
|
+
//#region src/v2/features/collection/components/Servers.vue?vue&type=script&setup=true&lang.ts
|
|
1621
|
+
var _hoisted_1$7 = { class: "flex h-8 items-center" };
|
|
1622
|
+
var _hoisted_2$7 = { class: "flex flex-col gap-4" };
|
|
1623
|
+
var _hoisted_3$6 = { class: "bg-b-2 flex items-center justify-between rounded-t-lg px-3 py-1 text-sm" };
|
|
1624
|
+
var _hoisted_4$5 = {
|
|
1625
|
+
key: 1,
|
|
1626
|
+
class: "self-center"
|
|
1627
|
+
};
|
|
1628
|
+
var _hoisted_5$5 = { class: "divide-0 flex w-full flex-col divide-y rounded-b-lg text-sm" };
|
|
1629
|
+
var _hoisted_6$2 = { class: "text-c-3 flex h-full items-center justify-center rounded-lg border p-4" };
|
|
1630
|
+
//#endregion
|
|
1631
|
+
//#region src/v2/features/collection/components/Servers.vue
|
|
1632
|
+
var Servers_default = /* @__PURE__ */ defineComponent({
|
|
1633
|
+
__name: "Servers",
|
|
1634
|
+
props: {
|
|
1635
|
+
documentSlug: {},
|
|
1636
|
+
document: {},
|
|
1637
|
+
eventBus: {},
|
|
1638
|
+
layout: {},
|
|
1639
|
+
path: {},
|
|
1640
|
+
method: {},
|
|
1641
|
+
exampleName: {},
|
|
1642
|
+
environment: {},
|
|
1643
|
+
securitySchemes: {},
|
|
1644
|
+
workspaceStore: {},
|
|
1645
|
+
activeWorkspace: {},
|
|
1646
|
+
plugins: {},
|
|
1647
|
+
customThemes: {},
|
|
1648
|
+
currentTheme: {},
|
|
1649
|
+
isDarkMode: { type: Boolean },
|
|
1650
|
+
fetchRegistryDocument: { type: Function },
|
|
1651
|
+
collectionType: {}
|
|
1652
|
+
},
|
|
1653
|
+
setup(__props) {
|
|
1654
|
+
const deleteModal = useModal();
|
|
1655
|
+
const selectedServerIndex = ref(-1);
|
|
1656
|
+
const isOperation = computed(() => __props.collectionType === "operation");
|
|
1657
|
+
const operation = computed(() => {
|
|
1658
|
+
if (!isOperation.value) return null;
|
|
1659
|
+
if (!__props.path || !isHttpMethod(__props.method)) return null;
|
|
1660
|
+
return getResolvedRef(__props.document?.paths?.[__props.path]?.[__props.method]);
|
|
1661
|
+
});
|
|
1662
|
+
const useOperationServers = ref(false);
|
|
1663
|
+
watchEffect(() => {
|
|
1664
|
+
useOperationServers.value = operation.value?.servers !== void 0;
|
|
1665
|
+
});
|
|
1666
|
+
/** Grab the servers for the collection */
|
|
1667
|
+
const servers = computed(() => {
|
|
1668
|
+
if (__props.collectionType === "operation" && operation.value) return operation.value.servers ?? [];
|
|
1669
|
+
return __props.document?.servers ?? [];
|
|
1670
|
+
});
|
|
1671
|
+
/** Grab whichever server we are working on */
|
|
1672
|
+
const selectedServer = computed(() => servers.value[selectedServerIndex.value]);
|
|
1673
|
+
/** Meta for server events: document-level or operation-level based on collection type */
|
|
1674
|
+
const serverMeta = computed(() => {
|
|
1675
|
+
if (__props.collectionType === "operation" && __props.path && isHttpMethod(__props.method)) return {
|
|
1676
|
+
type: "operation",
|
|
1677
|
+
path: __props.path,
|
|
1678
|
+
method: __props.method
|
|
1679
|
+
};
|
|
1680
|
+
return { type: "document" };
|
|
1681
|
+
});
|
|
1682
|
+
const FORM_OPTIONS = [{
|
|
1683
|
+
label: "URL",
|
|
1684
|
+
key: "url",
|
|
1685
|
+
placeholder: "https://void.scalar.com"
|
|
1686
|
+
}, {
|
|
1687
|
+
label: "Description",
|
|
1688
|
+
key: "description",
|
|
1689
|
+
placeholder: "Production",
|
|
1690
|
+
lineWrapping: true
|
|
1691
|
+
}];
|
|
1692
|
+
/** Opens the delete confirmation modal for a server */
|
|
1693
|
+
const openDeleteModal = (index) => {
|
|
1694
|
+
selectedServerIndex.value = index;
|
|
1695
|
+
deleteModal.show();
|
|
1696
|
+
};
|
|
1697
|
+
/** Closes the delete modal and resets the selected server */
|
|
1698
|
+
const resetState = () => {
|
|
1699
|
+
deleteModal.hide();
|
|
1700
|
+
selectedServerIndex.value = -1;
|
|
1701
|
+
};
|
|
1702
|
+
/** Handles server deletion */
|
|
1703
|
+
const handleDeleteServer = () => {
|
|
1704
|
+
if (selectedServerIndex.value < 0) return;
|
|
1705
|
+
__props.eventBus.emit("server:delete:server", {
|
|
1706
|
+
index: selectedServerIndex.value,
|
|
1707
|
+
meta: serverMeta.value
|
|
1708
|
+
});
|
|
1709
|
+
resetState();
|
|
1710
|
+
};
|
|
1711
|
+
/** Debounced execute function for server updates, keyed so we only debounce by server + key */
|
|
1712
|
+
const { execute } = debounce({
|
|
1713
|
+
delay: 328,
|
|
1714
|
+
maxWait: 1e3
|
|
1715
|
+
});
|
|
1716
|
+
/** Handles server property updates with debouncing */
|
|
1717
|
+
const handleServerUpdate = (index, key, value) => execute(`${index}-${key}-${serverMeta.value.type}`, () => __props.eventBus.emit("server:update:server", {
|
|
1718
|
+
index,
|
|
1719
|
+
server: { [key]: value },
|
|
1720
|
+
meta: serverMeta.value
|
|
1721
|
+
}));
|
|
1722
|
+
/** Handles server variable updates with debouncing */
|
|
1723
|
+
const handleVariableUpdate = (index, key, value) => execute(`${index}-${key}-${serverMeta.value.type}`, () => __props.eventBus.emit("server:update:variables", {
|
|
1724
|
+
index,
|
|
1725
|
+
key,
|
|
1726
|
+
value,
|
|
1727
|
+
meta: serverMeta.value
|
|
1728
|
+
}));
|
|
1729
|
+
/** Handles adding a new server */
|
|
1730
|
+
const handleAddServer = () => __props.eventBus.emit("server:add:server", { meta: serverMeta.value });
|
|
1731
|
+
/**
|
|
1732
|
+
* Gets the display name for a server
|
|
1733
|
+
*/
|
|
1734
|
+
const getServerDisplayName = (server, index = 0) => server?.description || `Server ${index + 1}`;
|
|
1735
|
+
/** Handles toggling the operation servers */
|
|
1736
|
+
const handleToggleOperationServers = (value) => {
|
|
1737
|
+
if (serverMeta.value.type !== "operation") return;
|
|
1738
|
+
useOperationServers.value = value;
|
|
1739
|
+
if (value) return __props.eventBus.emit("server:initialize:servers", { meta: serverMeta.value });
|
|
1740
|
+
return __props.eventBus.emit("server:clear:servers", { meta: serverMeta.value });
|
|
1741
|
+
};
|
|
1742
|
+
return (_ctx, _cache) => {
|
|
1743
|
+
return openBlock(), createElementBlock(Fragment, null, [createVNode(Section_default, null, createSlots({
|
|
1744
|
+
title: withCtx(() => [_cache[0] || (_cache[0] = createTextVNode("Servers", -1))]),
|
|
1745
|
+
description: withCtx(() => [isOperation.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
1746
|
+
_cache[1] || (_cache[1] = createElementVNode("span", { class: "block" }, " Override servers for this operation with the toggle. ", -1)),
|
|
1747
|
+
_cache[2] || (_cache[2] = createElementVNode("span", { class: "mt-1 block" }, [createElementVNode("strong", null, "On"), createTextVNode(" — Servers below apply only to this operation. ")], -1)),
|
|
1748
|
+
_cache[3] || (_cache[3] = createElementVNode("span", { class: "mt-1 block" }, [createElementVNode("strong", null, "Off"), createTextVNode(" — Removes operation servers; this operation uses document or path servers from the OpenAPI spec. ")], -1)),
|
|
1749
|
+
_cache[4] || (_cache[4] = createElementVNode("span", { class: "text-c-3 mt-1 block" }, [
|
|
1750
|
+
createTextVNode(" Use "),
|
|
1751
|
+
createElementVNode("code", { class: "font-code text-c-2" }, "{variables}"),
|
|
1752
|
+
createTextVNode(" for dynamic URL parts. ")
|
|
1753
|
+
], -1))
|
|
1754
|
+
], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [
|
|
1755
|
+
_cache[5] || (_cache[5] = createTextVNode(" Add different base URLs for your API. Use ", -1)),
|
|
1756
|
+
_cache[6] || (_cache[6] = createElementVNode("code", { class: "font-code text-c-2" }, "{variables}", -1)),
|
|
1757
|
+
_cache[7] || (_cache[7] = createTextVNode(" for dynamic parts. ", -1))
|
|
1758
|
+
], 64))]),
|
|
1759
|
+
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(isOperation.value && !useOperationServers.value && "cursor-not-allowed") }, [createElementVNode("div", { class: normalizeClass(["flex flex-col gap-4", isOperation.value && !useOperationServers.value && "pointer-events-none cursor-not-allowed opacity-50 mix-blend-luminosity"]) }, [createElementVNode("div", _hoisted_2$7, [(openBlock(true), createElementBlock(Fragment, null, renderList(servers.value, (server, index) => {
|
|
1760
|
+
return openBlock(), createElementBlock("div", {
|
|
1761
|
+
key: index,
|
|
1762
|
+
class: "rounded-lg border"
|
|
1763
|
+
}, [createElementVNode("div", _hoisted_3$6, [server.description ? (openBlock(), createBlock(unref(ScalarMarkdown), {
|
|
1764
|
+
key: 0,
|
|
1765
|
+
class: "self-center",
|
|
1766
|
+
value: server.description
|
|
1767
|
+
}, null, 8, ["value"])) : (openBlock(), createElementBlock("span", _hoisted_4$5, toDisplayString(getServerDisplayName(server, index)), 1)), createVNode(unref(ScalarButton), {
|
|
1768
|
+
class: "hover:bg-b-3 hover:text-c-1 h-fit p-1.25",
|
|
1769
|
+
"data-testid": "delete-server-button",
|
|
1770
|
+
variant: "ghost",
|
|
1771
|
+
onClick: ($event) => openDeleteModal(index)
|
|
1772
|
+
}, {
|
|
1773
|
+
default: withCtx(() => [createVNode(unref(ScalarIconTrash), { class: "size-3.5" })]),
|
|
1774
|
+
_: 1
|
|
1775
|
+
}, 8, ["onClick"])]), createElementVNode("div", _hoisted_5$5, [createVNode(Form_default, {
|
|
1776
|
+
data: server,
|
|
1777
|
+
environment: __props.environment,
|
|
1778
|
+
onUpdate: (key, value) => handleServerUpdate(index, key, value),
|
|
1779
|
+
options: FORM_OPTIONS
|
|
1780
|
+
}, null, 8, [
|
|
1781
|
+
"data",
|
|
1782
|
+
"environment",
|
|
1783
|
+
"onUpdate"
|
|
1784
|
+
]), server.variables ? (openBlock(), createBlock(unref(ServerVariablesForm_default), {
|
|
1785
|
+
key: 0,
|
|
1786
|
+
variables: server.variables,
|
|
1787
|
+
"onUpdate:variable": (name, value) => handleVariableUpdate(index, name, value)
|
|
1788
|
+
}, null, 8, ["variables", "onUpdate:variable"])) : createCommentVNode("", true)])]);
|
|
1789
|
+
}), 128))]), createElementVNode("div", _hoisted_6$2, [createVNode(unref(ScalarButton), {
|
|
1790
|
+
class: "hover:bg-b-2 hover:text-c-1 flex items-center gap-2",
|
|
1791
|
+
size: "sm",
|
|
1792
|
+
variant: "ghost",
|
|
1793
|
+
onClick: handleAddServer
|
|
1794
|
+
}, {
|
|
1795
|
+
default: withCtx(() => [createVNode(unref(ScalarIconPlus)), _cache[8] || (_cache[8] = createElementVNode("span", null, "Add Server", -1))]),
|
|
1796
|
+
_: 1
|
|
1797
|
+
})])], 2)], 2)]),
|
|
1798
|
+
_: 2
|
|
1799
|
+
}, [isOperation.value ? {
|
|
1800
|
+
name: "actions",
|
|
1801
|
+
fn: withCtx(() => [createElementVNode("div", _hoisted_1$7, [createVNode(unref(ScalarToggle), {
|
|
1802
|
+
class: "w-4",
|
|
1803
|
+
modelValue: useOperationServers.value,
|
|
1804
|
+
"onUpdate:modelValue": handleToggleOperationServers
|
|
1805
|
+
}, null, 8, ["modelValue"])])]),
|
|
1806
|
+
key: "0"
|
|
1807
|
+
} : void 0]), 1024), createVNode(unref(ScalarModal), {
|
|
1808
|
+
size: "xxs",
|
|
1809
|
+
state: unref(deleteModal),
|
|
1810
|
+
title: `Delete ${getServerDisplayName(selectedServer.value, selectedServerIndex.value)}`
|
|
1811
|
+
}, {
|
|
1812
|
+
default: withCtx(() => [createVNode(DeleteSidebarListElement_default, {
|
|
1813
|
+
variableName: "Server",
|
|
1814
|
+
warningMessage: "Are you sure you want to delete this server? This action cannot be undone.",
|
|
1815
|
+
onClose: resetState,
|
|
1816
|
+
onDelete: handleDeleteServer
|
|
1817
|
+
})]),
|
|
1818
|
+
_: 1
|
|
1819
|
+
}, 8, ["state", "title"])], 64);
|
|
1820
|
+
};
|
|
1821
|
+
}
|
|
1822
|
+
});
|
|
1823
|
+
//#endregion
|
|
1824
|
+
//#region src/v2/features/collection/components/Settings.vue
|
|
1825
|
+
var Settings_default = /* @__PURE__ */ defineComponent({
|
|
1826
|
+
__name: "Settings",
|
|
1827
|
+
props: {
|
|
1828
|
+
documentSlug: {},
|
|
1829
|
+
document: {},
|
|
1830
|
+
eventBus: {},
|
|
1831
|
+
layout: {},
|
|
1832
|
+
path: {},
|
|
1833
|
+
method: {},
|
|
1834
|
+
exampleName: {},
|
|
1835
|
+
environment: {},
|
|
1836
|
+
securitySchemes: {},
|
|
1837
|
+
workspaceStore: {},
|
|
1838
|
+
activeWorkspace: {},
|
|
1839
|
+
plugins: {},
|
|
1840
|
+
customThemes: {},
|
|
1841
|
+
currentTheme: {},
|
|
1842
|
+
isDarkMode: { type: Boolean },
|
|
1843
|
+
fetchRegistryDocument: { type: Function },
|
|
1844
|
+
collectionType: {}
|
|
1845
|
+
},
|
|
1846
|
+
setup(__props) {
|
|
1847
|
+
const handleUpdateWatchMode = (watchMode) => {
|
|
1848
|
+
__props.eventBus.emit("document:update:watch-mode", watchMode);
|
|
1849
|
+
};
|
|
1850
|
+
const handleUpdateThemeSlug = (themeSlug) => {
|
|
1851
|
+
__props.eventBus.emit("workspace:update:theme", themeSlug);
|
|
1852
|
+
};
|
|
1853
|
+
const handleUpdateActiveProxy = (proxy) => {
|
|
1854
|
+
__props.eventBus.emit("workspace:update:active-proxy", proxy);
|
|
1855
|
+
};
|
|
1856
|
+
const handleUpdateColorMode = (colorMode) => {
|
|
1857
|
+
__props.eventBus.emit("workspace:update:color-mode", colorMode);
|
|
1858
|
+
};
|
|
1859
|
+
return (_ctx, _cache) => {
|
|
1860
|
+
return __props.collectionType === "document" ? (openBlock(), createBlock(unref(DocumentSettings_default), {
|
|
1861
|
+
key: 0,
|
|
1862
|
+
documentUrl: __props.document?.["x-scalar-original-source-url"],
|
|
1863
|
+
isDraftDocument: __props.documentSlug === "drafts",
|
|
1864
|
+
title: __props.document?.info.title ?? "",
|
|
1865
|
+
watchMode: __props.document?.["x-scalar-watch-mode"],
|
|
1866
|
+
"onDelete:document": _cache[0] || (_cache[0] = ($event) => __props.eventBus.emit("document:delete:document", { name: __props.documentSlug })),
|
|
1867
|
+
"onUpdate:watchMode": handleUpdateWatchMode
|
|
1868
|
+
}, null, 8, [
|
|
1869
|
+
"documentUrl",
|
|
1870
|
+
"isDraftDocument",
|
|
1871
|
+
"title",
|
|
1872
|
+
"watchMode"
|
|
1873
|
+
])) : (openBlock(), createBlock(unref(CollectionSettings_default), {
|
|
1874
|
+
key: 1,
|
|
1875
|
+
activeProxyUrl: unref(getActiveProxyUrl)(__props.workspaceStore.workspace["x-scalar-active-proxy"], __props.layout),
|
|
1876
|
+
activeThemeSlug: __props.workspaceStore.workspace["x-scalar-theme"] ?? "none",
|
|
1877
|
+
colorMode: __props.workspaceStore.workspace["x-scalar-color-mode"] ?? "system",
|
|
1878
|
+
customThemes: __props.customThemes,
|
|
1879
|
+
"onUpdate:colorMode": handleUpdateColorMode,
|
|
1880
|
+
"onUpdate:proxyUrl": handleUpdateActiveProxy,
|
|
1881
|
+
"onUpdate:themeSlug": handleUpdateThemeSlug
|
|
1882
|
+
}, null, 8, [
|
|
1883
|
+
"activeProxyUrl",
|
|
1884
|
+
"activeThemeSlug",
|
|
1885
|
+
"colorMode",
|
|
1886
|
+
"customThemes"
|
|
1887
|
+
]));
|
|
1888
|
+
};
|
|
1889
|
+
}
|
|
1890
|
+
});
|
|
1891
|
+
//#endregion
|
|
1892
|
+
//#region src/v2/components/callout/Callout.vue?vue&type=script&setup=true&lang.ts
|
|
1893
|
+
var _hoisted_1$6 = { class: "flex w-full flex-col gap-2" };
|
|
1894
|
+
var _hoisted_2$6 = { class: "flex items-start gap-2" };
|
|
1895
|
+
var _hoisted_3$5 = {
|
|
1896
|
+
class: "callout-content__icon",
|
|
1897
|
+
"data-scalar-name": "callout-icon"
|
|
1898
|
+
};
|
|
1899
|
+
var _hoisted_4$4 = { class: "callout-content__text" };
|
|
1900
|
+
var _hoisted_5$4 = {
|
|
1901
|
+
key: 0,
|
|
1902
|
+
class: "flex justify-end gap-2"
|
|
1903
|
+
};
|
|
1904
|
+
//#endregion
|
|
1905
|
+
//#region src/v2/components/callout/Callout.vue
|
|
1906
|
+
var Callout_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1907
|
+
__name: "Callout",
|
|
1908
|
+
props: { type: {} },
|
|
1909
|
+
setup(__props) {
|
|
1910
|
+
const slots = useSlots();
|
|
1911
|
+
const iconsMapping = {
|
|
1912
|
+
info: ScalarIconInfo,
|
|
1913
|
+
success: ScalarIconCheckCircle,
|
|
1914
|
+
warning: ScalarIconWarning,
|
|
1915
|
+
danger: ScalarIconWarningCircle,
|
|
1916
|
+
neutral: ScalarIconInfo
|
|
1917
|
+
};
|
|
1918
|
+
return (_ctx, _cache) => {
|
|
1919
|
+
return openBlock(), createElementBlock("div", { class: normalizeClass(`callout t-editor__callout callout__${__props.type}`) }, [createElementVNode("div", _hoisted_1$6, [createElementVNode("div", _hoisted_2$6, [createElementVNode("div", _hoisted_3$5, [(openBlock(), createBlock(resolveDynamicComponent(iconsMapping[__props.type]), { class: "size-5 shrink-0" }))]), createElementVNode("div", _hoisted_4$4, [createVNode(slots.default)])]), slots.actions ? (openBlock(), createElementBlock("div", _hoisted_5$4, [createVNode(slots.actions)])) : createCommentVNode("", true)])], 2);
|
|
1920
|
+
};
|
|
1921
|
+
}
|
|
1922
|
+
}), [["__scopeId", "data-v-fa58cbab"]]);
|
|
1923
|
+
//#endregion
|
|
1924
|
+
//#region src/v2/features/collection/components/LabelInput.vue?vue&type=script&setup=true&lang.ts
|
|
1925
|
+
var _hoisted_1$5 = { class: "group pointer-events-none flex flex-1 items-center gap-1" };
|
|
1926
|
+
var _hoisted_2$5 = ["for"];
|
|
1927
|
+
var _hoisted_3$4 = ["id", "placeholder"];
|
|
1928
|
+
//#endregion
|
|
1929
|
+
//#region src/v2/features/collection/components/LabelInput.vue
|
|
1930
|
+
var LabelInput_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1931
|
+
__name: "LabelInput",
|
|
1932
|
+
props: /* @__PURE__ */ mergeModels({ placeholder: {} }, {
|
|
1933
|
+
"modelValue": { required: true },
|
|
1934
|
+
"modelModifiers": {}
|
|
1935
|
+
}),
|
|
1936
|
+
emits: /* @__PURE__ */ mergeModels(["blur"], ["update:modelValue"]),
|
|
1937
|
+
setup(__props, { emit: __emit }) {
|
|
1938
|
+
const emit = __emit;
|
|
1939
|
+
const model = useModel(__props, "modelValue");
|
|
1940
|
+
const id = useId();
|
|
1941
|
+
const handleBlur = () => {
|
|
1942
|
+
emit("blur", model.value);
|
|
1943
|
+
};
|
|
1944
|
+
return (_ctx, _cache) => {
|
|
1945
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [createElementVNode("label", {
|
|
1946
|
+
class: "pointer-events-auto absolute top-0 left-0 h-full w-full cursor-text opacity-0",
|
|
1947
|
+
for: unref(id)
|
|
1948
|
+
}, null, 8, _hoisted_2$5), withDirectives(createElementVNode("input", {
|
|
1949
|
+
id: unref(id),
|
|
1950
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
1951
|
+
class: "text-c-1 group-hover-input pointer-events-auto relative -ml-0.5 h-8 w-full flex-1 rounded pl-1.25 has-[:focus-visible]:outline md:-ml-1.25",
|
|
1952
|
+
placeholder: __props.placeholder ?? "Untitled Document",
|
|
1953
|
+
onBlur: handleBlur,
|
|
1954
|
+
onKeydown: _cache[1] || (_cache[1] = withKeys(($event) => $event.target?.blur(), ["enter"]))
|
|
1955
|
+
}, null, 40, _hoisted_3$4), [[vModelText, model.value]])]);
|
|
1956
|
+
};
|
|
1957
|
+
}
|
|
1958
|
+
}), [["__scopeId", "data-v-2f09f15e"]]);
|
|
1959
|
+
//#endregion
|
|
1960
|
+
//#region src/v2/features/editor/hooks/use-three-way-merge-editor.ts
|
|
1961
|
+
/**
|
|
1962
|
+
* Shared state and logic for a 3-way merge editor (base | local | remote → result).
|
|
1963
|
+
* Create editors by calling init() with the three container elements (e.g. from refs in onMounted).
|
|
1964
|
+
* Call dispose() in onUnmounted.
|
|
1965
|
+
*
|
|
1966
|
+
* @example
|
|
1967
|
+
* ```vue
|
|
1968
|
+
* <script setup lang="ts">
|
|
1969
|
+
* const localRef = ref<HTMLDivElement>()
|
|
1970
|
+
* const remoteRef = ref<HTMLDivElement>()
|
|
1971
|
+
* const resultRef = ref<HTMLDivElement>()
|
|
1972
|
+
*
|
|
1973
|
+
* const mergeEditor = useThreeWayMergeEditor({
|
|
1974
|
+
* baseDocument,
|
|
1975
|
+
* resolvedDocument,
|
|
1976
|
+
* conflicts,
|
|
1977
|
+
* onApplyChanges: (doc) => emit('applyChanges', { resolvedDocument: doc }),
|
|
1978
|
+
* onError: (msg) => toast(msg, 'error'),
|
|
1979
|
+
* })
|
|
1980
|
+
*
|
|
1981
|
+
* onMounted(() => {
|
|
1982
|
+
* const local = localRef.value
|
|
1983
|
+
* const remote = remoteRef.value
|
|
1984
|
+
* const result = resultRef.value
|
|
1985
|
+
* if (local && remote && result) {
|
|
1986
|
+
* mergeEditor.init({ local, remote, result })
|
|
1987
|
+
* }
|
|
1988
|
+
* })
|
|
1989
|
+
*
|
|
1990
|
+
* onUnmounted(() => {
|
|
1991
|
+
* mergeEditor.dispose()
|
|
1992
|
+
* })
|
|
1993
|
+
* <\/script>
|
|
1994
|
+
*
|
|
1995
|
+
* <template>
|
|
1996
|
+
* <div ref="localRef" />
|
|
1997
|
+
* <div ref="remoteRef" />
|
|
1998
|
+
* <div ref="resultRef" />
|
|
1999
|
+
* <button @click="mergeEditor.goToNextConflict">Next conflict</button>
|
|
2000
|
+
* <button :disabled="mergeEditor.conflictsLeft > 0" @click="mergeEditor.applyResolvedConflicts">
|
|
2001
|
+
* Apply ({{ mergeEditor.conflictsLeft }} left)
|
|
2002
|
+
* </button>
|
|
2003
|
+
* </template>
|
|
2004
|
+
* ```
|
|
2005
|
+
*/
|
|
2006
|
+
function useThreeWayMergeEditor(options) {
|
|
2007
|
+
const { baseDocument, resolvedDocument, conflicts, onApplyChanges, onError } = options;
|
|
2008
|
+
const resolvedConflicts = ref([]);
|
|
2009
|
+
const conflictRangesState = shallowRef([]);
|
|
2010
|
+
const localConflictRangesState = shallowRef([]);
|
|
2011
|
+
const remoteConflictRangesState = shallowRef([]);
|
|
2012
|
+
const lastNavigatedConflictIndex = ref(-1);
|
|
2013
|
+
const localChangesEditor = shallowRef();
|
|
2014
|
+
const remoteChangesEditor = shallowRef();
|
|
2015
|
+
const resultEditor = shallowRef();
|
|
2016
|
+
let resultCodeLensProviderDisposable;
|
|
2017
|
+
let jsonPointerLinkSupportDispose;
|
|
2018
|
+
const codeLensCommandDisposables = [];
|
|
2019
|
+
/** Models created in init(); disposed in dispose() to avoid leaks when the sync conflict modal closes. */
|
|
2020
|
+
let modelsToDispose = [];
|
|
2021
|
+
const normalizeConflicts = computed(() => {
|
|
2022
|
+
return toValue(conflicts).map((conflict) => {
|
|
2023
|
+
const localChanges = conflict[0];
|
|
2024
|
+
const remoteChanges = conflict[1];
|
|
2025
|
+
let smallestPath = localChanges[0].path;
|
|
2026
|
+
for (const localChange of localChanges) if (localChange.path.length < smallestPath.length) smallestPath = localChange.path;
|
|
2027
|
+
for (const remoteChange of remoteChanges) if (remoteChange.path.length < smallestPath.length) smallestPath = remoteChange.path;
|
|
2028
|
+
return {
|
|
2029
|
+
local: {
|
|
2030
|
+
path: smallestPath,
|
|
2031
|
+
changes: localChanges,
|
|
2032
|
+
type: localChanges[0].type
|
|
2033
|
+
},
|
|
2034
|
+
remote: {
|
|
2035
|
+
path: smallestPath,
|
|
2036
|
+
changes: remoteChanges,
|
|
2037
|
+
type: remoteChanges[0].type
|
|
2038
|
+
}
|
|
2039
|
+
};
|
|
2040
|
+
});
|
|
2041
|
+
});
|
|
2042
|
+
const documentWithLocalChanges = computed(() => apply(deepClone(toValue(resolvedDocument)), toValue(conflicts).flatMap((it) => it[0])));
|
|
2043
|
+
const documentWithRemoteChanges = computed(() => apply(deepClone(toValue(resolvedDocument)), toValue(conflicts).flatMap((it) => it[1])));
|
|
2044
|
+
const conflictsLeft = computed(() => resolvedConflicts.value.filter((status) => status === "idle").length);
|
|
2045
|
+
watch(normalizeConflicts, (nextConflicts) => {
|
|
2046
|
+
resolvedConflicts.value = nextConflicts.map((_, index) => resolvedConflicts.value[index] ?? "idle");
|
|
2047
|
+
}, { immediate: true });
|
|
2048
|
+
const focusEditorRange = (diffEditor, range) => {
|
|
2049
|
+
if (!diffEditor || !range) return;
|
|
2050
|
+
const modifiedEditor = diffEditor.getModifiedEditor();
|
|
2051
|
+
const safeRange = new monaco.Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
|
|
2052
|
+
modifiedEditor.setSelection(safeRange);
|
|
2053
|
+
modifiedEditor.revealRangeNearTop(safeRange);
|
|
2054
|
+
};
|
|
2055
|
+
const goToNextConflict = () => {
|
|
2056
|
+
const unresolvedConflictIndexes = normalizeConflicts.value.map((_, index) => index).filter((index) => resolvedConflicts.value[index] === "idle");
|
|
2057
|
+
if (!unresolvedConflictIndexes.length) return;
|
|
2058
|
+
const nextConflictIndex = unresolvedConflictIndexes.find((index) => index > lastNavigatedConflictIndex.value) ?? unresolvedConflictIndexes[0];
|
|
2059
|
+
if (nextConflictIndex === void 0) return;
|
|
2060
|
+
if (!normalizeConflicts.value[nextConflictIndex]) return;
|
|
2061
|
+
const localRange = localConflictRangesState.value.find((cr) => cr.index === nextConflictIndex)?.range;
|
|
2062
|
+
const remoteRange = remoteConflictRangesState.value.find((cr) => cr.index === nextConflictIndex)?.range;
|
|
2063
|
+
const resultRange = conflictRangesState.value.find((cr) => cr.index === nextConflictIndex)?.range;
|
|
2064
|
+
focusEditorRange(localChangesEditor.value, localRange);
|
|
2065
|
+
focusEditorRange(remoteChangesEditor.value, remoteRange);
|
|
2066
|
+
focusEditorRange(resultEditor.value, resultRange);
|
|
2067
|
+
resultEditor.value?.getModifiedEditor().focus();
|
|
2068
|
+
lastNavigatedConflictIndex.value = nextConflictIndex;
|
|
2069
|
+
};
|
|
2070
|
+
const applyResolvedConflicts = () => {
|
|
2071
|
+
if (conflictsLeft.value > 0) {
|
|
2072
|
+
onError?.("You have conflicts left");
|
|
2073
|
+
return;
|
|
2074
|
+
}
|
|
2075
|
+
const modifiedResultModel = resultEditor.value?.getModel()?.modified;
|
|
2076
|
+
if (!modifiedResultModel) return;
|
|
2077
|
+
let nextResolvedDocument = null;
|
|
2078
|
+
try {
|
|
2079
|
+
nextResolvedDocument = JSON.parse(modifiedResultModel.getValue());
|
|
2080
|
+
} catch {
|
|
2081
|
+
onError?.("You have formatting errors");
|
|
2082
|
+
return;
|
|
2083
|
+
}
|
|
2084
|
+
onApplyChanges(nextResolvedDocument);
|
|
2085
|
+
};
|
|
2086
|
+
const init = (containers) => {
|
|
2087
|
+
const base = toValue(baseDocument);
|
|
2088
|
+
const resolved = toValue(resolvedDocument);
|
|
2089
|
+
const localDoc = documentWithLocalChanges.value;
|
|
2090
|
+
const remoteDoc = documentWithRemoteChanges.value;
|
|
2091
|
+
const originalModelLocal = monaco.editor.createModel(JSON.stringify(resolved, null, 2), "json");
|
|
2092
|
+
const modifiedModelLocal = createJsonModel(JSON.stringify(localDoc, null, 2));
|
|
2093
|
+
const originalModelRemote = monaco.editor.createModel(JSON.stringify(resolved, null, 2), "json");
|
|
2094
|
+
const modifiedModelRemote = createJsonModel(JSON.stringify(remoteDoc, null, 2));
|
|
2095
|
+
const originalResultModel = monaco.editor.createModel(JSON.stringify(base, null, 2), "json");
|
|
2096
|
+
const modifiedResultModel = createJsonModel(JSON.stringify(resolved, null, 2));
|
|
2097
|
+
modelsToDispose = [
|
|
2098
|
+
originalModelLocal,
|
|
2099
|
+
modifiedModelLocal.model,
|
|
2100
|
+
originalModelRemote,
|
|
2101
|
+
modifiedModelRemote.model,
|
|
2102
|
+
originalResultModel,
|
|
2103
|
+
modifiedResultModel.model
|
|
2104
|
+
];
|
|
2105
|
+
const localDiffEditor = monaco.editor.createDiffEditor(containers.local, {
|
|
2106
|
+
originalEditable: false,
|
|
2107
|
+
readOnly: true,
|
|
2108
|
+
automaticLayout: true,
|
|
2109
|
+
renderSideBySide: false
|
|
2110
|
+
});
|
|
2111
|
+
localDiffEditor.setModel({
|
|
2112
|
+
original: originalModelLocal,
|
|
2113
|
+
modified: modifiedModelLocal.model
|
|
2114
|
+
});
|
|
2115
|
+
localChangesEditor.value = localDiffEditor;
|
|
2116
|
+
const remoteDiffEditor = monaco.editor.createDiffEditor(containers.remote, {
|
|
2117
|
+
originalEditable: false,
|
|
2118
|
+
readOnly: true,
|
|
2119
|
+
automaticLayout: true,
|
|
2120
|
+
renderSideBySide: false
|
|
2121
|
+
});
|
|
2122
|
+
remoteDiffEditor.setModel({
|
|
2123
|
+
original: originalModelRemote,
|
|
2124
|
+
modified: modifiedModelRemote.model
|
|
2125
|
+
});
|
|
2126
|
+
remoteChangesEditor.value = remoteDiffEditor;
|
|
2127
|
+
const resultDiffEditor = monaco.editor.createDiffEditor(containers.result, {
|
|
2128
|
+
originalEditable: false,
|
|
2129
|
+
readOnly: false,
|
|
2130
|
+
renderSideBySide: false,
|
|
2131
|
+
automaticLayout: true
|
|
2132
|
+
});
|
|
2133
|
+
resultDiffEditor.setModel({
|
|
2134
|
+
original: originalResultModel,
|
|
2135
|
+
modified: modifiedResultModel.model
|
|
2136
|
+
});
|
|
2137
|
+
const resultModifiedEditor = resultDiffEditor.getModifiedEditor();
|
|
2138
|
+
resultModifiedEditor.updateOptions({ codeLens: true });
|
|
2139
|
+
const focusResultPath = async (path) => {
|
|
2140
|
+
const range = await modifiedResultModel.getRangeFromPath(path);
|
|
2141
|
+
if (!range) return;
|
|
2142
|
+
const safeRange = new monaco.Range(range.startLineNumber, range.startColumn, range.endLineNumber, range.endColumn);
|
|
2143
|
+
resultModifiedEditor.setSelection(safeRange);
|
|
2144
|
+
resultModifiedEditor.revealRangeNearTop(safeRange);
|
|
2145
|
+
};
|
|
2146
|
+
const navigateJsonPointer = async (pointer) => {
|
|
2147
|
+
const path = parseJsonPointerPath(pointer);
|
|
2148
|
+
if (!path) return;
|
|
2149
|
+
await focusResultPath(path);
|
|
2150
|
+
};
|
|
2151
|
+
jsonPointerLinkSupportDispose = ensureJsonPointerLinkSupport(navigateJsonPointer).dispose;
|
|
2152
|
+
let resultHighlightDecorations = [];
|
|
2153
|
+
let suppressedChangeEvents = 0;
|
|
2154
|
+
const applyCurrentCodeLensCommandId = "scalar.conflict.applyCurrent";
|
|
2155
|
+
const applyRemoteCodeLensCommandId = "scalar.conflict.applyRemote";
|
|
2156
|
+
const ignoreCodeLensCommandId = "scalar.conflict.ignore";
|
|
2157
|
+
const noOpCodeLensCommandId = resultModifiedEditor.addCommand(0, () => void 0) ?? "scalar.conflict.status.noop";
|
|
2158
|
+
const getBoxDecorationsForRange = (range) => {
|
|
2159
|
+
const startLine = range.startLineNumber;
|
|
2160
|
+
const endLine = range.endLineNumber;
|
|
2161
|
+
if (startLine === endLine) return [{
|
|
2162
|
+
range,
|
|
2163
|
+
options: {
|
|
2164
|
+
isWholeLine: true,
|
|
2165
|
+
className: "json-focus-highlight-box-single"
|
|
2166
|
+
}
|
|
2167
|
+
}];
|
|
2168
|
+
const topRange = new monaco.Range(startLine, 1, startLine, range.endColumn);
|
|
2169
|
+
const middleRange = new monaco.Range(startLine + 1, 1, Math.max(startLine + 1, endLine - 1), 1);
|
|
2170
|
+
const bottomRange = new monaco.Range(endLine, 1, endLine, range.endColumn);
|
|
2171
|
+
const decorations = [{
|
|
2172
|
+
range: topRange,
|
|
2173
|
+
options: {
|
|
2174
|
+
isWholeLine: true,
|
|
2175
|
+
className: "json-focus-highlight-box-top"
|
|
2176
|
+
}
|
|
2177
|
+
}, {
|
|
2178
|
+
range: bottomRange,
|
|
2179
|
+
options: {
|
|
2180
|
+
isWholeLine: true,
|
|
2181
|
+
className: "json-focus-highlight-box-bottom"
|
|
2182
|
+
}
|
|
2183
|
+
}];
|
|
2184
|
+
if (endLine - startLine > 1) decorations.push({
|
|
2185
|
+
range: middleRange,
|
|
2186
|
+
options: {
|
|
2187
|
+
isWholeLine: true,
|
|
2188
|
+
className: "json-focus-highlight-box-middle"
|
|
2189
|
+
}
|
|
2190
|
+
});
|
|
2191
|
+
return decorations;
|
|
2192
|
+
};
|
|
2193
|
+
const refreshCodeLensProvider = () => {
|
|
2194
|
+
resultCodeLensProviderDisposable?.dispose();
|
|
2195
|
+
resultCodeLensProviderDisposable = monaco.languages.registerCodeLensProvider("json", { provideCodeLenses: (model) => {
|
|
2196
|
+
if (model.uri.toString() !== modifiedResultModel.model.uri.toString()) return {
|
|
2197
|
+
lenses: [],
|
|
2198
|
+
dispose: () => void 0
|
|
2199
|
+
};
|
|
2200
|
+
return {
|
|
2201
|
+
lenses: conflictRangesState.value.flatMap((conflictRange) => {
|
|
2202
|
+
const lensRange = new monaco.Range(conflictRange.range.startLineNumber, 1, conflictRange.range.startLineNumber, 1);
|
|
2203
|
+
return [
|
|
2204
|
+
{
|
|
2205
|
+
range: lensRange,
|
|
2206
|
+
command: {
|
|
2207
|
+
id: noOpCodeLensCommandId,
|
|
2208
|
+
title: `Status: ${resolvedConflicts.value[conflictRange.index] ?? "idle"}`
|
|
2209
|
+
}
|
|
2210
|
+
},
|
|
2211
|
+
{
|
|
2212
|
+
range: lensRange,
|
|
2213
|
+
command: {
|
|
2214
|
+
id: applyCurrentCodeLensCommandId,
|
|
2215
|
+
title: "Accept Current",
|
|
2216
|
+
arguments: [conflictRange.index]
|
|
2217
|
+
}
|
|
2218
|
+
},
|
|
2219
|
+
{
|
|
2220
|
+
range: lensRange,
|
|
2221
|
+
command: {
|
|
2222
|
+
id: applyRemoteCodeLensCommandId,
|
|
2223
|
+
title: "Accept Remote",
|
|
2224
|
+
arguments: [conflictRange.index]
|
|
2225
|
+
}
|
|
2226
|
+
},
|
|
2227
|
+
{
|
|
2228
|
+
range: lensRange,
|
|
2229
|
+
command: {
|
|
2230
|
+
id: ignoreCodeLensCommandId,
|
|
2231
|
+
title: "Ignore",
|
|
2232
|
+
arguments: [conflictRange.index]
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2235
|
+
];
|
|
2236
|
+
}),
|
|
2237
|
+
dispose: () => void 0
|
|
2238
|
+
};
|
|
2239
|
+
} });
|
|
2240
|
+
};
|
|
2241
|
+
const getConflictRange = async (editorModel, index, path) => {
|
|
2242
|
+
const { model } = editorModel;
|
|
2243
|
+
const fallbackRange = new monaco.Range(1, 1, 1, model.getLineMaxColumn(1));
|
|
2244
|
+
let range = null;
|
|
2245
|
+
for (let depth = path.length; depth >= 0; depth -= 1) {
|
|
2246
|
+
const candidatePath = path.slice(0, depth);
|
|
2247
|
+
const nodeRange = await editorModel.getRangeFromPath(candidatePath);
|
|
2248
|
+
if (!nodeRange) continue;
|
|
2249
|
+
range = rangeToWholeLine(model, nodeRange);
|
|
2250
|
+
break;
|
|
2251
|
+
}
|
|
2252
|
+
return {
|
|
2253
|
+
index,
|
|
2254
|
+
path,
|
|
2255
|
+
range: markRaw(range ?? fallbackRange)
|
|
2256
|
+
};
|
|
2257
|
+
};
|
|
2258
|
+
const refreshConflictRangesAndDecorations = async () => {
|
|
2259
|
+
const [resultRanges, localRanges, remoteRanges] = await Promise.all([
|
|
2260
|
+
Promise.all(normalizeConflicts.value.map((conflict, index) => getConflictRange(modifiedResultModel, index, conflict.local.path))),
|
|
2261
|
+
Promise.all(normalizeConflicts.value.map((conflict, index) => getConflictRange(modifiedModelLocal, index, conflict.local.path))),
|
|
2262
|
+
Promise.all(normalizeConflicts.value.map((conflict, index) => getConflictRange(modifiedModelRemote, index, conflict.local.path)))
|
|
2263
|
+
]);
|
|
2264
|
+
conflictRangesState.value = resultRanges.filter((r) => Boolean(r));
|
|
2265
|
+
localConflictRangesState.value = localRanges.filter((r) => Boolean(r));
|
|
2266
|
+
remoteConflictRangesState.value = remoteRanges.filter((r) => Boolean(r));
|
|
2267
|
+
resultHighlightDecorations = resultModifiedEditor.deltaDecorations(resultHighlightDecorations, conflictRangesState.value.flatMap((cr) => getBoxDecorationsForRange(cr.range)));
|
|
2268
|
+
refreshCodeLensProvider();
|
|
2269
|
+
};
|
|
2270
|
+
const setConflictResolution = (index, resolution) => {
|
|
2271
|
+
resolvedConflicts.value[index] = resolution;
|
|
2272
|
+
refreshCodeLensProvider();
|
|
2273
|
+
};
|
|
2274
|
+
const applyConflictChoice = async (index, source) => {
|
|
2275
|
+
const conflict = normalizeConflicts.value[index];
|
|
2276
|
+
if (!conflict) return;
|
|
2277
|
+
let currentDocument = null;
|
|
2278
|
+
try {
|
|
2279
|
+
currentDocument = JSON.parse(modifiedResultModel.model.getValue());
|
|
2280
|
+
} catch {
|
|
2281
|
+
return;
|
|
2282
|
+
}
|
|
2283
|
+
const changes = source === "local" ? conflict.local.changes : conflict.remote.changes;
|
|
2284
|
+
const nextDocument = apply(deepClone(currentDocument), changes);
|
|
2285
|
+
suppressedChangeEvents += 1;
|
|
2286
|
+
modifiedResultModel.model.setValue(JSON.stringify(nextDocument, null, 2));
|
|
2287
|
+
setConflictResolution(index, source);
|
|
2288
|
+
await refreshConflictRangesAndDecorations();
|
|
2289
|
+
};
|
|
2290
|
+
codeLensCommandDisposables.push(monaco.editor.registerCommand(applyCurrentCodeLensCommandId, (_accessor, index) => {
|
|
2291
|
+
applyConflictChoice(index, "local");
|
|
2292
|
+
}));
|
|
2293
|
+
codeLensCommandDisposables.push(monaco.editor.registerCommand(applyRemoteCodeLensCommandId, (_accessor, index) => {
|
|
2294
|
+
applyConflictChoice(index, "remote");
|
|
2295
|
+
}));
|
|
2296
|
+
codeLensCommandDisposables.push(monaco.editor.registerCommand(ignoreCodeLensCommandId, (_accessor, index) => {
|
|
2297
|
+
setConflictResolution(index, "ignore");
|
|
2298
|
+
}));
|
|
2299
|
+
refreshConflictRangesAndDecorations();
|
|
2300
|
+
resultModifiedEditor.onDidChangeModelContent((event) => {
|
|
2301
|
+
if (suppressedChangeEvents > 0) {
|
|
2302
|
+
suppressedChangeEvents -= 1;
|
|
2303
|
+
return;
|
|
2304
|
+
}
|
|
2305
|
+
let hasStatusUpdates = false;
|
|
2306
|
+
for (const change of event.changes) {
|
|
2307
|
+
const matchingConflicts = conflictRangesState.value.filter((cr) => monaco.Range.areIntersectingOrTouching(change.range, cr.range));
|
|
2308
|
+
if (!matchingConflicts.length) continue;
|
|
2309
|
+
matchingConflicts.forEach((conflict) => {
|
|
2310
|
+
if (resolvedConflicts.value[conflict.index] !== "manual") {
|
|
2311
|
+
resolvedConflicts.value[conflict.index] = "manual";
|
|
2312
|
+
hasStatusUpdates = true;
|
|
2313
|
+
}
|
|
2314
|
+
});
|
|
2315
|
+
}
|
|
2316
|
+
if (hasStatusUpdates) refreshCodeLensProvider();
|
|
2317
|
+
});
|
|
2318
|
+
resultEditor.value = resultDiffEditor;
|
|
2319
|
+
};
|
|
2320
|
+
const dispose = () => {
|
|
2321
|
+
localChangesEditor.value?.dispose();
|
|
2322
|
+
localChangesEditor.value = void 0;
|
|
2323
|
+
remoteChangesEditor.value?.dispose();
|
|
2324
|
+
remoteChangesEditor.value = void 0;
|
|
2325
|
+
resultEditor.value?.dispose();
|
|
2326
|
+
resultEditor.value = void 0;
|
|
2327
|
+
for (const model of modelsToDispose) model.dispose();
|
|
2328
|
+
modelsToDispose = [];
|
|
2329
|
+
resultCodeLensProviderDisposable?.dispose();
|
|
2330
|
+
resultCodeLensProviderDisposable = void 0;
|
|
2331
|
+
jsonPointerLinkSupportDispose?.();
|
|
2332
|
+
jsonPointerLinkSupportDispose = void 0;
|
|
2333
|
+
codeLensCommandDisposables.forEach((d) => d.dispose());
|
|
2334
|
+
codeLensCommandDisposables.length = 0;
|
|
2335
|
+
};
|
|
2336
|
+
return {
|
|
2337
|
+
init,
|
|
2338
|
+
dispose,
|
|
2339
|
+
conflictsLeft,
|
|
2340
|
+
goToNextConflict,
|
|
2341
|
+
applyResolvedConflicts
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
//#endregion
|
|
2345
|
+
//#region src/v2/features/collection/components/SyncConflictResolutionEditor.vue?vue&type=script&setup=true&lang.ts
|
|
2346
|
+
var _hoisted_1$4 = { class: "sync-editor-pane border-c-3 mx-1 mb-1 flex min-h-0 flex-1 flex-col overflow-hidden rounded-lg border" };
|
|
2347
|
+
var _hoisted_2$4 = { class: "sync-pane-title text-c-2 border-c-3 flex shrink-0 items-center justify-between border-b px-2 py-1 text-[11px]" };
|
|
2348
|
+
var _hoisted_3$3 = { class: "flex items-center gap-2" };
|
|
2349
|
+
var _hoisted_4$3 = { class: "text-c-2 text-[11px] normal-case" };
|
|
2350
|
+
var _hoisted_5$3 = { class: "flex shrink-0 items-center justify-end gap-2" };
|
|
2351
|
+
//#endregion
|
|
2352
|
+
//#region src/v2/features/collection/components/SyncConflictResolutionEditor.vue
|
|
2353
|
+
var SyncConflictResolutionEditor_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2354
|
+
__name: "SyncConflictResolutionEditor",
|
|
2355
|
+
props: {
|
|
2356
|
+
conflicts: {},
|
|
2357
|
+
baseDocument: {},
|
|
2358
|
+
resolvedDocument: {}
|
|
2359
|
+
},
|
|
2360
|
+
emits: ["applyChanges"],
|
|
2361
|
+
setup(__props, { emit: __emit }) {
|
|
2362
|
+
const emit = __emit;
|
|
2363
|
+
const { toast } = useToasts();
|
|
2364
|
+
const splitContainerRef = ref();
|
|
2365
|
+
const topEditorsRowRef = ref();
|
|
2366
|
+
const topPaneSize = ref(50);
|
|
2367
|
+
const leftPaneSize = ref(50);
|
|
2368
|
+
const { onHorizontalResizeStart, onVerticalResizeStart, stopActiveResize } = useSplitResize({
|
|
2369
|
+
horizontalContainerRef: topEditorsRowRef,
|
|
2370
|
+
verticalContainerRef: splitContainerRef,
|
|
2371
|
+
leftPaneSize,
|
|
2372
|
+
topPaneSize,
|
|
2373
|
+
horizontalMin: 20,
|
|
2374
|
+
horizontalMax: 80,
|
|
2375
|
+
verticalMin: 25,
|
|
2376
|
+
verticalMax: 75
|
|
2377
|
+
});
|
|
2378
|
+
const mergeEditor = useThreeWayMergeEditor({
|
|
2379
|
+
baseDocument: __props.baseDocument,
|
|
2380
|
+
resolvedDocument: __props.resolvedDocument,
|
|
2381
|
+
conflicts: __props.conflicts,
|
|
2382
|
+
onApplyChanges: (resolvedDoc) => emit("applyChanges", { resolvedDocument: resolvedDoc }),
|
|
2383
|
+
onError: (message) => toast(message, "error")
|
|
2384
|
+
});
|
|
2385
|
+
const conflictsLeft = computed(() => mergeEditor.conflictsLeft.value);
|
|
2386
|
+
const topPaneStyle = computed(() => ({ height: `${topPaneSize.value}%` }));
|
|
2387
|
+
const leftPaneStyle = computed(() => ({ width: `${leftPaneSize.value}%` }));
|
|
2388
|
+
const rightPaneStyle = computed(() => ({ width: `${100 - leftPaneSize.value}%` }));
|
|
2389
|
+
const localChangesEditorRef = ref();
|
|
2390
|
+
const remoteChangesEditorRef = ref();
|
|
2391
|
+
const resultEditorRef = ref();
|
|
2392
|
+
onMounted(() => {
|
|
2393
|
+
const localEl = localChangesEditorRef.value;
|
|
2394
|
+
const remoteEl = remoteChangesEditorRef.value;
|
|
2395
|
+
const resultEl = resultEditorRef.value;
|
|
2396
|
+
if (localEl && remoteEl && resultEl) mergeEditor.init({
|
|
2397
|
+
local: localEl,
|
|
2398
|
+
remote: remoteEl,
|
|
2399
|
+
result: resultEl
|
|
2400
|
+
});
|
|
2401
|
+
});
|
|
2402
|
+
onUnmounted(() => {
|
|
2403
|
+
stopActiveResize();
|
|
2404
|
+
mergeEditor.dispose();
|
|
2405
|
+
});
|
|
2406
|
+
return (_ctx, _cache) => {
|
|
2407
|
+
return openBlock(), createElementBlock(Fragment, null, [_cache[7] || (_cache[7] = createElementVNode("p", { class: "text-c-2 text-xs" }, " Resolve conflicts inline in the full document editor. Use the buttons inside the editor for each conflict. ", -1)), createElementVNode("div", {
|
|
2408
|
+
ref_key: "splitContainerRef",
|
|
2409
|
+
ref: splitContainerRef,
|
|
2410
|
+
class: "flex min-h-0 flex-1 flex-col overflow-hidden"
|
|
2411
|
+
}, [
|
|
2412
|
+
createElementVNode("div", {
|
|
2413
|
+
ref_key: "topEditorsRowRef",
|
|
2414
|
+
ref: topEditorsRowRef,
|
|
2415
|
+
class: "flex min-h-0 gap-1 p-1",
|
|
2416
|
+
style: normalizeStyle(topPaneStyle.value)
|
|
2417
|
+
}, [
|
|
2418
|
+
createElementVNode("div", {
|
|
2419
|
+
class: "sync-editor-pane border-c-3 flex min-h-0 flex-col overflow-hidden rounded-lg border",
|
|
2420
|
+
style: normalizeStyle(leftPaneStyle.value)
|
|
2421
|
+
}, [_cache[2] || (_cache[2] = createElementVNode("div", { class: "sync-pane-title text-c-2 border-c-3 shrink-0 border-b px-2 py-1 text-[11px]" }, " Current ", -1)), createElementVNode("div", {
|
|
2422
|
+
ref_key: "localChangesEditorRef",
|
|
2423
|
+
ref: localChangesEditorRef,
|
|
2424
|
+
class: "min-h-0 flex-1"
|
|
2425
|
+
}, null, 512)], 4),
|
|
2426
|
+
createElementVNode("button", {
|
|
2427
|
+
"aria-label": "Resize current and remote editors",
|
|
2428
|
+
class: "resize-handle resize-handle-col",
|
|
2429
|
+
type: "button",
|
|
2430
|
+
onPointerdown: _cache[0] || (_cache[0] = (...args) => unref(onHorizontalResizeStart) && unref(onHorizontalResizeStart)(...args))
|
|
2431
|
+
}, null, 32),
|
|
2432
|
+
createElementVNode("div", {
|
|
2433
|
+
class: "sync-editor-pane border-c-3 flex min-h-0 flex-col overflow-hidden rounded-lg border",
|
|
2434
|
+
style: normalizeStyle(rightPaneStyle.value)
|
|
2435
|
+
}, [_cache[3] || (_cache[3] = createElementVNode("div", { class: "sync-pane-title text-c-2 border-c-3 shrink-0 border-b px-2 py-1 text-[11px]" }, " Remote ", -1)), createElementVNode("div", {
|
|
2436
|
+
ref_key: "remoteChangesEditorRef",
|
|
2437
|
+
ref: remoteChangesEditorRef,
|
|
2438
|
+
class: "min-h-0 flex-1"
|
|
2439
|
+
}, null, 512)], 4)
|
|
2440
|
+
], 4),
|
|
2441
|
+
createElementVNode("button", {
|
|
2442
|
+
"aria-label": "Resize top and result editors",
|
|
2443
|
+
class: "resize-handle resize-handle-row",
|
|
2444
|
+
type: "button",
|
|
2445
|
+
onPointerdown: _cache[1] || (_cache[1] = (...args) => unref(onVerticalResizeStart) && unref(onVerticalResizeStart)(...args))
|
|
2446
|
+
}, null, 32),
|
|
2447
|
+
createElementVNode("div", _hoisted_1$4, [createElementVNode("div", _hoisted_2$4, [_cache[5] || (_cache[5] = createElementVNode("span", null, " Result ", -1)), createElementVNode("div", _hoisted_3$3, [createElementVNode("span", _hoisted_4$3, toDisplayString(conflictsLeft.value) + " conflict" + toDisplayString(conflictsLeft.value === 1 ? "" : "s") + " left ", 1), createVNode(unref(ScalarButton), {
|
|
2448
|
+
disabled: conflictsLeft.value === 0,
|
|
2449
|
+
size: "xs",
|
|
2450
|
+
type: "button",
|
|
2451
|
+
variant: "outlined",
|
|
2452
|
+
onClick: unref(mergeEditor).goToNextConflict
|
|
2453
|
+
}, {
|
|
2454
|
+
default: withCtx(() => [..._cache[4] || (_cache[4] = [createTextVNode(" Next Conflict ", -1)])]),
|
|
2455
|
+
_: 1
|
|
2456
|
+
}, 8, ["disabled", "onClick"])])]), createElementVNode("div", {
|
|
2457
|
+
ref_key: "resultEditorRef",
|
|
2458
|
+
ref: resultEditorRef,
|
|
2459
|
+
class: "min-h-0 flex-1"
|
|
2460
|
+
}, null, 512)]),
|
|
2461
|
+
createElementVNode("div", _hoisted_5$3, [createVNode(unref(ScalarButton), {
|
|
2462
|
+
disabled: conflictsLeft.value > 0,
|
|
2463
|
+
size: "xs",
|
|
2464
|
+
type: "button",
|
|
2465
|
+
onClick: unref(mergeEditor).applyResolvedConflicts
|
|
2466
|
+
}, {
|
|
2467
|
+
default: withCtx(() => [..._cache[6] || (_cache[6] = [createTextVNode(" Apply changes ", -1)])]),
|
|
2468
|
+
_: 1
|
|
2469
|
+
}, 8, ["disabled", "onClick"])])
|
|
2470
|
+
], 512)], 64);
|
|
2471
|
+
};
|
|
2472
|
+
}
|
|
2473
|
+
}), [["__scopeId", "data-v-a388e6a4"]]);
|
|
2474
|
+
//#endregion
|
|
2475
|
+
//#region src/v2/features/collection/components/Tabs.vue?vue&type=script&setup=true&lang.ts
|
|
2476
|
+
var _hoisted_1$3 = { class: "flex w-full gap-2 border-b pl-1.5 md:ml-1.5 md:pl-0" };
|
|
2477
|
+
var _hoisted_2$3 = ["href", "onClick"];
|
|
2478
|
+
//#endregion
|
|
2479
|
+
//#region src/v2/features/collection/components/Tabs.vue
|
|
2480
|
+
var Tabs_default = /* @__PURE__ */ defineComponent({
|
|
2481
|
+
__name: "Tabs",
|
|
2482
|
+
props: { type: {} },
|
|
2483
|
+
setup(__props) {
|
|
2484
|
+
/** Different routes for workspace vs document */
|
|
2485
|
+
const routes = computed(() => {
|
|
2486
|
+
if (__props.type === "workspace") return [
|
|
2487
|
+
"environment",
|
|
2488
|
+
"cookies",
|
|
2489
|
+
"settings"
|
|
2490
|
+
];
|
|
2491
|
+
if (__props.type === "operation") return [
|
|
2492
|
+
"overview",
|
|
2493
|
+
"servers",
|
|
2494
|
+
"authentication",
|
|
2495
|
+
"editor"
|
|
2496
|
+
];
|
|
2497
|
+
return [
|
|
2498
|
+
"overview",
|
|
2499
|
+
"servers",
|
|
2500
|
+
"authentication",
|
|
2501
|
+
"environment",
|
|
2502
|
+
"cookies",
|
|
2503
|
+
"settings"
|
|
2504
|
+
];
|
|
2505
|
+
});
|
|
2506
|
+
return (_ctx, _cache) => {
|
|
2507
|
+
return openBlock(), createElementBlock("div", _hoisted_1$3, [(openBlock(true), createElementBlock(Fragment, null, renderList(routes.value, (route) => {
|
|
2508
|
+
return openBlock(), createBlock(unref(RouterLink), {
|
|
2509
|
+
key: route,
|
|
2510
|
+
custom: "",
|
|
2511
|
+
to: { name: `${__props.type}.${route}` }
|
|
2512
|
+
}, {
|
|
2513
|
+
default: withCtx(({ isActive, href, navigate }) => [createElementVNode("a", {
|
|
2514
|
+
class: "-ml-2 flex h-10 cursor-pointer items-center px-2 text-center text-sm font-medium whitespace-nowrap no-underline -outline-offset-1 has-[:focus-visible]:outline",
|
|
2515
|
+
href,
|
|
2516
|
+
onClick: navigate
|
|
2517
|
+
}, [createElementVNode("span", { class: normalizeClass(["flex-center hover:text-c-1 h-full border-b", isActive ? "text-c-1 border-c-1" : "text-c-2 hover:text-c-1 border-transparent"]) }, toDisplayString(capitalize(route)), 3)], 8, _hoisted_2$3)]),
|
|
2518
|
+
_: 2
|
|
2519
|
+
}, 1032, ["to"]);
|
|
2520
|
+
}), 128))]);
|
|
2521
|
+
};
|
|
2522
|
+
}
|
|
2523
|
+
});
|
|
2524
|
+
//#endregion
|
|
2525
|
+
//#region src/v2/features/collection/DocumentCollection.vue?vue&type=script&setup=true&lang.ts
|
|
2526
|
+
var _hoisted_1$2 = { class: "custom-scroll h-full" };
|
|
2527
|
+
var _hoisted_2$2 = {
|
|
2528
|
+
key: 0,
|
|
2529
|
+
class: "w-full px-3 md:mx-auto md:max-w-180"
|
|
2530
|
+
};
|
|
2531
|
+
var _hoisted_3$2 = ["aria-label"];
|
|
2532
|
+
var _hoisted_4$2 = { class: "flex flex-row items-center justify-between gap-2" };
|
|
2533
|
+
var _hoisted_5$2 = { class: "flex min-w-0 items-center gap-2" };
|
|
2534
|
+
var _hoisted_6$1 = { class: "group relative ml-1.25 min-w-0" };
|
|
2535
|
+
var _hoisted_7 = { class: "px-1.5 py-8" };
|
|
2536
|
+
var _hoisted_8 = {
|
|
2537
|
+
key: 1,
|
|
2538
|
+
class: "flex w-full flex-1 items-center justify-center"
|
|
2539
|
+
};
|
|
2540
|
+
var _hoisted_9 = { class: "flex flex-col gap-5" };
|
|
2541
|
+
var _hoisted_10 = { class: "flex gap-3" };
|
|
2542
|
+
var _hoisted_11 = {
|
|
2543
|
+
"aria-hidden": "true",
|
|
2544
|
+
class: "bg-b-3 text-c-2 flex size-10 shrink-0 items-center justify-center rounded-lg"
|
|
2545
|
+
};
|
|
2546
|
+
var _hoisted_12 = { class: "flex flex-wrap items-center justify-end gap-2 border-t border-[var(--scalar-border-color)] pt-4" };
|
|
2547
|
+
var _hoisted_13 = { class: "flex h-full w-full flex-col gap-4 overflow-hidden" };
|
|
2548
|
+
//#endregion
|
|
2549
|
+
//#region src/v2/features/collection/DocumentCollection.vue
|
|
2550
|
+
var DocumentCollection_default = /* @__PURE__ */ defineComponent({
|
|
2551
|
+
name: "DocumentCollection",
|
|
2552
|
+
props: {
|
|
2553
|
+
documentSlug: {},
|
|
2554
|
+
document: {},
|
|
2555
|
+
eventBus: {},
|
|
2556
|
+
layout: {},
|
|
2557
|
+
path: {},
|
|
2558
|
+
method: {},
|
|
2559
|
+
exampleName: {},
|
|
2560
|
+
environment: {},
|
|
2561
|
+
securitySchemes: {},
|
|
2562
|
+
workspaceStore: {},
|
|
2563
|
+
activeWorkspace: {},
|
|
2564
|
+
plugins: {},
|
|
2565
|
+
customThemes: {},
|
|
2566
|
+
currentTheme: {},
|
|
2567
|
+
isDarkMode: { type: Boolean },
|
|
2568
|
+
fetchRegistryDocument: { type: Function }
|
|
2569
|
+
},
|
|
2570
|
+
setup(__props) {
|
|
2571
|
+
const props = __props;
|
|
2572
|
+
/** Snag the title from the info object */
|
|
2573
|
+
const title = computed(() => props.document?.info?.title ?? "");
|
|
2574
|
+
/** Default to the folder icon */
|
|
2575
|
+
const icon = computed(() => props.document?.["x-scalar-icon"] || "interface-content-folder");
|
|
2576
|
+
const syncModal = useModal();
|
|
2577
|
+
const dirtyBeforeSyncModal = useModal();
|
|
2578
|
+
const isDocumentDirty = computed(() => props.document?.["x-scalar-is-dirty"] === true);
|
|
2579
|
+
const documentSourceUrl = computed(() => props.document?.["x-scalar-original-source-url"]);
|
|
2580
|
+
const documentRegistryMeta = computed(() => props.document?.["x-scalar-registry-meta"]);
|
|
2581
|
+
/** Show Sync when the document has a source URL or registry meta (registry can be used if fetchRegistryDocument is set). */
|
|
2582
|
+
const canShowSyncButton = computed(() => documentSourceUrl.value !== void 0 || documentRegistryMeta.value !== void 0);
|
|
2583
|
+
const { toast } = useToasts();
|
|
2584
|
+
const undoChanges = () => {
|
|
2585
|
+
props.workspaceStore.revertDocumentChanges(props.documentSlug);
|
|
2586
|
+
};
|
|
2587
|
+
const saveChanges = () => {
|
|
2588
|
+
props.workspaceStore.saveDocument(props.documentSlug);
|
|
2589
|
+
};
|
|
2590
|
+
const handleSaveThenCloseDirtyModal = async () => {
|
|
2591
|
+
await props.workspaceStore.saveDocument(props.documentSlug);
|
|
2592
|
+
dirtyBeforeSyncModal.hide();
|
|
2593
|
+
await handleSyncFlow();
|
|
2594
|
+
};
|
|
2595
|
+
const handleDiscardThenCloseDirtyModal = async () => {
|
|
2596
|
+
await props.workspaceStore.revertDocumentChanges(props.documentSlug);
|
|
2597
|
+
dirtyBeforeSyncModal.hide();
|
|
2598
|
+
await handleSyncFlow();
|
|
2599
|
+
};
|
|
2600
|
+
const isSyncInProgress = ref(false);
|
|
2601
|
+
const rebaseResult = ref(null);
|
|
2602
|
+
/**
|
|
2603
|
+
* Resolves the source for syncing. Registry meta has priority over x-scalar-original-source-url
|
|
2604
|
+
* when fetchRegistryDocument is provided. Returns either a URL or the full document object.
|
|
2605
|
+
*/
|
|
2606
|
+
const resolveSyncInput = async () => {
|
|
2607
|
+
const registryMeta = documentRegistryMeta.value;
|
|
2608
|
+
if (registryMeta && props.fetchRegistryDocument) try {
|
|
2609
|
+
const result = await props.fetchRegistryDocument(registryMeta);
|
|
2610
|
+
if (!result.ok) {
|
|
2611
|
+
toast(result.error, "error");
|
|
2612
|
+
return null;
|
|
2613
|
+
}
|
|
2614
|
+
return { document: result.data };
|
|
2615
|
+
} catch (err) {
|
|
2616
|
+
toast("Failed to resolve document from registry", "error");
|
|
2617
|
+
return null;
|
|
2618
|
+
}
|
|
2619
|
+
const url = documentSourceUrl.value;
|
|
2620
|
+
if (url) return { url };
|
|
2621
|
+
return null;
|
|
2622
|
+
};
|
|
2623
|
+
/**
|
|
2624
|
+
* Handles actions to perform when synchronization is complete.
|
|
2625
|
+
* Hides the sync modal, resets the sync progress flag, and emits the
|
|
2626
|
+
* 'hooks:on:rebase:document:complete' event with document metadata.
|
|
2627
|
+
*/
|
|
2628
|
+
const onSyncComplete = () => {
|
|
2629
|
+
syncModal.hide();
|
|
2630
|
+
isSyncInProgress.value = false;
|
|
2631
|
+
toast("Your document has been rebased with the latest version from the source.", "info");
|
|
2632
|
+
props.eventBus.emit("hooks:on:rebase:document:complete", { meta: { documentName: props.documentSlug } });
|
|
2633
|
+
};
|
|
2634
|
+
/**
|
|
2635
|
+
* Handles errors that occur during synchronization.
|
|
2636
|
+
* If an error string is provided, it displays the error via toast.
|
|
2637
|
+
* Always resets the sync progress flag.
|
|
2638
|
+
*/
|
|
2639
|
+
const onSyncError = (error) => {
|
|
2640
|
+
if (error !== null) toast(error, "error");
|
|
2641
|
+
isSyncInProgress.value = false;
|
|
2642
|
+
};
|
|
2643
|
+
/**
|
|
2644
|
+
* Handles the synchronization flow for a document.
|
|
2645
|
+
* Checks for unsaved changes, resolves source (registry over URL),
|
|
2646
|
+
* initiates rebasing, handles conflicts, and emits completion events.
|
|
2647
|
+
* If conflicts are detected, a modal dialog is shown for user resolution.
|
|
2648
|
+
*/
|
|
2649
|
+
const handleSyncFlow = async () => {
|
|
2650
|
+
if (isDocumentDirty.value) {
|
|
2651
|
+
dirtyBeforeSyncModal.show();
|
|
2652
|
+
return;
|
|
2653
|
+
}
|
|
2654
|
+
if (isSyncInProgress.value) return;
|
|
2655
|
+
isSyncInProgress.value = true;
|
|
2656
|
+
const input = await resolveSyncInput();
|
|
2657
|
+
if (!input) {
|
|
2658
|
+
onSyncError(null);
|
|
2659
|
+
return;
|
|
2660
|
+
}
|
|
2661
|
+
const result = await props.workspaceStore.rebaseDocument({
|
|
2662
|
+
name: props.documentSlug,
|
|
2663
|
+
...input
|
|
2664
|
+
});
|
|
2665
|
+
if (result?.ok) {
|
|
2666
|
+
const originalDocument = props.workspaceStore.getOriginalDocument(props.documentSlug) ?? {};
|
|
2667
|
+
rebaseResult.value = {
|
|
2668
|
+
conflicts: result.conflicts,
|
|
2669
|
+
applyChanges: result.applyChanges,
|
|
2670
|
+
resolvedDocument: apply(deepClone(originalDocument), result.changes),
|
|
2671
|
+
originalDocument
|
|
2672
|
+
};
|
|
2673
|
+
if (rebaseResult.value.conflicts.length > 0) syncModal.show();
|
|
2674
|
+
else {
|
|
2675
|
+
await rebaseResult.value?.applyChanges({ resolvedDocument: rebaseResult.value.resolvedDocument });
|
|
2676
|
+
onSyncComplete();
|
|
2677
|
+
}
|
|
2678
|
+
} else if (result?.ok === false && result.type === "NO_CHANGES_DETECTED") onSyncComplete();
|
|
2679
|
+
else onSyncError("Failed to sync document");
|
|
2680
|
+
};
|
|
2681
|
+
const handleApplyChanges = async ({ resolvedDocument }) => {
|
|
2682
|
+
await rebaseResult.value?.applyChanges({ resolvedDocument });
|
|
2683
|
+
props.eventBus.emit("hooks:on:rebase:document:complete", { meta: { documentName: props.documentSlug } });
|
|
2684
|
+
syncModal.hide();
|
|
2685
|
+
};
|
|
2686
|
+
/**
|
|
2687
|
+
* Resets sync state when the sync conflict modal is closed (dismissed or after
|
|
2688
|
+
* applying changes). Ensures the Sync button is re-enabled and conflict state
|
|
2689
|
+
* is cleared.
|
|
2690
|
+
*/
|
|
2691
|
+
const onSyncModalClose = () => {
|
|
2692
|
+
isSyncInProgress.value = false;
|
|
2693
|
+
rebaseResult.value = null;
|
|
2694
|
+
};
|
|
2695
|
+
return (_ctx, _cache) => {
|
|
2696
|
+
return openBlock(), createElementBlock(Fragment, null, [
|
|
2697
|
+
createElementVNode("div", _hoisted_1$2, [__props.document ? (openBlock(), createElementBlock("div", _hoisted_2$2, [
|
|
2698
|
+
createElementVNode("div", {
|
|
2699
|
+
"aria-label": `title: ${title.value}`,
|
|
2700
|
+
class: "mx-auto flex h-fit w-full flex-col gap-2 pt-14 pb-3 md:max-w-180 md:pt-6"
|
|
2701
|
+
}, [__props.document?.["x-scalar-is-dirty"] ? (openBlock(), createBlock(Callout_default, {
|
|
2702
|
+
key: 0,
|
|
2703
|
+
class: "mb-5",
|
|
2704
|
+
type: "warning"
|
|
2705
|
+
}, {
|
|
2706
|
+
actions: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
2707
|
+
class: "text-c-2 hover:text-c-1 flex items-center gap-2",
|
|
2708
|
+
size: "xs",
|
|
2709
|
+
type: "button",
|
|
2710
|
+
variant: "outlined",
|
|
2711
|
+
onClick: undoChanges
|
|
2712
|
+
}, {
|
|
2713
|
+
default: withCtx(() => [..._cache[5] || (_cache[5] = [createElementVNode("span", null, "Undo", -1)])]),
|
|
2714
|
+
_: 1
|
|
2715
|
+
}), createVNode(unref(ScalarButton), {
|
|
2716
|
+
class: "text-c-btn flex items-center gap-2",
|
|
2717
|
+
size: "xs",
|
|
2718
|
+
type: "button",
|
|
2719
|
+
variant: "solid",
|
|
2720
|
+
onClick: saveChanges
|
|
2721
|
+
}, {
|
|
2722
|
+
default: withCtx(() => [createVNode(unref(ScalarIconFloppyDisk), {
|
|
2723
|
+
size: "sm",
|
|
2724
|
+
thickness: "1.5"
|
|
2725
|
+
}), _cache[6] || (_cache[6] = createElementVNode("span", null, "Save", -1))]),
|
|
2726
|
+
_: 1
|
|
2727
|
+
})]),
|
|
2728
|
+
default: withCtx(() => [_cache[7] || (_cache[7] = createElementVNode("p", null, " You have unsaved changes. Save your work to keep your changes, or undo to revert them. ", -1))]),
|
|
2729
|
+
_: 1
|
|
2730
|
+
})) : createCommentVNode("", true), createElementVNode("div", _hoisted_4$2, [createElementVNode("div", _hoisted_5$2, [createVNode(IconSelector_default, {
|
|
2731
|
+
modelValue: icon.value,
|
|
2732
|
+
placement: "bottom-start",
|
|
2733
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = (icon) => __props.eventBus.emit("document:update:icon", icon))
|
|
2734
|
+
}, {
|
|
2735
|
+
default: withCtx(() => [createVNode(unref(ScalarButton), {
|
|
2736
|
+
class: "hover:bg-b-2 aspect-square h-7 w-7 cursor-pointer rounded border border-transparent p-0 hover:border-inherit",
|
|
2737
|
+
variant: "ghost"
|
|
2738
|
+
}, {
|
|
2739
|
+
default: withCtx(() => [createVNode(unref(LibraryIcon), {
|
|
2740
|
+
class: "text-c-2 size-5",
|
|
2741
|
+
src: icon.value,
|
|
2742
|
+
"stroke-width": "2"
|
|
2743
|
+
}, null, 8, ["src"])]),
|
|
2744
|
+
_: 1
|
|
2745
|
+
})]),
|
|
2746
|
+
_: 1
|
|
2747
|
+
}, 8, ["modelValue"]), createElementVNode("div", _hoisted_6$1, [createVNode(LabelInput_default, {
|
|
2748
|
+
class: "text-xl font-bold",
|
|
2749
|
+
inputId: "documentName",
|
|
2750
|
+
modelValue: title.value,
|
|
2751
|
+
"onUpdate:modelValue": _cache[1] || (_cache[1] = (title) => __props.eventBus.emit("document:update:info", { title }))
|
|
2752
|
+
}, null, 8, ["modelValue"])])]), canShowSyncButton.value ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
2753
|
+
key: 0,
|
|
2754
|
+
class: "text-c-2 hover:text-c-1 shrink-0 gap-1.5",
|
|
2755
|
+
"data-testid": "document-sync-button",
|
|
2756
|
+
disabled: isSyncInProgress.value,
|
|
2757
|
+
size: "xs",
|
|
2758
|
+
title: "Pull the latest version from the document source and merge with your local copy. Save your changes first if you have unsaved edits.",
|
|
2759
|
+
type: "button",
|
|
2760
|
+
variant: "ghost",
|
|
2761
|
+
onClick: handleSyncFlow
|
|
2762
|
+
}, {
|
|
2763
|
+
default: withCtx(() => [isSyncInProgress.value ? (openBlock(), createBlock(unref(ScalarIconSpinner), {
|
|
2764
|
+
key: 0,
|
|
2765
|
+
class: "size-3.5 animate-spin",
|
|
2766
|
+
size: "sm"
|
|
2767
|
+
})) : (openBlock(), createBlock(unref(ScalarIconCloudArrowDown), {
|
|
2768
|
+
key: 1,
|
|
2769
|
+
class: "size-3.5",
|
|
2770
|
+
size: "sm",
|
|
2771
|
+
thickness: "1.5"
|
|
2772
|
+
})), _cache[8] || (_cache[8] = createElementVNode("span", null, "Sync from source", -1))]),
|
|
2773
|
+
_: 1
|
|
2774
|
+
}, 8, ["disabled"])) : createCommentVNode("", true)])], 8, _hoisted_3$2),
|
|
2775
|
+
createVNode(Tabs_default, { type: "document" }),
|
|
2776
|
+
createElementVNode("div", _hoisted_7, [createVNode(unref(RouterView), null, {
|
|
2777
|
+
default: withCtx(({ Component }) => [(openBlock(), createBlock(resolveDynamicComponent(Component), mergeProps(props, { collectionType: "document" }), null, 16))]),
|
|
2778
|
+
_: 1
|
|
2779
|
+
})])
|
|
2780
|
+
])) : (openBlock(), createElementBlock("div", _hoisted_8, [..._cache[9] || (_cache[9] = [createElementVNode("div", { class: "flex h-full flex-col items-center justify-center" }, [createElementVNode("h1", { class: "text-2xl font-bold" }, "Document not found"), createElementVNode("p", { class: "text-gray-500" }, " The document you are looking for does not exist. ")], -1)])]))]),
|
|
2781
|
+
createVNode(unref(ScalarModal), {
|
|
2782
|
+
bodyClass: "border-t-0 rounded-t-lg flex flex-col gap-5",
|
|
2783
|
+
size: "xs",
|
|
2784
|
+
state: unref(dirtyBeforeSyncModal),
|
|
2785
|
+
title: "Sync requires saved document",
|
|
2786
|
+
onClose: _cache[3] || (_cache[3] = ($event) => unref(dirtyBeforeSyncModal).hide())
|
|
2787
|
+
}, {
|
|
2788
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_9, [createElementVNode("div", _hoisted_10, [createElementVNode("div", _hoisted_11, [createVNode(unref(ScalarIconWarning), { class: "size-5 text-[var(--scalar-color-yellow)]" })]), _cache[10] || (_cache[10] = createElementVNode("div", { class: "min-w-0 flex-1 space-y-1" }, [createElementVNode("p", { class: "text-c-1 text-sm leading-snug font-medium" }, " You have unsaved changes "), createElementVNode("p", { class: "text-c-2 text-sm leading-relaxed" }, " Save your work to keep changes, or discard to revert to the last saved version. Then you can sync with the source. ")], -1))]), createElementVNode("div", _hoisted_12, [
|
|
2789
|
+
createVNode(unref(ScalarButton), {
|
|
2790
|
+
size: "sm",
|
|
2791
|
+
type: "button",
|
|
2792
|
+
variant: "ghost",
|
|
2793
|
+
onClick: _cache[2] || (_cache[2] = ($event) => unref(dirtyBeforeSyncModal).hide())
|
|
2794
|
+
}, {
|
|
2795
|
+
default: withCtx(() => [..._cache[11] || (_cache[11] = [createTextVNode(" Cancel ", -1)])]),
|
|
2796
|
+
_: 1
|
|
2797
|
+
}),
|
|
2798
|
+
createVNode(unref(ScalarButton), {
|
|
2799
|
+
size: "sm",
|
|
2800
|
+
type: "button",
|
|
2801
|
+
variant: "outlined",
|
|
2802
|
+
onClick: handleDiscardThenCloseDirtyModal
|
|
2803
|
+
}, {
|
|
2804
|
+
default: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode(" Discard changes ", -1)])]),
|
|
2805
|
+
_: 1
|
|
2806
|
+
}),
|
|
2807
|
+
createVNode(unref(ScalarButton), {
|
|
2808
|
+
class: "flex items-center gap-2",
|
|
2809
|
+
size: "sm",
|
|
2810
|
+
type: "button",
|
|
2811
|
+
variant: "solid",
|
|
2812
|
+
onClick: handleSaveThenCloseDirtyModal
|
|
2813
|
+
}, {
|
|
2814
|
+
default: withCtx(() => [createVNode(unref(ScalarIconFloppyDisk), {
|
|
2815
|
+
size: "sm",
|
|
2816
|
+
thickness: "1.5"
|
|
2817
|
+
}), _cache[13] || (_cache[13] = createTextVNode(" Save and continue ", -1))]),
|
|
2818
|
+
_: 1
|
|
2819
|
+
})
|
|
2820
|
+
])])]),
|
|
2821
|
+
_: 1
|
|
2822
|
+
}, 8, ["state"]),
|
|
2823
|
+
rebaseResult.value ? (openBlock(), createBlock(unref(ScalarModal), {
|
|
2824
|
+
key: 0,
|
|
2825
|
+
bodyClass: "sync-conflict-modal-root flex h-dvh flex-col p-4",
|
|
2826
|
+
maxWidth: "calc(100dvw - 32px)",
|
|
2827
|
+
size: "full",
|
|
2828
|
+
state: unref(syncModal),
|
|
2829
|
+
onClose: onSyncModalClose
|
|
2830
|
+
}, {
|
|
2831
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_13, [createVNode(SyncConflictResolutionEditor_default, {
|
|
2832
|
+
baseDocument: rebaseResult.value.originalDocument,
|
|
2833
|
+
conflicts: rebaseResult.value.conflicts,
|
|
2834
|
+
resolvedDocument: rebaseResult.value.resolvedDocument,
|
|
2835
|
+
onApplyChanges: _cache[4] || (_cache[4] = (payload) => handleApplyChanges(payload))
|
|
2836
|
+
}, null, 8, [
|
|
2837
|
+
"baseDocument",
|
|
2838
|
+
"conflicts",
|
|
2839
|
+
"resolvedDocument"
|
|
2840
|
+
])])]),
|
|
2841
|
+
_: 1
|
|
2842
|
+
}, 8, ["state"])) : createCommentVNode("", true)
|
|
2843
|
+
], 64);
|
|
2844
|
+
};
|
|
2845
|
+
}
|
|
2846
|
+
});
|
|
2847
|
+
//#endregion
|
|
2848
|
+
//#region src/v2/features/collection/OperationCollection.vue?vue&type=script&setup=true&lang.ts
|
|
2849
|
+
var _hoisted_1$1 = {
|
|
2850
|
+
key: 0,
|
|
2851
|
+
class: "custom-scroll h-full"
|
|
2852
|
+
};
|
|
2853
|
+
var _hoisted_2$1 = { class: "w-full px-3 md:mx-auto md:max-w-180" };
|
|
2854
|
+
var _hoisted_3$1 = ["aria-label"];
|
|
2855
|
+
var _hoisted_4$1 = { class: "group relative ml-1.25" };
|
|
2856
|
+
var _hoisted_5$1 = { class: "px-1.5 py-8" };
|
|
2857
|
+
var _hoisted_6 = {
|
|
2858
|
+
key: 1,
|
|
2859
|
+
class: "flex w-full flex-1 items-center justify-center"
|
|
2860
|
+
};
|
|
2861
|
+
//#endregion
|
|
2862
|
+
//#region src/v2/features/collection/OperationCollection.vue
|
|
2863
|
+
var OperationCollection_default = /* @__PURE__ */ defineComponent({
|
|
2864
|
+
__name: "OperationCollection",
|
|
2865
|
+
props: {
|
|
2866
|
+
documentSlug: {},
|
|
2867
|
+
document: {},
|
|
2868
|
+
eventBus: {},
|
|
2869
|
+
layout: {},
|
|
2870
|
+
path: {},
|
|
2871
|
+
method: {},
|
|
2872
|
+
exampleName: {},
|
|
2873
|
+
environment: {},
|
|
2874
|
+
securitySchemes: {},
|
|
2875
|
+
workspaceStore: {},
|
|
2876
|
+
activeWorkspace: {},
|
|
2877
|
+
plugins: {},
|
|
2878
|
+
customThemes: {},
|
|
2879
|
+
currentTheme: {},
|
|
2880
|
+
isDarkMode: { type: Boolean },
|
|
2881
|
+
fetchRegistryDocument: { type: Function }
|
|
2882
|
+
},
|
|
2883
|
+
setup(__props) {
|
|
2884
|
+
const props = __props;
|
|
2885
|
+
const operation = computed(() => {
|
|
2886
|
+
if (!props.path || !props.method) return;
|
|
2887
|
+
return getResolvedRef(props.document?.paths?.[props.path]?.[props.method]);
|
|
2888
|
+
});
|
|
2889
|
+
/**
|
|
2890
|
+
* Local copy of the label so we can reset on empty-blur rejection and stay in
|
|
2891
|
+
* sync when Vue Router reuses this component across workspace navigations.
|
|
2892
|
+
*/
|
|
2893
|
+
const operationSummary = ref(operation.value?.summary ?? "");
|
|
2894
|
+
watch(() => operation.value?.summary, (newSummary) => {
|
|
2895
|
+
operationSummary.value = newSummary ?? "";
|
|
2896
|
+
});
|
|
2897
|
+
/** Emits the rename event on blur, or resets the input if the title is blank. */
|
|
2898
|
+
const handleSummaryUpdate = (payload) => {
|
|
2899
|
+
const { path, method } = props;
|
|
2900
|
+
if (!path || !method || !isHttpMethod(method)) return;
|
|
2901
|
+
props.eventBus.emit("operation:update:meta", {
|
|
2902
|
+
meta: {
|
|
2903
|
+
path,
|
|
2904
|
+
method
|
|
2905
|
+
},
|
|
2906
|
+
payload: { summary: payload.trim() }
|
|
2907
|
+
});
|
|
2908
|
+
};
|
|
2909
|
+
const operationPlaceholder = computed(() => {
|
|
2910
|
+
if (!props.path || !props.method) return "Untitled Operation";
|
|
2911
|
+
return `${props.method.toUpperCase()} ${props.path}`;
|
|
2912
|
+
});
|
|
2913
|
+
return (_ctx, _cache) => {
|
|
2914
|
+
return operation.value !== void 0 ? (openBlock(), createElementBlock("div", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [
|
|
2915
|
+
createElementVNode("div", {
|
|
2916
|
+
"aria-label": `title: ${operationSummary.value}`,
|
|
2917
|
+
class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-8"
|
|
2918
|
+
}, [createElementVNode("div", _hoisted_4$1, [createVNode(LabelInput_default, {
|
|
2919
|
+
modelValue: operationSummary.value,
|
|
2920
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => operationSummary.value = $event),
|
|
2921
|
+
class: "text-xl font-bold",
|
|
2922
|
+
inputId: "operationSummary",
|
|
2923
|
+
placeholder: operationPlaceholder.value,
|
|
2924
|
+
onBlur: handleSummaryUpdate
|
|
2925
|
+
}, null, 8, ["modelValue", "placeholder"])])], 8, _hoisted_3$1),
|
|
2926
|
+
createVNode(Tabs_default, { type: "operation" }),
|
|
2927
|
+
createElementVNode("div", _hoisted_5$1, [createVNode(unref(RouterView), mergeProps(props, { collectionType: "operation" }), null, 16)])
|
|
2928
|
+
])])) : (openBlock(), createElementBlock("div", _hoisted_6, [..._cache[1] || (_cache[1] = [createElementVNode("div", { class: "flex h-full flex-col items-center justify-center" }, [createElementVNode("h1", { class: "text-2xl font-bold" }, "Operation not found"), createElementVNode("p", { class: "text-gray-500" }, " The operation you are looking for does not exist. ")], -1)])]));
|
|
2929
|
+
};
|
|
2930
|
+
}
|
|
2931
|
+
});
|
|
2932
|
+
//#endregion
|
|
2933
|
+
//#region src/v2/features/collection/WorkspaceCollection.vue?vue&type=script&setup=true&lang.ts
|
|
2934
|
+
var _hoisted_1 = { class: "custom-scroll h-full" };
|
|
2935
|
+
var _hoisted_2 = { class: "w-full px-3 md:mx-auto md:max-w-180" };
|
|
2936
|
+
var _hoisted_3 = ["aria-label"];
|
|
2937
|
+
var _hoisted_4 = { class: "group relative ml-1.25" };
|
|
2938
|
+
var _hoisted_5 = { class: "px-1.5 py-8" };
|
|
2939
|
+
//#endregion
|
|
2940
|
+
//#region src/v2/features/collection/WorkspaceCollection.vue
|
|
2941
|
+
var WorkspaceCollection_default = /* @__PURE__ */ defineComponent({
|
|
2942
|
+
__name: "WorkspaceCollection",
|
|
2943
|
+
props: {
|
|
2944
|
+
documentSlug: {},
|
|
2945
|
+
document: {},
|
|
2946
|
+
eventBus: {},
|
|
2947
|
+
layout: {},
|
|
2948
|
+
path: {},
|
|
2949
|
+
method: {},
|
|
2950
|
+
exampleName: {},
|
|
2951
|
+
environment: {},
|
|
2952
|
+
securitySchemes: {},
|
|
2953
|
+
workspaceStore: {},
|
|
2954
|
+
activeWorkspace: {},
|
|
2955
|
+
plugins: {},
|
|
2956
|
+
customThemes: {},
|
|
2957
|
+
currentTheme: {},
|
|
2958
|
+
isDarkMode: { type: Boolean },
|
|
2959
|
+
fetchRegistryDocument: { type: Function }
|
|
2960
|
+
},
|
|
2961
|
+
setup(__props) {
|
|
2962
|
+
const props = __props;
|
|
2963
|
+
/**
|
|
2964
|
+
* Local copy of the label so we can reset on empty-blur rejection and stay in
|
|
2965
|
+
* sync when Vue Router reuses this component across workspace navigations.
|
|
2966
|
+
*/
|
|
2967
|
+
const workspaceTitle = ref(props.activeWorkspace.label);
|
|
2968
|
+
watch(() => props.activeWorkspace.label, (newLabel) => {
|
|
2969
|
+
workspaceTitle.value = newLabel;
|
|
2970
|
+
});
|
|
2971
|
+
/** Emits the rename event on blur, or resets the input if the title is blank. */
|
|
2972
|
+
const handleUpdateWorkspaceTitle = (title) => {
|
|
2973
|
+
if (title.trim() === "") {
|
|
2974
|
+
workspaceTitle.value = props.activeWorkspace.label;
|
|
2975
|
+
return;
|
|
2976
|
+
}
|
|
2977
|
+
props.eventBus.emit("workspace:update:name", title);
|
|
2978
|
+
};
|
|
2979
|
+
return (_ctx, _cache) => {
|
|
2980
|
+
return openBlock(), createElementBlock("div", _hoisted_1, [createElementVNode("div", _hoisted_2, [
|
|
2981
|
+
createElementVNode("div", {
|
|
2982
|
+
"aria-label": `title: ${__props.activeWorkspace.label}`,
|
|
2983
|
+
class: "mx-auto flex h-fit w-full flex-row items-center gap-2 pt-14 pb-3 md:max-w-180 md:pt-6"
|
|
2984
|
+
}, [createElementVNode("div", _hoisted_4, [createVNode(LabelInput_default, {
|
|
2985
|
+
modelValue: workspaceTitle.value,
|
|
2986
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => workspaceTitle.value = $event),
|
|
2987
|
+
class: "text-xl font-bold",
|
|
2988
|
+
inputId: "workspaceName",
|
|
2989
|
+
placeholder: "Untitled Workspace",
|
|
2990
|
+
onBlur: handleUpdateWorkspaceTitle
|
|
2991
|
+
}, null, 8, ["modelValue"])])], 8, _hoisted_3),
|
|
2992
|
+
createVNode(Tabs_default, { type: "workspace" }),
|
|
2993
|
+
createElementVNode("div", _hoisted_5, [createVNode(unref(RouterView), mergeProps(props, { collectionType: "workspace" }), null, 16)])
|
|
2994
|
+
])]);
|
|
2995
|
+
};
|
|
2996
|
+
}
|
|
2997
|
+
});
|
|
2998
|
+
//#endregion
|
|
2999
|
+
//#region src/v2/features/app/helpers/routes.ts
|
|
3000
|
+
/** Routes for the API client app and web, the same as modal + workspace routes */
|
|
3001
|
+
var ROUTES = [{
|
|
3002
|
+
path: "/@:namespace/:workspaceSlug",
|
|
3003
|
+
children: [{
|
|
3004
|
+
path: "document/:documentSlug",
|
|
3005
|
+
children: [{
|
|
3006
|
+
path: "path/:pathEncoded/method/:method",
|
|
3007
|
+
children: [{
|
|
3008
|
+
name: "example",
|
|
3009
|
+
path: "example/:exampleName",
|
|
3010
|
+
component: Operation_default
|
|
3011
|
+
}, {
|
|
3012
|
+
name: "operation",
|
|
3013
|
+
path: "",
|
|
3014
|
+
component: OperationCollection_default,
|
|
3015
|
+
redirect: { name: "operation.overview" },
|
|
3016
|
+
children: [
|
|
3017
|
+
{
|
|
3018
|
+
name: "operation.overview",
|
|
3019
|
+
path: "overview",
|
|
3020
|
+
component: Overview_default
|
|
3021
|
+
},
|
|
3022
|
+
{
|
|
3023
|
+
name: "operation.servers",
|
|
3024
|
+
path: "servers",
|
|
3025
|
+
component: Servers_default
|
|
3026
|
+
},
|
|
3027
|
+
{
|
|
3028
|
+
name: "operation.authentication",
|
|
3029
|
+
path: "authentication",
|
|
3030
|
+
component: Authentication_default
|
|
3031
|
+
},
|
|
3032
|
+
{
|
|
3033
|
+
name: "operation.editor",
|
|
3034
|
+
path: "editor",
|
|
3035
|
+
component: Editor_default
|
|
3036
|
+
}
|
|
3037
|
+
]
|
|
3038
|
+
}]
|
|
3039
|
+
}, {
|
|
3040
|
+
name: "document",
|
|
3041
|
+
path: "",
|
|
3042
|
+
component: DocumentCollection_default,
|
|
3043
|
+
children: [
|
|
3044
|
+
{
|
|
3045
|
+
name: "document.redirect",
|
|
3046
|
+
path: "",
|
|
3047
|
+
redirect: { name: "document.overview" }
|
|
3048
|
+
},
|
|
3049
|
+
{
|
|
3050
|
+
name: "document.overview",
|
|
3051
|
+
path: "overview",
|
|
3052
|
+
component: Overview_default
|
|
3053
|
+
},
|
|
3054
|
+
{
|
|
3055
|
+
name: "document.servers",
|
|
3056
|
+
path: "servers",
|
|
3057
|
+
component: Servers_default
|
|
3058
|
+
},
|
|
3059
|
+
{
|
|
3060
|
+
name: "document.environment",
|
|
3061
|
+
path: "environment",
|
|
3062
|
+
component: Environment_default
|
|
3063
|
+
},
|
|
3064
|
+
{
|
|
3065
|
+
name: "document.authentication",
|
|
3066
|
+
path: "authentication",
|
|
3067
|
+
component: Authentication_default
|
|
3068
|
+
},
|
|
3069
|
+
{
|
|
3070
|
+
name: "document.cookies",
|
|
3071
|
+
path: "cookies",
|
|
3072
|
+
component: Cookies_default
|
|
3073
|
+
},
|
|
3074
|
+
{
|
|
3075
|
+
name: "document.settings",
|
|
3076
|
+
path: "settings",
|
|
3077
|
+
component: Settings_default
|
|
3078
|
+
}
|
|
3079
|
+
]
|
|
3080
|
+
}]
|
|
3081
|
+
}, {
|
|
3082
|
+
name: "workspace",
|
|
3083
|
+
path: "",
|
|
3084
|
+
component: WorkspaceCollection_default,
|
|
3085
|
+
children: [
|
|
3086
|
+
{
|
|
3087
|
+
name: "workspace.environment",
|
|
3088
|
+
path: "environment",
|
|
3089
|
+
component: Environment_default
|
|
3090
|
+
},
|
|
3091
|
+
{
|
|
3092
|
+
name: "workspace.cookies",
|
|
3093
|
+
path: "cookies",
|
|
3094
|
+
component: Cookies_default
|
|
3095
|
+
},
|
|
3096
|
+
{
|
|
3097
|
+
name: "workspace.settings",
|
|
3098
|
+
path: "settings",
|
|
3099
|
+
component: Settings_default
|
|
3100
|
+
}
|
|
3101
|
+
]
|
|
3102
|
+
}]
|
|
3103
|
+
}, {
|
|
3104
|
+
path: "/:pathMatch(.*)*",
|
|
3105
|
+
redirect: () => {
|
|
3106
|
+
const DEFAULT_PATH = "/@local/default/document/drafts/overview";
|
|
3107
|
+
const lastPath = workspaceStorage.getLastPath() ?? DEFAULT_PATH;
|
|
3108
|
+
workspaceStorage.setCurrentPath(DEFAULT_PATH);
|
|
3109
|
+
const url = new URL(lastPath, "http://example.com");
|
|
3110
|
+
const queryParameters = new URLSearchParams(window.location.search);
|
|
3111
|
+
const mergedSearchParams = mergeSearchParams(url.searchParams, queryParameters);
|
|
3112
|
+
return `${url.pathname}?${mergedSearchParams.toString()}`;
|
|
3113
|
+
}
|
|
3114
|
+
}];
|
|
3115
|
+
//#endregion
|
|
3116
|
+
//#region src/v2/features/app/helpers/create-api-client-app.ts
|
|
3117
|
+
/**
|
|
3118
|
+
* Creates the appropriate router with the appropriate routes based on the layout
|
|
3119
|
+
*/
|
|
3120
|
+
var createAppRouter = (layout) => {
|
|
3121
|
+
if (layout === "web") return createRouter({
|
|
3122
|
+
history: createWebHistory(),
|
|
3123
|
+
routes: ROUTES
|
|
3124
|
+
});
|
|
3125
|
+
return createRouter({
|
|
3126
|
+
history: createWebHashHistory(),
|
|
3127
|
+
routes: ROUTES
|
|
3128
|
+
});
|
|
3129
|
+
};
|
|
3130
|
+
/**
|
|
3131
|
+
* Create the API Client with router and passes in the workspace store as a prop
|
|
3132
|
+
*/
|
|
3133
|
+
var createApiClientApp = async (el, { layout = "desktop", plugins, customThemes, fallbackThemeSlug, fetchRegistryDocument }) => {
|
|
3134
|
+
const router = createAppRouter(layout);
|
|
3135
|
+
const state = await createAppState({
|
|
3136
|
+
router,
|
|
3137
|
+
customThemes,
|
|
3138
|
+
fallbackThemeSlug
|
|
3139
|
+
});
|
|
3140
|
+
const commandPaletteState = useCommandPaletteState();
|
|
3141
|
+
const app = createApp(App_default, {
|
|
3142
|
+
layout,
|
|
3143
|
+
plugins,
|
|
3144
|
+
getAppState: () => state,
|
|
3145
|
+
getCommandPaletteState: () => commandPaletteState,
|
|
3146
|
+
fetchRegistryDocument
|
|
3147
|
+
});
|
|
3148
|
+
app.use(router);
|
|
3149
|
+
if (!el) {
|
|
3150
|
+
console.error("[@scalar/api-client-modal] Could not create the API client.", "Invalid HTML element provided.", "Read more: https://github.com/scalar/scalar/tree/main/packages/api-client");
|
|
3151
|
+
return;
|
|
3152
|
+
}
|
|
3153
|
+
app.mount(el);
|
|
3154
|
+
return {
|
|
3155
|
+
app,
|
|
3156
|
+
state
|
|
3157
|
+
};
|
|
3158
|
+
};
|
|
3159
|
+
//#endregion
|
|
3160
|
+
export { App_default as ClientApp, CommandActionForm_default as CommandActionForm, CommandActionInput_default as CommandActionInput, CreateWorkspaceModal_default as CreateWorkspaceModal, baseClientActions, baseRoutes, createApiClientApp, createAppRouter, createAppState, useCommandPaletteState };
|
|
3161
|
+
|
|
3162
|
+
//# sourceMappingURL=index.js.map
|