@scalar/api-client 2.38.1 → 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 +9 -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/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 +3 -3
- 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/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/Overview.vue.d.ts +4 -4
- package/dist/v2/features/collection/components/Servers.vue.d.ts +4 -4
- 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/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 -347
- 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 -184
- 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 -52
- 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 -210
- 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
|
@@ -0,0 +1,2510 @@
|
|
|
1
|
+
import { t as _plugin_vue_export_helper_default } from "./_plugin-vue_export-helper-BmmBcIzD.js";
|
|
2
|
+
import { n as CommandActionForm_default, t as CommandActionInput_default } from "./CommandActionInput-TkcAx6E8.js";
|
|
3
|
+
import { t as mergeSecurity } from "./scalar-auth-selector-block-DI3DLag9.js";
|
|
4
|
+
import { t as ScalarAsciiArt_default } from "./ScalarAsciiArt-BjuSnj8e.js";
|
|
5
|
+
import { n as Sidebar_default, t as SidebarToggle_default } from "./sidebar-ceSbYmnt.js";
|
|
6
|
+
import { t as getActiveEnvironment } from "./get-active-environment-CkxyQ1dM.js";
|
|
7
|
+
import { n as slugify, t as TheCommandPalette_default } from "./TheCommandPalette-Dl9TAeke.js";
|
|
8
|
+
import { n as initializeWorkspaceEventHandlers, t as useGlobalHotKeys } from "./use-global-hot-keys-D8Ai8Qbm.js";
|
|
9
|
+
import { o as useMonacoEditorConfiguration } from "./editor-BZ_J0eze.js";
|
|
10
|
+
import { n as rabbit_default, t as rabbitjump_default } from "./rabbitjump-CMZXAR6d.js";
|
|
11
|
+
import { t as DeleteSidebarListElement_default } from "./DeleteSidebarListElement-C-p87d03.js";
|
|
12
|
+
import { Fragment, capitalize, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, guardReactiveProps, mergeModels, nextTick, normalizeClass, normalizeProps, onBeforeUnmount, onMounted, onUnmounted, openBlock, readonly, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toValue, unref, useModel, watch, withCtx, withKeys, withModifiers } from "vue";
|
|
13
|
+
import { ScalarButton, ScalarContextMenu, ScalarDropdown, ScalarDropdownButton, ScalarDropdownDivider, ScalarDropdownItem, ScalarDropdownMenu, ScalarFloating, ScalarHotkey, ScalarIcon, ScalarIconButton, ScalarModal, ScalarSidebarItem, ScalarTeleportRoot, ScalarTooltip, useModal } from "@scalar/components";
|
|
14
|
+
import { defaultFonts, themePresets } from "@scalar/themes";
|
|
15
|
+
import { ScalarToasts } from "@scalar/use-toasts";
|
|
16
|
+
import { NavigationFailureType, RouterView } from "vue-router";
|
|
17
|
+
import { LibraryIcon } from "@scalar/icons/library";
|
|
18
|
+
import { safeLocalStorage } from "@scalar/helpers/object/local-storage";
|
|
19
|
+
import { migrateLocalStorageToIndexDb } from "@scalar/oas-utils/migrations";
|
|
20
|
+
import { isMacOS } from "@scalar/helpers/general/is-mac-os";
|
|
21
|
+
import { isDefined } from "@scalar/helpers/array/is-defined";
|
|
22
|
+
import { createWorkspaceEventBus } from "@scalar/workspace-store/events";
|
|
23
|
+
import { ScalarIconArrowUpRight, ScalarIconDotsThree, ScalarIconDownloadSimple, ScalarIconFolderSimple, ScalarIconGearSix, ScalarIconLinkSimple, ScalarIconPencil, ScalarIconPlus, ScalarIconPlusSquare, ScalarIconTabs, ScalarIconX, ScalarIconXSquare } from "@scalar/icons";
|
|
24
|
+
import { dereference, escapeJsonPointer } from "@scalar/openapi-parser";
|
|
25
|
+
import { unpackProxyObject } from "@scalar/workspace-store/helpers/unpack-proxy";
|
|
26
|
+
import { createSidebarState, generateReverseIndex } from "@scalar/sidebar";
|
|
27
|
+
import { sortByOrder } from "@scalar/helpers/array/sort-by-order";
|
|
28
|
+
import { createWorkspaceStore } from "@scalar/workspace-store/client";
|
|
29
|
+
import { generateUniqueValue } from "@scalar/workspace-store/helpers/generate-unique-value";
|
|
30
|
+
import { getOpenapiObject, getParentEntry } from "@scalar/workspace-store/navigation";
|
|
31
|
+
import { createWorkspaceStorePersistence, getWorkspaceId } from "@scalar/workspace-store/persistence";
|
|
32
|
+
import { persistencePlugin } from "@scalar/workspace-store/plugins/client";
|
|
33
|
+
import { extensions } from "@scalar/workspace-store/schemas/extensions";
|
|
34
|
+
import { isHttpMethod } from "@scalar/helpers/http/is-http-method";
|
|
35
|
+
import { toJsonCompatible } from "@scalar/helpers/object/to-json-compatible";
|
|
36
|
+
//#region src/v2/features/app/helpers/get-route-param.ts
|
|
37
|
+
function getRouteParam(paramName, route) {
|
|
38
|
+
const param = route?.params[paramName];
|
|
39
|
+
if (typeof param !== "string") return;
|
|
40
|
+
if (paramName === "method") return param && isHttpMethod(param) ? param : void 0;
|
|
41
|
+
return decodeURIComponent(param);
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
//#region src/v2/features/app/helpers/group-workspaces.ts
|
|
45
|
+
/**
|
|
46
|
+
* Groups workspaces into team and local categories.
|
|
47
|
+
* Team workspaces are listed first (if not viewing local workspaces),
|
|
48
|
+
* followed by local workspaces.
|
|
49
|
+
*
|
|
50
|
+
* @param workspaces - Array of workspaces to group
|
|
51
|
+
* @param currentTeamUid - Current team identifier ('local' for local team)
|
|
52
|
+
* @returns Array of workspace groups with labels and options
|
|
53
|
+
*/
|
|
54
|
+
function groupWorkspacesByTeam(workspaces, currentTeamUid) {
|
|
55
|
+
const workspacesByTeam = workspaces.reduce((acc, workspace) => {
|
|
56
|
+
const teamUid = workspace.teamUid;
|
|
57
|
+
if (!acc[teamUid]) acc[teamUid] = [];
|
|
58
|
+
acc[teamUid].push({
|
|
59
|
+
id: workspace.id,
|
|
60
|
+
label: workspace.label
|
|
61
|
+
});
|
|
62
|
+
return acc;
|
|
63
|
+
}, {});
|
|
64
|
+
const result = [];
|
|
65
|
+
if (currentTeamUid !== "local") {
|
|
66
|
+
const teamWorkspaces = workspacesByTeam[currentTeamUid] ?? [];
|
|
67
|
+
if (teamWorkspaces.length > 0) result.push({
|
|
68
|
+
label: "Team Workspaces",
|
|
69
|
+
options: teamWorkspaces
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
result.push({
|
|
73
|
+
label: "Local Workspaces",
|
|
74
|
+
options: workspacesByTeam["local"] ?? []
|
|
75
|
+
});
|
|
76
|
+
return result;
|
|
77
|
+
}
|
|
78
|
+
//#endregion
|
|
79
|
+
//#region src/v2/features/app/hooks/use-theme.ts
|
|
80
|
+
var themePresentsMap = new Map(themePresets.map((theme) => [theme.slug, theme]));
|
|
81
|
+
/**
|
|
82
|
+
* Wraps theme CSS styles in a style tag for injection into the DOM.
|
|
83
|
+
*/
|
|
84
|
+
var wrapThemeInStyleTag = (themeStyles, dataTestId = "scalar-theme") => {
|
|
85
|
+
return `<style id="scalar-theme" data-testid="${dataTestId}">${themeStyles}</style>`;
|
|
86
|
+
};
|
|
87
|
+
/**
|
|
88
|
+
* Resolves theme styles by slug from built-in presets or custom themes.
|
|
89
|
+
* Returns undefined if the theme is not found.
|
|
90
|
+
*/
|
|
91
|
+
var resolveThemeStyles = (themeSlug, customThemes) => {
|
|
92
|
+
const addFonts = (themeStyles) => {
|
|
93
|
+
return `${themeStyles}\n${defaultFonts}`;
|
|
94
|
+
};
|
|
95
|
+
if (themePresentsMap.has(themeSlug)) return addFonts(themePresentsMap.get(themeSlug)?.theme ?? "");
|
|
96
|
+
const customTheme = customThemes.find((theme) => theme.slug === themeSlug);
|
|
97
|
+
if (customTheme) return addFonts(customTheme.theme);
|
|
98
|
+
};
|
|
99
|
+
/**
|
|
100
|
+
* useTheme
|
|
101
|
+
*
|
|
102
|
+
* Reactive Vue.js hook to resolve and generate a <style> tag string based on the current theme.
|
|
103
|
+
* Automatically selects the appropriate theme styles in the following priority order:
|
|
104
|
+
* 1. Workspace theme (from the provided store, e.g. store.workspace['x-scalar-theme'])
|
|
105
|
+
* 2. Fallback theme (from the fallbackThemeSlug prop)
|
|
106
|
+
* 3. Default built-in theme (with slug "default")
|
|
107
|
+
*
|
|
108
|
+
* The returned `themeStyleTag` can be injected into your page to dynamically apply theming.
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```ts
|
|
112
|
+
* // In a Vue component setup() function
|
|
113
|
+
* import { ref } from 'vue'
|
|
114
|
+
* import { useTheme } from './use-theme'
|
|
115
|
+
*
|
|
116
|
+
* const myThemes = ref([...])
|
|
117
|
+
* const workspaceStore = ref(...)
|
|
118
|
+
* const fallbackThemeSlug = ref('dark')
|
|
119
|
+
*
|
|
120
|
+
* const { themeStyleTag } = useTheme({
|
|
121
|
+
* customThemes: myThemes,
|
|
122
|
+
* fallbackThemeSlug,
|
|
123
|
+
* store: workspaceStore
|
|
124
|
+
* })
|
|
125
|
+
*
|
|
126
|
+
* // To inject in template:
|
|
127
|
+
* // <div v-html="themeStyleTag"></div>
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
var useTheme = ({ fallbackThemeSlug, store, customThemes }) => {
|
|
131
|
+
const themeStyles = computed(() => {
|
|
132
|
+
const defaultThemeStyles = {
|
|
133
|
+
themeStyles: resolveThemeStyles("default", []),
|
|
134
|
+
themeSlug: "default"
|
|
135
|
+
};
|
|
136
|
+
const storeValue = toValue(store);
|
|
137
|
+
const fallbackThemeSlugValue = toValue(fallbackThemeSlug);
|
|
138
|
+
if (storeValue === null) return defaultThemeStyles;
|
|
139
|
+
const workspaceTheme = storeValue.workspace["x-scalar-theme"];
|
|
140
|
+
const themeSlug = workspaceTheme === "none" ? fallbackThemeSlugValue : workspaceTheme;
|
|
141
|
+
if (!themeSlug) {
|
|
142
|
+
const fallbackStyles = resolveThemeStyles(fallbackThemeSlugValue, toValue(customThemes));
|
|
143
|
+
return fallbackStyles ? {
|
|
144
|
+
themeStyles: fallbackStyles,
|
|
145
|
+
themeSlug: fallbackThemeSlugValue
|
|
146
|
+
} : defaultThemeStyles;
|
|
147
|
+
}
|
|
148
|
+
const themeStyles = resolveThemeStyles(themeSlug, toValue(customThemes));
|
|
149
|
+
if (themeStyles) return {
|
|
150
|
+
themeStyles,
|
|
151
|
+
themeSlug
|
|
152
|
+
};
|
|
153
|
+
const fallbackStyles = resolveThemeStyles(fallbackThemeSlugValue, toValue(customThemes));
|
|
154
|
+
if (fallbackStyles) return {
|
|
155
|
+
themeStyles: fallbackStyles,
|
|
156
|
+
themeSlug: fallbackThemeSlugValue
|
|
157
|
+
};
|
|
158
|
+
return defaultThemeStyles;
|
|
159
|
+
});
|
|
160
|
+
return {
|
|
161
|
+
themeStyles,
|
|
162
|
+
themeStyleTag: computed(() => {
|
|
163
|
+
return wrapThemeInStyleTag(themeStyles.value.themeStyles, themeStyles.value.themeSlug);
|
|
164
|
+
})
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/v2/helpers/get-tab-details.ts
|
|
169
|
+
/**
|
|
170
|
+
* Returns display details for a tab in the API client UI.
|
|
171
|
+
* Determines the title and icon to use based on workspace, document, path, and method.
|
|
172
|
+
*
|
|
173
|
+
* - If no workspace is provided, returns { title: 'Untitled Tab' }.
|
|
174
|
+
* - If document is present, attempts to fetch an entry using getEntryByLocation, and returns:
|
|
175
|
+
* - { title: entry.title, icon: 'document' } for document entry types,
|
|
176
|
+
* - { title: entry.title, icon: 'request' } for all other types,
|
|
177
|
+
* - If no entry found, returns { title: 'Untitled Tab' }.
|
|
178
|
+
* - If neither document nor entry is available, returns { title: 'Workspace' }.
|
|
179
|
+
*
|
|
180
|
+
* Example:
|
|
181
|
+
* ```
|
|
182
|
+
* const result = getTabDetails({
|
|
183
|
+
* workspace: "main",
|
|
184
|
+
* document: "doc1",
|
|
185
|
+
* path: "/users",
|
|
186
|
+
* method: "get",
|
|
187
|
+
* getEntryByLocation: ({ document, path, method }) => {
|
|
188
|
+
* // Mock lookup:
|
|
189
|
+
* if (document === "doc1" && path === "/users") {
|
|
190
|
+
* return { type: "document", title: "Users" }
|
|
191
|
+
* }
|
|
192
|
+
* return null
|
|
193
|
+
* }
|
|
194
|
+
* })
|
|
195
|
+
* // result: { title: "Users", icon: "document" }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
var getTabDetails = ({ workspace, document, path, method, getEntryByLocation }) => {
|
|
199
|
+
if (!workspace) return { title: "Untitled Tab" };
|
|
200
|
+
if (document) {
|
|
201
|
+
const entry = getEntryByLocation({
|
|
202
|
+
document,
|
|
203
|
+
path,
|
|
204
|
+
method
|
|
205
|
+
});
|
|
206
|
+
if (!entry) return { title: "Untitled Tab" };
|
|
207
|
+
if (entry.type === "document") return {
|
|
208
|
+
title: entry.title,
|
|
209
|
+
icon: "document"
|
|
210
|
+
};
|
|
211
|
+
return {
|
|
212
|
+
title: entry.title,
|
|
213
|
+
icon: "request"
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
return { title: "Workspace" };
|
|
217
|
+
};
|
|
218
|
+
//#endregion
|
|
219
|
+
//#region src/v2/helpers/storage.ts
|
|
220
|
+
var CURRENT_PATH_KEY = "scalar.currentPath";
|
|
221
|
+
/**
|
|
222
|
+
* Handles persistence of the active workspace ID in localStorage.
|
|
223
|
+
*
|
|
224
|
+
* Usage example:
|
|
225
|
+
* ```ts
|
|
226
|
+
* // Set the active workspace id
|
|
227
|
+
* workspaceStorage.setActiveWorkspaceId('workspace-1');
|
|
228
|
+
*
|
|
229
|
+
* // Get the currently active workspace id
|
|
230
|
+
* const id = workspaceStorage.getActiveWorkspaceId();
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
var workspaceStorage = {
|
|
234
|
+
setCurrentPath: (path) => {
|
|
235
|
+
if (path === "/") return;
|
|
236
|
+
safeLocalStorage().setItem(CURRENT_PATH_KEY, path);
|
|
237
|
+
},
|
|
238
|
+
getLastPath: () => {
|
|
239
|
+
return safeLocalStorage().getItem(CURRENT_PATH_KEY);
|
|
240
|
+
}
|
|
241
|
+
};
|
|
242
|
+
//#endregion
|
|
243
|
+
//#region src/v2/features/app/app-events.ts
|
|
244
|
+
function initializeAppEventHandlers({ eventBus, store, router, rebuildSidebar, navigateToCurrentTab, onSelectSidebarItem, onAfterExampleCreation, onCopyTabUrl, onToggleSidebar, closeSidebar, renameWorkspace }) {
|
|
245
|
+
const currentRoute = computed(() => router.currentRoute?.value);
|
|
246
|
+
/**
|
|
247
|
+
* Checks if the current route params match the specified operation meta.
|
|
248
|
+
* Useful for determining if the sidebar or UI needs to be updated after changes to operations/examples.
|
|
249
|
+
*
|
|
250
|
+
* NOTE: It may be beneficial to compare to the active state instead of the router
|
|
251
|
+
*/
|
|
252
|
+
const isRouteParamsMatch = ({ documentName, path, method, exampleName }) => {
|
|
253
|
+
if (documentName !== void 0 && documentName !== currentRoute.value?.params.documentSlug) return false;
|
|
254
|
+
if (path !== void 0 && encodeURIComponent(path) !== currentRoute.value?.params.pathEncoded) return false;
|
|
255
|
+
if (method !== void 0 && method !== currentRoute.value?.params.method) return false;
|
|
256
|
+
if (exampleName !== void 0 && exampleName !== currentRoute.value?.params.exampleName) return false;
|
|
257
|
+
return true;
|
|
258
|
+
};
|
|
259
|
+
initializeWorkspaceEventHandlers({
|
|
260
|
+
eventBus,
|
|
261
|
+
store,
|
|
262
|
+
hooks: {
|
|
263
|
+
"document:delete:document": { onAfterExecute: async (payload) => {
|
|
264
|
+
if (currentRoute?.value?.params.documentSlug === payload.name) await router.push({ name: "workspace.environment" });
|
|
265
|
+
} },
|
|
266
|
+
"operation:update:pathMethod": { onBeforeExecute: (payload) => ({
|
|
267
|
+
...payload,
|
|
268
|
+
callback: async (status) => {
|
|
269
|
+
if (status === "success") {
|
|
270
|
+
rebuildSidebar(store.value?.workspace.activeDocument?.["x-scalar-navigation"]?.name);
|
|
271
|
+
await router.replace({
|
|
272
|
+
name: "example",
|
|
273
|
+
params: {
|
|
274
|
+
method: payload.payload.method,
|
|
275
|
+
pathEncoded: encodeURIComponent(payload.payload.path),
|
|
276
|
+
exampleName: currentRoute.value?.params.exampleName
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
payload.callback(status);
|
|
281
|
+
}
|
|
282
|
+
}) },
|
|
283
|
+
"operation:upsert:parameter": { onAfterExecute: (payload) => onAfterExampleCreation(payload.meta) },
|
|
284
|
+
"operation:update:extra-parameters": { onAfterExecute: (payload) => onAfterExampleCreation(payload.meta) },
|
|
285
|
+
"operation:reload:history": { onAfterExecute: (payload) => onAfterExampleCreation({
|
|
286
|
+
...payload.meta,
|
|
287
|
+
exampleKey: "draft"
|
|
288
|
+
}) },
|
|
289
|
+
"operation:delete:operation": { onAfterExecute: async (payload) => {
|
|
290
|
+
rebuildSidebar(payload.documentName);
|
|
291
|
+
const { documentName, meta: { path, method } } = payload;
|
|
292
|
+
if (isRouteParamsMatch({
|
|
293
|
+
documentName,
|
|
294
|
+
path,
|
|
295
|
+
method
|
|
296
|
+
})) await router.replace({
|
|
297
|
+
name: "document.overview",
|
|
298
|
+
params: { documentSlug: documentName }
|
|
299
|
+
});
|
|
300
|
+
} },
|
|
301
|
+
"operation:create:draft-example": { onAfterExecute: async (payload) => {
|
|
302
|
+
onAfterExampleCreation({
|
|
303
|
+
...payload.meta,
|
|
304
|
+
exampleKey: payload.exampleName
|
|
305
|
+
});
|
|
306
|
+
await router.push({
|
|
307
|
+
name: "example",
|
|
308
|
+
params: {
|
|
309
|
+
documentSlug: payload.documentName,
|
|
310
|
+
pathEncoded: encodeURIComponent(payload.meta.path),
|
|
311
|
+
method: payload.meta.method,
|
|
312
|
+
exampleName: payload.exampleName
|
|
313
|
+
}
|
|
314
|
+
});
|
|
315
|
+
} },
|
|
316
|
+
"operation:delete:example": { onAfterExecute: async (payload) => {
|
|
317
|
+
rebuildSidebar(payload.documentName);
|
|
318
|
+
const { documentName, meta: { path, method, exampleKey } } = payload;
|
|
319
|
+
if (isRouteParamsMatch({
|
|
320
|
+
documentName,
|
|
321
|
+
path,
|
|
322
|
+
method,
|
|
323
|
+
exampleName: exampleKey
|
|
324
|
+
})) await router.replace({
|
|
325
|
+
name: "example",
|
|
326
|
+
params: {
|
|
327
|
+
pathEncoded: encodeURIComponent(path),
|
|
328
|
+
method,
|
|
329
|
+
documentSlug: documentName,
|
|
330
|
+
exampleName: "default"
|
|
331
|
+
}
|
|
332
|
+
});
|
|
333
|
+
} },
|
|
334
|
+
"operation:rename:example": { onAfterExecute: async ({ meta, payload, documentName }) => {
|
|
335
|
+
onAfterExampleCreation({
|
|
336
|
+
...meta,
|
|
337
|
+
exampleKey: payload.name,
|
|
338
|
+
documentName
|
|
339
|
+
});
|
|
340
|
+
if (isRouteParamsMatch({
|
|
341
|
+
documentName,
|
|
342
|
+
path: meta.path,
|
|
343
|
+
method: meta.method,
|
|
344
|
+
exampleName: meta.exampleKey
|
|
345
|
+
})) await router.replace({
|
|
346
|
+
name: "example",
|
|
347
|
+
params: {
|
|
348
|
+
documentSlug: documentName,
|
|
349
|
+
pathEncoded: encodeURIComponent(meta.path),
|
|
350
|
+
method: meta.method,
|
|
351
|
+
exampleName: payload.name
|
|
352
|
+
}
|
|
353
|
+
});
|
|
354
|
+
} },
|
|
355
|
+
"operation:update:requestBody:value": { onAfterExecute: (payload) => onAfterExampleCreation(payload.meta) },
|
|
356
|
+
"operation:update:requestBody:formValue": { onAfterExecute: (payload) => onAfterExampleCreation(payload.meta) },
|
|
357
|
+
"tag:create:tag": { onAfterExecute: (payload) => rebuildSidebar(payload.documentName) },
|
|
358
|
+
"tag:edit:tag": { onAfterExecute: async (payload) => {
|
|
359
|
+
rebuildSidebar(payload.documentName);
|
|
360
|
+
if (payload.tag.children?.some((child) => child.type === "operation" && isRouteParamsMatch({
|
|
361
|
+
documentName: payload.documentName,
|
|
362
|
+
path: child.path,
|
|
363
|
+
method: child.method
|
|
364
|
+
}))) await router.replace({ ...currentRoute.value });
|
|
365
|
+
} },
|
|
366
|
+
"tag:delete:tag": { onAfterExecute: (payload) => rebuildSidebar(payload.documentName) },
|
|
367
|
+
"tabs:add:tab": { onAfterExecute: navigateToCurrentTab },
|
|
368
|
+
"tabs:close:tab": { onAfterExecute: navigateToCurrentTab },
|
|
369
|
+
"tabs:focus:tab": { onAfterExecute: navigateToCurrentTab },
|
|
370
|
+
"tabs:focus:tab-last": { onAfterExecute: navigateToCurrentTab },
|
|
371
|
+
"tabs:navigate:previous": { onAfterExecute: navigateToCurrentTab },
|
|
372
|
+
"tabs:navigate:next": { onAfterExecute: navigateToCurrentTab },
|
|
373
|
+
"tabs:update:tabs": { onAfterExecute: navigateToCurrentTab }
|
|
374
|
+
}
|
|
375
|
+
});
|
|
376
|
+
eventBus.on("workspace:update:name", (payload) => renameWorkspace(payload));
|
|
377
|
+
eventBus.on("scroll-to:nav-item", ({ id }) => onSelectSidebarItem(id));
|
|
378
|
+
eventBus.on("ui:toggle:sidebar", onToggleSidebar);
|
|
379
|
+
/**
|
|
380
|
+
* Bind the inernal navigation to a public api
|
|
381
|
+
*/
|
|
382
|
+
eventBus.on("ui:navigate", async (payload) => {
|
|
383
|
+
const { replace = false } = payload;
|
|
384
|
+
const fn = replace ? router.replace : router.push;
|
|
385
|
+
const execCallback = (result) => {
|
|
386
|
+
if (!result) {
|
|
387
|
+
closeSidebar();
|
|
388
|
+
return payload.callback?.("success");
|
|
389
|
+
}
|
|
390
|
+
const navigationFailure = NavigationFailureType.duplicated;
|
|
391
|
+
if (result.type !== navigationFailure) return payload.callback?.("error");
|
|
392
|
+
return payload.callback?.("success");
|
|
393
|
+
};
|
|
394
|
+
if (payload.page === "document") {
|
|
395
|
+
const params = {
|
|
396
|
+
documentSlug: payload.documentSlug,
|
|
397
|
+
workspaceSlug: payload.workspaceSlug,
|
|
398
|
+
namespace: payload.namespace
|
|
399
|
+
};
|
|
400
|
+
if (payload.path === "overview") return execCallback(await fn({
|
|
401
|
+
name: "document.overview",
|
|
402
|
+
params
|
|
403
|
+
}));
|
|
404
|
+
if (payload.path === "servers") return execCallback(await fn({
|
|
405
|
+
name: "document.servers",
|
|
406
|
+
params
|
|
407
|
+
}));
|
|
408
|
+
if (payload.path === "environment") return execCallback(await fn({
|
|
409
|
+
name: "document.environment",
|
|
410
|
+
params
|
|
411
|
+
}));
|
|
412
|
+
if (payload.path === "authentication") return execCallback(await fn({
|
|
413
|
+
name: "document.authentication",
|
|
414
|
+
params
|
|
415
|
+
}));
|
|
416
|
+
if (payload.path === "cookies") return execCallback(await fn({
|
|
417
|
+
name: "document.cookies",
|
|
418
|
+
params
|
|
419
|
+
}));
|
|
420
|
+
if (payload.path === "settings") return execCallback(await fn({
|
|
421
|
+
name: "document.settings",
|
|
422
|
+
params
|
|
423
|
+
}));
|
|
424
|
+
}
|
|
425
|
+
if (payload.page === "workspace") {
|
|
426
|
+
const params = {
|
|
427
|
+
workspaceSlug: payload.workspaceSlug,
|
|
428
|
+
namespace: payload.namespace
|
|
429
|
+
};
|
|
430
|
+
if (payload.path === "environment") return execCallback(await fn({
|
|
431
|
+
name: "workspace.environment",
|
|
432
|
+
params
|
|
433
|
+
}));
|
|
434
|
+
if (payload.path === "cookies") return execCallback(await fn({
|
|
435
|
+
name: "workspace.cookies",
|
|
436
|
+
params
|
|
437
|
+
}));
|
|
438
|
+
if (payload.path === "settings") return execCallback(await fn({
|
|
439
|
+
name: "workspace.settings",
|
|
440
|
+
params
|
|
441
|
+
}));
|
|
442
|
+
}
|
|
443
|
+
if (payload.page === "example") return execCallback(await fn({
|
|
444
|
+
name: "example",
|
|
445
|
+
params: {
|
|
446
|
+
namespace: payload.namespace,
|
|
447
|
+
workspaceSlug: payload.workspaceSlug,
|
|
448
|
+
documentSlug: payload.documentSlug,
|
|
449
|
+
pathEncoded: encodeURIComponent(payload.path),
|
|
450
|
+
method: payload.method,
|
|
451
|
+
exampleName: payload.exampleName
|
|
452
|
+
}
|
|
453
|
+
}));
|
|
454
|
+
if (payload.page === "operation") {
|
|
455
|
+
const params = {
|
|
456
|
+
namespace: payload.namespace,
|
|
457
|
+
workspaceSlug: payload.workspaceSlug,
|
|
458
|
+
documentSlug: payload.documentSlug,
|
|
459
|
+
pathEncoded: encodeURIComponent(payload.operationPath),
|
|
460
|
+
method: payload.method
|
|
461
|
+
};
|
|
462
|
+
if (payload.path === "overview") return execCallback(await fn({
|
|
463
|
+
name: "operation.overview",
|
|
464
|
+
params
|
|
465
|
+
}));
|
|
466
|
+
if (payload.path === "servers") return execCallback(await fn({
|
|
467
|
+
name: "operation.servers",
|
|
468
|
+
params
|
|
469
|
+
}));
|
|
470
|
+
if (payload.path === "authentication") return execCallback(await fn({
|
|
471
|
+
name: "operation.authentication",
|
|
472
|
+
params
|
|
473
|
+
}));
|
|
474
|
+
}
|
|
475
|
+
});
|
|
476
|
+
eventBus.on("tabs:copy:url", (payload) => onCopyTabUrl(payload.index));
|
|
477
|
+
}
|
|
478
|
+
//#endregion
|
|
479
|
+
//#region src/v2/features/app/helpers/filter-workspaces.ts
|
|
480
|
+
/**
|
|
481
|
+
* Filters workspaces to show only those accessible to the current team.
|
|
482
|
+
*
|
|
483
|
+
* A workspace is accessible if:
|
|
484
|
+
* - Its teamUid matches the current team, OR
|
|
485
|
+
* - Its teamUid is 'local' (local workspaces are always accessible)
|
|
486
|
+
*
|
|
487
|
+
* @param workspaces - Array of workspaces to filter
|
|
488
|
+
* @param currentTeamUid - The currently active team identifier
|
|
489
|
+
* @returns Filtered array of workspaces accessible to the current team
|
|
490
|
+
*
|
|
491
|
+
* @example
|
|
492
|
+
* ```ts
|
|
493
|
+
* const workspaces = [
|
|
494
|
+
* { id: '1', teamUid: 'local', name: 'Local' },
|
|
495
|
+
* { id: '2', teamUid: 'team-a', name: 'Team A' },
|
|
496
|
+
* { id: '3', teamUid: 'team-b', name: 'Team B' },
|
|
497
|
+
* ]
|
|
498
|
+
*
|
|
499
|
+
* filterWorkspacesByTeam(workspaces, 'team-a')
|
|
500
|
+
* // => [{ id: '1', teamUid: 'local' }, { id: '2', teamUid: 'team-a' }]
|
|
501
|
+
* ```
|
|
502
|
+
*/
|
|
503
|
+
var filterWorkspacesByTeam = (workspaces, currentTeamUid) => {
|
|
504
|
+
return workspaces.filter((workspace) => canLoadWorkspace(workspace.teamUid, currentTeamUid));
|
|
505
|
+
};
|
|
506
|
+
/**
|
|
507
|
+
* Checks if a workspace can be loaded by the current team.
|
|
508
|
+
*
|
|
509
|
+
* A workspace can be loaded if:
|
|
510
|
+
* - Its teamUid matches the current team, OR
|
|
511
|
+
* - Its teamUid is 'local' (local workspaces are always accessible)
|
|
512
|
+
*
|
|
513
|
+
* This is used during route changes to prevent users from accessing
|
|
514
|
+
* workspaces that do not belong to their active team.
|
|
515
|
+
*
|
|
516
|
+
* @param workspaceTeamUid - The team identifier of the workspace to check
|
|
517
|
+
* @param currentTeamUid - The currently active team identifier
|
|
518
|
+
* @returns true if the workspace can be loaded, false otherwise
|
|
519
|
+
*
|
|
520
|
+
* @example
|
|
521
|
+
* ```ts
|
|
522
|
+
* canLoadWorkspace('team-a', 'team-a') // => true
|
|
523
|
+
* canLoadWorkspace('local', 'team-a') // => true
|
|
524
|
+
* canLoadWorkspace('team-b', 'team-a') // => false
|
|
525
|
+
* ```
|
|
526
|
+
*/
|
|
527
|
+
var canLoadWorkspace = (workspaceTeamUid, currentTeamUid) => {
|
|
528
|
+
return workspaceTeamUid === currentTeamUid || workspaceTeamUid === "local";
|
|
529
|
+
};
|
|
530
|
+
//#endregion
|
|
531
|
+
//#region src/v2/features/app/app-state.ts
|
|
532
|
+
/** Default debounce delay in milliseconds for workspace store persistence. */
|
|
533
|
+
var DEFAULT_DEBOUNCE_DELAY = 1e3;
|
|
534
|
+
/** Default sidebar width in pixels. */
|
|
535
|
+
var DEFAULT_SIDEBAR_WIDTH = 288;
|
|
536
|
+
var createAppState = async ({ router, fileLoader, fallbackThemeSlug = () => "default", customThemes = () => [] }) => {
|
|
537
|
+
/** Workspace event bus for handling workspace-level events. */
|
|
538
|
+
const eventBus = createWorkspaceEventBus({ debug: false });
|
|
539
|
+
const { workspace: persistence } = await createWorkspaceStorePersistence();
|
|
540
|
+
/**
|
|
541
|
+
* Run migration from localStorage to IndexedDB if needed
|
|
542
|
+
* This happens once per user and transforms old data structure to new workspace format
|
|
543
|
+
*/
|
|
544
|
+
await migrateLocalStorageToIndexDb();
|
|
545
|
+
const teamUid = ref("local");
|
|
546
|
+
const namespace = ref(void 0);
|
|
547
|
+
const workspaceSlug = ref(void 0);
|
|
548
|
+
const documentSlug = ref(void 0);
|
|
549
|
+
const method = ref(void 0);
|
|
550
|
+
const path = ref(void 0);
|
|
551
|
+
const exampleName = ref(void 0);
|
|
552
|
+
const isSyncingWorkspace = ref(false);
|
|
553
|
+
router.afterEach((to) => handleRouteChange(to));
|
|
554
|
+
const currentRoute = computed(() => router.currentRoute.value ?? null);
|
|
555
|
+
const activeWorkspace = shallowRef(null);
|
|
556
|
+
const workspaces = ref([]);
|
|
557
|
+
const filteredWorkspaces = computed(() => filterWorkspacesByTeam(workspaces.value, teamUid.value));
|
|
558
|
+
const workspaceGroups = computed(() => groupWorkspacesByTeam(filteredWorkspaces.value, teamUid.value));
|
|
559
|
+
const store = shallowRef(null);
|
|
560
|
+
const activeDocument = computed(() => {
|
|
561
|
+
return store.value?.workspace.documents[documentSlug.value ?? ""] || null;
|
|
562
|
+
});
|
|
563
|
+
/**
|
|
564
|
+
* Merged environment variables from workspace and document levels.
|
|
565
|
+
* Variables from both sources are combined, with document variables
|
|
566
|
+
* taking precedence in case of naming conflicts.
|
|
567
|
+
*/
|
|
568
|
+
const environment = computed(() => getActiveEnvironment(store.value, activeDocument.value));
|
|
569
|
+
/** Update the workspace list when the component is mounted */
|
|
570
|
+
workspaces.value = await persistence.getAll().then((w) => w.map(({ teamUid, namespace, slug, name }) => ({
|
|
571
|
+
id: getWorkspaceId(namespace, slug),
|
|
572
|
+
teamUid,
|
|
573
|
+
namespace,
|
|
574
|
+
slug,
|
|
575
|
+
label: name
|
|
576
|
+
})));
|
|
577
|
+
/**
|
|
578
|
+
* Renames the currently active workspace.
|
|
579
|
+
* Updates the workspace name in persistence and updates activeWorkspace if successful.
|
|
580
|
+
* Returns early if namespace or workspaceSlug is not set, or if update fails.
|
|
581
|
+
*/
|
|
582
|
+
const renameWorkspace = async (name) => {
|
|
583
|
+
const namespaceValue = namespace.value;
|
|
584
|
+
const slugValue = workspaceSlug.value;
|
|
585
|
+
if (!namespaceValue || !slugValue) return;
|
|
586
|
+
const workspaceId = getWorkspaceId(namespaceValue, slugValue);
|
|
587
|
+
if (await persistence.updateName({
|
|
588
|
+
namespace: namespaceValue,
|
|
589
|
+
slug: slugValue
|
|
590
|
+
}, name) === void 0) return;
|
|
591
|
+
workspaces.value = workspaces.value.map((workspace) => {
|
|
592
|
+
if (workspace.id === workspaceId) return {
|
|
593
|
+
...workspace,
|
|
594
|
+
label: name
|
|
595
|
+
};
|
|
596
|
+
return workspace;
|
|
597
|
+
});
|
|
598
|
+
activeWorkspace.value = {
|
|
599
|
+
id: workspaceId,
|
|
600
|
+
label: name
|
|
601
|
+
};
|
|
602
|
+
};
|
|
603
|
+
/**
|
|
604
|
+
* Creates a client-side workspace store with persistence enabled for the given workspace id.
|
|
605
|
+
*/
|
|
606
|
+
const createClientStore = async ({ namespace, slug }) => {
|
|
607
|
+
return createWorkspaceStore({
|
|
608
|
+
plugins: [await persistencePlugin({
|
|
609
|
+
workspaceId: getWorkspaceId(namespace, slug),
|
|
610
|
+
debounceDelay: DEFAULT_DEBOUNCE_DELAY
|
|
611
|
+
})],
|
|
612
|
+
fileLoader
|
|
613
|
+
});
|
|
614
|
+
};
|
|
615
|
+
/**
|
|
616
|
+
* Attempts to load and activate a workspace by id.
|
|
617
|
+
* Returns true when the workspace was found and activated.
|
|
618
|
+
*/
|
|
619
|
+
const loadWorkspace = async (namespace, slug) => {
|
|
620
|
+
const workspace = await persistence.getItem({
|
|
621
|
+
namespace,
|
|
622
|
+
slug
|
|
623
|
+
});
|
|
624
|
+
if (!workspace) return { success: false };
|
|
625
|
+
const client = await createClientStore({
|
|
626
|
+
namespace,
|
|
627
|
+
slug
|
|
628
|
+
});
|
|
629
|
+
client.loadWorkspace(workspace.workspace);
|
|
630
|
+
activeWorkspace.value = {
|
|
631
|
+
id: getWorkspaceId(workspace.namespace, workspace.slug),
|
|
632
|
+
label: workspace.name
|
|
633
|
+
};
|
|
634
|
+
store.value = client;
|
|
635
|
+
return {
|
|
636
|
+
success: true,
|
|
637
|
+
workspace: client.workspace
|
|
638
|
+
};
|
|
639
|
+
};
|
|
640
|
+
/**
|
|
641
|
+
* Creates and persists the default workspace with a blank draft document.
|
|
642
|
+
* Used when no workspaces exist yet.
|
|
643
|
+
*/
|
|
644
|
+
const createAndPersistWorkspace = async ({ name, teamUid, namespace, slug }) => {
|
|
645
|
+
const draftStore = createWorkspaceStore();
|
|
646
|
+
await draftStore.addDocument({
|
|
647
|
+
name: "drafts",
|
|
648
|
+
document: {
|
|
649
|
+
openapi: "3.1.0",
|
|
650
|
+
info: {
|
|
651
|
+
title: "Drafts",
|
|
652
|
+
version: "1.0.0"
|
|
653
|
+
},
|
|
654
|
+
paths: { "/": { get: {} } },
|
|
655
|
+
"x-scalar-original-document-hash": "drafts",
|
|
656
|
+
"x-scalar-icon": "interface-edit-tool-pencil"
|
|
657
|
+
}
|
|
658
|
+
});
|
|
659
|
+
const workspace = await persistence.setItem({
|
|
660
|
+
namespace,
|
|
661
|
+
slug
|
|
662
|
+
}, {
|
|
663
|
+
name,
|
|
664
|
+
teamUid,
|
|
665
|
+
workspace: draftStore.exportWorkspace()
|
|
666
|
+
});
|
|
667
|
+
workspaces.value.push({
|
|
668
|
+
id: getWorkspaceId(workspace.namespace, workspace.slug),
|
|
669
|
+
teamUid: workspace.teamUid,
|
|
670
|
+
namespace: workspace.namespace,
|
|
671
|
+
slug: workspace.slug,
|
|
672
|
+
label: workspace.name
|
|
673
|
+
});
|
|
674
|
+
return workspace;
|
|
675
|
+
};
|
|
676
|
+
/**
|
|
677
|
+
* Navigates to the overview page of the specified workspace.
|
|
678
|
+
*
|
|
679
|
+
* @param namespace - The workspace namespace.
|
|
680
|
+
* @param slug - The unique workspace slug (identifier).
|
|
681
|
+
*/
|
|
682
|
+
const navigateToWorkspace = async (namespace, slug) => {
|
|
683
|
+
if (!namespace || !slug) {
|
|
684
|
+
await router.push("/");
|
|
685
|
+
return;
|
|
686
|
+
}
|
|
687
|
+
await router.push({
|
|
688
|
+
name: "example",
|
|
689
|
+
params: {
|
|
690
|
+
namespace,
|
|
691
|
+
workspaceSlug: slug,
|
|
692
|
+
documentSlug: "drafts",
|
|
693
|
+
pathEncoded: encodeURIComponent("/"),
|
|
694
|
+
method: "get",
|
|
695
|
+
exampleName: "default"
|
|
696
|
+
}
|
|
697
|
+
});
|
|
698
|
+
};
|
|
699
|
+
/**
|
|
700
|
+
* Creates a new workspace with the provided name.
|
|
701
|
+
* - Generates a unique slug for the workspace (uses the provided slug if it is unique, otherwise generates a unique slug).
|
|
702
|
+
* - Adds a default blank document ("drafts") to the workspace.
|
|
703
|
+
* - Persists the workspace and navigates to it.
|
|
704
|
+
*
|
|
705
|
+
* Example usage:
|
|
706
|
+
* await createWorkspace({ name: 'My Awesome API' })
|
|
707
|
+
* // -> Navigates to /workspace/my-awesome-api (if available)
|
|
708
|
+
*/
|
|
709
|
+
const createWorkspace = async ({ teamUid, namespace, slug, name }) => {
|
|
710
|
+
store.value = null;
|
|
711
|
+
const newWorkspaceSlug = await generateUniqueValue({
|
|
712
|
+
defaultValue: slug ?? name,
|
|
713
|
+
validation: async (value) => !await persistence.has({
|
|
714
|
+
namespace: namespace ?? "local",
|
|
715
|
+
slug: value
|
|
716
|
+
}),
|
|
717
|
+
maxRetries: 100,
|
|
718
|
+
transformation: slugify
|
|
719
|
+
});
|
|
720
|
+
if (!newWorkspaceSlug) return;
|
|
721
|
+
const createdWorkspace = await createAndPersistWorkspace({
|
|
722
|
+
teamUid,
|
|
723
|
+
namespace,
|
|
724
|
+
slug: newWorkspaceSlug,
|
|
725
|
+
name
|
|
726
|
+
});
|
|
727
|
+
await navigateToWorkspace(createdWorkspace.namespace, createdWorkspace.slug);
|
|
728
|
+
return createdWorkspace;
|
|
729
|
+
};
|
|
730
|
+
/**
|
|
731
|
+
* Handles changing the active workspace when the workspace slug changes in the route.
|
|
732
|
+
* This function:
|
|
733
|
+
* - Clears the current workspace store and sets loading state.
|
|
734
|
+
* - Attempts to load the workspace by slug.
|
|
735
|
+
* - If found, navigates to the active tab path (if available).
|
|
736
|
+
* - If not found, creates the default workspace and navigates to it.
|
|
737
|
+
*/
|
|
738
|
+
const changeWorkspace = async (namespace, slug) => {
|
|
739
|
+
store.value = null;
|
|
740
|
+
isSyncingWorkspace.value = true;
|
|
741
|
+
const result = await loadWorkspace(namespace, slug);
|
|
742
|
+
if (result.success) {
|
|
743
|
+
const index = result.workspace["x-scalar-active-tab"] ?? 0;
|
|
744
|
+
const tabs = result.workspace["x-scalar-tabs"];
|
|
745
|
+
const tab = tabs?.[index];
|
|
746
|
+
if (tab) await router.replace({
|
|
747
|
+
path: tab.path,
|
|
748
|
+
query: currentRoute.value?.query ?? {}
|
|
749
|
+
});
|
|
750
|
+
if (tabs && index >= tabs.length) eventBus.emit("tabs:update:tabs", { "x-scalar-active-tab": 0 });
|
|
751
|
+
if (!tabs) eventBus.emit("tabs:update:tabs", {
|
|
752
|
+
"x-scalar-tabs": [createTabFromRoute(currentRoute.value)],
|
|
753
|
+
"x-scalar-active-tab": 0
|
|
754
|
+
});
|
|
755
|
+
isSyncingWorkspace.value = false;
|
|
756
|
+
return;
|
|
757
|
+
}
|
|
758
|
+
const targetWorkspace = filteredWorkspaces.value.find((workspace) => workspace.teamUid === "local" && workspace.slug === "default") ?? filteredWorkspaces.value[0];
|
|
759
|
+
if (targetWorkspace) return navigateToWorkspace(targetWorkspace.namespace, targetWorkspace.slug);
|
|
760
|
+
const createResult = await createWorkspace({
|
|
761
|
+
name: "Default Workspace",
|
|
762
|
+
slug: "default"
|
|
763
|
+
});
|
|
764
|
+
isSyncingWorkspace.value = false;
|
|
765
|
+
if (!createResult) return console.error("Failed to create the default workspace, something went wrong, can not load the workspace");
|
|
766
|
+
sidebarState.reset();
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Sets the current team context. If the active workspace is not accessible
|
|
770
|
+
* with the new team, navigates to the default workspace for that team.
|
|
771
|
+
*/
|
|
772
|
+
const setTeamUid = (value) => {
|
|
773
|
+
teamUid.value = value;
|
|
774
|
+
const workspace = filteredWorkspaces.value.find((w) => w.namespace === namespace.value && w.slug === workspaceSlug.value);
|
|
775
|
+
if (workspace && canLoadWorkspace(workspace.teamUid, value)) return;
|
|
776
|
+
return navigateToWorkspace("local", "default");
|
|
777
|
+
};
|
|
778
|
+
const entries = computed(() => {
|
|
779
|
+
const activeStore = store.value;
|
|
780
|
+
if (!activeStore) return [];
|
|
781
|
+
const order = activeStore.workspace["x-scalar-order"] ?? Object.keys(activeStore.workspace.documents);
|
|
782
|
+
return sortByOrder(Object.keys(activeStore.workspace.documents), order, (item) => item).map((doc) => activeStore.workspace.documents[doc]?.["x-scalar-navigation"]).filter(isDefined);
|
|
783
|
+
});
|
|
784
|
+
const sidebarState = createSidebarState(entries);
|
|
785
|
+
/**
|
|
786
|
+
* Generates a unique string ID for an API location, based on the document, path, method, and example.
|
|
787
|
+
* Filters out undefined values and serializes the composite array into a stable string.
|
|
788
|
+
*
|
|
789
|
+
* @param params - An object containing document, path, method, and optional example name.
|
|
790
|
+
* @returns A stringified array representing the unique location identifier.
|
|
791
|
+
*
|
|
792
|
+
* Example:
|
|
793
|
+
* generateId({ document: 'mydoc', path: '/users', method: 'get', example: 'default' })
|
|
794
|
+
* // => '["mydoc","/users","get","default"]'
|
|
795
|
+
*/
|
|
796
|
+
const generateId = ({ document, path, method, example }) => {
|
|
797
|
+
return JSON.stringify([
|
|
798
|
+
document,
|
|
799
|
+
path,
|
|
800
|
+
method,
|
|
801
|
+
example
|
|
802
|
+
].filter(isDefined));
|
|
803
|
+
};
|
|
804
|
+
/**
|
|
805
|
+
* Computed index for fast lookup of sidebar nodes by their unique API location.
|
|
806
|
+
*
|
|
807
|
+
* - Only indexes nodes of type 'document', 'operation', or 'example'.
|
|
808
|
+
* - The lookup key is a serialized array of: [documentName, operationPath, operationMethod, exampleName?].
|
|
809
|
+
* - Supports precise resolution of sidebar entries given an API "location".
|
|
810
|
+
*/
|
|
811
|
+
const locationIndex = computed(() => generateReverseIndex({
|
|
812
|
+
items: entries.value,
|
|
813
|
+
nestedKey: "children",
|
|
814
|
+
filter: (node) => node.type === "document" || node.type === "operation" || node.type === "example",
|
|
815
|
+
getId: (node) => {
|
|
816
|
+
const document = getParentEntry("document", node);
|
|
817
|
+
const operation = getParentEntry("operation", node);
|
|
818
|
+
return generateId({
|
|
819
|
+
document: document?.name ?? "",
|
|
820
|
+
path: operation?.path,
|
|
821
|
+
method: operation?.method,
|
|
822
|
+
example: node.type === "example" ? node.name : void 0
|
|
823
|
+
});
|
|
824
|
+
}
|
|
825
|
+
}));
|
|
826
|
+
/**
|
|
827
|
+
* Looks up a sidebar entry by its unique API location.
|
|
828
|
+
* - First tries to find an entry matching all provided properties (including example).
|
|
829
|
+
* - If not found, falls back to matching only the operation (ignores example field).
|
|
830
|
+
* This allows resolving either examples, operations, or documents as appropriate.
|
|
831
|
+
*
|
|
832
|
+
* @param location - Object specifying the document name, path, method, and optional example name.
|
|
833
|
+
* @returns The matching sidebar entry, or undefined if none found.
|
|
834
|
+
*
|
|
835
|
+
* Example:
|
|
836
|
+
* const entry = getEntryByLocation({
|
|
837
|
+
* document: 'pets',
|
|
838
|
+
* path: '/pets',
|
|
839
|
+
* method: 'get',
|
|
840
|
+
* example: 'default',
|
|
841
|
+
* })
|
|
842
|
+
*/
|
|
843
|
+
const getEntryByLocation = (location) => {
|
|
844
|
+
const entryWithExample = locationIndex.value.get(generateId(location));
|
|
845
|
+
if (entryWithExample) return entryWithExample;
|
|
846
|
+
return locationIndex.value.get(generateId({
|
|
847
|
+
document: location.document,
|
|
848
|
+
path: location.path,
|
|
849
|
+
method: location.method
|
|
850
|
+
}));
|
|
851
|
+
};
|
|
852
|
+
/**
|
|
853
|
+
* Handles item selection from the sidebar and routes navigation accordingly.
|
|
854
|
+
*
|
|
855
|
+
* Example:
|
|
856
|
+
* handleSelectItem('id-of-entry')
|
|
857
|
+
*/
|
|
858
|
+
const handleSelectItem = (id) => {
|
|
859
|
+
const entry = sidebarState.getEntryById(id);
|
|
860
|
+
if (!entry) {
|
|
861
|
+
console.warn(`Could not find sidebar entry with id ${id} to select`);
|
|
862
|
+
return;
|
|
863
|
+
}
|
|
864
|
+
/** Close sidebar and navigate. Used for every branch that performs navigation. */
|
|
865
|
+
const navigate = (route) => {
|
|
866
|
+
isSidebarOpen.value = false;
|
|
867
|
+
return router.push(route);
|
|
868
|
+
};
|
|
869
|
+
if (entry.type === "document") {
|
|
870
|
+
if (sidebarState.selectedItem.value === id) {
|
|
871
|
+
sidebarState.setExpanded(id, !sidebarState.isExpanded(id));
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
sidebarState.setSelected(id);
|
|
875
|
+
sidebarState.setExpanded(id, true);
|
|
876
|
+
return navigate({
|
|
877
|
+
name: "document.overview",
|
|
878
|
+
params: { documentSlug: entry.name }
|
|
879
|
+
});
|
|
880
|
+
}
|
|
881
|
+
if (entry.type === "operation") {
|
|
882
|
+
if (sidebarState.isSelected(id) && sidebarState.selectedItem.value !== id) {
|
|
883
|
+
sidebarState.setExpanded(id, !sidebarState.isExpanded(id));
|
|
884
|
+
return;
|
|
885
|
+
}
|
|
886
|
+
const firstExample = entry.children?.find((child) => child.type === "example");
|
|
887
|
+
if (firstExample) {
|
|
888
|
+
sidebarState.setSelected(firstExample.id);
|
|
889
|
+
sidebarState.setExpanded(firstExample.id, true);
|
|
890
|
+
} else sidebarState.setSelected(id);
|
|
891
|
+
return navigate({
|
|
892
|
+
name: "example",
|
|
893
|
+
params: {
|
|
894
|
+
documentSlug: getParentEntry("document", entry)?.name,
|
|
895
|
+
pathEncoded: encodeURIComponent(entry.path),
|
|
896
|
+
method: entry.method,
|
|
897
|
+
exampleName: firstExample?.name ?? "default"
|
|
898
|
+
}
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
if (entry.type === "example") {
|
|
902
|
+
sidebarState.setSelected(id);
|
|
903
|
+
const operation = getParentEntry("operation", entry);
|
|
904
|
+
return navigate({
|
|
905
|
+
name: "example",
|
|
906
|
+
params: {
|
|
907
|
+
documentSlug: getParentEntry("document", entry)?.name,
|
|
908
|
+
pathEncoded: encodeURIComponent(operation?.path ?? ""),
|
|
909
|
+
method: operation?.method,
|
|
910
|
+
exampleName: entry.name
|
|
911
|
+
}
|
|
912
|
+
});
|
|
913
|
+
}
|
|
914
|
+
if (entry.type === "text") return navigate({
|
|
915
|
+
name: "document.overview",
|
|
916
|
+
params: { documentSlug: getParentEntry("document", entry)?.name }
|
|
917
|
+
});
|
|
918
|
+
sidebarState.setExpanded(id, !sidebarState.isExpanded(id));
|
|
919
|
+
};
|
|
920
|
+
/**
|
|
921
|
+
* Navigates to the currently active tab's path using the router.
|
|
922
|
+
* Returns early if the workspace store or active tab is unavailable.
|
|
923
|
+
*/
|
|
924
|
+
const navigateToCurrentTab = async () => {
|
|
925
|
+
if (!store.value) return;
|
|
926
|
+
const activeTabIndex = store.value.workspace["x-scalar-active-tab"] ?? 0;
|
|
927
|
+
const activeTab = store.value.workspace["x-scalar-tabs"]?.[activeTabIndex];
|
|
928
|
+
if (!activeTab) return;
|
|
929
|
+
await router.replace(activeTab.path);
|
|
930
|
+
};
|
|
931
|
+
/**
|
|
932
|
+
* Rebuilds the sidebar for the given document.
|
|
933
|
+
* This is used to refresh the sidebar state after structural changes (e.g. after adding or removing items).
|
|
934
|
+
*
|
|
935
|
+
* @param documentName - The name (id) of the document for which to rebuild the sidebar
|
|
936
|
+
*/
|
|
937
|
+
const rebuildSidebar = (documentName) => {
|
|
938
|
+
if (documentName) store.value?.buildSidebar(documentName);
|
|
939
|
+
};
|
|
940
|
+
/**
|
|
941
|
+
* Ensures the sidebar is refreshed after a new example is created.
|
|
942
|
+
*
|
|
943
|
+
* If the sidebar entry for the new example does not exist or is of a different type,
|
|
944
|
+
* this will rebuild the sidebar for the current document. This helps keep the sidebar state
|
|
945
|
+
* consistent (e.g., after adding a new example via the UI).
|
|
946
|
+
*/
|
|
947
|
+
const refreshSidebarAfterExampleCreation = (payload) => {
|
|
948
|
+
const documentName = payload.documentName ?? activeDocument.value?.["x-scalar-navigation"]?.name;
|
|
949
|
+
if (!documentName) return;
|
|
950
|
+
const entry = getEntryByLocation({
|
|
951
|
+
document: documentName,
|
|
952
|
+
path: payload.path,
|
|
953
|
+
method: payload.method,
|
|
954
|
+
example: payload.exampleKey
|
|
955
|
+
});
|
|
956
|
+
if (!entry || entry.type !== "example") {
|
|
957
|
+
rebuildSidebar(documentName);
|
|
958
|
+
if (currentRoute.value) syncSidebar(currentRoute.value);
|
|
959
|
+
}
|
|
960
|
+
};
|
|
961
|
+
/** Width of the sidebar, with fallback to default. */
|
|
962
|
+
const sidebarWidth = computed(() => store.value?.workspace?.["x-scalar-sidebar-width"] ?? DEFAULT_SIDEBAR_WIDTH);
|
|
963
|
+
/** Handler for sidebar width changes. */
|
|
964
|
+
const handleSidebarWidthUpdate = (width) => store.value?.update("x-scalar-sidebar-width", width);
|
|
965
|
+
/** Controls the visibility of the sidebar. */
|
|
966
|
+
const isSidebarOpen = ref(false);
|
|
967
|
+
/** Constants for workspace store keys */
|
|
968
|
+
const TABS_KEY = "x-scalar-tabs";
|
|
969
|
+
const ACTIVE_TAB_KEY = "x-scalar-active-tab";
|
|
970
|
+
/**
|
|
971
|
+
* Creates a tab object based on the current route and workspace state.
|
|
972
|
+
* Used as a fallback when no tabs exist or when creating new tabs.
|
|
973
|
+
*/
|
|
974
|
+
const createTabFromRoute = (to) => {
|
|
975
|
+
const method = getRouteParam("method", to);
|
|
976
|
+
const path = getRouteParam("pathEncoded", to);
|
|
977
|
+
const document = getRouteParam("documentSlug", to);
|
|
978
|
+
return {
|
|
979
|
+
...getTabDetails({
|
|
980
|
+
workspace: getRouteParam("workspaceSlug", to),
|
|
981
|
+
document,
|
|
982
|
+
path,
|
|
983
|
+
method,
|
|
984
|
+
getEntryByLocation
|
|
985
|
+
}),
|
|
986
|
+
path: currentRoute.value?.path ?? ""
|
|
987
|
+
};
|
|
988
|
+
};
|
|
989
|
+
const tabs = computed(() => {
|
|
990
|
+
return store.value?.workspace[TABS_KEY] ?? [createTabFromRoute(currentRoute.value)];
|
|
991
|
+
});
|
|
992
|
+
const activeTabIndex = computed(() => {
|
|
993
|
+
return store.value?.workspace[ACTIVE_TAB_KEY] ?? 0;
|
|
994
|
+
});
|
|
995
|
+
/**
|
|
996
|
+
* Copies the URL of the tab at the given index to the clipboard.
|
|
997
|
+
* Constructs the full URL using the current origin and the tab path.
|
|
998
|
+
*
|
|
999
|
+
* Note: Will silently fail if clipboard API is unavailable or the tab does not exist.
|
|
1000
|
+
*/
|
|
1001
|
+
const copyTabUrl = async (index) => {
|
|
1002
|
+
const tab = tabs.value[index];
|
|
1003
|
+
if (!tab) {
|
|
1004
|
+
console.warn(`Cannot copy URL: tab at index ${index} does not exist`);
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
1007
|
+
const url = `${window.location.origin}${tab.path}`;
|
|
1008
|
+
try {
|
|
1009
|
+
await navigator.clipboard.writeText(url);
|
|
1010
|
+
} catch (error) {
|
|
1011
|
+
console.error("Failed to copy URL to clipboard:", error);
|
|
1012
|
+
}
|
|
1013
|
+
};
|
|
1014
|
+
/** When the route changes we need to update the active entities in the store */
|
|
1015
|
+
const handleRouteChange = (to) => {
|
|
1016
|
+
const slug = getRouteParam("workspaceSlug", to);
|
|
1017
|
+
const document = getRouteParam("documentSlug", to);
|
|
1018
|
+
const namespaceValue = getRouteParam("namespace", to);
|
|
1019
|
+
if (!namespaceValue || !slug) return;
|
|
1020
|
+
const workspace = workspaces.value.find((workspace) => workspace.slug === slug && workspace.namespace === namespaceValue);
|
|
1021
|
+
if (workspace && !canLoadWorkspace(workspace.teamUid, teamUid.value)) return navigateToWorkspace("local", "default");
|
|
1022
|
+
namespace.value = namespaceValue;
|
|
1023
|
+
workspaceSlug.value = slug;
|
|
1024
|
+
documentSlug.value = document;
|
|
1025
|
+
method.value = getRouteParam("method", to);
|
|
1026
|
+
path.value = getRouteParam("pathEncoded", to);
|
|
1027
|
+
exampleName.value = getRouteParam("exampleName", to);
|
|
1028
|
+
if (to.path !== "") workspaceStorage.setCurrentPath(to.path);
|
|
1029
|
+
if (getWorkspaceId(namespace.value, slug) !== activeWorkspace.value?.id) return changeWorkspace(namespace.value, slug);
|
|
1030
|
+
if (document && document !== store.value?.workspace[extensions.workspace.activeDocument]) store?.value?.update("x-scalar-active-document", document);
|
|
1031
|
+
syncTabs(to);
|
|
1032
|
+
syncSidebar(to);
|
|
1033
|
+
};
|
|
1034
|
+
/** Aligns the tabs with any potential slug changes */
|
|
1035
|
+
const syncTabs = (to) => {
|
|
1036
|
+
const tabs = store.value?.workspace["x-scalar-tabs"] ?? [];
|
|
1037
|
+
const index = store.value?.workspace["x-scalar-active-tab"] ?? 0;
|
|
1038
|
+
const tab = tabs[index];
|
|
1039
|
+
if (!tab || tab.path === to.path) return;
|
|
1040
|
+
tabs[index] = createTabFromRoute(to);
|
|
1041
|
+
};
|
|
1042
|
+
/** Aligns the sidebar state with any potential slug changes */
|
|
1043
|
+
const syncSidebar = (to) => {
|
|
1044
|
+
const document = getRouteParam("documentSlug", to);
|
|
1045
|
+
if (!document) {
|
|
1046
|
+
sidebarState.setSelected(null);
|
|
1047
|
+
return;
|
|
1048
|
+
}
|
|
1049
|
+
const entry = getEntryByLocation({
|
|
1050
|
+
document,
|
|
1051
|
+
path: getRouteParam("pathEncoded", to),
|
|
1052
|
+
method: getRouteParam("method", to),
|
|
1053
|
+
example: getRouteParam("exampleName", to)
|
|
1054
|
+
});
|
|
1055
|
+
if (entry) {
|
|
1056
|
+
sidebarState.setSelected(entry.id);
|
|
1057
|
+
sidebarState.setExpanded(entry.id, true);
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
initializeAppEventHandlers({
|
|
1061
|
+
eventBus,
|
|
1062
|
+
router,
|
|
1063
|
+
store,
|
|
1064
|
+
navigateToCurrentTab,
|
|
1065
|
+
rebuildSidebar,
|
|
1066
|
+
onAfterExampleCreation: refreshSidebarAfterExampleCreation,
|
|
1067
|
+
onSelectSidebarItem: handleSelectItem,
|
|
1068
|
+
onCopyTabUrl: (index) => copyTabUrl(index),
|
|
1069
|
+
onToggleSidebar: () => isSidebarOpen.value = !isSidebarOpen.value,
|
|
1070
|
+
closeSidebar: () => isSidebarOpen.value = false,
|
|
1071
|
+
renameWorkspace
|
|
1072
|
+
});
|
|
1073
|
+
const theme = useTheme({
|
|
1074
|
+
fallbackThemeSlug,
|
|
1075
|
+
customThemes,
|
|
1076
|
+
store
|
|
1077
|
+
});
|
|
1078
|
+
const isDarkMode = computed(() => {
|
|
1079
|
+
const colorMode = store.value?.workspace["x-scalar-color-mode"] ?? "system";
|
|
1080
|
+
if (colorMode === "system") return window.matchMedia?.("(prefers-color-scheme: dark)")?.matches ?? false;
|
|
1081
|
+
return colorMode === "dark";
|
|
1082
|
+
});
|
|
1083
|
+
return {
|
|
1084
|
+
store,
|
|
1085
|
+
sidebar: {
|
|
1086
|
+
state: sidebarState,
|
|
1087
|
+
width: sidebarWidth,
|
|
1088
|
+
isOpen: isSidebarOpen,
|
|
1089
|
+
handleSelectItem,
|
|
1090
|
+
handleSidebarWidthUpdate,
|
|
1091
|
+
getEntryByLocation
|
|
1092
|
+
},
|
|
1093
|
+
tabs: {
|
|
1094
|
+
state: tabs,
|
|
1095
|
+
activeTabIndex,
|
|
1096
|
+
copyTabUrl
|
|
1097
|
+
},
|
|
1098
|
+
workspace: {
|
|
1099
|
+
create: createWorkspace,
|
|
1100
|
+
workspaceList: workspaces,
|
|
1101
|
+
filteredWorkspaceList: filteredWorkspaces,
|
|
1102
|
+
workspaceGroups,
|
|
1103
|
+
activeWorkspace,
|
|
1104
|
+
navigateToWorkspace,
|
|
1105
|
+
isOpen: computed(() => Boolean(workspaceSlug.value && !documentSlug.value))
|
|
1106
|
+
},
|
|
1107
|
+
eventBus,
|
|
1108
|
+
router,
|
|
1109
|
+
currentRoute,
|
|
1110
|
+
loading: isSyncingWorkspace,
|
|
1111
|
+
activeEntities: {
|
|
1112
|
+
namespace,
|
|
1113
|
+
workspaceSlug,
|
|
1114
|
+
documentSlug,
|
|
1115
|
+
path,
|
|
1116
|
+
method,
|
|
1117
|
+
exampleName,
|
|
1118
|
+
teamUid: readonly(teamUid),
|
|
1119
|
+
setTeamUid
|
|
1120
|
+
},
|
|
1121
|
+
environment,
|
|
1122
|
+
document: activeDocument,
|
|
1123
|
+
isDarkMode,
|
|
1124
|
+
theme: {
|
|
1125
|
+
styles: theme.themeStyles,
|
|
1126
|
+
themeStyleTag: theme.themeStyleTag,
|
|
1127
|
+
customThemes
|
|
1128
|
+
}
|
|
1129
|
+
};
|
|
1130
|
+
};
|
|
1131
|
+
//#endregion
|
|
1132
|
+
//#region src/v2/features/app/components/CreateWorkspaceModal.vue
|
|
1133
|
+
var CreateWorkspaceModal_default = /* @__PURE__ */ defineComponent({
|
|
1134
|
+
__name: "CreateWorkspaceModal",
|
|
1135
|
+
props: { state: {} },
|
|
1136
|
+
emits: ["create:workspace"],
|
|
1137
|
+
setup(__props, { emit: __emit }) {
|
|
1138
|
+
const emit = __emit;
|
|
1139
|
+
/** Name input for the new workspace. Resets whenever the modal opens. */
|
|
1140
|
+
const name = ref("");
|
|
1141
|
+
/** Trimmed version of the name to avoid repeating .trim() in multiple places. */
|
|
1142
|
+
const trimmedName = computed(() => name.value.trim());
|
|
1143
|
+
/** Disable submit when the name is empty after trimming. */
|
|
1144
|
+
const isDisabled = computed(() => trimmedName.value.length === 0);
|
|
1145
|
+
/**
|
|
1146
|
+
* Ensure the form is reset whenever the modal opens.
|
|
1147
|
+
* Avoids stale state if the modal is reopened.
|
|
1148
|
+
*/
|
|
1149
|
+
watch(() => __props.state.open, (isOpen) => {
|
|
1150
|
+
if (isOpen) name.value = "";
|
|
1151
|
+
});
|
|
1152
|
+
/** Emits an event to create the workspace with the provided name */
|
|
1153
|
+
const handleSubmit = () => {
|
|
1154
|
+
if (!trimmedName.value) return;
|
|
1155
|
+
emit("create:workspace", { name: trimmedName.value });
|
|
1156
|
+
__props.state.hide();
|
|
1157
|
+
};
|
|
1158
|
+
return (_ctx, _cache) => {
|
|
1159
|
+
return openBlock(), createBlock(unref(ScalarModal), {
|
|
1160
|
+
bodyClass: "border-t-0 rounded-t-lg",
|
|
1161
|
+
size: "xs",
|
|
1162
|
+
state: __props.state
|
|
1163
|
+
}, {
|
|
1164
|
+
default: withCtx(() => [createVNode(CommandActionForm_default, {
|
|
1165
|
+
disabled: isDisabled.value,
|
|
1166
|
+
onSubmit: handleSubmit
|
|
1167
|
+
}, {
|
|
1168
|
+
submit: withCtx(() => [..._cache[1] || (_cache[1] = [createTextVNode("Add Workspace", -1)])]),
|
|
1169
|
+
default: withCtx(() => [createVNode(CommandActionInput_default, {
|
|
1170
|
+
modelValue: name.value,
|
|
1171
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => name.value = $event),
|
|
1172
|
+
class: "-mt-[.5px] !p-0",
|
|
1173
|
+
placeholder: "Workspace name"
|
|
1174
|
+
}, null, 8, ["modelValue"])]),
|
|
1175
|
+
_: 1
|
|
1176
|
+
}, 8, ["disabled"])]),
|
|
1177
|
+
_: 1
|
|
1178
|
+
}, 8, ["state"]);
|
|
1179
|
+
};
|
|
1180
|
+
}
|
|
1181
|
+
});
|
|
1182
|
+
//#endregion
|
|
1183
|
+
//#region src/v2/features/app/components/SplashScreen.vue?vue&type=script&setup=true&lang.ts
|
|
1184
|
+
var _hoisted_1$5 = { class: "splash-screen bg-b-1 fixed inset-0 z-50 flex items-center justify-center" };
|
|
1185
|
+
var _hoisted_2$4 = { class: "flex flex-col items-center gap-4" };
|
|
1186
|
+
//#endregion
|
|
1187
|
+
//#region src/v2/features/app/components/SplashScreen.vue
|
|
1188
|
+
var SplashScreen_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1189
|
+
__name: "SplashScreen",
|
|
1190
|
+
setup(__props) {
|
|
1191
|
+
return (_ctx, _cache) => {
|
|
1192
|
+
return openBlock(), createElementBlock("div", _hoisted_1$5, [createElementVNode("div", _hoisted_2$4, [createVNode(unref(ScalarIcon), {
|
|
1193
|
+
class: "logo-icon text-c-1 h-16 w-16",
|
|
1194
|
+
icon: "Logo"
|
|
1195
|
+
})])]);
|
|
1196
|
+
};
|
|
1197
|
+
}
|
|
1198
|
+
}), [["__scopeId", "data-v-af32615f"]]);
|
|
1199
|
+
//#endregion
|
|
1200
|
+
//#region src/v2/features/app/hooks/use-document-watcher.ts
|
|
1201
|
+
/**
|
|
1202
|
+
* Default timeout before the first poll attempt (in milliseconds).
|
|
1203
|
+
*/
|
|
1204
|
+
var DEFAULT_INITIAL_TIMEOUT = 5 * 1e3;
|
|
1205
|
+
/**
|
|
1206
|
+
* Maximum timeout cap for exponential backoff (in milliseconds).
|
|
1207
|
+
*/
|
|
1208
|
+
var MAX_TIMEOUT = 60 * 1e3;
|
|
1209
|
+
/**
|
|
1210
|
+
* Creates a timer manager for handling polling timeouts.
|
|
1211
|
+
*
|
|
1212
|
+
* @returns Object with methods to manage the polling timer.
|
|
1213
|
+
*/
|
|
1214
|
+
var createTimerManager = () => {
|
|
1215
|
+
let timer = null;
|
|
1216
|
+
/**
|
|
1217
|
+
* Clears the current timer if it exists.
|
|
1218
|
+
*/
|
|
1219
|
+
const clear = () => {
|
|
1220
|
+
if (timer) {
|
|
1221
|
+
clearTimeout(timer);
|
|
1222
|
+
timer = null;
|
|
1223
|
+
}
|
|
1224
|
+
};
|
|
1225
|
+
/**
|
|
1226
|
+
* Schedules the next poll after the specified timeout.
|
|
1227
|
+
*
|
|
1228
|
+
* @param callback - The function to call when the timeout expires.
|
|
1229
|
+
* @param timeout - The delay in milliseconds before calling the callback.
|
|
1230
|
+
*/
|
|
1231
|
+
const schedule = (callback, timeout) => {
|
|
1232
|
+
clear();
|
|
1233
|
+
timer = setTimeout(callback, timeout);
|
|
1234
|
+
};
|
|
1235
|
+
return {
|
|
1236
|
+
clear,
|
|
1237
|
+
schedule
|
|
1238
|
+
};
|
|
1239
|
+
};
|
|
1240
|
+
/**
|
|
1241
|
+
* Creates a timeout manager that handles exponential backoff on failures.
|
|
1242
|
+
*
|
|
1243
|
+
* @param initialTimeout - The initial timeout value in milliseconds.
|
|
1244
|
+
* @returns Object with methods to manage timeout values.
|
|
1245
|
+
*/
|
|
1246
|
+
var createTimeoutManager = (initialTimeout) => {
|
|
1247
|
+
let currentTimeout = initialTimeout;
|
|
1248
|
+
/**
|
|
1249
|
+
* Resets the timeout to its initial value.
|
|
1250
|
+
*/
|
|
1251
|
+
const reset = () => {
|
|
1252
|
+
currentTimeout = initialTimeout;
|
|
1253
|
+
};
|
|
1254
|
+
/**
|
|
1255
|
+
* Doubles the timeout with exponential backoff, capped at MAX_TIMEOUT.
|
|
1256
|
+
*/
|
|
1257
|
+
const backoff = () => {
|
|
1258
|
+
currentTimeout = Math.min(currentTimeout * 2, MAX_TIMEOUT);
|
|
1259
|
+
};
|
|
1260
|
+
/**
|
|
1261
|
+
* Gets the current timeout value.
|
|
1262
|
+
*/
|
|
1263
|
+
const get = () => currentTimeout;
|
|
1264
|
+
return {
|
|
1265
|
+
reset,
|
|
1266
|
+
backoff,
|
|
1267
|
+
get
|
|
1268
|
+
};
|
|
1269
|
+
};
|
|
1270
|
+
/**
|
|
1271
|
+
* Resolves conflicts by preferring remote changes.
|
|
1272
|
+
*
|
|
1273
|
+
* @param conflicts - Array of conflict tuples from the rebase result.
|
|
1274
|
+
* Each tuple contains two arrays: [remote changes, local changes].
|
|
1275
|
+
* @returns Array of remote changes to apply.
|
|
1276
|
+
*/
|
|
1277
|
+
var resolveConflicts = (conflicts) => {
|
|
1278
|
+
return conflicts.flatMap(([remote]) => remote);
|
|
1279
|
+
};
|
|
1280
|
+
/**
|
|
1281
|
+
* Watches the specified document in the workspace store and periodically rebases it with its remote source.
|
|
1282
|
+
*
|
|
1283
|
+
* This utility sets up a watcher on the given document. If the document specifies an 'x-scalar-original-source-url'
|
|
1284
|
+
* and watch mode is enabled, this hook polls the remote source and calls `store.rebaseDocument`.
|
|
1285
|
+
* If rebase conflicts are detected, it applies automatic conflict resolution by preferring remote changes.
|
|
1286
|
+
* Uses exponential backoff on failures to avoid overwhelming the server.
|
|
1287
|
+
*
|
|
1288
|
+
* @param params - Configuration object for the document watcher.
|
|
1289
|
+
* @param params.documentName - The name/key of the document to watch and rebase.
|
|
1290
|
+
* @param params.store - The WorkspaceStore instance.
|
|
1291
|
+
* @param params.initialTimeout - Initial delay before the first poll attempt (default: 5000ms).
|
|
1292
|
+
*
|
|
1293
|
+
* @example
|
|
1294
|
+
* ```ts
|
|
1295
|
+
* import { useDocumentWatcher } from '@/hooks/use-document-watcher'
|
|
1296
|
+
* import { useScalarWorkspaceStore } from '@scalar/workspace-store'
|
|
1297
|
+
*
|
|
1298
|
+
* const store = useScalarWorkspaceStore()
|
|
1299
|
+
* useDocumentWatcher({ documentName: 'myApi', store })
|
|
1300
|
+
* ```
|
|
1301
|
+
*/
|
|
1302
|
+
var useDocumentWatcher = ({ documentName, store, initialTimeout = DEFAULT_INITIAL_TIMEOUT }) => {
|
|
1303
|
+
const document = computed(() => {
|
|
1304
|
+
const storeValue = toValue(store);
|
|
1305
|
+
const documentNameValue = toValue(documentName);
|
|
1306
|
+
if (!storeValue || !documentNameValue) return null;
|
|
1307
|
+
return storeValue.workspace.documents[documentNameValue];
|
|
1308
|
+
});
|
|
1309
|
+
const timerManager = createTimerManager();
|
|
1310
|
+
const timeoutManager = createTimeoutManager(initialTimeout);
|
|
1311
|
+
/**
|
|
1312
|
+
* Handles a successful poll result (with or without changes).
|
|
1313
|
+
*/
|
|
1314
|
+
const handleSuccess = () => {
|
|
1315
|
+
timeoutManager.reset();
|
|
1316
|
+
timerManager.schedule(poll, timeoutManager.get());
|
|
1317
|
+
};
|
|
1318
|
+
/**
|
|
1319
|
+
* Handles a failed poll result with exponential backoff.
|
|
1320
|
+
*/
|
|
1321
|
+
const handleFailure = () => {
|
|
1322
|
+
timeoutManager.backoff();
|
|
1323
|
+
timerManager.schedule(poll, timeoutManager.get());
|
|
1324
|
+
};
|
|
1325
|
+
/**
|
|
1326
|
+
* Polls the remote document source and attempts to rebase.
|
|
1327
|
+
*/
|
|
1328
|
+
const poll = async () => {
|
|
1329
|
+
const storeValue = toValue(store);
|
|
1330
|
+
const documentNameValue = toValue(documentName);
|
|
1331
|
+
const sourceUrl = document.value?.["x-scalar-original-source-url"];
|
|
1332
|
+
if (!storeValue || !documentNameValue || !sourceUrl) return;
|
|
1333
|
+
const result = await storeValue.rebaseDocument({
|
|
1334
|
+
name: documentNameValue,
|
|
1335
|
+
url: sourceUrl
|
|
1336
|
+
});
|
|
1337
|
+
if (result?.ok) {
|
|
1338
|
+
await result.applyChanges({ resolvedConflicts: resolveConflicts(result.conflicts) });
|
|
1339
|
+
handleSuccess();
|
|
1340
|
+
} else if (result?.ok === false && result.type === "NO_CHANGES_DETECTED") handleSuccess();
|
|
1341
|
+
else handleFailure();
|
|
1342
|
+
};
|
|
1343
|
+
/**
|
|
1344
|
+
* Watches for changes to the document's source URL and watch mode.
|
|
1345
|
+
* Starts or stops polling based on these values.
|
|
1346
|
+
*/
|
|
1347
|
+
watch([() => document.value?.["x-scalar-original-source-url"], () => document.value?.["x-scalar-watch-mode"]], ([sourceUrl, watchMode = false]) => {
|
|
1348
|
+
if (!toValue(store)) {
|
|
1349
|
+
timerManager.clear();
|
|
1350
|
+
return;
|
|
1351
|
+
}
|
|
1352
|
+
timerManager.clear();
|
|
1353
|
+
if (!sourceUrl || !watchMode) {
|
|
1354
|
+
timeoutManager.reset();
|
|
1355
|
+
return;
|
|
1356
|
+
}
|
|
1357
|
+
timerManager.schedule(poll, timeoutManager.get());
|
|
1358
|
+
}, { immediate: true });
|
|
1359
|
+
onBeforeUnmount(() => {
|
|
1360
|
+
timerManager.clear();
|
|
1361
|
+
});
|
|
1362
|
+
};
|
|
1363
|
+
//#endregion
|
|
1364
|
+
//#region src/v2/hooks/use-color-mode.ts
|
|
1365
|
+
/**
|
|
1366
|
+
* Gets the system color mode preference from the browser.
|
|
1367
|
+
* Falls back to 'light' if running in a non-browser environment.
|
|
1368
|
+
*
|
|
1369
|
+
* @returns The system preference for dark or light mode.
|
|
1370
|
+
*/
|
|
1371
|
+
var getSystemModePreference = () => {
|
|
1372
|
+
if (typeof window === "undefined" || typeof window?.matchMedia !== "function") return "light";
|
|
1373
|
+
return window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light";
|
|
1374
|
+
};
|
|
1375
|
+
/**
|
|
1376
|
+
* Converts a ColorMode to a DarkLightMode by resolving 'system' to the actual system preference.
|
|
1377
|
+
*
|
|
1378
|
+
* @param mode - The color mode to convert.
|
|
1379
|
+
* @returns The resolved dark or light mode.
|
|
1380
|
+
*/
|
|
1381
|
+
var getDarkLightMode = (mode) => {
|
|
1382
|
+
return mode === "system" ? getSystemModePreference() : mode;
|
|
1383
|
+
};
|
|
1384
|
+
/**
|
|
1385
|
+
* Applies the color mode by adding/removing the appropriate CSS classes on the document body.
|
|
1386
|
+
* This function is safe to call in non-browser environments (no-op).
|
|
1387
|
+
*
|
|
1388
|
+
* @param mode - The dark or light mode to apply.
|
|
1389
|
+
*/
|
|
1390
|
+
var applyColorMode = (mode) => {
|
|
1391
|
+
if (typeof document === "undefined") return;
|
|
1392
|
+
const isDark = mode === "dark";
|
|
1393
|
+
document.body.classList.toggle("dark-mode", isDark);
|
|
1394
|
+
document.body.classList.toggle("light-mode", !isDark);
|
|
1395
|
+
};
|
|
1396
|
+
/**
|
|
1397
|
+
* Composable hook that manages color mode (dark/light/system) based on workspace store configuration.
|
|
1398
|
+
* Automatically listens to system preference changes when mode is set to 'system'.
|
|
1399
|
+
*
|
|
1400
|
+
* @param options - Configuration options for the color mode hook.
|
|
1401
|
+
* @param options.workspaceStore - The workspace store instance that contains the color mode preference.
|
|
1402
|
+
* @returns Reactive color mode state and computed properties.
|
|
1403
|
+
*/
|
|
1404
|
+
var useColorMode = ({ workspaceStore }) => {
|
|
1405
|
+
const colorMode = computed(() => toValue(workspaceStore)?.workspace["x-scalar-color-mode"] ?? "system");
|
|
1406
|
+
const darkLightMode = computed(() => getDarkLightMode(colorMode.value));
|
|
1407
|
+
const isDarkMode = computed(() => darkLightMode.value === "dark");
|
|
1408
|
+
const mediaQuery = ref(null);
|
|
1409
|
+
/**
|
|
1410
|
+
* Handles system preference changes.
|
|
1411
|
+
* Only updates the color mode if the current mode is set to 'system'.
|
|
1412
|
+
*/
|
|
1413
|
+
const handleSystemPreferenceChange = () => {
|
|
1414
|
+
if (colorMode.value === "system") applyColorMode(getSystemModePreference());
|
|
1415
|
+
};
|
|
1416
|
+
watch(colorMode, (mode) => applyColorMode(getDarkLightMode(mode)), { immediate: true });
|
|
1417
|
+
onMounted(() => {
|
|
1418
|
+
if (typeof window !== "undefined" && typeof window?.matchMedia === "function") {
|
|
1419
|
+
mediaQuery.value = window.matchMedia("(prefers-color-scheme: dark)");
|
|
1420
|
+
mediaQuery.value.addEventListener("change", handleSystemPreferenceChange);
|
|
1421
|
+
}
|
|
1422
|
+
});
|
|
1423
|
+
onUnmounted(() => {
|
|
1424
|
+
mediaQuery.value?.removeEventListener("change", handleSystemPreferenceChange);
|
|
1425
|
+
});
|
|
1426
|
+
return {
|
|
1427
|
+
colorMode,
|
|
1428
|
+
isDarkMode
|
|
1429
|
+
};
|
|
1430
|
+
};
|
|
1431
|
+
//#endregion
|
|
1432
|
+
//#region src/v2/features/app/components/DownloadAppButton.vue?vue&type=script&setup=true&lang.ts
|
|
1433
|
+
var _hoisted_1$4 = {
|
|
1434
|
+
class: "download-app-button flex w-full flex-row items-center justify-center gap-2 rounded px-3.5 py-2 text-sm leading-4 font-medium",
|
|
1435
|
+
href: "https://scalar.com/download?utm_source=web_client&utm_medium=download_button&utm_campaign=topnav",
|
|
1436
|
+
target: "_blank",
|
|
1437
|
+
type: "button"
|
|
1438
|
+
};
|
|
1439
|
+
//#endregion
|
|
1440
|
+
//#region src/v2/features/app/components/DownloadAppButton.vue
|
|
1441
|
+
var DownloadAppButton_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1442
|
+
__name: "DownloadAppButton",
|
|
1443
|
+
setup(__props) {
|
|
1444
|
+
return (_ctx, _cache) => {
|
|
1445
|
+
return openBlock(), createElementBlock("a", _hoisted_1$4, [createVNode(unref(ScalarIconDownloadSimple), { size: "sm" }), _cache[0] || (_cache[0] = createElementVNode("span", { class: "sr-only text-sm font-medium sm:not-sr-only" }, " Download App ", -1))]);
|
|
1446
|
+
};
|
|
1447
|
+
}
|
|
1448
|
+
}), [["__scopeId", "data-v-9b609275"]]);
|
|
1449
|
+
//#endregion
|
|
1450
|
+
//#region src/v2/features/app/components/SidebarItemMenu.vue?vue&type=script&setup=true&lang.ts
|
|
1451
|
+
var _hoisted_1$3 = { class: "flex items-center gap-2" };
|
|
1452
|
+
var _hoisted_2$3 = { class: "flex items-center gap-2" };
|
|
1453
|
+
var _hoisted_3$3 = { class: "flex items-center gap-2" };
|
|
1454
|
+
var _hoisted_4$2 = { class: "flex items-center gap-2" };
|
|
1455
|
+
var _hoisted_5$2 = { class: "flex items-center gap-2" };
|
|
1456
|
+
var _hoisted_6$2 = { class: "text-red flex items-center gap-2" };
|
|
1457
|
+
//#endregion
|
|
1458
|
+
//#region src/v2/features/app/components/SidebarItemMenu.vue
|
|
1459
|
+
var SidebarItemMenu_default = /* @__PURE__ */ defineComponent({
|
|
1460
|
+
__name: "SidebarItemMenu",
|
|
1461
|
+
props: {
|
|
1462
|
+
item: {},
|
|
1463
|
+
eventBus: {},
|
|
1464
|
+
sidebarState: {},
|
|
1465
|
+
target: {}
|
|
1466
|
+
},
|
|
1467
|
+
emits: ["closeMenu", "showDeleteModal"],
|
|
1468
|
+
setup(__props, { emit: __emit }) {
|
|
1469
|
+
const emit = __emit;
|
|
1470
|
+
const open = ref(false);
|
|
1471
|
+
watch(open, async (newValue, oldValue) => {
|
|
1472
|
+
if (!newValue && oldValue) {
|
|
1473
|
+
await nextTick();
|
|
1474
|
+
emit("closeMenu");
|
|
1475
|
+
}
|
|
1476
|
+
});
|
|
1477
|
+
/** Returns whether the item supports adding operations */
|
|
1478
|
+
const canAddOperation = () => __props.item.type === "document" || __props.item.type === "tag";
|
|
1479
|
+
/** Returns whether the item supports adding tags */
|
|
1480
|
+
const canAddTag = () => __props.item.type === "document";
|
|
1481
|
+
/** Returns whether the item supports editing tags */
|
|
1482
|
+
const canEditTag = () => __props.item.type === "tag";
|
|
1483
|
+
/** Returns whether the item supports editing examples */
|
|
1484
|
+
const canEditExample = () => __props.item.type === "example";
|
|
1485
|
+
/** Returns whether the item supports adding examples */
|
|
1486
|
+
const canAddExample = () => __props.item.type === "operation";
|
|
1487
|
+
/** Returns whether the item supports deletion */
|
|
1488
|
+
const canDelete = () => __props.item.type === "document" && __props.item.id !== "drafts" || __props.item.type === "tag" || __props.item.type === "operation" || __props.item.type === "example";
|
|
1489
|
+
const handleAddOperation = () => {
|
|
1490
|
+
if (__props.item.type === "document") __props.eventBus.emit("ui:open:command-palette", {
|
|
1491
|
+
action: "create-request",
|
|
1492
|
+
payload: { documentName: __props.item.name }
|
|
1493
|
+
});
|
|
1494
|
+
if (__props.item.type === "tag") {
|
|
1495
|
+
const itemWithParent = __props.sidebarState.getEntryById(__props.item.id);
|
|
1496
|
+
__props.eventBus.emit("ui:open:command-palette", {
|
|
1497
|
+
action: "create-request",
|
|
1498
|
+
payload: {
|
|
1499
|
+
documentName: getParentEntry("document", itemWithParent)?.name,
|
|
1500
|
+
tagId: __props.item.name
|
|
1501
|
+
}
|
|
1502
|
+
});
|
|
1503
|
+
}
|
|
1504
|
+
};
|
|
1505
|
+
const handleAddTag = () => {
|
|
1506
|
+
if (__props.item.type === "document") __props.eventBus.emit("ui:open:command-palette", {
|
|
1507
|
+
action: "add-tag",
|
|
1508
|
+
payload: { documentName: __props.item.name }
|
|
1509
|
+
});
|
|
1510
|
+
};
|
|
1511
|
+
const handleEditTag = () => {
|
|
1512
|
+
if (__props.item.type === "tag") {
|
|
1513
|
+
const itemWithParent = __props.sidebarState.getEntryById(__props.item.id);
|
|
1514
|
+
__props.eventBus.emit("ui:open:command-palette", {
|
|
1515
|
+
action: "edit-tag",
|
|
1516
|
+
payload: {
|
|
1517
|
+
tag: __props.item,
|
|
1518
|
+
documentName: getParentEntry("document", itemWithParent)?.name ?? ""
|
|
1519
|
+
}
|
|
1520
|
+
}, { skipUnpackProxy: true });
|
|
1521
|
+
}
|
|
1522
|
+
};
|
|
1523
|
+
const handleAddExample = () => {
|
|
1524
|
+
if (__props.item.type === "operation") {
|
|
1525
|
+
const itemWithParent = __props.sidebarState.getEntryById(__props.item.id);
|
|
1526
|
+
__props.eventBus.emit("ui:open:command-palette", {
|
|
1527
|
+
action: "add-example",
|
|
1528
|
+
payload: {
|
|
1529
|
+
documentName: getParentEntry("document", itemWithParent)?.name,
|
|
1530
|
+
operationId: __props.item.id
|
|
1531
|
+
}
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
const handleEditExample = () => {
|
|
1536
|
+
if (__props.item.type === "example") {
|
|
1537
|
+
const itemWithParent = __props.sidebarState.getEntryById(__props.item.id);
|
|
1538
|
+
const parentOperation = getParentEntry("operation", itemWithParent);
|
|
1539
|
+
__props.eventBus.emit("ui:open:command-palette", {
|
|
1540
|
+
action: "edit-example",
|
|
1541
|
+
payload: {
|
|
1542
|
+
example: __props.item,
|
|
1543
|
+
documentName: getParentEntry("document", itemWithParent)?.name ?? "",
|
|
1544
|
+
operationId: parentOperation?.id ?? ""
|
|
1545
|
+
}
|
|
1546
|
+
}, { skipUnpackProxy: true });
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
return (_ctx, _cache) => {
|
|
1550
|
+
return openBlock(), createBlock(unref(ScalarDropdown), {
|
|
1551
|
+
open: open.value,
|
|
1552
|
+
"onUpdate:open": _cache[6] || (_cache[6] = ($event) => open.value = $event),
|
|
1553
|
+
placement: "bottom-end",
|
|
1554
|
+
target: __props.target,
|
|
1555
|
+
teleport: ""
|
|
1556
|
+
}, {
|
|
1557
|
+
items: withCtx(() => [
|
|
1558
|
+
canAddOperation() ? (openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
1559
|
+
key: 0,
|
|
1560
|
+
onClick: _cache[0] || (_cache[0] = ($event) => handleAddOperation())
|
|
1561
|
+
}, {
|
|
1562
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_1$3, [createVNode(unref(ScalarIcon), {
|
|
1563
|
+
icon: "Add",
|
|
1564
|
+
size: "sm"
|
|
1565
|
+
}), _cache[7] || (_cache[7] = createTextVNode(" Add Operation ", -1))])]),
|
|
1566
|
+
_: 1
|
|
1567
|
+
})) : createCommentVNode("", true),
|
|
1568
|
+
canAddTag() ? (openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
1569
|
+
key: 1,
|
|
1570
|
+
onClick: _cache[1] || (_cache[1] = ($event) => handleAddTag())
|
|
1571
|
+
}, {
|
|
1572
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_2$3, [createVNode(unref(ScalarIcon), {
|
|
1573
|
+
icon: "Add",
|
|
1574
|
+
size: "sm"
|
|
1575
|
+
}), _cache[8] || (_cache[8] = createTextVNode(" Add Tag ", -1))])]),
|
|
1576
|
+
_: 1
|
|
1577
|
+
})) : createCommentVNode("", true),
|
|
1578
|
+
canEditTag() ? (openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
1579
|
+
key: 2,
|
|
1580
|
+
onClick: _cache[2] || (_cache[2] = ($event) => handleEditTag())
|
|
1581
|
+
}, {
|
|
1582
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_3$3, [createVNode(unref(ScalarIconPencil), { size: "sm" }), _cache[9] || (_cache[9] = createTextVNode(" Rename Tag ", -1))])]),
|
|
1583
|
+
_: 1
|
|
1584
|
+
})) : createCommentVNode("", true),
|
|
1585
|
+
canEditExample() ? (openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
1586
|
+
key: 3,
|
|
1587
|
+
onClick: _cache[3] || (_cache[3] = ($event) => handleEditExample())
|
|
1588
|
+
}, {
|
|
1589
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_4$2, [createVNode(unref(ScalarIconPencil), { size: "sm" }), _cache[10] || (_cache[10] = createTextVNode(" Rename Example ", -1))])]),
|
|
1590
|
+
_: 1
|
|
1591
|
+
})) : createCommentVNode("", true),
|
|
1592
|
+
canAddExample() ? (openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
1593
|
+
key: 4,
|
|
1594
|
+
onClick: _cache[4] || (_cache[4] = ($event) => handleAddExample())
|
|
1595
|
+
}, {
|
|
1596
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_5$2, [createVNode(unref(ScalarIcon), {
|
|
1597
|
+
icon: "Add",
|
|
1598
|
+
size: "sm"
|
|
1599
|
+
}), _cache[11] || (_cache[11] = createTextVNode(" Add Example ", -1))])]),
|
|
1600
|
+
_: 1
|
|
1601
|
+
})) : createCommentVNode("", true),
|
|
1602
|
+
(canAddExample() || canAddOperation() || canAddTag() || canEditExample()) && canDelete() ? (openBlock(), createBlock(unref(ScalarDropdownDivider), { key: 5 })) : createCommentVNode("", true),
|
|
1603
|
+
canDelete() ? (openBlock(), createBlock(unref(ScalarDropdownItem), {
|
|
1604
|
+
key: 6,
|
|
1605
|
+
onClick: _cache[5] || (_cache[5] = ($event) => emit("showDeleteModal"))
|
|
1606
|
+
}, {
|
|
1607
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_6$2, [createVNode(unref(ScalarIcon), {
|
|
1608
|
+
icon: "Delete",
|
|
1609
|
+
size: "sm"
|
|
1610
|
+
}), _cache[12] || (_cache[12] = createTextVNode(" Delete ", -1))])]),
|
|
1611
|
+
_: 1
|
|
1612
|
+
})) : createCommentVNode("", true)
|
|
1613
|
+
]),
|
|
1614
|
+
_: 1
|
|
1615
|
+
}, 8, ["open", "target"]);
|
|
1616
|
+
};
|
|
1617
|
+
}
|
|
1618
|
+
});
|
|
1619
|
+
//#endregion
|
|
1620
|
+
//#region src/v2/helpers/drag-handle-factory.ts
|
|
1621
|
+
/**
|
|
1622
|
+
* Reorders items in an array by moving an item from one index to another,
|
|
1623
|
+
* adjusting insertion point based on offset.
|
|
1624
|
+
* Returns the new order array, or null if indices are invalid.
|
|
1625
|
+
*/
|
|
1626
|
+
var reorderArray = (array, fromIndex, toIndex, offset) => {
|
|
1627
|
+
if (fromIndex === -1 || toIndex === -1 || fromIndex === toIndex) return null;
|
|
1628
|
+
const newArray = [...array];
|
|
1629
|
+
const [removed] = newArray.splice(fromIndex, 1);
|
|
1630
|
+
if (removed === void 0) return null;
|
|
1631
|
+
const insertIndex = calculateInsertIndex(fromIndex, toIndex, offset, newArray.length);
|
|
1632
|
+
newArray.splice(insertIndex, 0, removed);
|
|
1633
|
+
return unpackProxyObject(newArray, { depth: 1 });
|
|
1634
|
+
};
|
|
1635
|
+
/**
|
|
1636
|
+
* Calculates the insertion index based on drag offset and direction.
|
|
1637
|
+
*/
|
|
1638
|
+
var calculateInsertIndex = (fromIndex, toIndex, offset, arrayLength) => {
|
|
1639
|
+
const isMovingDown = fromIndex < toIndex;
|
|
1640
|
+
if (offset === "after") return isMovingDown ? toIndex : toIndex + 1;
|
|
1641
|
+
if (offset === "before") return isMovingDown ? toIndex - 1 : toIndex;
|
|
1642
|
+
if (offset === "into") return arrayLength;
|
|
1643
|
+
return toIndex;
|
|
1644
|
+
};
|
|
1645
|
+
/**
|
|
1646
|
+
* Type guard to check if an entry's type matches any of the provided types.
|
|
1647
|
+
*
|
|
1648
|
+
* @template Entry - The traversed entry type (must extend TraversedEntry).
|
|
1649
|
+
* @template Type - An array of allowed entry types to check against.
|
|
1650
|
+
* @param entry - The sidebar entry to check.
|
|
1651
|
+
* @param type - Array of entry types to match (e.g., ['document', 'tag']).
|
|
1652
|
+
* @returns {boolean} True if entry.type is included in the provided type array; otherwise, false.
|
|
1653
|
+
*
|
|
1654
|
+
* @example
|
|
1655
|
+
* isEntryType(someEntry, ['document', 'tag']) // true if someEntry.type === 'document' or 'tag'
|
|
1656
|
+
*/
|
|
1657
|
+
var isEntryType = (entry, type) => {
|
|
1658
|
+
return type.includes(entry.type);
|
|
1659
|
+
};
|
|
1660
|
+
/**
|
|
1661
|
+
* Determines if the hovered item qualifies as a "reorder" operation.
|
|
1662
|
+
* Reorder means moving before or after another item, not dropping
|
|
1663
|
+
* into a parent container.
|
|
1664
|
+
*/
|
|
1665
|
+
var isReorder = (hoveredItem) => {
|
|
1666
|
+
return hoveredItem.offset === "before" || hoveredItem.offset === "after";
|
|
1667
|
+
};
|
|
1668
|
+
/**
|
|
1669
|
+
* Determines if the hovered item represents a "drop into parent" operation.
|
|
1670
|
+
*/
|
|
1671
|
+
var isDropIntoParent = (hoveredItem) => {
|
|
1672
|
+
return hoveredItem.offset === "into";
|
|
1673
|
+
};
|
|
1674
|
+
/**
|
|
1675
|
+
* Checks if two sidebar entries (dragging and hovered) share the same parent.
|
|
1676
|
+
*
|
|
1677
|
+
* This is useful for determining if items can be reordered within the same context,
|
|
1678
|
+
* such as reordering tags or operations under the same tag or document, during drag-and-drop operations.
|
|
1679
|
+
*
|
|
1680
|
+
* @param draggingItem - The entry currently being dragged (must have a parent to compare).
|
|
1681
|
+
* @param hoveredItem - The entry currently hovered over (must have a parent to compare).
|
|
1682
|
+
* @returns {boolean} True if both entries have the same parent (by id), false otherwise.
|
|
1683
|
+
*
|
|
1684
|
+
* @example
|
|
1685
|
+
* const parent = { id: 'doc-1', type: 'document' };
|
|
1686
|
+
* const tagA = { id: 'tag-1', type: 'tag', parent };
|
|
1687
|
+
* const tagB = { id: 'tag-2', type: 'tag', parent };
|
|
1688
|
+
* itemsShareParent(tagA, tagB); // true
|
|
1689
|
+
*
|
|
1690
|
+
* const otherParent = { id: 'doc-2', type: 'document' };
|
|
1691
|
+
* const tagC = { id: 'tag-3', type: 'tag', parent: otherParent };
|
|
1692
|
+
* itemsShareParent(tagA, tagC); // false
|
|
1693
|
+
*/
|
|
1694
|
+
var itemsShareParent = (draggingItem, hoveredItem) => {
|
|
1695
|
+
if (!draggingItem.parent || !hoveredItem.parent) return false;
|
|
1696
|
+
return draggingItem.parent.id === hoveredItem.parent.id;
|
|
1697
|
+
};
|
|
1698
|
+
/**
|
|
1699
|
+
* Triggers rebuilding of the sidebar for a specific document entry.
|
|
1700
|
+
* This is called after operations that alter the sidebar structure.
|
|
1701
|
+
*/
|
|
1702
|
+
var rebuildSidebar = ({ store, entry }) => {
|
|
1703
|
+
const documentEntry = getParentEntry("document", entry);
|
|
1704
|
+
if (documentEntry) store.buildSidebar(documentEntry.name);
|
|
1705
|
+
};
|
|
1706
|
+
/**
|
|
1707
|
+
* Gets the current order array for a parent entry.
|
|
1708
|
+
* Falls back to children IDs if no explicit order exists.
|
|
1709
|
+
*/
|
|
1710
|
+
var getCurrentOrder = (parent, parentEntry) => {
|
|
1711
|
+
return parent["x-scalar-order"] ?? parentEntry.children?.map((child) => child.id) ?? [];
|
|
1712
|
+
};
|
|
1713
|
+
/**
|
|
1714
|
+
* Handles reordering of entries (tags or operations) within the same parent.
|
|
1715
|
+
*/
|
|
1716
|
+
var handleReorderWithinParent = (store, draggingItem, hoveredItem, offset) => {
|
|
1717
|
+
const parentEntry = draggingItem.parent;
|
|
1718
|
+
if (!parentEntry || !isEntryType(parentEntry, ["tag", "document"])) return false;
|
|
1719
|
+
const parent = getOpenapiObject({
|
|
1720
|
+
store,
|
|
1721
|
+
entry: parentEntry
|
|
1722
|
+
});
|
|
1723
|
+
if (!parent) return false;
|
|
1724
|
+
const currentOrder = getCurrentOrder(parent, parentEntry);
|
|
1725
|
+
const newOrder = reorderArray(currentOrder, currentOrder.findIndex((id) => id === draggingItem.id), currentOrder.findIndex((id) => id === hoveredItem.id), offset);
|
|
1726
|
+
if (!newOrder) return false;
|
|
1727
|
+
parent["x-scalar-order"] = newOrder;
|
|
1728
|
+
rebuildSidebar({
|
|
1729
|
+
store,
|
|
1730
|
+
entry: parentEntry
|
|
1731
|
+
});
|
|
1732
|
+
return true;
|
|
1733
|
+
};
|
|
1734
|
+
/**
|
|
1735
|
+
* Updates operation tags when moving between different parents.
|
|
1736
|
+
*/
|
|
1737
|
+
var updateOperationTags = (operation, draggedTag, hoveredTag) => {
|
|
1738
|
+
const tags = new Set(operation.tags ?? []);
|
|
1739
|
+
if (hoveredTag) tags.add(hoveredTag.name);
|
|
1740
|
+
if (draggedTag) tags.delete(draggedTag.name);
|
|
1741
|
+
operation.tags = Array.from(tags);
|
|
1742
|
+
};
|
|
1743
|
+
/**
|
|
1744
|
+
* Moves an operation from one document to another.
|
|
1745
|
+
*/
|
|
1746
|
+
var moveOperationBetweenDocuments = (draggingDocument, hoveredDocument, draggingItem, operationCopy) => {
|
|
1747
|
+
if (draggingDocument.paths?.[draggingItem.path]?.[draggingItem.method]) delete draggingDocument.paths[draggingItem.path][draggingItem.method];
|
|
1748
|
+
if (!hoveredDocument.paths) hoveredDocument.paths = { [draggingItem.path]: { [draggingItem.method]: operationCopy } };
|
|
1749
|
+
else {
|
|
1750
|
+
if (!hoveredDocument.paths[draggingItem.path]) hoveredDocument.paths[draggingItem.path] = {};
|
|
1751
|
+
hoveredDocument.paths[draggingItem.path][draggingItem.method] = operationCopy;
|
|
1752
|
+
}
|
|
1753
|
+
};
|
|
1754
|
+
/**
|
|
1755
|
+
* Retrieves the dereferenced operation object for a given path and method.
|
|
1756
|
+
* This resolves all $ref references so you always get the full, dereferenced operation.
|
|
1757
|
+
*/
|
|
1758
|
+
var getDereferencedOperation = (document, path, method) => {
|
|
1759
|
+
const operation = dereference(document).schema.paths?.[path]?.[method];
|
|
1760
|
+
return toJsonCompatible(operation, { prefix: `#/paths/${escapeJsonPointer(path)}/${method}` });
|
|
1761
|
+
};
|
|
1762
|
+
/**
|
|
1763
|
+
* Handles moving an operation between different documents/tags.
|
|
1764
|
+
*/
|
|
1765
|
+
var handleMoveOperation = (store, draggingItem, hoveredItem) => {
|
|
1766
|
+
const draggingDocumentEntry = getParentEntry("document", draggingItem);
|
|
1767
|
+
const hoveredDocumentEntry = getParentEntry("document", hoveredItem);
|
|
1768
|
+
if (!draggingDocumentEntry || !hoveredDocumentEntry) return false;
|
|
1769
|
+
const draggingDocument = getOpenapiObject({
|
|
1770
|
+
store,
|
|
1771
|
+
entry: draggingDocumentEntry
|
|
1772
|
+
});
|
|
1773
|
+
const hoveredDocument = getOpenapiObject({
|
|
1774
|
+
store,
|
|
1775
|
+
entry: hoveredDocumentEntry
|
|
1776
|
+
});
|
|
1777
|
+
if (!draggingDocument || !hoveredDocument) return false;
|
|
1778
|
+
const currentOperation = getDereferencedOperation(unpackProxyObject(draggingDocument), draggingItem.path, draggingItem.method);
|
|
1779
|
+
if (!currentOperation) return false;
|
|
1780
|
+
updateOperationTags(currentOperation, getParentEntry("tag", draggingItem) ?? null, getParentEntry("tag", hoveredItem) ?? null);
|
|
1781
|
+
moveOperationBetweenDocuments(draggingDocument, hoveredDocument, draggingItem, currentOperation);
|
|
1782
|
+
rebuildSidebar({
|
|
1783
|
+
store,
|
|
1784
|
+
entry: draggingItem
|
|
1785
|
+
});
|
|
1786
|
+
rebuildSidebar({
|
|
1787
|
+
store,
|
|
1788
|
+
entry: hoveredItem
|
|
1789
|
+
});
|
|
1790
|
+
return true;
|
|
1791
|
+
};
|
|
1792
|
+
/**
|
|
1793
|
+
* Handles document reordering.
|
|
1794
|
+
*/
|
|
1795
|
+
var handleDocumentReorder = (store, draggingItem, hoveredItem, offset) => {
|
|
1796
|
+
const order = store.workspace["x-scalar-order"] ?? [];
|
|
1797
|
+
const currentOrder = sortByOrder(Object.keys(store.workspace.documents), order, (item) => item);
|
|
1798
|
+
const newOrder = reorderArray(currentOrder, currentOrder.findIndex((id) => id === draggingItem.id), currentOrder.findIndex((id) => id === hoveredItem.id), offset);
|
|
1799
|
+
if (!newOrder) return false;
|
|
1800
|
+
store.update("x-scalar-order", newOrder);
|
|
1801
|
+
return true;
|
|
1802
|
+
};
|
|
1803
|
+
/**
|
|
1804
|
+
* Factory function that creates drag and drop handlers for sidebar items.
|
|
1805
|
+
* Handles reordering and moving of documents, tags, and operations.
|
|
1806
|
+
*/
|
|
1807
|
+
var dragHandleFactory = ({ store: _store, sidebarState }) => {
|
|
1808
|
+
/**
|
|
1809
|
+
* Handles the end of a drag operation.
|
|
1810
|
+
* Returns true if the drag and drop was successful, false otherwise.
|
|
1811
|
+
*/
|
|
1812
|
+
const handleDragEnd = (_draggingItem, _hoveredItem) => {
|
|
1813
|
+
const store = toValue(_store);
|
|
1814
|
+
if (!store) return false;
|
|
1815
|
+
const draggingItem = sidebarState.getEntryById(_draggingItem.id);
|
|
1816
|
+
const hoveredItem = sidebarState.getEntryById(_hoveredItem.id);
|
|
1817
|
+
if (!draggingItem || !hoveredItem) return false;
|
|
1818
|
+
if (draggingItem.type === "document") {
|
|
1819
|
+
if (hoveredItem.type !== "document" || !isReorder(_hoveredItem)) return false;
|
|
1820
|
+
return handleDocumentReorder(store, draggingItem, hoveredItem, _hoveredItem.offset);
|
|
1821
|
+
}
|
|
1822
|
+
if (draggingItem.type === "tag") {
|
|
1823
|
+
if (hoveredItem.type !== "tag" || !isReorder(_hoveredItem) || !itemsShareParent(draggingItem, hoveredItem)) return false;
|
|
1824
|
+
return handleReorderWithinParent(store, draggingItem, hoveredItem, _hoveredItem.offset);
|
|
1825
|
+
}
|
|
1826
|
+
if (draggingItem.type === "operation") {
|
|
1827
|
+
if (isReorder(_hoveredItem) && itemsShareParent(draggingItem, hoveredItem)) return handleReorderWithinParent(store, draggingItem, hoveredItem, _hoveredItem.offset);
|
|
1828
|
+
if (isEntryType(hoveredItem, ["tag", "document"]) && isDropIntoParent(_hoveredItem)) return handleMoveOperation(store, draggingItem, hoveredItem);
|
|
1829
|
+
}
|
|
1830
|
+
return false;
|
|
1831
|
+
};
|
|
1832
|
+
/**
|
|
1833
|
+
* Determines if an item can be dropped on another item.
|
|
1834
|
+
* Returns true if the drop operation is allowed, false otherwise.
|
|
1835
|
+
*/
|
|
1836
|
+
const isDroppable = (_draggingItem, _hoveredItem) => {
|
|
1837
|
+
const store = toValue(_store);
|
|
1838
|
+
if (!store) return false;
|
|
1839
|
+
const draggingItem = sidebarState.getEntryById(_draggingItem.id);
|
|
1840
|
+
const hoveredItem = sidebarState.getEntryById(_hoveredItem.id);
|
|
1841
|
+
if (!draggingItem || !hoveredItem) return false;
|
|
1842
|
+
if (draggingItem.type === "example") return false;
|
|
1843
|
+
if (draggingItem.type === "document") return hoveredItem.type === "document" && isReorder(_hoveredItem);
|
|
1844
|
+
if (draggingItem.type === "tag") return isReorder(_hoveredItem) && itemsShareParent(draggingItem, hoveredItem);
|
|
1845
|
+
if (draggingItem.type === "operation") {
|
|
1846
|
+
const hoveredDocumentEntry = getParentEntry("document", hoveredItem);
|
|
1847
|
+
const draggingDocumentEntry = getParentEntry("document", draggingItem);
|
|
1848
|
+
if (!hoveredDocumentEntry || !draggingDocumentEntry) return false;
|
|
1849
|
+
const hoveredDocument = getOpenapiObject({
|
|
1850
|
+
store,
|
|
1851
|
+
entry: hoveredDocumentEntry
|
|
1852
|
+
});
|
|
1853
|
+
if (!hoveredDocument) return false;
|
|
1854
|
+
const sameParent = itemsShareParent(draggingItem, hoveredItem);
|
|
1855
|
+
if (isReorder(_hoveredItem) && !sameParent) return false;
|
|
1856
|
+
if (sameParent) return isReorder(_hoveredItem) || isDropIntoParent(_hoveredItem) && isEntryType(hoveredItem, ["tag", "document"]);
|
|
1857
|
+
return isDropIntoParent(_hoveredItem) && isEntryType(hoveredItem, ["tag", "document"]) && (draggingDocumentEntry.id === hoveredDocumentEntry.id || hoveredDocument.paths?.[draggingItem.path]?.[draggingItem.method] === void 0);
|
|
1858
|
+
}
|
|
1859
|
+
return false;
|
|
1860
|
+
};
|
|
1861
|
+
return {
|
|
1862
|
+
handleDragEnd,
|
|
1863
|
+
isDroppable
|
|
1864
|
+
};
|
|
1865
|
+
};
|
|
1866
|
+
//#endregion
|
|
1867
|
+
//#region src/v2/features/app/components/AppSidebar.vue?vue&type=script&setup=true&lang.ts
|
|
1868
|
+
var _hoisted_1$2 = { class: "flex" };
|
|
1869
|
+
var _hoisted_2$2 = { class: "flex items-center gap-0.5" };
|
|
1870
|
+
var _hoisted_3$2 = {
|
|
1871
|
+
key: 0,
|
|
1872
|
+
class: "relative flex items-center"
|
|
1873
|
+
};
|
|
1874
|
+
var _hoisted_4$1 = {
|
|
1875
|
+
key: 0,
|
|
1876
|
+
class: "empty-sidebar-item-content overflow-hidden px-2.5 py-2.5"
|
|
1877
|
+
};
|
|
1878
|
+
var _hoisted_5$1 = { class: "rabbit-ascii relative m-auto mt-2 h-[68px] w-[60px]" };
|
|
1879
|
+
var _hoisted_6$1 = { class: "flex flex-col gap-1.5 p-2" };
|
|
1880
|
+
var _hoisted_7$1 = { class: "text-sidebar-c-2 rounded border px-1.25 py-1 text-xs leading-none font-medium uppercase" };
|
|
1881
|
+
//#endregion
|
|
1882
|
+
//#region src/v2/features/app/components/AppSidebar.vue
|
|
1883
|
+
var AppSidebar_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
1884
|
+
__name: "AppSidebar",
|
|
1885
|
+
props: /* @__PURE__ */ mergeModels({
|
|
1886
|
+
layout: {},
|
|
1887
|
+
sidebarState: {},
|
|
1888
|
+
isWorkspaceOpen: { type: Boolean },
|
|
1889
|
+
activeWorkspace: {},
|
|
1890
|
+
workspaces: {},
|
|
1891
|
+
eventBus: {},
|
|
1892
|
+
store: {}
|
|
1893
|
+
}, {
|
|
1894
|
+
"isSidebarOpen": {
|
|
1895
|
+
type: Boolean,
|
|
1896
|
+
required: true
|
|
1897
|
+
},
|
|
1898
|
+
"isSidebarOpenModifiers": {},
|
|
1899
|
+
"sidebarWidth": {
|
|
1900
|
+
required: true,
|
|
1901
|
+
default: 288
|
|
1902
|
+
},
|
|
1903
|
+
"sidebarWidthModifiers": {}
|
|
1904
|
+
}),
|
|
1905
|
+
emits: /* @__PURE__ */ mergeModels([
|
|
1906
|
+
"click:workspace",
|
|
1907
|
+
"selectItem",
|
|
1908
|
+
"select:workspace",
|
|
1909
|
+
"create:workspace"
|
|
1910
|
+
], ["update:isSidebarOpen", "update:sidebarWidth"]),
|
|
1911
|
+
setup(__props, { emit: __emit }) {
|
|
1912
|
+
const emit = __emit;
|
|
1913
|
+
/** The label for the workspace button in the sidebar */
|
|
1914
|
+
const workspaceLabel = computed(() => capitalize(__props.activeWorkspace.label));
|
|
1915
|
+
/** Controls the visibility of the sidebar */
|
|
1916
|
+
const isSidebarOpen = useModel(__props, "isSidebarOpen");
|
|
1917
|
+
/** Controls the width of the sidebar */
|
|
1918
|
+
const sidebarWidth = useModel(__props, "sidebarWidth");
|
|
1919
|
+
/** Calculate if we should show the getting started section */
|
|
1920
|
+
const showGettingStarted = computed(() => __props.sidebarState.items.value.length <= 1);
|
|
1921
|
+
const dragHandlers = computed(() => dragHandleFactory({
|
|
1922
|
+
store: __props.store,
|
|
1923
|
+
sidebarState: __props.sidebarState
|
|
1924
|
+
}));
|
|
1925
|
+
const handleDragEnd = (draggingItem, hoveredItem) => {
|
|
1926
|
+
return dragHandlers.value.handleDragEnd(draggingItem, hoveredItem);
|
|
1927
|
+
};
|
|
1928
|
+
const isDroppable = (draggingItem, hoveredItem) => {
|
|
1929
|
+
return dragHandlers.value.isDroppable(draggingItem, hoveredItem);
|
|
1930
|
+
};
|
|
1931
|
+
/** The current target for the dropdown menu */
|
|
1932
|
+
const menuTarget = ref(null);
|
|
1933
|
+
const deleteModalState = useModal();
|
|
1934
|
+
/** Computes the message for the delete modal */
|
|
1935
|
+
const deleteMessage = computed(() => {
|
|
1936
|
+
const item = menuTarget.value?.item;
|
|
1937
|
+
if (item?.type === "document") return "This cannot be undone. You're about to delete the document and all tags and operations inside it.";
|
|
1938
|
+
return `Are you sure you want to delete this ${item?.type ?? "item"}? This action cannot be undone.`;
|
|
1939
|
+
});
|
|
1940
|
+
/** Deletes an item from the sidebar by emitting the appropriate event */
|
|
1941
|
+
const handleDelete = () => {
|
|
1942
|
+
const item = menuTarget.value?.item;
|
|
1943
|
+
if (!item) return;
|
|
1944
|
+
const result = __props.sidebarState.getEntryById(item.id);
|
|
1945
|
+
const document = getParentEntry("document", result);
|
|
1946
|
+
const operation = getParentEntry("operation", result);
|
|
1947
|
+
if (!document) return;
|
|
1948
|
+
if (item.type === "document") __props.eventBus.emit("document:delete:document", { name: document.name });
|
|
1949
|
+
else if (item.type === "tag") __props.eventBus.emit("tag:delete:tag", {
|
|
1950
|
+
documentName: document.name,
|
|
1951
|
+
name: item.name
|
|
1952
|
+
});
|
|
1953
|
+
else if (item.type === "operation") {
|
|
1954
|
+
if (!operation) return;
|
|
1955
|
+
__props.eventBus.emit("operation:delete:operation", {
|
|
1956
|
+
meta: {
|
|
1957
|
+
method: operation.method,
|
|
1958
|
+
path: operation.path
|
|
1959
|
+
},
|
|
1960
|
+
documentName: document.name
|
|
1961
|
+
});
|
|
1962
|
+
} else if (item.type === "example") {
|
|
1963
|
+
if (!operation) return;
|
|
1964
|
+
__props.eventBus.emit("operation:delete:example", {
|
|
1965
|
+
meta: {
|
|
1966
|
+
method: operation.method,
|
|
1967
|
+
path: operation.path,
|
|
1968
|
+
exampleKey: item.name
|
|
1969
|
+
},
|
|
1970
|
+
documentName: document.name
|
|
1971
|
+
});
|
|
1972
|
+
}
|
|
1973
|
+
/** Clean up after deletion */
|
|
1974
|
+
deleteModalState.hide();
|
|
1975
|
+
menuTarget.value = null;
|
|
1976
|
+
};
|
|
1977
|
+
/** Opens the dropdown menu for the given item */
|
|
1978
|
+
const openMenu = async (event, item) => {
|
|
1979
|
+
if (menuTarget.value?.showMenu) return;
|
|
1980
|
+
menuTarget.value = {
|
|
1981
|
+
item,
|
|
1982
|
+
el: event.currentTarget,
|
|
1983
|
+
showMenu: true
|
|
1984
|
+
};
|
|
1985
|
+
await nextTick();
|
|
1986
|
+
const cloned = event instanceof MouseEvent ? new MouseEvent(event.type, event) : new KeyboardEvent(event.type, event);
|
|
1987
|
+
menuTarget.value?.el.dispatchEvent(cloned);
|
|
1988
|
+
};
|
|
1989
|
+
/** Closes the dropdown menu */
|
|
1990
|
+
const closeMenu = () => {
|
|
1991
|
+
if (menuTarget.value) menuTarget.value.showMenu = false;
|
|
1992
|
+
};
|
|
1993
|
+
/** Opens the command palette with the payload needed to create a request */
|
|
1994
|
+
const handleAddEmptyFolder = (item) => {
|
|
1995
|
+
const itemWithParent = __props.sidebarState.getEntryById(item.id);
|
|
1996
|
+
const documentEntry = getParentEntry("document", itemWithParent);
|
|
1997
|
+
const tag = getParentEntry("tag", itemWithParent);
|
|
1998
|
+
__props.eventBus.emit("ui:open:command-palette", {
|
|
1999
|
+
action: "create-request",
|
|
2000
|
+
payload: {
|
|
2001
|
+
documentName: documentEntry?.name,
|
|
2002
|
+
tagId: tag?.name
|
|
2003
|
+
}
|
|
2004
|
+
});
|
|
2005
|
+
};
|
|
2006
|
+
/**
|
|
2007
|
+
* Navigates to the operations page for the provided operation item.
|
|
2008
|
+
* Emits a navigation event for the operation overview page.
|
|
2009
|
+
*/
|
|
2010
|
+
const navigateToOperationsPage = (item) => {
|
|
2011
|
+
const documentSlug = getParentEntry("document", __props.sidebarState.getEntryById(item.id))?.name;
|
|
2012
|
+
__props.eventBus.emit("ui:navigate", {
|
|
2013
|
+
page: "operation",
|
|
2014
|
+
path: "overview",
|
|
2015
|
+
operationPath: item.path,
|
|
2016
|
+
method: item.method,
|
|
2017
|
+
documentSlug
|
|
2018
|
+
});
|
|
2019
|
+
};
|
|
2020
|
+
return (_ctx, _cache) => {
|
|
2021
|
+
return openBlock(), createElementBlock("div", _hoisted_1$2, [
|
|
2022
|
+
createVNode(unref(Sidebar_default), {
|
|
2023
|
+
sidebarWidth: sidebarWidth.value,
|
|
2024
|
+
"onUpdate:sidebarWidth": _cache[3] || (_cache[3] = ($event) => sidebarWidth.value = $event),
|
|
2025
|
+
activeWorkspace: __props.activeWorkspace,
|
|
2026
|
+
class: normalizeClass(["max-md:inset-y-0 max-md:z-2 max-md:w-full!", isSidebarOpen.value ? "max-md:fixed! max-md:flex!" : "max-md:hidden!"]),
|
|
2027
|
+
documents: Object.values(__props.store.workspace.documents),
|
|
2028
|
+
isDroppable,
|
|
2029
|
+
layout: __props.layout,
|
|
2030
|
+
sidebarState: __props.sidebarState,
|
|
2031
|
+
workspaces: __props.workspaces,
|
|
2032
|
+
"onCreate:workspace": _cache[4] || (_cache[4] = ($event) => emit("create:workspace")),
|
|
2033
|
+
"onNavigate:to:settings": _cache[5] || (_cache[5] = ($event) => __props.eventBus.emit("ui:navigate", {
|
|
2034
|
+
page: "workspace",
|
|
2035
|
+
path: "settings"
|
|
2036
|
+
})),
|
|
2037
|
+
onReorder: _cache[6] || (_cache[6] = (draggingItem, hoveredItem) => handleDragEnd(draggingItem, hoveredItem)),
|
|
2038
|
+
"onSelect:workspace": _cache[7] || (_cache[7] = (id) => emit("select:workspace", id)),
|
|
2039
|
+
onSelectItem: _cache[8] || (_cache[8] = (id) => emit("selectItem", id))
|
|
2040
|
+
}, createSlots({
|
|
2041
|
+
sidebarMenuActions: withCtx(() => [renderSlot(_ctx.$slots, "sidebarMenuActions", {}, void 0, true)]),
|
|
2042
|
+
workspaceButton: withCtx(() => [createVNode(unref(ScalarSidebarItem), {
|
|
2043
|
+
is: "button",
|
|
2044
|
+
active: __props.isWorkspaceOpen,
|
|
2045
|
+
onClick: _cache[0] || (_cache[0] = ($event) => emit("click:workspace"))
|
|
2046
|
+
}, {
|
|
2047
|
+
default: withCtx(() => [createTextVNode(toDisplayString(workspaceLabel.value), 1)]),
|
|
2048
|
+
_: 1
|
|
2049
|
+
}, 8, ["active"])]),
|
|
2050
|
+
decorator: withCtx(({ item }) => [createElementVNode("div", _hoisted_2$2, [item.type === "operation" ? (openBlock(), createBlock(unref(ScalarIconButton), {
|
|
2051
|
+
key: 0,
|
|
2052
|
+
icon: unref(ScalarIconGearSix),
|
|
2053
|
+
label: "Operation settings",
|
|
2054
|
+
size: "sm",
|
|
2055
|
+
weight: "bold",
|
|
2056
|
+
onClick: withModifiers(($event) => navigateToOperationsPage(item), ["stop"]),
|
|
2057
|
+
onKeydown: [withKeys(withModifiers(($event) => navigateToOperationsPage(item), ["stop"]), ["enter"]), withKeys(withModifiers(($event) => navigateToOperationsPage(item), ["stop"]), ["space"])]
|
|
2058
|
+
}, null, 8, [
|
|
2059
|
+
"icon",
|
|
2060
|
+
"onClick",
|
|
2061
|
+
"onKeydown"
|
|
2062
|
+
])) : createCommentVNode("", true), createVNode(unref(ScalarIconButton), {
|
|
2063
|
+
"aria-expanded": "false",
|
|
2064
|
+
"aria-haspopup": "menu",
|
|
2065
|
+
icon: unref(ScalarIconDotsThree),
|
|
2066
|
+
label: "More options",
|
|
2067
|
+
size: "sm",
|
|
2068
|
+
weight: "bold",
|
|
2069
|
+
onClick: withModifiers((e) => openMenu(e, item), ["stop"]),
|
|
2070
|
+
onKeydown: [
|
|
2071
|
+
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["down"]),
|
|
2072
|
+
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["enter"]),
|
|
2073
|
+
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["space"]),
|
|
2074
|
+
withKeys(withModifiers((e) => openMenu(e, item), ["stop"]), ["up"])
|
|
2075
|
+
]
|
|
2076
|
+
}, null, 8, [
|
|
2077
|
+
"icon",
|
|
2078
|
+
"onClick",
|
|
2079
|
+
"onKeydown"
|
|
2080
|
+
])])]),
|
|
2081
|
+
icon: withCtx(({ item }) => [item.type === "document" && __props.store.workspace.documents[item.name]?.["x-scalar-is-dirty"] === true ? (openBlock(), createElementBlock("div", _hoisted_3$2, [createVNode(unref(LibraryIcon), {
|
|
2082
|
+
class: "block",
|
|
2083
|
+
src: "icon" in item && item.icon || "interface-content-folder"
|
|
2084
|
+
}, null, 8, ["src"]), _cache[11] || (_cache[11] = createElementVNode("div", { class: "bg-orange absolute -top-1.25 -right-1.25 flex h-2.5 w-2.5 items-center justify-center rounded-full text-[9px] font-bold text-white" }, " ! ", -1))])) : createCommentVNode("", true)]),
|
|
2085
|
+
empty: withCtx(({ item }) => [createVNode(unref(ScalarSidebarItem), {
|
|
2086
|
+
is: "button",
|
|
2087
|
+
onClick: ($event) => handleAddEmptyFolder(item)
|
|
2088
|
+
}, {
|
|
2089
|
+
icon: withCtx(() => [createVNode(unref(ScalarIconPlus))]),
|
|
2090
|
+
default: withCtx(() => [..._cache[12] || (_cache[12] = [createTextVNode("Add operation", -1)])]),
|
|
2091
|
+
_: 1
|
|
2092
|
+
}, 8, ["onClick"])]),
|
|
2093
|
+
_: 2
|
|
2094
|
+
}, [__props.layout !== "modal" ? {
|
|
2095
|
+
name: "footer",
|
|
2096
|
+
fn: withCtx(() => [createElementVNode("div", { class: normalizeClass({ "empty-sidebar-item border-t": showGettingStarted.value }) }, [showGettingStarted.value ? (openBlock(), createElementBlock("div", _hoisted_4$1, [createElementVNode("div", _hoisted_5$1, [createVNode(ScalarAsciiArt_default, {
|
|
2097
|
+
art: unref(rabbit_default),
|
|
2098
|
+
class: "rabbitsit font-bold"
|
|
2099
|
+
}, null, 8, ["art"]), createVNode(ScalarAsciiArt_default, {
|
|
2100
|
+
art: unref(rabbitjump_default),
|
|
2101
|
+
class: "rabbitjump absolute top-0 left-0 font-bold"
|
|
2102
|
+
}, null, 8, ["art"])]), _cache[13] || (_cache[13] = createElementVNode("div", { class: "mt-2 mb-2 text-center text-sm text-balance" }, [createElementVNode("b", { class: "font-medium" }, "Let's Get Started"), createElementVNode("p", { class: "mt-2 leading-5" }, " Create request, folder, collection or import from OpenAPI/Postman ")], -1))])) : createCommentVNode("", true), createElementVNode("div", _hoisted_6$1, [
|
|
2103
|
+
showGettingStarted.value ? (openBlock(), createBlock(unref(ScalarButton), {
|
|
2104
|
+
key: 0,
|
|
2105
|
+
class: "w-full",
|
|
2106
|
+
size: "sm",
|
|
2107
|
+
onClick: _cache[1] || (_cache[1] = ($event) => __props.eventBus.emit("ui:open:command-palette", {
|
|
2108
|
+
action: "import-from-openapi-swagger-postman-curl",
|
|
2109
|
+
payload: void 0
|
|
2110
|
+
}))
|
|
2111
|
+
}, {
|
|
2112
|
+
default: withCtx(() => [..._cache[14] || (_cache[14] = [createTextVNode(" Import Collection ", -1)])]),
|
|
2113
|
+
_: 1
|
|
2114
|
+
})) : createCommentVNode("", true),
|
|
2115
|
+
createVNode(unref(ScalarButton), {
|
|
2116
|
+
class: "w-full",
|
|
2117
|
+
hotkey: "K",
|
|
2118
|
+
size: "sm",
|
|
2119
|
+
variant: "outlined",
|
|
2120
|
+
onClick: _cache[2] || (_cache[2] = ($event) => __props.eventBus.emit("ui:open:command-palette"))
|
|
2121
|
+
}, {
|
|
2122
|
+
default: withCtx(() => [_cache[20] || (_cache[20] = createTextVNode(" Add Item \xA0 ", -1)), createElementVNode("span", _hoisted_7$1, [unref(isMacOS)() ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [_cache[15] || (_cache[15] = createElementVNode("span", { class: "sr-only" }, "Command", -1)), _cache[16] || (_cache[16] = createElementVNode("span", { "aria-hidden": "true" }, "⌘", -1))], 64)) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [_cache[17] || (_cache[17] = createElementVNode("span", { class: "sr-only" }, "CTRL", -1)), _cache[18] || (_cache[18] = createElementVNode("span", { "aria-hidden": "true" }, "⌃", -1))], 64)), _cache[19] || (_cache[19] = createTextVNode(" K ", -1))])]),
|
|
2123
|
+
_: 1
|
|
2124
|
+
}),
|
|
2125
|
+
__props.layout === "web" ? (openBlock(), createBlock(DownloadAppButton_default, { key: 1 })) : createCommentVNode("", true)
|
|
2126
|
+
])], 2)]),
|
|
2127
|
+
key: "0"
|
|
2128
|
+
} : void 0]), 1032, [
|
|
2129
|
+
"sidebarWidth",
|
|
2130
|
+
"activeWorkspace",
|
|
2131
|
+
"class",
|
|
2132
|
+
"documents",
|
|
2133
|
+
"layout",
|
|
2134
|
+
"sidebarState",
|
|
2135
|
+
"workspaces"
|
|
2136
|
+
]),
|
|
2137
|
+
menuTarget.value?.showMenu ? (openBlock(), createBlock(SidebarItemMenu_default, {
|
|
2138
|
+
key: 0,
|
|
2139
|
+
eventBus: __props.eventBus,
|
|
2140
|
+
item: menuTarget.value.item,
|
|
2141
|
+
sidebarState: __props.sidebarState,
|
|
2142
|
+
target: menuTarget.value.el,
|
|
2143
|
+
onCloseMenu: closeMenu,
|
|
2144
|
+
onShowDeleteModal: _cache[9] || (_cache[9] = ($event) => unref(deleteModalState).show())
|
|
2145
|
+
}, null, 8, [
|
|
2146
|
+
"eventBus",
|
|
2147
|
+
"item",
|
|
2148
|
+
"sidebarState",
|
|
2149
|
+
"target"
|
|
2150
|
+
])) : createCommentVNode("", true),
|
|
2151
|
+
menuTarget.value ? (openBlock(), createBlock(unref(ScalarModal), {
|
|
2152
|
+
key: 1,
|
|
2153
|
+
size: "xxs",
|
|
2154
|
+
state: unref(deleteModalState),
|
|
2155
|
+
title: `Delete ${menuTarget.value.item.title}`
|
|
2156
|
+
}, {
|
|
2157
|
+
default: withCtx(() => [createVNode(DeleteSidebarListElement_default, {
|
|
2158
|
+
variableName: menuTarget.value.item.title,
|
|
2159
|
+
warningMessage: deleteMessage.value,
|
|
2160
|
+
onClose: _cache[10] || (_cache[10] = ($event) => unref(deleteModalState).hide()),
|
|
2161
|
+
onDelete: handleDelete
|
|
2162
|
+
}, null, 8, ["variableName", "warningMessage"])]),
|
|
2163
|
+
_: 1
|
|
2164
|
+
}, 8, ["state", "title"])) : createCommentVNode("", true)
|
|
2165
|
+
]);
|
|
2166
|
+
};
|
|
2167
|
+
}
|
|
2168
|
+
}), [["__scopeId", "data-v-8621f58a"]]);
|
|
2169
|
+
//#endregion
|
|
2170
|
+
//#region src/v2/features/app/components/DesktopTab.vue
|
|
2171
|
+
var DesktopTab_default = /* @__PURE__ */ _plugin_vue_export_helper_default(/* @__PURE__ */ defineComponent({
|
|
2172
|
+
__name: "DesktopTab",
|
|
2173
|
+
props: {
|
|
2174
|
+
hotkey: {},
|
|
2175
|
+
active: { type: Boolean },
|
|
2176
|
+
isSingleTab: {
|
|
2177
|
+
type: Boolean,
|
|
2178
|
+
default: false
|
|
2179
|
+
},
|
|
2180
|
+
tab: {}
|
|
2181
|
+
},
|
|
2182
|
+
emits: [
|
|
2183
|
+
"click",
|
|
2184
|
+
"close",
|
|
2185
|
+
"newTab",
|
|
2186
|
+
"copyUrl",
|
|
2187
|
+
"closeOtherTabs"
|
|
2188
|
+
],
|
|
2189
|
+
setup(__props, { emit: __emit }) {
|
|
2190
|
+
const emit = __emit;
|
|
2191
|
+
const ICONS = {
|
|
2192
|
+
request: ScalarIconArrowUpRight,
|
|
2193
|
+
document: ScalarIconFolderSimple
|
|
2194
|
+
};
|
|
2195
|
+
/** Display the appropriate modifier key based on the operating system */
|
|
2196
|
+
const modifierKey = computed(() => isMacOS() ? "⌘" : "^");
|
|
2197
|
+
/** The tooltip content showing the keyboard shortcut */
|
|
2198
|
+
const tooltipContent = computed(() => __props.hotkey ? `${modifierKey.value} ${__props.hotkey}` : "");
|
|
2199
|
+
/**
|
|
2200
|
+
* Handle the close button click.
|
|
2201
|
+
* We stop propagation to prevent triggering the tab activation click.
|
|
2202
|
+
*/
|
|
2203
|
+
const handleClose = (event) => {
|
|
2204
|
+
event.stopPropagation();
|
|
2205
|
+
emit("close");
|
|
2206
|
+
};
|
|
2207
|
+
return (_ctx, _cache) => {
|
|
2208
|
+
return openBlock(), createBlock(unref(ScalarContextMenu), { triggerClass: "overflow-hidden w-full flex-1 select-none\n" }, {
|
|
2209
|
+
trigger: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(__props.isSingleTab ? "div" : unref(ScalarTooltip)), {
|
|
2210
|
+
content: tooltipContent.value,
|
|
2211
|
+
placement: "bottom"
|
|
2212
|
+
}, {
|
|
2213
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
2214
|
+
class: normalizeClass(["app-no-drag-region", [__props.isSingleTab ? "nav-single-tab" : "nav-item", { "nav-item__active": __props.active && !__props.isSingleTab }]]),
|
|
2215
|
+
onClick: _cache[0] || (_cache[0] = ($event) => !__props.isSingleTab && emit("click"))
|
|
2216
|
+
}, [createElementVNode("div", { class: normalizeClass(["flex items-center justify-center gap-1.5", __props.isSingleTab ? "custom-scroll h-full w-full whitespace-nowrap" : "nav-item-icon-copy flex-1"]) }, [__props.tab.icon && ICONS[__props.tab.icon] ? (openBlock(), createBlock(resolveDynamicComponent(ICONS[__props.tab.icon]), { key: 0 })) : createCommentVNode("", true), createElementVNode("span", { class: normalizeClass([__props.isSingleTab ? "" : "custom-scroll nav-item-copy", "text-sm"]) }, toDisplayString(__props.tab.title), 3)], 2), !__props.isSingleTab ? (openBlock(), createElementBlock("button", {
|
|
2217
|
+
key: 0,
|
|
2218
|
+
class: "nav-item-close",
|
|
2219
|
+
type: "button",
|
|
2220
|
+
onClick: handleClose
|
|
2221
|
+
}, [(openBlock(), createBlock(resolveDynamicComponent(unref(ScalarIconX))))])) : createCommentVNode("", true)], 2)]),
|
|
2222
|
+
_: 1
|
|
2223
|
+
}, 8, ["content"]))]),
|
|
2224
|
+
content: withCtx(() => [createVNode(unref(ScalarFloating), { placement: "right-start" }, {
|
|
2225
|
+
floating: withCtx(() => [createVNode(unref(ScalarDropdownMenu), { class: "scalar-app scalar-client" }, {
|
|
2226
|
+
default: withCtx(() => [
|
|
2227
|
+
createVNode(unref(ScalarDropdownButton), {
|
|
2228
|
+
class: "flex items-center gap-1.5",
|
|
2229
|
+
onClick: _cache[1] || (_cache[1] = ($event) => emit("newTab"))
|
|
2230
|
+
}, {
|
|
2231
|
+
default: withCtx(() => [
|
|
2232
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(ScalarIconPlusSquare)))),
|
|
2233
|
+
_cache[5] || (_cache[5] = createTextVNode(" New Tab ", -1)),
|
|
2234
|
+
createVNode(unref(ScalarHotkey), {
|
|
2235
|
+
class: "bg-b-2 ml-auto",
|
|
2236
|
+
hotkey: "T"
|
|
2237
|
+
})
|
|
2238
|
+
]),
|
|
2239
|
+
_: 1
|
|
2240
|
+
}),
|
|
2241
|
+
createVNode(unref(ScalarDropdownButton), {
|
|
2242
|
+
class: "flex items-center gap-1.5",
|
|
2243
|
+
onClick: _cache[2] || (_cache[2] = ($event) => emit("copyUrl"))
|
|
2244
|
+
}, {
|
|
2245
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(ScalarIconLinkSimple)))), _cache[6] || (_cache[6] = createTextVNode(" Copy URL ", -1))]),
|
|
2246
|
+
_: 1
|
|
2247
|
+
}),
|
|
2248
|
+
!__props.isSingleTab ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [
|
|
2249
|
+
createVNode(unref(ScalarDropdownDivider)),
|
|
2250
|
+
createVNode(unref(ScalarDropdownButton), {
|
|
2251
|
+
class: "flex items-center gap-1.5",
|
|
2252
|
+
onClick: _cache[3] || (_cache[3] = ($event) => emit("close"))
|
|
2253
|
+
}, {
|
|
2254
|
+
default: withCtx(() => [
|
|
2255
|
+
(openBlock(), createBlock(resolveDynamicComponent(unref(ScalarIconXSquare)))),
|
|
2256
|
+
_cache[7] || (_cache[7] = createTextVNode(" Close Tab ", -1)),
|
|
2257
|
+
createVNode(unref(ScalarHotkey), {
|
|
2258
|
+
class: "bg-b-2 ml-auto",
|
|
2259
|
+
hotkey: "W"
|
|
2260
|
+
})
|
|
2261
|
+
]),
|
|
2262
|
+
_: 1
|
|
2263
|
+
}),
|
|
2264
|
+
createVNode(unref(ScalarDropdownButton), {
|
|
2265
|
+
class: "flex items-center gap-1.5",
|
|
2266
|
+
onClick: _cache[4] || (_cache[4] = ($event) => emit("closeOtherTabs"))
|
|
2267
|
+
}, {
|
|
2268
|
+
default: withCtx(() => [(openBlock(), createBlock(resolveDynamicComponent(unref(ScalarIconTabs)))), _cache[8] || (_cache[8] = createTextVNode(" Close Other Tabs ", -1))]),
|
|
2269
|
+
_: 1
|
|
2270
|
+
})
|
|
2271
|
+
], 64)) : createCommentVNode("", true)
|
|
2272
|
+
]),
|
|
2273
|
+
_: 1
|
|
2274
|
+
})]),
|
|
2275
|
+
_: 1
|
|
2276
|
+
})]),
|
|
2277
|
+
_: 1
|
|
2278
|
+
});
|
|
2279
|
+
};
|
|
2280
|
+
}
|
|
2281
|
+
}), [["__scopeId", "data-v-2e741aab"]]);
|
|
2282
|
+
//#endregion
|
|
2283
|
+
//#region src/v2/features/app/components/DesktopTabs.vue?vue&type=script&setup=true&lang.ts
|
|
2284
|
+
var _hoisted_1$1 = { class: "t-app__top-nav" };
|
|
2285
|
+
var _hoisted_2$1 = { class: "mac:app-drag-region" };
|
|
2286
|
+
var _hoisted_3$1 = { class: "z-1 flex h-10 items-center gap-2 px-2" };
|
|
2287
|
+
//#endregion
|
|
2288
|
+
//#region src/v2/features/app/components/DesktopTabs.vue
|
|
2289
|
+
var DesktopTabs_default = /* @__PURE__ */ defineComponent({
|
|
2290
|
+
__name: "DesktopTabs",
|
|
2291
|
+
props: {
|
|
2292
|
+
tabs: {},
|
|
2293
|
+
activeTabIndex: {},
|
|
2294
|
+
eventBus: {}
|
|
2295
|
+
},
|
|
2296
|
+
setup(__props) {
|
|
2297
|
+
/** Whether there is only a single tab open */
|
|
2298
|
+
const isSingleTab = computed(() => __props.tabs.length === 1);
|
|
2299
|
+
/** Adds a new tab */
|
|
2300
|
+
const handleAddTab = () => {
|
|
2301
|
+
__props.eventBus.emit("tabs:add:tab", void 0);
|
|
2302
|
+
};
|
|
2303
|
+
/** Switches to the tab at the specified index */
|
|
2304
|
+
const switchTab = (index) => {
|
|
2305
|
+
__props.eventBus.emit("tabs:focus:tab", { index });
|
|
2306
|
+
};
|
|
2307
|
+
/** Closes the tab at the specified index */
|
|
2308
|
+
const handleCloseTab = (index) => {
|
|
2309
|
+
__props.eventBus.emit("tabs:close:tab", { index });
|
|
2310
|
+
};
|
|
2311
|
+
/** Closes all tabs except the one at the specified index */
|
|
2312
|
+
const handleCloseOtherTabs = (index) => {
|
|
2313
|
+
__props.eventBus.emit("tabs:close:other-tabs", { index });
|
|
2314
|
+
};
|
|
2315
|
+
const handleCopyTabUrl = (index) => {
|
|
2316
|
+
__props.eventBus.emit("tabs:copy:url", { index });
|
|
2317
|
+
};
|
|
2318
|
+
return (_ctx, _cache) => {
|
|
2319
|
+
return openBlock(), createElementBlock("nav", _hoisted_1$1, [createElementVNode("div", _hoisted_2$1, [createElementVNode("div", _hoisted_3$1, [(openBlock(true), createElementBlock(Fragment, null, renderList(__props.tabs, (tab, index) => {
|
|
2320
|
+
return openBlock(), createBlock(DesktopTab_default, {
|
|
2321
|
+
key: index,
|
|
2322
|
+
active: index === __props.activeTabIndex,
|
|
2323
|
+
hotkey: !isSingleTab.value && index < 9 ? String(index + 1) : void 0,
|
|
2324
|
+
isSingleTab: isSingleTab.value,
|
|
2325
|
+
tab,
|
|
2326
|
+
onClick: ($event) => switchTab(index),
|
|
2327
|
+
onClose: ($event) => handleCloseTab(index),
|
|
2328
|
+
onCloseOtherTabs: ($event) => handleCloseOtherTabs(index),
|
|
2329
|
+
onCopyUrl: () => handleCopyTabUrl(index),
|
|
2330
|
+
onNewTab: handleAddTab
|
|
2331
|
+
}, null, 8, [
|
|
2332
|
+
"active",
|
|
2333
|
+
"hotkey",
|
|
2334
|
+
"isSingleTab",
|
|
2335
|
+
"tab",
|
|
2336
|
+
"onClick",
|
|
2337
|
+
"onClose",
|
|
2338
|
+
"onCloseOtherTabs",
|
|
2339
|
+
"onCopyUrl"
|
|
2340
|
+
]);
|
|
2341
|
+
}), 128)), createElementVNode("button", {
|
|
2342
|
+
class: "text-c-3 hover:bg-b-3 app-no-drag-region rounded p-1.5",
|
|
2343
|
+
type: "button",
|
|
2344
|
+
onClick: handleAddTab
|
|
2345
|
+
}, [createVNode(unref(ScalarIcon), {
|
|
2346
|
+
icon: "Add",
|
|
2347
|
+
size: "sm",
|
|
2348
|
+
thickness: "2.5"
|
|
2349
|
+
})])])])]);
|
|
2350
|
+
};
|
|
2351
|
+
}
|
|
2352
|
+
});
|
|
2353
|
+
//#endregion
|
|
2354
|
+
//#region src/v2/features/app/App.vue?vue&type=script&setup=true&lang.ts
|
|
2355
|
+
var _hoisted_1 = ["innerHTML"];
|
|
2356
|
+
var _hoisted_2 = { key: 0 };
|
|
2357
|
+
var _hoisted_3 = { class: "relative flex h-dvh w-dvw flex-1 flex-col" };
|
|
2358
|
+
var _hoisted_4 = { class: "flex min-h-0 flex-1 flex-row" };
|
|
2359
|
+
var _hoisted_5 = { class: "flex flex-1 flex-col" };
|
|
2360
|
+
var _hoisted_6 = { class: "bg-b-1 min-h-0 flex-1" };
|
|
2361
|
+
var _hoisted_7 = { key: 1 };
|
|
2362
|
+
//#endregion
|
|
2363
|
+
//#region src/v2/features/app/App.vue
|
|
2364
|
+
var App_default = /* @__PURE__ */ defineComponent({
|
|
2365
|
+
__name: "App",
|
|
2366
|
+
props: {
|
|
2367
|
+
layout: {},
|
|
2368
|
+
plugins: { default: () => [] },
|
|
2369
|
+
getAppState: { type: Function },
|
|
2370
|
+
getCommandPaletteState: { type: Function },
|
|
2371
|
+
fetchRegistryDocument: { type: Function }
|
|
2372
|
+
},
|
|
2373
|
+
setup(__props, { expose: __expose }) {
|
|
2374
|
+
__expose({ openCreateWorkspace: () => createWorkspaceModalState.show() });
|
|
2375
|
+
const app = __props.getAppState();
|
|
2376
|
+
const paletteState = __props.getCommandPaletteState();
|
|
2377
|
+
/** Expose workspace store to window for debugging purposes. */
|
|
2378
|
+
if (typeof window !== "undefined") {
|
|
2379
|
+
window.dataDumpWorkspace = () => app.store.value;
|
|
2380
|
+
window.dumpAppState = () => app;
|
|
2381
|
+
}
|
|
2382
|
+
/** Register global hotkeys for the app, passing the workspace event bus and layout state */
|
|
2383
|
+
useGlobalHotKeys(app.eventBus, __props.layout);
|
|
2384
|
+
/** Watch the active document for changes and rebase it with its remote source */
|
|
2385
|
+
useDocumentWatcher({
|
|
2386
|
+
documentName: () => app.store.value?.workspace[extensions.workspace.activeDocument],
|
|
2387
|
+
store: app.store,
|
|
2388
|
+
initialTimeout: 5e3
|
|
2389
|
+
});
|
|
2390
|
+
/** Color mode */
|
|
2391
|
+
useColorMode({ workspaceStore: app.store });
|
|
2392
|
+
/** Setup monaco editor configuration */
|
|
2393
|
+
useMonacoEditorConfiguration({
|
|
2394
|
+
theme: computed(() => app.theme.styles.value.themeStyles),
|
|
2395
|
+
darkMode: computed(() => app.isDarkMode.value)
|
|
2396
|
+
});
|
|
2397
|
+
const navigateToWorkspaceOverview = (namespace, slug) => {
|
|
2398
|
+
app.eventBus.emit("ui:navigate", {
|
|
2399
|
+
page: "workspace",
|
|
2400
|
+
path: "environment",
|
|
2401
|
+
namespace,
|
|
2402
|
+
workspaceSlug: slug
|
|
2403
|
+
});
|
|
2404
|
+
};
|
|
2405
|
+
/** Sets the active workspace by ID: finds the workspace in the list and updates app state & navigation. */
|
|
2406
|
+
const setActiveWorkspace = (id) => {
|
|
2407
|
+
if (!id) return;
|
|
2408
|
+
const workspace = app.workspace.workspaceList.value?.find((workspace) => workspace.id === id);
|
|
2409
|
+
if (!workspace) return;
|
|
2410
|
+
navigateToWorkspaceOverview(workspace.namespace, workspace.slug);
|
|
2411
|
+
};
|
|
2412
|
+
const createWorkspaceModalState = useModal();
|
|
2413
|
+
/** Props to pass to the RouterView component. */
|
|
2414
|
+
const routerViewProps = computed(() => {
|
|
2415
|
+
/** Ensure we have the auth store */
|
|
2416
|
+
const securitySchemes = app.store.value?.auth ? mergeSecurity(app.document.value?.components?.securitySchemes ?? {}, {}, app.store.value.auth, app.activeEntities.documentSlug.value ?? "") : {};
|
|
2417
|
+
return {
|
|
2418
|
+
documentSlug: app.activeEntities.documentSlug.value ?? "",
|
|
2419
|
+
document: app.store.value?.workspace.activeDocument ?? null,
|
|
2420
|
+
environment: app.environment.value,
|
|
2421
|
+
eventBus: app.eventBus,
|
|
2422
|
+
exampleName: app.activeEntities.exampleName.value,
|
|
2423
|
+
fetchRegistryDocument: __props.fetchRegistryDocument,
|
|
2424
|
+
layout: __props.layout,
|
|
2425
|
+
method: app.activeEntities.method.value,
|
|
2426
|
+
path: app.activeEntities.path.value,
|
|
2427
|
+
workspaceStore: app.store.value,
|
|
2428
|
+
activeWorkspace: app.workspace.activeWorkspace.value,
|
|
2429
|
+
plugins: __props.plugins,
|
|
2430
|
+
securitySchemes,
|
|
2431
|
+
isDarkMode: app.isDarkMode.value,
|
|
2432
|
+
currentTheme: app.theme.styles.value.themeStyles,
|
|
2433
|
+
customThemes: toValue(app.theme.customThemes)
|
|
2434
|
+
};
|
|
2435
|
+
});
|
|
2436
|
+
return (_ctx, _cache) => {
|
|
2437
|
+
return openBlock(), createBlock(unref(ScalarTeleportRoot), null, {
|
|
2438
|
+
default: withCtx(() => [
|
|
2439
|
+
createElementVNode("div", { innerHTML: unref(app).theme.themeStyleTag.value }, null, 8, _hoisted_1),
|
|
2440
|
+
createVNode(unref(ScalarToasts)),
|
|
2441
|
+
unref(app).store.value !== null && unref(app).workspace.activeWorkspace.value !== null && !unref(app).loading.value ? (openBlock(), createElementBlock("main", _hoisted_2, [
|
|
2442
|
+
createElementVNode("div", _hoisted_3, [createVNode(unref(SidebarToggle_default), {
|
|
2443
|
+
modelValue: unref(app).sidebar.isOpen.value,
|
|
2444
|
+
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => unref(app).sidebar.isOpen.value = $event),
|
|
2445
|
+
class: "absolute top-4 left-3 z-[60] md:hidden"
|
|
2446
|
+
}, null, 8, ["modelValue"]), createElementVNode("div", _hoisted_4, [createVNode(AppSidebar_default, {
|
|
2447
|
+
isSidebarOpen: unref(app).sidebar.isOpen.value,
|
|
2448
|
+
"onUpdate:isSidebarOpen": _cache[1] || (_cache[1] = ($event) => unref(app).sidebar.isOpen.value = $event),
|
|
2449
|
+
activeWorkspace: unref(app).workspace.activeWorkspace.value,
|
|
2450
|
+
eventBus: unref(app).eventBus,
|
|
2451
|
+
isWorkspaceOpen: unref(app).workspace.isOpen.value,
|
|
2452
|
+
layout: __props.layout,
|
|
2453
|
+
sidebarState: unref(app).sidebar.state,
|
|
2454
|
+
sidebarWidth: unref(app).sidebar.width.value,
|
|
2455
|
+
store: unref(app).store.value,
|
|
2456
|
+
workspaces: unref(app).workspace.workspaceGroups.value,
|
|
2457
|
+
"onClick:workspace": navigateToWorkspaceOverview,
|
|
2458
|
+
"onCreate:workspace": _cache[2] || (_cache[2] = ($event) => unref(createWorkspaceModalState).show()),
|
|
2459
|
+
"onSelect:workspace": setActiveWorkspace,
|
|
2460
|
+
onSelectItem: unref(app).sidebar.handleSelectItem,
|
|
2461
|
+
"onUpdate:sidebarWidth": unref(app).sidebar.handleSidebarWidthUpdate
|
|
2462
|
+
}, {
|
|
2463
|
+
sidebarMenuActions: withCtx(() => [renderSlot(_ctx.$slots, "sidebar-menu-actions")]),
|
|
2464
|
+
_: 3
|
|
2465
|
+
}, 8, [
|
|
2466
|
+
"isSidebarOpen",
|
|
2467
|
+
"activeWorkspace",
|
|
2468
|
+
"eventBus",
|
|
2469
|
+
"isWorkspaceOpen",
|
|
2470
|
+
"layout",
|
|
2471
|
+
"sidebarState",
|
|
2472
|
+
"sidebarWidth",
|
|
2473
|
+
"store",
|
|
2474
|
+
"workspaces",
|
|
2475
|
+
"onSelectItem",
|
|
2476
|
+
"onUpdate:sidebarWidth"
|
|
2477
|
+
]), createElementVNode("div", _hoisted_5, [__props.layout === "desktop" ? (openBlock(), createBlock(DesktopTabs_default, {
|
|
2478
|
+
key: 0,
|
|
2479
|
+
activeTabIndex: unref(app).tabs.activeTabIndex.value,
|
|
2480
|
+
eventBus: unref(app).eventBus,
|
|
2481
|
+
tabs: unref(app).tabs.state.value
|
|
2482
|
+
}, null, 8, [
|
|
2483
|
+
"activeTabIndex",
|
|
2484
|
+
"eventBus",
|
|
2485
|
+
"tabs"
|
|
2486
|
+
])) : createCommentVNode("", true), createElementVNode("div", _hoisted_6, [createVNode(unref(RouterView), normalizeProps(guardReactiveProps(routerViewProps.value)), null, 16)])])])]),
|
|
2487
|
+
renderSlot(_ctx.$slots, "create-workspace", { state: unref(createWorkspaceModalState) }, () => [createVNode(CreateWorkspaceModal_default, {
|
|
2488
|
+
state: unref(createWorkspaceModalState),
|
|
2489
|
+
"onCreate:workspace": _cache[3] || (_cache[3] = (payload) => unref(app).workspace.create(payload))
|
|
2490
|
+
}, null, 8, ["state"])]),
|
|
2491
|
+
createVNode(TheCommandPalette_default, {
|
|
2492
|
+
eventBus: unref(app).eventBus,
|
|
2493
|
+
paletteState: unref(paletteState),
|
|
2494
|
+
workspaceStore: unref(app).store.value
|
|
2495
|
+
}, null, 8, [
|
|
2496
|
+
"eventBus",
|
|
2497
|
+
"paletteState",
|
|
2498
|
+
"workspaceStore"
|
|
2499
|
+
])
|
|
2500
|
+
])) : (openBlock(), createElementBlock("main", _hoisted_7, [createVNode(SplashScreen_default)]))
|
|
2501
|
+
]),
|
|
2502
|
+
_: 3
|
|
2503
|
+
});
|
|
2504
|
+
};
|
|
2505
|
+
}
|
|
2506
|
+
});
|
|
2507
|
+
//#endregion
|
|
2508
|
+
export { workspaceStorage as i, CreateWorkspaceModal_default as n, createAppState as r, App_default as t };
|
|
2509
|
+
|
|
2510
|
+
//# sourceMappingURL=App-CvClwSlM.js.map
|