@scalar/api-client 3.2.2 → 3.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -0
- package/dist/style.css +102 -130
- package/dist/v2/blocks/operation-block/OperationBlock.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js +9 -0
- package/dist/v2/blocks/operation-block/OperationBlock.vue.script.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts +2 -0
- package/dist/v2/blocks/operation-block/components/Header.vue.d.ts.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.js.map +1 -1
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js +20 -10
- package/dist/v2/blocks/operation-block/components/Header.vue.script.js.map +1 -1
- package/dist/v2/blocks/request-block/components/RequestTable.vue.d.ts +2 -2
- package/dist/v2/blocks/request-block/components/RequestTableRow.vue.d.ts +2 -2
- package/dist/v2/blocks/response-block/components/ResponseEmpty.vue.d.ts +2 -2
- package/dist/v2/components/server/ServerDropdown.vue.d.ts +2 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js +2 -2
- package/dist/v2/components/sidebar/Sidebar.vue.script.js.map +1 -1
- package/dist/v2/constants.js +1 -1
- package/dist/v2/features/app/App.vue.d.ts +22 -4
- package/dist/v2/features/app/App.vue.d.ts.map +1 -1
- package/dist/v2/features/app/App.vue.js.map +1 -1
- package/dist/v2/features/app/App.vue.script.js +57 -54
- package/dist/v2/features/app/App.vue.script.js.map +1 -1
- package/dist/v2/features/app/app-events.d.ts.map +1 -1
- package/dist/v2/features/app/app-events.js +4 -0
- package/dist/v2/features/app/app-events.js.map +1 -1
- package/dist/v2/features/app/app-state.d.ts +6 -0
- package/dist/v2/features/app/app-state.d.ts.map +1 -1
- package/dist/v2/features/app/app-state.js +15 -1
- package/dist/v2/features/app/app-state.js.map +1 -1
- package/dist/v2/features/app/components/AppHeader.vue.d.ts +20 -0
- package/dist/v2/features/app/components/AppHeader.vue.d.ts.map +1 -0
- package/dist/v2/features/app/components/AppHeader.vue.js +7 -0
- package/dist/v2/features/app/components/AppHeader.vue.js.map +1 -0
- package/dist/v2/features/app/components/AppHeader.vue.script.js +43 -0
- package/dist/v2/features/app/components/AppHeader.vue.script.js.map +1 -0
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts +17 -56
- package/dist/v2/features/app/components/AppSidebar.vue.d.ts.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.js.map +1 -1
- package/dist/v2/features/app/components/AppSidebar.vue.script.js +437 -271
- package/dist/v2/features/app/components/AppSidebar.vue.script.js.map +1 -1
- package/dist/v2/features/app/helpers/load-registry-document.d.ts +18 -0
- package/dist/v2/features/app/helpers/load-registry-document.d.ts.map +1 -0
- package/dist/v2/features/app/helpers/load-registry-document.js +45 -0
- package/dist/v2/features/app/helpers/load-registry-document.js.map +1 -0
- package/dist/v2/features/app/helpers/routes.d.ts +6 -1
- package/dist/v2/features/app/helpers/routes.d.ts.map +1 -1
- package/dist/v2/features/app/helpers/routes.js +84 -75
- package/dist/v2/features/app/helpers/routes.js.map +1 -1
- package/dist/v2/features/app/hooks/use-document-filter.d.ts +38 -0
- package/dist/v2/features/app/hooks/use-document-filter.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-document-filter.js +63 -0
- package/dist/v2/features/app/hooks/use-document-filter.js.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.d.ts +17258 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.js +107 -0
- package/dist/v2/features/app/hooks/use-sidebar-context-menu.js.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts +95 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.d.ts.map +1 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.js +97 -0
- package/dist/v2/features/app/hooks/use-sidebar-documents.js.map +1 -0
- package/dist/v2/features/app/index.d.ts +1 -0
- package/dist/v2/features/app/index.d.ts.map +1 -1
- package/dist/v2/features/collection/components/GetStarted.vue.d.ts +13 -0
- package/dist/v2/features/collection/components/GetStarted.vue.d.ts.map +1 -0
- package/dist/v2/features/collection/components/GetStarted.vue.js +7 -0
- package/dist/v2/features/collection/components/GetStarted.vue.js.map +1 -0
- package/dist/v2/features/collection/components/GetStarted.vue.script.js +101 -0
- package/dist/v2/features/collection/components/GetStarted.vue.script.js.map +1 -0
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.d.ts +4 -0
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.d.ts.map +1 -1
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.js +5 -1
- package/dist/v2/features/command-palette/helpers/generate-unique-slug.js.map +1 -1
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts +16 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.d.ts.map +1 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js +9 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.js.map +1 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js +123 -0
- package/dist/v2/features/search/components/DocumentSearchModal.vue.script.js.map +1 -0
- package/dist/v2/features/search/components/SearchResult.vue.d.ts +11 -0
- package/dist/v2/features/search/components/SearchResult.vue.d.ts.map +1 -0
- package/dist/v2/features/search/components/SearchResult.vue.js +7 -0
- package/dist/v2/features/search/components/SearchResult.vue.js.map +1 -0
- package/dist/v2/features/search/components/SearchResult.vue.script.js +71 -0
- package/dist/v2/features/search/components/SearchResult.vue.script.js.map +1 -0
- package/dist/v2/features/search/hooks/use-document-search.d.ts +19 -0
- package/dist/v2/features/search/hooks/use-document-search.d.ts.map +1 -0
- package/dist/v2/features/search/hooks/use-document-search.js +42 -0
- package/dist/v2/features/search/hooks/use-document-search.js.map +1 -0
- package/dist/v2/features/search/index.d.ts +2 -0
- package/dist/v2/features/search/index.d.ts.map +1 -1
- package/dist/v2/features/search/index.js +3 -1
- package/dist/v2/helpers/handle-hotkeys.d.ts.map +1 -1
- package/dist/v2/helpers/handle-hotkeys.js +8 -4
- package/dist/v2/helpers/handle-hotkeys.js.map +1 -1
- package/dist/v2/types/configuration.d.ts +1 -0
- package/dist/v2/types/configuration.d.ts.map +1 -1
- package/package.json +11 -10
- package/dist/assets/rabbit.ascii.virtual.js +0 -6
- package/dist/assets/rabbit.ascii.virtual.js.map +0 -1
- package/dist/assets/rabbitjump.ascii.virtual.js +0 -6
- package/dist/assets/rabbitjump.ascii.virtual.js.map +0 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts +0 -4
- package/dist/v2/features/app/components/DownloadAppButton.vue.d.ts.map +0 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.js +0 -9
- package/dist/v2/features/app/components/DownloadAppButton.vue.js.map +0 -1
- package/dist/v2/features/app/components/DownloadAppButton.vue.script.js +0 -21
- package/dist/v2/features/app/components/DownloadAppButton.vue.script.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OperationBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Application version */\n appVersion: string\n /** Openapi document */\n document: OpenApiDocument\n /** Workspace cookies */\n workspaceCookies: XScalarCookie[]\n /** Document cookies */\n documentCookies: XScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Currently selected security */\n selectedSecurity: SelectedSecurity\n /** Currently selected security schemes */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n /** Security requirements */\n securityRequirements: OpenApiDocument['security']\n /** Default headers */\n defaultHeaders: Record<string, string>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n buildRequest,\n createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n type MergedSecuritySchemes,\n type RequestPayload,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport {\n sendRequest,\n type ResponseInstance,\n} from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n options,\n activeEnvironment,\n serverMeta,\n selectedSecurity,\n selectedSecuritySchemes,\n securityRequirements,\n defaultHeaders,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst requestPayload = ref<RequestPayload | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const globalCookies = [...workspaceCookies, ...documentCookies]\n\n const { request: requestBuilder } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const requestResult = (() => {\n try {\n return {\n ok: true,\n result: buildRequest(requestBuilder, {\n envVariables,\n }),\n } as const\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return {\n ok: false,\n error: message,\n } as const\n }\n })()\n\n if (requestResult.ok === false) {\n toast(requestResult.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = requestResult.result.controller\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n requestPayload: requestResult.result.requestPayload,\n plugins,\n customFetch: toValue(options)?.customFetch,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\n document,\n operation,\n variablesStore,\n },\n 'responseReceived',\n plugins,\n )\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse.clone(),\n requestPayload: sendResult.requestPayload,\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n if (sendError) {\n // clean up the response and request\n response.value = null\n requestPayload.value = null\n abortController.value = null\n\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n requestPayload.value = sendResult.requestPayload\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n requestPayload: sendResult.requestPayload,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n requestPayload.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n requestPayload.value = cached.requestPayload\n } else {\n response.value = null\n requestPayload.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :defaultHeaders\n :documentCookies\n :environment\n :eventBus\n :exampleKey\n :layout\n :method\n :operation\n :options=\"toValue(options)\"\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :workspaceCookies />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :requestPayload\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;CAeE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmKR,MAAM,gBAAgB,eAAe,sBAAsB,QAAA,YAAY,CAAA;EAEvE,MAAM,EAAE,UAAU,WAAU;EAG5B,MAAM,kBAAkB,IAA4B,KAAI;EACxD,MAAM,WAAW,IAA6B,KAAI;EAClD,MAAM,iBAAiB,IAA2B,KAAI;;EAGtD,MAAM,sBAAsB,gBAAgB,OAAO,MAAM,OAAO,gBAAe;;EAG/E,MAAM,gBAAgB,YAAY;AAKhC,OAJuB,uBACrB,QAAA,UAAU,cAAc,EAAE,EAC1B,QAAA,WACF,CACmB,OAAO,OAAO;AAC/B,UAAM,qCAAqC,QAAO;AAClD;;GAGF,MAAM,gBAAgB,CAAC,GAAG,QAAA,kBAAkB,GAAG,QAAA,gBAAe;GAE9D,MAAM,EAAE,SAAS,mBAAmB,eAAe;IACjD,gBAAa,QAAA;IACb,aAAU,QAAA;IACV,aAAa,QAAA;IACb;IACA,QAAK,QAAA;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gBAAA,QAAA;MACA,iBAAA,QAAA;MACA,aAAA,QAAA;MACA,UAAA,QAAA;MACA,YAAA,QAAA;MACA,QAAA,QAAA;MACA,QAAA,QAAA;MACA,WAAA,QAAA;MACA,SAAS,QAAQ,QAAA,QAAO;MACxB,MAAA,QAAA;MACA,SAAA,QAAA;MACA,UAAA,QAAA;MACA,iCAAA,QAAA;MACA,sBAAA,QAAA;MACA,iBAAA,QAAA;MACA,gBAAA,QAAA;MACA,kBAAA,QAAA;MACA,yBAAA,QAAA;MACA,QAAA,QAAA;MACA,kBAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;SAGH,YAOsD,MAAA,sBAAA,EAAA;MANnD,YAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAA,QAAA;MACA,SAAA,QAAA;MACA,gBAAA,eAAA;MACA,UAAA,SAAA;MACA,wBAAwB,iBAAA,MAAiB"}
|
|
1
|
+
{"version":3,"file":"OperationBlock.vue.script.js","names":[],"sources":["../../../../src/v2/blocks/operation-block/OperationBlock.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * OperationBlock\n *\n * Orchestrates the operation view by wiring together the Header, OperationBlock,\n * and ResponseBlock. Forwards user interactions to the workspace event bus and\n * passes through configuration such as auth, servers, plugins, and environment.\n * This component keeps the Operation page lean by centralizing event emission\n * and prop wiring between the blocks.\n *\n * Notable behavior:\n * - Uses operation['x-scalar-method'] and operation['x-scalar-path'] to provide\n * draft overrides for the UI when present.\n */\nexport default {\n name: 'OperationBlock',\n}\n\nexport type OperationBlockProps = {\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Application version */\n appVersion: string\n /** Openapi document */\n document: OpenApiDocument\n /** Workspace cookies */\n workspaceCookies: XScalarCookie[]\n /** Document cookies */\n documentCookies: XScalarCookie[]\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethodType\n /** HTTP clients */\n httpClients: AvailableClients\n /** The history for the operation */\n history?: HistoryEntry[]\n /** Client layout */\n layout: ClientLayout\n /** Currently selected server */\n server: ServerObject | null\n /** Currently selected client */\n selectedClient: WorkspaceStore['workspace']['x-scalar-default-client']\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** Meta information for the server */\n serverMeta: ServerMeta\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Operation object */\n operation: OperationObject\n /** Currently selected example key for the current operation */\n exampleKey: string\n /** Meta information for the auth update */\n authMeta: AuthMeta\n /** Document defined security schemes */\n securitySchemes: MergedSecuritySchemes\n /** Client plugins */\n plugins: ClientPlugin[]\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** For environment variables in the inputs */\n environment: XScalarEnvironment\n /** The proxy URL for sending requests */\n proxyUrl: string\n /** Currently selected security */\n selectedSecurity: SelectedSecurity\n /** Currently selected security schemes */\n selectedSecuritySchemes: SecuritySchemeObjectSecret[]\n /** Security requirements */\n securityRequirements: OpenApiDocument['security']\n /** Default headers */\n defaultHeaders: Record<string, string>\n /** Selected anyOf/oneOf request-body variants keyed by schema path */\n requestBodyCompositionSelection?: Record<string, number>\n /** Subset of config options for the modal */\n options?: ModalProps['options']\n}\n</script>\n<script setup lang=\"ts\">\nimport { ERRORS } from '@scalar/helpers/errors/normalize-error'\nimport { isElectron } from '@scalar/helpers/general/is-electron'\nimport { buildSafeBodyRequest } from '@scalar/helpers/http/can-method-have-body'\nimport type { HttpMethod as HttpMethodType } from '@scalar/helpers/http/http-methods'\nimport { executeHook, type ClientPlugin } from '@scalar/oas-utils/helpers'\nimport {\n AVAILABLE_CLIENTS,\n type AvailableClients,\n} from '@scalar/types/snippetz'\nimport { useToasts } from '@scalar/use-toasts'\nimport type { WorkspaceStore } from '@scalar/workspace-store/client'\nimport type { SelectedSecurity } from '@scalar/workspace-store/entities/auth'\nimport type { HistoryEntry } from '@scalar/workspace-store/entities/history/schema'\nimport type {\n AuthMeta,\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport {\n buildRequest,\n createVariablesStoreForRequest,\n getEnvironmentVariables,\n requestFactory,\n type MergedSecuritySchemes,\n type RequestPayload,\n type SecuritySchemeObjectSecret,\n} from '@scalar/workspace-store/request-example'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { XScalarCookie } from '@scalar/workspace-store/schemas/extensions/general/x-scalar-cookies'\nimport type {\n OpenApiDocument,\n ServerObject,\n} from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\nimport type { OperationObject } from '@scalar/workspace-store/schemas/v3.1/strict/operation'\nimport { computed, onBeforeUnmount, onMounted, ref, toValue, watch } from 'vue'\n\nimport ViewLayout from '@/components/ViewLayout/ViewLayout.vue'\nimport ViewLayoutContent from '@/components/ViewLayout/ViewLayoutContent.vue'\nimport { harToFetchRequest } from '@/v2/blocks/operation-block/helpers/har-to-fetch-request'\nimport { harToFetchResponse } from '@/v2/blocks/operation-block/helpers/har-to-fetch-response'\nimport {\n getOperationExampleKey,\n isStreamingResponse,\n responseCache,\n} from '@/v2/blocks/operation-block/helpers/response-cache'\nimport {\n sendRequest,\n type ResponseInstance,\n} from '@/v2/blocks/operation-block/helpers/send-request'\nimport { validatePathParameters } from '@/v2/blocks/operation-block/helpers/validate-path-parameters'\nimport { generateClientOptions } from '@/v2/blocks/operation-code-sample'\nimport { RequestBlock } from '@/v2/blocks/request-block'\nimport { ResponseBlock } from '@/v2/blocks/response-block'\nimport { type History } from '@/v2/blocks/scalar-address-bar-block'\nimport type { ModalProps } from '@/v2/features/modal/Modal.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport Header from './components/Header.vue'\n\nconst {\n authMeta,\n environment,\n eventBus,\n exampleKey,\n document,\n workspaceCookies = [],\n documentCookies = [],\n hideClientButton,\n httpClients = AVAILABLE_CLIENTS,\n history = [],\n method,\n operation,\n path,\n plugins = [],\n proxyUrl,\n requestBodyCompositionSelection,\n securitySchemes,\n selectedClient,\n server,\n environments,\n options,\n activeEnvironment,\n serverMeta,\n selectedSecurity,\n selectedSecuritySchemes,\n securityRequirements,\n defaultHeaders,\n} = defineProps<OperationBlockProps>()\n\n/** Hoist up client generation so it doesn't get re-generated on every operation */\nconst clientOptions = computed(() => generateClientOptions(httpClients))\n\nconst { toast } = useToasts()\n\n// Refs\nconst abortController = ref<AbortController | null>(null)\nconst response = ref<ResponseInstance | null>(null)\nconst requestPayload = ref<RequestPayload | null>(null)\n\n/** Cancel the request */\nconst cancelRequest = () => abortController.value?.abort(ERRORS.REQUEST_ABORTED)\n\n/** Execute the current operation example */\nconst handleExecute = async () => {\n const pathValidation = validatePathParameters(\n operation.parameters ?? [],\n exampleKey,\n )\n if (pathValidation.ok === false) {\n toast('Path parameters must have values.', 'error')\n return\n }\n\n const globalCookies = [...workspaceCookies, ...documentCookies]\n\n const { request: requestBuilder } = requestFactory({\n defaultHeaders,\n environment,\n exampleName: exampleKey,\n globalCookies,\n method,\n operation,\n path,\n proxyUrl,\n server,\n selectedSecuritySchemes,\n isElectron: isElectron(),\n requestBodyCompositionSelection,\n })\n\n // Stop any previous streaming response\n if (response.value && 'reader' in response.value) {\n response.value.reader.cancel()\n }\n\n const variablesStore = createVariablesStoreForRequest()\n\n // Execute the beforeRequest hook (plugins receive RequestFactory, not fetch Request)\n await executeHook(\n {\n requestBuilder,\n document,\n operation,\n variablesStore,\n },\n 'beforeRequest',\n plugins,\n )\n\n const envVariables = {\n ...getEnvironmentVariables(environment),\n ...variablesStore.getVariables(),\n }\n\n // Build the fetch Request after hooks may have mutated the factory\n const requestResult = (() => {\n try {\n return {\n ok: true,\n result: buildRequest(requestBuilder, {\n envVariables,\n }),\n } as const\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n return {\n ok: false,\n error: message,\n } as const\n }\n })()\n\n if (requestResult.ok === false) {\n toast(requestResult.error, 'error')\n return\n }\n\n // Store the abort controller for cancellation\n abortController.value = requestResult.result.controller\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:sent', {\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n /** Execute the request */\n const [sendError, sendResult] = await sendRequest({\n isUsingProxy: requestResult.result.isUsingProxy,\n requestPayload: requestResult.result.requestPayload,\n plugins,\n customFetch: toValue(options)?.customFetch,\n })\n\n if (sendResult) {\n // Execute the responseReceived hook\n await executeHook(\n {\n response: sendResult.originalResponse.clone(),\n requestBuilder,\n request: buildSafeBodyRequest(...sendResult.requestPayload),\n document,\n operation,\n variablesStore,\n },\n 'responseReceived',\n plugins,\n )\n }\n\n // Execute the hooks\n eventBus.emit('hooks:on:request:complete', {\n payload: sendResult\n ? {\n response: sendResult.originalResponse.clone(),\n requestPayload: sendResult.requestPayload,\n duration: sendResult.response.duration,\n timestamp: sendResult.timestamp,\n }\n : undefined,\n meta: {\n method,\n path,\n exampleKey,\n },\n })\n\n if (sendError) {\n // clean up the response and request\n response.value = null\n requestPayload.value = null\n abortController.value = null\n\n toast(sendError.message, 'error')\n return\n }\n\n // Store the response\n response.value = sendResult.response\n requestPayload.value = sendResult.requestPayload\n\n // Cache non-streaming responses so they can be restored when navigating back\n if (!isStreamingResponse(sendResult.response)) {\n responseCache.set(getOperationExampleKey(method, path, exampleKey), {\n response: sendResult.response,\n requestPayload: sendResult.requestPayload,\n })\n }\n}\n\nonMounted(() => {\n eventBus.on('operation:send:request:hotkey', handleExecute)\n eventBus.on('operation:cancel:request', cancelRequest)\n})\nonBeforeUnmount(() => {\n eventBus.off('operation:send:request:hotkey', handleExecute)\n eventBus.off('operation:cancel:request', cancelRequest)\n})\n\nconst operationHistory = computed<History[]>(() =>\n history\n .map((entry) => ({\n method: entry.request.method as HttpMethodType,\n path: entry.request.url,\n duration: entry.time,\n status: entry.response.status,\n }))\n .reverse(),\n)\n\nconst handleSelectHistoryItem = ({ index }: { index: number }) => {\n const transformedIndex = (history.length ?? 0) - index - 1\n const historyItem = history[transformedIndex]\n if (!historyItem) {\n return\n }\n\n const navigate = () =>\n eventBus.emit('ui:navigate', {\n page: 'example',\n method,\n path,\n exampleName: 'draft',\n callback: (status) => {\n // Do not replace the response if the navigation was not successful\n if (status !== 'success') {\n return\n }\n // Reconstruct the response\n const fetchResponse = harToFetchResponse({\n harResponse: historyItem.response,\n url: historyItem.request.url,\n method,\n path,\n duration: historyItem.time,\n })\n\n // Reconstruct the request\n const fetchRequest = harToFetchRequest({\n harRequest: historyItem.request,\n })\n\n // Update the response and request\n response.value = fetchResponse\n requestPayload.value = fetchRequest\n },\n })\n\n eventBus.emit('operation:reload:history', {\n meta: {\n path,\n method,\n },\n index: transformedIndex,\n callback: navigate,\n })\n}\n\nconst handleNavigateSettings = () => {\n eventBus.emit('ui:navigate', {\n page: 'operation',\n path: 'overview',\n operationPath: path,\n method,\n })\n}\n\n/**\n * When the path, method, or example key changes: save current response to\n * cache (so it can be restored when navigating back), then restore from cache\n * for the new operation or clear if no cached response. Response is only\n * cleared on page refresh or when making a new request for that operation.\n */\nwatch(\n [() => path, () => method, () => exampleKey],\n ([newPath, newMethod, newExampleKey]) => {\n const newKey = getOperationExampleKey(newMethod, newPath, newExampleKey)\n const cached = responseCache.get(newKey)\n if (cached) {\n response.value = cached.response\n requestPayload.value = cached.requestPayload\n } else {\n response.value = null\n requestPayload.value = null\n }\n\n // Cancel any in-flight request\n cancelRequest()\n },\n { immediate: true },\n)\n\nonBeforeUnmount(() => {\n // We cancel the request if the component is unmounted\n cancelRequest()\n})\n</script>\n<template>\n <div class=\"bg-b-1 flex h-full flex-col\">\n <div\n class=\"lg:min-h-header flex w-full flex-wrap items-center justify-center p-2 lg:p-0\">\n <!-- Address Bar -->\n <Header\n :activeEnvironment\n :documentUrl\n :environment\n :environments\n :eventBus\n :hideClientButton\n :history=\"operationHistory\"\n :integration\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n :source\n @execute=\"handleExecute\"\n @navigate:settings=\"handleNavigateSettings\"\n @select:history:item=\"handleSelectHistoryItem\" />\n </div>\n\n <ViewLayout class=\"border-t\">\n <ViewLayoutContent class=\"flex-1\">\n <!-- Request Section -->\n <RequestBlock\n :authMeta\n :clientOptions\n :defaultHeaders\n :documentCookies\n :environment\n :eventBus\n :exampleKey\n :layout\n :method\n :operation\n :options=\"toValue(options)\"\n :path\n :plugins\n :proxyUrl\n :requestBodyCompositionSelection\n :securityRequirements\n :securitySchemes\n :selectedClient\n :selectedSecurity\n :selectedSecuritySchemes\n :server\n :workspaceCookies />\n\n <!-- Response Section -->\n <ResponseBlock\n :appVersion\n :eventBus\n :layout\n :plugins\n :requestPayload\n :response\n :totalPerformedRequests=\"operationHistory.length\" />\n </ViewLayoutContent>\n </ViewLayout>\n </div>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;CAeE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAmKR,MAAM,gBAAgB,eAAe,sBAAsB,QAAA,YAAY,CAAA;EAEvE,MAAM,EAAE,UAAU,WAAU;EAG5B,MAAM,kBAAkB,IAA4B,KAAI;EACxD,MAAM,WAAW,IAA6B,KAAI;EAClD,MAAM,iBAAiB,IAA2B,KAAI;;EAGtD,MAAM,sBAAsB,gBAAgB,OAAO,MAAM,OAAO,gBAAe;;EAG/E,MAAM,gBAAgB,YAAY;AAKhC,OAJuB,uBACrB,QAAA,UAAU,cAAc,EAAE,EAC1B,QAAA,WACF,CACmB,OAAO,OAAO;AAC/B,UAAM,qCAAqC,QAAO;AAClD;;GAGF,MAAM,gBAAgB,CAAC,GAAG,QAAA,kBAAkB,GAAG,QAAA,gBAAe;GAE9D,MAAM,EAAE,SAAS,mBAAmB,eAAe;IACjD,gBAAa,QAAA;IACb,aAAU,QAAA;IACV,aAAa,QAAA;IACb;IACA,QAAK,QAAA;IACL,WAAQ,QAAA;IACR,MAAG,QAAA;IACH,UAAO,QAAA;IACP,QAAK,QAAA;IACL,yBAAsB,QAAA;IACtB,YAAY,YAAY;IACxB,i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;MACA,eAAA,cAAA;MACA,gBAAA,QAAA;MACA,iBAAA,QAAA;MACA,aAAA,QAAA;MACA,UAAA,QAAA;MACA,YAAA,QAAA;MACA,QAAA,QAAA;MACA,QAAA,QAAA;MACA,WAAA,QAAA;MACA,SAAS,QAAQ,QAAA,QAAO;MACxB,MAAA,QAAA;MACA,SAAA,QAAA;MACA,UAAA,QAAA;MACA,iCAAA,QAAA;MACA,sBAAA,QAAA;MACA,iBAAA,QAAA;MACA,gBAAA,QAAA;MACA,kBAAA,QAAA;MACA,yBAAA,QAAA;MACA,QAAA,QAAA;MACA,kBAAA,QAAA;;;;;;;;;;;;;;;;;;;;;;;;SAGH,YAOsD,MAAA,sBAAA,EAAA;MANnD,YAAA,QAAA;MACA,UAAA,QAAA;MACA,QAAA,QAAA;MACA,SAAA,QAAA;MACA,gBAAA,eAAA;MACA,UAAA,SAAA;MACA,wBAAwB,iBAAA,MAAiB"}
|
|
@@ -51,11 +51,13 @@ declare const __VLS_export: import("vue").DefineComponent<HeaderProps, {}, {}, {
|
|
|
51
51
|
index: number;
|
|
52
52
|
}) => any;
|
|
53
53
|
"add:environment": () => any;
|
|
54
|
+
"navigate:settings": () => any;
|
|
54
55
|
}, string, import("vue").PublicProps, Readonly<HeaderProps> & Readonly<{
|
|
55
56
|
onExecute?: (() => any) | undefined;
|
|
56
57
|
"onSelect:history:item"?: ((payload: {
|
|
57
58
|
index: number;
|
|
58
59
|
}) => any) | undefined;
|
|
59
60
|
"onAdd:environment"?: (() => any) | undefined;
|
|
61
|
+
"onNavigate:settings"?: (() => any) | undefined;
|
|
60
62
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
61
63
|
//# sourceMappingURL=Header.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.vue.d.ts","sourceRoot":"","sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.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IACtC,UAAU,EAAE,UAAU,CAAA;CACvB,CAAA;wBACoB,OAAO,YAAY;AAAxC,wBAAyC;AACzC,QAAA,MAAM,YAAY;;;eAS6B,MAAM;;;;;;;eAAN,MAAM;;;;kFA+SjD,CAAC"}
|
|
@@ -2,7 +2,7 @@ import _plugin_vue_export_helper_default from "../../../../_virtual/_plugin-vue_
|
|
|
2
2
|
import Header_vue_vue_type_script_setup_true_lang_default from "./Header.vue.script.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
//#region src/v2/blocks/operation-block/components/Header.vue
|
|
5
|
-
var Header_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Header_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-
|
|
5
|
+
var Header_default = /* @__PURE__ */ _plugin_vue_export_helper_default(Header_vue_vue_type_script_setup_true_lang_default, [["__scopeId", "data-v-1c2b0dae"]]);
|
|
6
6
|
//#endregion
|
|
7
7
|
export { Header_default as default };
|
|
8
8
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.vue.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n Operation block header: address bar, environment selector, and modal controls.\n\n Renders the top bar for the API client operation view: URL/method (AddressBar),\n optional environment selector, optional \"Open API Client\" button in modal layout,\n and close button for modal. Layout and visibility depend on `layout` and `source` props.\n */\nexport type HeaderProps = {\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethod\n /** Client layout */\n layout: ClientLayout\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** Environment variables */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type {\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { AddressBar, type History } from '@/v2/blocks/scalar-address-bar-block'\nimport EnvironmentSelector from '@/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport OpenApiClientButton from './OpenApiClientButton.vue'\n\nconst { hideClientButton = false, eventBus } = defineProps<HeaderProps>()\n\nconst emit = defineEmits<{\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Add a new environment */\n (e: 'add:environment'): void\n}>()\n\nconst handleSelectEnvironment = (environmentName: string) => {\n eventBus.emit('workspace:update:active-environment', environmentName)\n}\n\nconst handleAddEnvironment = () => {\n eventBus.emit('ui:navigate', { page: 'document', path: 'environment' })\n}\n</script>\n\n<template>\n <div\n class=\"lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1\">\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1\">\n <!--\n Holds space for the sidebar toggle\n\n Hidden for `modal` layout\n -->\n <div class=\"size-8\"></div>\n </div>\n <AddressBar\n :activeEnvironment\n :environment\n :environments\n :eventBus\n :history\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n @add:environment=\"emit('add:environment')\"\n @execute=\"emit('execute')\"\n @select:history:item=\"\n (payload) => emit('select:history:item', payload)\n \" />\n\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center justify-end gap-2 lg:mb-0 lg:flex-1 lg:px-2.5\">\n <!--\n Environment Selector\n Hidden for `modal` layout\n -->\n <EnvironmentSelector\n v-if=\"layout !== 'modal'\"\n :activeEnvironment=\"activeEnvironment\"\n :environments=\"environments\"\n @add:environment=\"handleAddEnvironment\"\n @select:environment=\"handleSelectEnvironment\" />\n <!--\n Open API Client Button\n\n Only shown in `modal` layout\n -->\n <OpenApiClientButton\n v-if=\"layout === 'modal' && documentUrl && !hideClientButton\"\n buttonSource=\"modal\"\n class=\"!w-fit lg:-mr-1\"\n :integration=\"integration ?? null\"\n :source=\"source ?? 'api-reference'\"\n :url=\"documentUrl\" />\n\n <!--\n Close Button\n\n Only shown in `modal` layout and hidden for GitBook Integration\n -->\n <button\n v-if=\"layout === 'modal' && source !== 'gitbook'\"\n class=\"app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"lg\"\n thickness=\"2\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n\n <!--\n Close Button for GitBook Integration\n\n Hidden by default and visible for GitBook Integration in `modal` layout\n -->\n <button\n v-if=\"layout === 'modal' && source === 'gitbook'\"\n class=\"text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"md\"\n thickness=\"1.75\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n.app-exit-button {\n color: white;\n background: rgba(0, 0, 0, 0.1);\n}\n.app-exit-button:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"Header.vue.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n Operation block header: address bar, environment selector, and modal controls.\n\n Renders the top bar for the API client operation view: URL/method (AddressBar),\n optional environment selector, optional \"Open API Client\" button in modal layout,\n and close button for modal. Layout and visibility depend on `layout` and `source` props.\n */\nexport type HeaderProps = {\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethod\n /** Client layout */\n layout: ClientLayout\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** Environment variables */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarIcon, ScalarIconButton } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { ScalarIconGearSix } from '@scalar/icons'\nimport type {\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { AddressBar, type History } from '@/v2/blocks/scalar-address-bar-block'\nimport EnvironmentSelector from '@/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport OpenApiClientButton from './OpenApiClientButton.vue'\n\nconst { hideClientButton = false, eventBus } = defineProps<HeaderProps>()\n\nconst emit = defineEmits<{\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Add a new environment */\n (e: 'add:environment'): void\n /** Navigate to the settings page for the current entity */\n (e: 'navigate:settings'): void\n}>()\n\nconst handleSelectEnvironment = (environmentName: string) => {\n eventBus.emit('workspace:update:active-environment', environmentName)\n}\n\nconst handleAddEnvironment = () => {\n eventBus.emit('ui:navigate', { page: 'document', path: 'environment' })\n}\n</script>\n\n<template>\n <div\n class=\"lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1\">\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1\">\n <!--\n Holds space for the sidebar toggle\n\n Hidden for `modal` layout\n -->\n <div class=\"size-8\"></div>\n </div>\n <AddressBar\n :activeEnvironment\n :environment\n :environments\n :eventBus\n :history\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n @add:environment=\"emit('add:environment')\"\n @execute=\"emit('execute')\"\n @select:history:item=\"\n (payload) => emit('select:history:item', payload)\n \" />\n\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center justify-end gap-2 lg:mb-0 lg:flex-1 lg:px-2.5\">\n <!--\n Environment Selector\n Hidden for `modal` layout\n -->\n <EnvironmentSelector\n v-if=\"layout !== 'modal'\"\n :activeEnvironment=\"activeEnvironment\"\n :environments=\"environments\"\n @add:environment=\"handleAddEnvironment\"\n @select:environment=\"handleSelectEnvironment\" />\n <!-- Operation settings -->\n <ScalarIconButton\n v-if=\"layout !== 'modal'\"\n :icon=\"ScalarIconGearSix\"\n label=\"Operation settings\"\n size=\"sm\"\n weight=\"bold\"\n @click=\"emit('navigate:settings')\" />\n <!--\n Open API Client Button\n\n Only shown in `modal` layout\n -->\n <OpenApiClientButton\n v-if=\"layout === 'modal' && documentUrl && !hideClientButton\"\n buttonSource=\"modal\"\n class=\"!w-fit lg:-mr-1\"\n :integration=\"integration ?? null\"\n :source=\"source ?? 'api-reference'\"\n :url=\"documentUrl\" />\n\n <!--\n Close Button\n\n Only shown in `modal` layout and hidden for GitBook Integration\n -->\n <button\n v-if=\"layout === 'modal' && source !== 'gitbook'\"\n class=\"app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"lg\"\n thickness=\"2\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n\n <!--\n Close Button for GitBook Integration\n\n Hidden by default and visible for GitBook Integration in `modal` layout\n -->\n <button\n v-if=\"layout === 'modal' && source === 'gitbook'\"\n class=\"text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"md\"\n thickness=\"1.75\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n.app-exit-button {\n color: white;\n background: rgba(0, 0, 0, 0.1);\n}\n.app-exit-button:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n</style>\n"],"mappings":""}
|
|
@@ -2,7 +2,8 @@ import OpenApiClientButton_default from "./OpenApiClientButton.vue.js";
|
|
|
2
2
|
import AddressBar_default from "../../scalar-address-bar-block/components/AddressBar.vue.js";
|
|
3
3
|
import EnvironmentSelector_default from "../../scalar-address-bar-block/components/EnvironmentSelector.vue.js";
|
|
4
4
|
import { createBlock, createCommentVNode, createElementBlock, createElementVNode, createVNode, defineComponent, openBlock, unref } from "vue";
|
|
5
|
-
import { ScalarIcon } from "@scalar/components";
|
|
5
|
+
import { ScalarIcon, ScalarIconButton } from "@scalar/components";
|
|
6
|
+
import { ScalarIconGearSix } from "@scalar/icons";
|
|
6
7
|
//#region src/v2/blocks/operation-block/components/Header.vue?vue&type=script&setup=true&lang.ts
|
|
7
8
|
var _hoisted_1 = { class: "lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1" };
|
|
8
9
|
var _hoisted_2 = { class: "mb-2 flex w-1/2 flex-row items-center justify-end gap-2 lg:mb-0 lg:flex-1 lg:px-2.5" };
|
|
@@ -31,7 +32,8 @@ var Header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
31
32
|
emits: [
|
|
32
33
|
"execute",
|
|
33
34
|
"select:history:item",
|
|
34
|
-
"add:environment"
|
|
35
|
+
"add:environment",
|
|
36
|
+
"navigate:settings"
|
|
35
37
|
],
|
|
36
38
|
setup(__props, { emit: __emit }) {
|
|
37
39
|
const emit = __emit;
|
|
@@ -46,7 +48,7 @@ var Header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
46
48
|
};
|
|
47
49
|
return (_ctx, _cache) => {
|
|
48
50
|
return openBlock(), createElementBlock("div", _hoisted_1, [
|
|
49
|
-
_cache[
|
|
51
|
+
_cache[8] || (_cache[8] = createElementVNode("div", { class: "mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1" }, [createElementVNode("div", { class: "size-8" })], -1)),
|
|
50
52
|
createVNode(unref(AddressBar_default), {
|
|
51
53
|
activeEnvironment: __props.activeEnvironment,
|
|
52
54
|
environment: __props.environment,
|
|
@@ -83,8 +85,16 @@ var Header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
83
85
|
"onAdd:environment": handleAddEnvironment,
|
|
84
86
|
"onSelect:environment": handleSelectEnvironment
|
|
85
87
|
}, null, 8, ["activeEnvironment", "environments"])) : createCommentVNode("", true),
|
|
86
|
-
__props.layout
|
|
88
|
+
__props.layout !== "modal" ? (openBlock(), createBlock(unref(ScalarIconButton), {
|
|
87
89
|
key: 1,
|
|
90
|
+
icon: unref(ScalarIconGearSix),
|
|
91
|
+
label: "Operation settings",
|
|
92
|
+
size: "sm",
|
|
93
|
+
weight: "bold",
|
|
94
|
+
onClick: _cache[3] || (_cache[3] = ($event) => emit("navigate:settings"))
|
|
95
|
+
}, null, 8, ["icon"])) : createCommentVNode("", true),
|
|
96
|
+
__props.layout === "modal" && __props.documentUrl && !__props.hideClientButton ? (openBlock(), createBlock(OpenApiClientButton_default, {
|
|
97
|
+
key: 2,
|
|
88
98
|
buttonSource: "modal",
|
|
89
99
|
class: "!w-fit lg:-mr-1",
|
|
90
100
|
integration: __props.integration ?? null,
|
|
@@ -96,25 +106,25 @@ var Header_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineC
|
|
|
96
106
|
"url"
|
|
97
107
|
])) : createCommentVNode("", true),
|
|
98
108
|
__props.layout === "modal" && __props.source !== "gitbook" ? (openBlock(), createElementBlock("button", {
|
|
99
|
-
key:
|
|
109
|
+
key: 3,
|
|
100
110
|
class: "app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2",
|
|
101
111
|
type: "button",
|
|
102
|
-
onClick: _cache[
|
|
112
|
+
onClick: _cache[4] || (_cache[4] = ($event) => __props.eventBus.emit("ui:close:client-modal"))
|
|
103
113
|
}, [createVNode(unref(ScalarIcon), {
|
|
104
114
|
icon: "Close",
|
|
105
115
|
size: "lg",
|
|
106
116
|
thickness: "2"
|
|
107
|
-
}), _cache[
|
|
117
|
+
}), _cache[6] || (_cache[6] = createElementVNode("span", { class: "sr-only" }, "Close Client", -1))])) : createCommentVNode("", true),
|
|
108
118
|
__props.layout === "modal" && __props.source === "gitbook" ? (openBlock(), createElementBlock("button", {
|
|
109
|
-
key:
|
|
119
|
+
key: 4,
|
|
110
120
|
class: "text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2",
|
|
111
121
|
type: "button",
|
|
112
|
-
onClick: _cache[
|
|
122
|
+
onClick: _cache[5] || (_cache[5] = ($event) => __props.eventBus.emit("ui:close:client-modal"))
|
|
113
123
|
}, [createVNode(unref(ScalarIcon), {
|
|
114
124
|
icon: "Close",
|
|
115
125
|
size: "md",
|
|
116
126
|
thickness: "1.75"
|
|
117
|
-
}), _cache[
|
|
127
|
+
}), _cache[7] || (_cache[7] = createElementVNode("span", { class: "sr-only" }, "Close Client", -1))])) : createCommentVNode("", true)
|
|
118
128
|
])
|
|
119
129
|
]);
|
|
120
130
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Header.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n Operation block header: address bar, environment selector, and modal controls.\n\n Renders the top bar for the API client operation view: URL/method (AddressBar),\n optional environment selector, optional \"Open API Client\" button in modal layout,\n and close button for modal. Layout and visibility depend on `layout` and `source` props.\n */\nexport type HeaderProps = {\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethod\n /** Client layout */\n layout: ClientLayout\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** Environment variables */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarIcon } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport type {\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { AddressBar, type History } from '@/v2/blocks/scalar-address-bar-block'\nimport EnvironmentSelector from '@/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport OpenApiClientButton from './OpenApiClientButton.vue'\n\nconst { hideClientButton = false, eventBus } = defineProps<HeaderProps>()\n\nconst emit = defineEmits<{\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Add a new environment */\n (e: 'add:environment'): void\n}>()\n\nconst handleSelectEnvironment = (environmentName: string) => {\n eventBus.emit('workspace:update:active-environment', environmentName)\n}\n\nconst handleAddEnvironment = () => {\n eventBus.emit('ui:navigate', { page: 'document', path: 'environment' })\n}\n</script>\n\n<template>\n <div\n class=\"lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1\">\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1\">\n <!--\n Holds space for the sidebar toggle\n\n Hidden for `modal` layout\n -->\n <div class=\"size-8\"></div>\n </div>\n <AddressBar\n :activeEnvironment\n :environment\n :environments\n :eventBus\n :history\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n @add:environment=\"emit('add:environment')\"\n @execute=\"emit('execute')\"\n @select:history:item=\"\n (payload) => emit('select:history:item', payload)\n \" />\n\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center justify-end gap-2 lg:mb-0 lg:flex-1 lg:px-2.5\">\n <!--\n Environment Selector\n Hidden for `modal` layout\n -->\n <EnvironmentSelector\n v-if=\"layout !== 'modal'\"\n :activeEnvironment=\"activeEnvironment\"\n :environments=\"environments\"\n @add:environment=\"handleAddEnvironment\"\n @select:environment=\"handleSelectEnvironment\" />\n <!--\n Open API Client Button\n\n Only shown in `modal` layout\n -->\n <OpenApiClientButton\n v-if=\"layout === 'modal' && documentUrl && !hideClientButton\"\n buttonSource=\"modal\"\n class=\"!w-fit lg:-mr-1\"\n :integration=\"integration ?? null\"\n :source=\"source ?? 'api-reference'\"\n :url=\"documentUrl\" />\n\n <!--\n Close Button\n\n Only shown in `modal` layout and hidden for GitBook Integration\n -->\n <button\n v-if=\"layout === 'modal' && source !== 'gitbook'\"\n class=\"app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"lg\"\n thickness=\"2\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n\n <!--\n Close Button for GitBook Integration\n\n Hidden by default and visible for GitBook Integration in `modal` layout\n -->\n <button\n v-if=\"layout === 'modal' && source === 'gitbook'\"\n class=\"text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"md\"\n thickness=\"1.75\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n.app-exit-button {\n color: white;\n background: rgba(0, 0, 0, 0.1);\n}\n.app-exit-button:hover {\n background: rgba(255, 255, 255, 0.1);\n}\n</style>\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"Header.vue.script.js","names":[],"sources":["../../../../../src/v2/blocks/operation-block/components/Header.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n Operation block header: address bar, environment selector, and modal controls.\n\n Renders the top bar for the API client operation view: URL/method (AddressBar),\n optional environment selector, optional \"Open API Client\" button in modal layout,\n and close button for modal. Layout and visibility depend on `layout` and `source` props.\n */\nexport type HeaderProps = {\n /** Current request path */\n path: string\n /** Current request method */\n method: HttpMethod\n /** Client layout */\n layout: ClientLayout\n /** Hides the client button on the header */\n hideClientButton?: boolean\n /** Client integration */\n integration?: string | null\n /** Openapi document url for `modal` mode to open the client app */\n documentUrl?: string\n /** Client source */\n source?: 'gitbook' | 'api-reference'\n /** Currently selected server */\n server: ServerObject | null\n /** Server list available for operation/document */\n servers: ServerObject[]\n /** List of request history */\n history: History[]\n /** Event bus */\n eventBus: WorkspaceEventBus\n /** Environment list */\n environments?: string[]\n /** Currently selected environment */\n activeEnvironment?: string\n /** Environment variables */\n environment: XScalarEnvironment\n /** Meta information for the server */\n serverMeta: ServerMeta\n}\n</script>\n\n<script setup lang=\"ts\">\nimport { ScalarIcon, ScalarIconButton } from '@scalar/components'\nimport type { HttpMethod } from '@scalar/helpers/http/http-methods'\nimport { ScalarIconGearSix } from '@scalar/icons'\nimport type {\n ServerMeta,\n WorkspaceEventBus,\n} from '@scalar/workspace-store/events'\nimport type { XScalarEnvironment } from '@scalar/workspace-store/schemas/extensions/document/x-scalar-environments'\nimport type { ServerObject } from '@scalar/workspace-store/schemas/v3.1/strict/openapi-document'\n\nimport { AddressBar, type History } from '@/v2/blocks/scalar-address-bar-block'\nimport EnvironmentSelector from '@/v2/blocks/scalar-address-bar-block/components/EnvironmentSelector.vue'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport OpenApiClientButton from './OpenApiClientButton.vue'\n\nconst { hideClientButton = false, eventBus } = defineProps<HeaderProps>()\n\nconst emit = defineEmits<{\n /** Execute the current operation example */\n (e: 'execute'): void\n /** Select a request history item by index */\n (e: 'select:history:item', payload: { index: number }): void\n /** Add a new environment */\n (e: 'add:environment'): void\n /** Navigate to the settings page for the current entity */\n (e: 'navigate:settings'): void\n}>()\n\nconst handleSelectEnvironment = (environmentName: string) => {\n eventBus.emit('workspace:update:active-environment', environmentName)\n}\n\nconst handleAddEnvironment = () => {\n eventBus.emit('ui:navigate', { page: 'document', path: 'environment' })\n}\n</script>\n\n<template>\n <div\n class=\"lg:min-h-header t-app__top-container flex w-full flex-wrap items-center justify-center p-2 pt-2 lg:p-1 lg:pt-1\">\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center gap-1 lg:mb-0 lg:flex-1 lg:px-1\">\n <!--\n Holds space for the sidebar toggle\n\n Hidden for `modal` layout\n -->\n <div class=\"size-8\"></div>\n </div>\n <AddressBar\n :activeEnvironment\n :environment\n :environments\n :eventBus\n :history\n :layout\n :method\n :path\n :server\n :serverMeta\n :servers\n @add:environment=\"emit('add:environment')\"\n @execute=\"emit('execute')\"\n @select:history:item=\"\n (payload) => emit('select:history:item', payload)\n \" />\n\n <div\n class=\"mb-2 flex w-1/2 flex-row items-center justify-end gap-2 lg:mb-0 lg:flex-1 lg:px-2.5\">\n <!--\n Environment Selector\n Hidden for `modal` layout\n -->\n <EnvironmentSelector\n v-if=\"layout !== 'modal'\"\n :activeEnvironment=\"activeEnvironment\"\n :environments=\"environments\"\n @add:environment=\"handleAddEnvironment\"\n @select:environment=\"handleSelectEnvironment\" />\n <!-- Operation settings -->\n <ScalarIconButton\n v-if=\"layout !== 'modal'\"\n :icon=\"ScalarIconGearSix\"\n label=\"Operation settings\"\n size=\"sm\"\n weight=\"bold\"\n @click=\"emit('navigate:settings')\" />\n <!--\n Open API Client Button\n\n Only shown in `modal` layout\n -->\n <OpenApiClientButton\n v-if=\"layout === 'modal' && documentUrl && !hideClientButton\"\n buttonSource=\"modal\"\n class=\"!w-fit lg:-mr-1\"\n :integration=\"integration ?? null\"\n :source=\"source ?? 'api-reference'\"\n :url=\"documentUrl\" />\n\n <!--\n Close Button\n\n Only shown in `modal` layout and hidden for GitBook Integration\n -->\n <button\n v-if=\"layout === 'modal' && source !== 'gitbook'\"\n class=\"app-exit-button zoomed:static zoomed:p-1 fixed top-2 right-2 rounded-full p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"lg\"\n thickness=\"2\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n\n <!--\n Close Button for GitBook Integration\n\n Hidden by default and visible for GitBook Integration in `modal` layout\n -->\n <button\n v-if=\"layout === 'modal' && source === 'gitbook'\"\n class=\"text-c-1 hover:bg-b-2 active:text-c-1 -mr-1.5 rounded p-2\"\n type=\"button\"\n @click=\"eventBus.emit('ui:close:client-modal')\">\n <ScalarIcon\n icon=\"Close\"\n size=\"md\"\n thickness=\"1.75\" />\n <span class=\"sr-only\">Close Client</span>\n </button>\n </div>\n </div>\n</template>\n<style scoped>\n.app-exit-button {\n color: white;\n background: rgba(0, 0, 0, 0.1);\n}\n.app-exit-button:hover {\n background: r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A;;MAJrB,cAAa;MACb,OAAM;MACL,aAAa,QAAA,eAAW;MACxB,QAAQ,QAAA,UAAM;MACd,KAAK,QAAA;;;;;;KAQA,QAAA,WAAM,WAAgB,QAAA,WAAM,aAAA,WAAA,EADpC,mBAUS,UAAA;;MARP,OAAM;MACN,MAAK;MACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,SAAS,KAAI,wBAAA;SACrB,YAGkB,MAAA,WAAA,EAAA;MAFhB,MAAK;MACL,MAAK;MACL,WAAU;mCACZ,mBAAyC,QAAA,EAAnC,OAAM,WAAS,EAAC,gBAAY,GAAA,EAAA,CAAA,IAAA,mBAAA,IAAA,KAAA;KAS5B,QAAA,WAAM,WAAgB,QAAA,WAAM,aAAA,WAAA,EADpC,mBAUS,UAAA;;MARP,OAAM;MACN,MAAK;MACJ,SAAK,OAAA,OAAA,OAAA,MAAA,WAAE,QAAA,SAAS,KAAI,wBAAA;SACrB,YAGqB,MAAA,WAAA,EAAA;MAFnB,MAAK;MACL,MAAK;MACL,WAAU;mCACZ,mBAAyC,QAAA,EAAnC,OAAM,WAAS,EAAC,gBAAY,GAAA,EAAA,CAAA,IAAA,mBAAA,IAAA,KAAA"}
|
|
@@ -22,7 +22,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
22
22
|
documentSlug?: string;
|
|
23
23
|
} | {
|
|
24
24
|
page: "workspace";
|
|
25
|
-
path: "environment" | "cookies" | "settings";
|
|
25
|
+
path: "environment" | "cookies" | "settings" | "get-started";
|
|
26
26
|
} | {
|
|
27
27
|
page: "example";
|
|
28
28
|
documentSlug?: string;
|
|
@@ -56,7 +56,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
56
56
|
documentSlug?: string;
|
|
57
57
|
} | {
|
|
58
58
|
page: "workspace";
|
|
59
|
-
path: "environment" | "cookies" | "settings";
|
|
59
|
+
path: "environment" | "cookies" | "settings" | "get-started";
|
|
60
60
|
} | {
|
|
61
61
|
page: "example";
|
|
62
62
|
documentSlug?: string;
|
|
@@ -46,7 +46,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
46
46
|
documentSlug?: string;
|
|
47
47
|
} | {
|
|
48
48
|
page: "workspace";
|
|
49
|
-
path: "environment" | "cookies" | "settings";
|
|
49
|
+
path: "environment" | "cookies" | "settings" | "get-started";
|
|
50
50
|
} | {
|
|
51
51
|
page: "example";
|
|
52
52
|
documentSlug?: string;
|
|
@@ -80,7 +80,7 @@ declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {
|
|
|
80
80
|
documentSlug?: string;
|
|
81
81
|
} | {
|
|
82
82
|
page: "workspace";
|
|
83
|
-
path: "environment" | "cookies" | "settings";
|
|
83
|
+
path: "environment" | "cookies" | "settings" | "get-started";
|
|
84
84
|
} | {
|
|
85
85
|
page: "example";
|
|
86
86
|
documentSlug?: string;
|
|
@@ -8,13 +8,13 @@ type __VLS_Props = {
|
|
|
8
8
|
appVersion: string;
|
|
9
9
|
};
|
|
10
10
|
declare const __VLS_export: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
11
|
+
openCommandPalette: () => any;
|
|
11
12
|
addRequest: () => any;
|
|
12
13
|
sendRequest: () => any;
|
|
13
|
-
openCommandPalette: () => any;
|
|
14
14
|
}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{
|
|
15
|
+
onOpenCommandPalette?: (() => any) | undefined;
|
|
15
16
|
onAddRequest?: (() => any) | undefined;
|
|
16
17
|
onSendRequest?: (() => any) | undefined;
|
|
17
|
-
onOpenCommandPalette?: (() => any) | undefined;
|
|
18
18
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
19
|
declare const _default: typeof __VLS_export;
|
|
20
20
|
export default _default;
|
|
@@ -20,6 +20,7 @@ export type ServerDropdownProps = {
|
|
|
20
20
|
layout: ClientLayout;
|
|
21
21
|
};
|
|
22
22
|
declare const __VLS_export: import("vue").DefineComponent<ServerDropdownProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {} & {
|
|
23
|
+
"update:open": (value: boolean) => any;
|
|
23
24
|
"update:variable": (payload: {
|
|
24
25
|
index: number;
|
|
25
26
|
key: string;
|
|
@@ -31,8 +32,8 @@ declare const __VLS_export: import("vue").DefineComponent<ServerDropdownProps, {
|
|
|
31
32
|
meta: ServerMeta;
|
|
32
33
|
}) => any;
|
|
33
34
|
"update:servers": () => any;
|
|
34
|
-
"update:open": (value: boolean) => any;
|
|
35
35
|
}, string, import("vue").PublicProps, Readonly<ServerDropdownProps> & Readonly<{
|
|
36
|
+
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
36
37
|
"onUpdate:variable"?: ((payload: {
|
|
37
38
|
index: number;
|
|
38
39
|
key: string;
|
|
@@ -44,6 +45,5 @@ declare const __VLS_export: import("vue").DefineComponent<ServerDropdownProps, {
|
|
|
44
45
|
meta: ServerMeta;
|
|
45
46
|
}) => any) | undefined;
|
|
46
47
|
"onUpdate:servers"?: (() => any) | undefined;
|
|
47
|
-
"onUpdate:open"?: ((value: boolean) => any) | undefined;
|
|
48
48
|
}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
49
49
|
//# sourceMappingURL=ServerDropdown.vue.d.ts.map
|
|
@@ -4,7 +4,7 @@ import SidebarMenu_default from "./SidebarMenu.vue.js";
|
|
|
4
4
|
import { Fragment, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createVNode, defineComponent, guardReactiveProps, isRef, mergeModels, normalizeClass, normalizeProps, openBlock, ref, renderSlot, unref, useModel, useSlots, withCtx } from "vue";
|
|
5
5
|
import { ScalarIconButton, ScalarSidebarSearchInput } from "@scalar/components";
|
|
6
6
|
import { ScalarIconFileDashed, ScalarIconMagnifyingGlass } from "@scalar/icons";
|
|
7
|
-
import { ScalarSidebar } from "@scalar/sidebar";
|
|
7
|
+
import { ScalarSidebar as ScalarSidebar$1 } from "@scalar/sidebar";
|
|
8
8
|
//#region src/v2/components/sidebar/Sidebar.vue?vue&type=script&setup=true&lang.ts
|
|
9
9
|
var _hoisted_1 = { key: 1 };
|
|
10
10
|
var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ defineComponent({
|
|
@@ -56,7 +56,7 @@ var Sidebar_vue_vue_type_script_setup_true_lang_default = /* @__PURE__ */ define
|
|
|
56
56
|
"onUpdate:width": _cache[6] || (_cache[6] = ($event) => sidebarWidth.value = $event),
|
|
57
57
|
class: "flex flex-col"
|
|
58
58
|
}, {
|
|
59
|
-
default: withCtx(() => [createVNode(unref(ScalarSidebar), {
|
|
59
|
+
default: withCtx(() => [createVNode(unref(ScalarSidebar$1), {
|
|
60
60
|
class: "flex w-auto flex-1",
|
|
61
61
|
indent: 20,
|
|
62
62
|
isDraggable: __props.layout !== "modal",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Sidebar.vue.script.js","names":[],"sources":["../../../../src/v2/components/sidebar/Sidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarIconButton,\n ScalarSidebarSearchInput,\n type WorkspaceGroup,\n} from '@scalar/components'\nimport { ScalarIconFileDashed, ScalarIconMagnifyingGlass } from '@scalar/icons'\nimport {\n ScalarSidebar,\n type DraggingItem,\n type HoveredItem,\n type SidebarState,\n} from '@scalar/sidebar'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport { computed, ref } from 'vue'\n\nimport { Resize } from '@/v2/components/resize'\nimport { useSearchIndex } from '@/v2/features/search'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport SidebarMenu from './SidebarMenu.vue'\n\nconst { documents, sidebarState, layout } = defineProps<{\n /** All documents to display sidebar items for */\n sidebarState: SidebarState<TraversedEntry>\n /** Layout for the client */\n layout: ClientLayout\n /** The currently active workspace */\n activeWorkspace: { id: string }\n /** The list of all available workspaces */\n workspaces: WorkspaceGroup[]\n /** The documents belonging to the workspace */\n documents: WorkspaceDocument[]\n /**\n * Prevents sidebar items from being hovered and dropped into. Can be either a function or a boolean\n *\n * @default true\n */\n isDroppable?:\n | boolean\n | ((draggingItem: DraggingItem, hoveredItem: HoveredItem) => boolean)\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when an item is selected */\n (e: 'selectItem', id: string): void\n /** Emitted when a workspace is selected by optional ID */\n (e: 'select:workspace', id?: string): void\n /** Emitted when the user wants to create a new workspace */\n (e: 'create:workspace'): void\n /** Emitted when sidebar items are reordered via drag and drop */\n (e: 'reorder', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n /** Emitted when the user wants to open the settings */\n (e: 'navigate:to:settings'): void\n}>()\n\nconst slots = defineSlots<{\n /** Slot to add the workspace button */\n workspaceButton?(): unknown\n /** Slot to add additional content to the decorator */\n decorator?(props: { item: TraversedEntry }): unknown\n /** Slot to add additional content to the footer */\n footer?(): unknown\n /** Slot to add additional content to the empty folder */\n empty?(props: { item: TraversedEntry }): unknown\n /** Slot for customizing the actions section of the sidebar menu. */\n sidebarMenuActions?(): unknown\n /** Slot to add additional content to the icon */\n icon?(props: { item: TraversedEntry; open: boolean }): unknown\n}>()\n\n/** Controls the visibility of the search input */\nconst isSearchVisible = ref(false)\n\n/** Controls the width of the sidebar */\nconst sidebarWidth = defineModel<number>('sidebarWidth', {\n required: true,\n default: 288,\n})\n\nconst isDraft = (item: TraversedEntry) => {\n return item.type === 'example' && item.title === 'draft'\n}\n\n/** We handle search results out here so we can show them in the sidebar */\nconst { query, results } = useSearchIndex(() => documents)\n\n/** We show either the search results or the sidebar items */\nconst items = computed(() => results.value ?? sidebarState.items.value)\n\n/** Select an item and clear the search query */\nconst handleSelectItem = (id: string) => {\n emit('selectItem', id)\n query.value = ''\n isSearchVisible.value = false\n}\n</script>\n<template>\n <Resize\n v-model:width=\"sidebarWidth\"\n class=\"flex flex-col\">\n <template #default>\n <ScalarSidebar\n class=\"flex w-auto flex-1\"\n :indent=\"20\"\n :isDraggable=\"layout !== 'modal'\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"sidebarState.isExpanded\"\n :isSelected=\"sidebarState.isSelected\"\n :items\n layout=\"client\"\n :options=\"{ hideOperationDefaultExamples: layout === 'modal' }\"\n @reorder=\"\n (draggingItem, hoveredItem) =>\n emit('reorder', draggingItem, hoveredItem)\n \"\n @selectItem=\"handleSelectItem\">\n <template #header>\n <!-- drag region (macos) -->\n <div class=\"mac:h-12 mac:app-drag-region h-2\"></div>\n <div\n class=\"bg-sidebar-b-1 z-1 flex flex-col gap-1.5 px-3 pb-1.5\"\n :class=\"{\n 'max-md:pt-12': layout === 'desktop',\n 'max-md:pt-2 max-md:pl-4!': layout === 'modal',\n 'pt-1 max-md:pt-2 max-md:pl-14': layout === 'web',\n }\">\n <div\n v-if=\"layout !== 'web'\"\n class=\"flex items-center justify-between\"\n :class=\"{ 'max-md:pl-10': layout === 'desktop' }\">\n <!-- Desktop gets the workspace menu here -->\n <SidebarMenu\n v-if=\"layout !== 'modal'\"\n :activeWorkspace=\"activeWorkspace\"\n :workspaces=\"workspaces\"\n @create:workspace=\"emit('create:workspace')\"\n @navigate:to:settings=\"emit('navigate:to:settings')\"\n @select:workspace=\"(id) => emit('select:workspace', id)\">\n <template #sidebarMenuActions>\n <slot name=\"sidebarMenuActions\" />\n </template>\n </SidebarMenu>\n\n <!-- Placeholder for the sidebar toggle in modal layout -->\n <div v-else-if=\"layout === 'modal'\"></div>\n\n <!-- Toggle search, always visible on web -->\n <ScalarIconButton\n class=\"hover:bg-b-2 active:text-c-1 size-8 rounded p-2\"\n :icon=\"ScalarIconMagnifyingGlass\"\n label=\"Search\"\n size=\"sm\"\n @click=\"isSearchVisible = !isSearchVisible\" />\n </div>\n\n <ScalarSidebarSearchInput\n v-if=\"isSearchVisible || layout === 'web'\"\n v-model=\"query\"\n :autofocus=\"layout !== 'web'\" />\n </div>\n </template>\n\n <template #spacer>\n <div class=\"flex-1\"></div>\n </template>\n\n <template\n v-if=\"slots.decorator\"\n #decorator=\"decoratorProps\">\n <slot\n v-bind=\"decoratorProps\"\n name=\"decorator\" />\n </template>\n\n <template #icon=\"iconProps\">\n <template v-if=\"slots.icon || isDraft(iconProps.item)\">\n <ScalarIconFileDashed v-if=\"isDraft(iconProps.item)\" />\n <slot\n v-bind=\"iconProps\"\n name=\"icon\" />\n </template>\n </template>\n\n <!-- Empty folder slot -->\n <template\n v-if=\"slots.empty\"\n #empty=\"emptyProps\">\n <slot\n v-bind=\"emptyProps\"\n name=\"empty\" />\n </template>\n\n <template #before>\n <slot name=\"workspaceButton\" />\n </template>\n\n <template #footer>\n <slot name=\"footer\" />\n </template>\n </ScalarSidebar>\n </template>\n </Resize>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CA,MAAM,OAAO;EAab,MAAM,QAAQ,UAAA;;EAgBd,MAAM,kBAAkB,IAAI,MAAK;;EAGjC,MAAM,eAAe,SAAmB,SAAC,eAGxC;EAED,MAAM,WAAW,SAAyB;AACxC,UAAO,KAAK,SAAS,aAAa,KAAK,UAAU;;;EAInD,MAAM,EAAE,OAAO,YAAY,qBAAqB,QAAA,UAAS;;EAGzD,MAAM,QAAQ,eAAe,QAAQ,SAAS,QAAA,aAAa,MAAM,MAAK;;EAGtE,MAAM,oBAAoB,OAAe;AACvC,QAAK,cAAc,GAAE;AACrB,SAAM,QAAQ;AACd,mBAAgB,QAAQ;;;uBAIxB,YAwGS,MAAA,eAAA,EAAA;IAvGC,OAAO,aAAA;yEAAY,QAAA;IAC3B,OAAM;;IACK,SAAO,cAmGA,CAlGhB,YAkGgB,MAAA,
|
|
1
|
+
{"version":3,"file":"Sidebar.vue.script.js","names":[],"sources":["../../../../src/v2/components/sidebar/Sidebar.vue"],"sourcesContent":["<script setup lang=\"ts\">\nimport {\n ScalarIconButton,\n ScalarSidebarSearchInput,\n type WorkspaceGroup,\n} from '@scalar/components'\nimport { ScalarIconFileDashed, ScalarIconMagnifyingGlass } from '@scalar/icons'\nimport {\n ScalarSidebar,\n type DraggingItem,\n type HoveredItem,\n type SidebarState,\n} from '@scalar/sidebar'\nimport type { WorkspaceDocument } from '@scalar/workspace-store/schemas'\nimport type { TraversedEntry } from '@scalar/workspace-store/schemas/navigation'\nimport { computed, ref } from 'vue'\n\nimport { Resize } from '@/v2/components/resize'\nimport { useSearchIndex } from '@/v2/features/search'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport SidebarMenu from './SidebarMenu.vue'\n\nconst { documents, sidebarState, layout } = defineProps<{\n /** All documents to display sidebar items for */\n sidebarState: SidebarState<TraversedEntry>\n /** Layout for the client */\n layout: ClientLayout\n /** The currently active workspace */\n activeWorkspace: { id: string }\n /** The list of all available workspaces */\n workspaces: WorkspaceGroup[]\n /** The documents belonging to the workspace */\n documents: WorkspaceDocument[]\n /**\n * Prevents sidebar items from being hovered and dropped into. Can be either a function or a boolean\n *\n * @default true\n */\n isDroppable?:\n | boolean\n | ((draggingItem: DraggingItem, hoveredItem: HoveredItem) => boolean)\n}>()\n\nconst emit = defineEmits<{\n /** Emitted when an item is selected */\n (e: 'selectItem', id: string): void\n /** Emitted when a workspace is selected by optional ID */\n (e: 'select:workspace', id?: string): void\n /** Emitted when the user wants to create a new workspace */\n (e: 'create:workspace'): void\n /** Emitted when sidebar items are reordered via drag and drop */\n (e: 'reorder', draggingItem: DraggingItem, hoveredItem: HoveredItem): void\n /** Emitted when the user wants to open the settings */\n (e: 'navigate:to:settings'): void\n}>()\n\nconst slots = defineSlots<{\n /** Slot to add the workspace button */\n workspaceButton?(): unknown\n /** Slot to add additional content to the decorator */\n decorator?(props: { item: TraversedEntry }): unknown\n /** Slot to add additional content to the footer */\n footer?(): unknown\n /** Slot to add additional content to the empty folder */\n empty?(props: { item: TraversedEntry }): unknown\n /** Slot for customizing the actions section of the sidebar menu. */\n sidebarMenuActions?(): unknown\n /** Slot to add additional content to the icon */\n icon?(props: { item: TraversedEntry; open: boolean }): unknown\n}>()\n\n/** Controls the visibility of the search input */\nconst isSearchVisible = ref(false)\n\n/** Controls the width of the sidebar */\nconst sidebarWidth = defineModel<number>('sidebarWidth', {\n required: true,\n default: 288,\n})\n\nconst isDraft = (item: TraversedEntry) => {\n return item.type === 'example' && item.title === 'draft'\n}\n\n/** We handle search results out here so we can show them in the sidebar */\nconst { query, results } = useSearchIndex(() => documents)\n\n/** We show either the search results or the sidebar items */\nconst items = computed(() => results.value ?? sidebarState.items.value)\n\n/** Select an item and clear the search query */\nconst handleSelectItem = (id: string) => {\n emit('selectItem', id)\n query.value = ''\n isSearchVisible.value = false\n}\n</script>\n<template>\n <Resize\n v-model:width=\"sidebarWidth\"\n class=\"flex flex-col\">\n <template #default>\n <ScalarSidebar\n class=\"flex w-auto flex-1\"\n :indent=\"20\"\n :isDraggable=\"layout !== 'modal'\"\n :isDroppable=\"isDroppable\"\n :isExpanded=\"sidebarState.isExpanded\"\n :isSelected=\"sidebarState.isSelected\"\n :items\n layout=\"client\"\n :options=\"{ hideOperationDefaultExamples: layout === 'modal' }\"\n @reorder=\"\n (draggingItem, hoveredItem) =>\n emit('reorder', draggingItem, hoveredItem)\n \"\n @selectItem=\"handleSelectItem\">\n <template #header>\n <!-- drag region (macos) -->\n <div class=\"mac:h-12 mac:app-drag-region h-2\"></div>\n <div\n class=\"bg-sidebar-b-1 z-1 flex flex-col gap-1.5 px-3 pb-1.5\"\n :class=\"{\n 'max-md:pt-12': layout === 'desktop',\n 'max-md:pt-2 max-md:pl-4!': layout === 'modal',\n 'pt-1 max-md:pt-2 max-md:pl-14': layout === 'web',\n }\">\n <div\n v-if=\"layout !== 'web'\"\n class=\"flex items-center justify-between\"\n :class=\"{ 'max-md:pl-10': layout === 'desktop' }\">\n <!-- Desktop gets the workspace menu here -->\n <SidebarMenu\n v-if=\"layout !== 'modal'\"\n :activeWorkspace=\"activeWorkspace\"\n :workspaces=\"workspaces\"\n @create:workspace=\"emit('create:workspace')\"\n @navigate:to:settings=\"emit('navigate:to:settings')\"\n @select:workspace=\"(id) => emit('select:workspace', id)\">\n <template #sidebarMenuActions>\n <slot name=\"sidebarMenuActions\" />\n </template>\n </SidebarMenu>\n\n <!-- Placeholder for the sidebar toggle in modal layout -->\n <div v-else-if=\"layout === 'modal'\"></div>\n\n <!-- Toggle search, always visible on web -->\n <ScalarIconButton\n class=\"hover:bg-b-2 active:text-c-1 size-8 rounded p-2\"\n :icon=\"ScalarIconMagnifyingGlass\"\n label=\"Search\"\n size=\"sm\"\n @click=\"isSearchVisible = !isSearchVisible\" />\n </div>\n\n <ScalarSidebarSearchInput\n v-if=\"isSearchVisible || layout === 'web'\"\n v-model=\"query\"\n :autofocus=\"layout !== 'web'\" />\n </div>\n </template>\n\n <template #spacer>\n <div class=\"flex-1\"></div>\n </template>\n\n <template\n v-if=\"slots.decorator\"\n #decorator=\"decoratorProps\">\n <slot\n v-bind=\"decoratorProps\"\n name=\"decorator\" />\n </template>\n\n <template #icon=\"iconProps\">\n <template v-if=\"slots.icon || isDraft(iconProps.item)\">\n <ScalarIconFileDashed v-if=\"isDraft(iconProps.item)\" />\n <slot\n v-bind=\"iconProps\"\n name=\"icon\" />\n </template>\n </template>\n\n <!-- Empty folder slot -->\n <template\n v-if=\"slots.empty\"\n #empty=\"emptyProps\">\n <slot\n v-bind=\"emptyProps\"\n name=\"empty\" />\n </template>\n\n <template #before>\n <slot name=\"workspaceButton\" />\n </template>\n\n <template #footer>\n <slot name=\"footer\" />\n </template>\n </ScalarSidebar>\n </template>\n </Resize>\n</template>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA4CA,MAAM,OAAO;EAab,MAAM,QAAQ,UAAA;;EAgBd,MAAM,kBAAkB,IAAI,MAAK;;EAGjC,MAAM,eAAe,SAAmB,SAAC,eAGxC;EAED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AAA,CAAA;;gBAelB,MAAM,QAAA;WACX;kBAAO,eAAU,CAClB,WAEiB,KAAA,QAAA,SAAA,eAAA,mBADP,WAAU,CAAA,CAAA,CAAA,CAAA"}
|
package/dist/v2/constants.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/v2/constants.ts
|
|
2
2
|
/** The version number taken from the package.json. Consumers can override at build time via define (e.g. OVERRIDE_PACKAGE_VERSION: JSON.stringify('1.2.3')). */
|
|
3
|
-
var APP_VERSION = typeof OVERRIDE_PACKAGE_VERSION !== "undefined" ? OVERRIDE_PACKAGE_VERSION : "3.
|
|
3
|
+
var APP_VERSION = typeof OVERRIDE_PACKAGE_VERSION !== "undefined" ? OVERRIDE_PACKAGE_VERSION : "3.3.0";
|
|
4
4
|
//#endregion
|
|
5
5
|
export { APP_VERSION };
|
|
6
6
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type ModalState } from '@scalar/components';
|
|
2
2
|
import type { ClientPlugin } from '@scalar/oas-utils/helpers';
|
|
3
|
+
import type { RegistryDocumentsState } from '../../../v2/features/app/hooks/use-sidebar-documents.js';
|
|
3
4
|
import type { CommandPaletteState } from '../../../v2/features/command-palette/hooks/use-command-palette-state.js';
|
|
4
5
|
import type { ImportDocumentFromRegistry } from '../../../v2/types/configuration';
|
|
5
6
|
import type { ClientLayout } from '../../../v2/types/layout';
|
|
@@ -18,6 +19,11 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
18
19
|
getCommandPaletteState: () => CommandPaletteState;
|
|
19
20
|
/** Fetches the full document from registry by meta. Passed through to route props for sync. */
|
|
20
21
|
fetchRegistryDocument?: ImportDocumentFromRegistry;
|
|
22
|
+
/**
|
|
23
|
+
* The list of all available registry documents, with a loading status so the
|
|
24
|
+
* sidebar can render skeleton placeholders until the real list is ready.
|
|
25
|
+
*/
|
|
26
|
+
registryDocuments?: RegistryDocumentsState;
|
|
21
27
|
}, {
|
|
22
28
|
openCreateWorkspace: () => void;
|
|
23
29
|
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<{
|
|
@@ -27,12 +33,12 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
27
33
|
getCommandPaletteState: () => CommandPaletteState;
|
|
28
34
|
/** Fetches the full document from registry by meta. Passed through to route props for sync. */
|
|
29
35
|
fetchRegistryDocument?: ImportDocumentFromRegistry;
|
|
30
|
-
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
31
36
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
37
|
+
* The list of all available registry documents, with a loading status so the
|
|
38
|
+
* sidebar can render skeleton placeholders until the real list is ready.
|
|
34
39
|
*/
|
|
35
|
-
|
|
40
|
+
registryDocuments?: RegistryDocumentsState;
|
|
41
|
+
}> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
|
|
36
42
|
/**
|
|
37
43
|
* Slot for customizing the create workspace modal.
|
|
38
44
|
* This slot is used to render custom actions or components within the create workspace modal.
|
|
@@ -40,6 +46,18 @@ declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<{
|
|
|
40
46
|
'create-workspace'?: (payload: {
|
|
41
47
|
state: ModalState;
|
|
42
48
|
}) => unknown;
|
|
49
|
+
/**
|
|
50
|
+
* Slot for customizing the menu items section of the app header.
|
|
51
|
+
* Defaults to a workspace picker bound to the current app state. Overriding this slot
|
|
52
|
+
* replaces the default picker entirely, so the consumer is responsible for rendering
|
|
53
|
+
* any workspace switcher (or other menu content) they need.
|
|
54
|
+
*/
|
|
55
|
+
'header-menu-items'?: () => unknown;
|
|
56
|
+
/**
|
|
57
|
+
* Slot for customizing the end section of the app header.
|
|
58
|
+
* Typically used for user menus, action buttons, or other trailing controls.
|
|
59
|
+
*/
|
|
60
|
+
'header-end'?: () => unknown;
|
|
43
61
|
}>;
|
|
44
62
|
type __VLS_WithSlots<T, S> = T & {
|
|
45
63
|
new (): {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/App.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"App.vue.d.ts","sourceRoot":"","sources":["../../../../src/v2/features/app/App.vue"],"names":[],"mappings":"AA8SA,OAAO,EAIL,KAAK,UAAU,EAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAA;AAa7D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+CAA+C,CAAA;AAC3F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,+DAA+D,CAAA;AAKxG,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,0BAA0B,CAAA;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAErD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,aAAa,CAAA;AAI3C;;;;GAIG;wBACkB,OAAO,YAAY;AAAxC,wBAAyC;AAGzC,QAAA,MAAM,YAAY;YAER,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;cAC5B,YAAY,EAAE;iBACX,MAAM,QAAQ;4BACH,MAAM,mBAAmB;IACjD,+FAA+F;4BACvE,0BAA0B;IAClD;;;OAGG;wBACiB,sBAAsB;;;;YAVlC,OAAO,CAAC,YAAY,EAAE,OAAO,CAAC;cAC5B,YAAY,EAAE;iBACX,MAAM,QAAQ;4BACH,MAAM,mBAAmB;IACjD,+FAA+F;4BACvE,0BAA0B;IAClD;;;OAGG;wBACiB,sBAAsB;;IAa1C;;;OAGG;yBACkB,CAAC,OAAO,EAAE;QAAE,KAAK,EAAE,UAAU,CAAA;KAAE,KAAK,OAAO;IAChE;;;;;OAKG;0BACmB,MAAM,OAAO;IACnC;;;OAGG;mBACY,MAAM,OAAO;EAqZ1B,CAAC;AACL,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.vue.js","names":[],"sources":["../../../../src/v2/features/app/App.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Main entry point for the API client for electron and web.\n *\n * This component handles all events and store business logic for the application.\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarTeleportRoot,\n useModal,\n type ModalState,\n} from '@scalar/components'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport { extensions } from '@scalar/workspace-store/schemas/extensions'\nimport { computed, onBeforeUnmount, toValue, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport { SidebarToggle } from '@/v2/components/sidebar'\nimport CreateWorkspaceModal from '@/v2/features/app/components/CreateWorkspaceModal.vue'\nimport SplashScreen from '@/v2/features/app/components/SplashScreen.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { useDocumentWatcher } from '@/v2/features/app/hooks/use-document-watcher'\nimport type { CommandPaletteState } from '@/v2/features/command-palette/hooks/use-command-palette-state'\nimport TheCommandPalette from '@/v2/features/command-palette/TheCommandPalette.vue'\nimport { useMonacoEditorConfiguration } from '@/v2/features/editor'\nimport { useColorMode } from '@/v2/hooks/use-color-mode'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport { type AppState } from './app-state'\nimport AppSidebar from './components/AppSidebar.vue'\nimport DesktopTabs from './components/DesktopTabs.vue'\n\nconst {\n layout,\n plugins = [],\n getAppState,\n getCommandPaletteState,\n fetchRegistryDocument,\n} = defineProps<{\n layout: Exclude<ClientLayout, 'modal'>\n plugins?: ClientPlugin[]\n getAppState: () => AppState\n getCommandPaletteState: () => CommandPaletteState\n /** Fetches the full document from registry by meta. Passed through to route props for sync. */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n}>()\n\ndefineSlots<{\n /**\n * Slot for customizing the actions section of the sidebar menu.\n * This slot is used to render custom actions or components within the actions section.\n */\n 'sidebar-menu-actions': () => unknown\n /**\n * Slot for customizing the create workspace modal.\n * This slot is used to render custom actions or components within the create workspace modal.\n */\n 'create-workspace'?: (payload: { state: ModalState }) => unknown\n}>()\n\ndefineExpose({\n openCreateWorkspace: () => createWorkspaceModalState.show(),\n})\n\nconst app = getAppState()\nconst paletteState = getCommandPaletteState()\n\n/** Expose workspace store to window for debugging purposes. */\nif (typeof window !== 'undefined') {\n window.dataDumpWorkspace = () => app.store.value\n window.dumpAppState = () => app\n}\n\n/** Call lifecycle hooks on plugins and subscribe to event bus events */\nconst pluginUnsubscribes: (() => void)[] = []\n\nfor (const plugin of plugins) {\n plugin.lifecycle?.onInit?.({ config: { telemetry: app.telemetry.value } })\n\n if (plugin.on) {\n for (const [event, handler] of Object.entries(plugin.on)) {\n pluginUnsubscribes.push(app.eventBus.on(event as any, handler as any))\n }\n }\n}\n\n/** Notify plugins when telemetry config changes */\nwatch(app.telemetry, () => {\n for (const plugin of plugins) {\n plugin.lifecycle?.onConfigChange?.({\n config: { telemetry: app.telemetry.value },\n })\n }\n})\n\nonBeforeUnmount(() => {\n for (const unsub of pluginUnsubscribes) {\n unsub()\n }\n for (const plugin of plugins) {\n plugin.lifecycle?.onDestroy?.()\n }\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(app.eventBus, layout)\n\nconst DEFAULT_DOCUMENT_WATCH_TIMEOUT = 5000\n\n/** Watch the active document for changes and rebase it with its remote source */\nuseDocumentWatcher({\n documentName: () =>\n app.store.value?.workspace[extensions.workspace.activeDocument],\n store: app.store,\n initialTimeout: DEFAULT_DOCUMENT_WATCH_TIMEOUT,\n})\n\n/** Color mode */\nuseColorMode({ workspaceStore: app.store })\n\nconst currentTheme = computed(() => app.theme.styles.value.themeStyles)\nconst isDarkMode = computed(() => app.isDarkMode.value)\n\n/** Setup monaco editor configuration */\nuseMonacoEditorConfiguration({\n theme: currentTheme,\n darkMode: isDarkMode,\n})\n\nconst navigateToWorkspaceOverview = (namespace?: string, slug?: string) => {\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'environment',\n namespace,\n workspaceSlug: slug,\n })\n}\n\n/** Sets the active workspace by ID: finds the workspace in the list and updates app state & navigation. */\nconst setActiveWorkspace = (id?: string) => {\n if (!id) {\n return\n }\n const workspace = app.workspace.workspaceList.value?.find(\n (workspace) => workspace.id === id,\n )\n if (!workspace) {\n return\n }\n\n navigateToWorkspaceOverview(workspace.namespace, workspace.slug)\n}\n\nconst createWorkspaceModalState = useModal()\n\n/** Props to pass to the RouterView component. */\nconst routerViewProps = computed<RouteProps>(() => {\n return {\n documentSlug: app.activeEntities.documentSlug.value ?? '',\n document: app.store.value?.workspace.activeDocument ?? null,\n environment: app.environment.value,\n eventBus: app.eventBus,\n exampleName: app.activeEntities.exampleName.value,\n fetchRegistryDocument,\n layout,\n method: app.activeEntities.method.value,\n path: app.activeEntities.path.value,\n workspaceStore: app.store.value!,\n activeWorkspace: app.workspace.activeWorkspace.value!,\n plugins,\n isDarkMode: app.isDarkMode.value,\n currentTheme: app.theme.styles.value.themeStyles,\n customThemes: toValue(app.theme.customThemes),\n telemetry: app.telemetry.value,\n onUpdateTelemetry: (value: boolean) => {\n app.telemetry.value = value\n },\n options: app.options,\n }\n})\n</script>\n\n<template>\n <ScalarTeleportRoot>\n <!-- Theme style tag -->\n <div v-html=\"app.theme.themeStyleTag.value\" />\n\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- Main content -->\n <main\n v-if=\"\n app.store.value !== null &&\n app.workspace.activeWorkspace.value !== null &&\n !app.loading.value\n \">\n <div\n class=\"relative flex w-dvw flex-col\"\n :class=\"layout === 'web' ? 'min-h-0' : 'h-dvh'\">\n <SidebarToggle\n v-model=\"app.sidebar.isOpen.value\"\n class=\"absolute z-60 md:hidden\"\n :class=\"layout === 'desktop' ? 'top-14 left-4' : 'top-4 left-4'\" />\n <div class=\"flex min-h-0 flex-1 flex-row\">\n <!-- App sidebar -->\n <AppSidebar\n v-model:isSidebarOpen=\"app.sidebar.isOpen.value\"\n :activeWorkspace=\"app.workspace.activeWorkspace.value\"\n :eventBus=\"app.eventBus\"\n :isWorkspaceOpen=\"app.workspace.isOpen.value\"\n :layout\n :sidebarState=\"app.sidebar.state\"\n :sidebarWidth=\"app.sidebar.width.value\"\n :store=\"app.store.value!\"\n :workspaces=\"app.workspace.workspaceGroups.value\"\n @click:workspace=\"navigateToWorkspaceOverview\"\n @create:workspace=\"createWorkspaceModalState.show()\"\n @select:workspace=\"setActiveWorkspace\"\n @selectItem=\"app.sidebar.handleSelectItem\"\n @update:sidebarWidth=\"app.sidebar.handleSidebarWidthUpdate\">\n <template #sidebarMenuActions>\n <slot name=\"sidebar-menu-actions\" />\n </template>\n </AppSidebar>\n\n <div class=\"flex min-h-0 flex-1 flex-col\">\n <!-- App Tabs -->\n <DesktopTabs\n v-if=\"layout === 'desktop'\"\n :activeTabIndex=\"app.tabs.activeTabIndex.value\"\n :eventBus=\"app.eventBus\"\n :tabs=\"app.tabs.state.value\" />\n\n <!-- Router view min-h-0 is required for scrolling, do not remove it -->\n <div class=\"bg-b-1 relative min-h-0 flex-1\">\n <RouterView v-bind=\"routerViewProps\" />\n </div>\n </div>\n </div>\n </div>\n\n <slot\n name=\"create-workspace\"\n :state=\"createWorkspaceModalState\">\n <!-- Create workspace modal -->\n <CreateWorkspaceModal\n :state=\"createWorkspaceModalState\"\n @create:workspace=\"(payload) => app.workspace.create(payload)\" />\n </slot>\n\n <!-- Popup command palette to add resources from anywhere -->\n <TheCommandPalette\n :eventBus=\"app.eventBus\"\n :paletteState=\"paletteState\"\n :workspaceStore=\"app.store.value!\" />\n </main>\n <!-- Splash screen -->\n <main v-else>\n <SplashScreen />\n </main>\n </ScalarTeleportRoot>\n</template>\n\n<style>\n#scalar-client {\n position: relative;\n background-color: var(--scalar-background-2);\n}\n.dark-mode #scalar-client {\n background-color: color-mix(in srgb, var(--scalar-background-1) 65%, black);\n}\n</style>\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"App.vue.js","names":[],"sources":["../../../../src/v2/features/app/App.vue"],"sourcesContent":["<script lang=\"ts\">\n/**\n * Main entry point for the API client for electron and web.\n *\n * This component handles all events and store business logic for the application.\n */\nexport default {}\n</script>\n\n<script setup lang=\"ts\">\nimport {\n ScalarMenuWorkspacePicker,\n ScalarTeleportRoot,\n useModal,\n type ModalState,\n} from '@scalar/components'\nimport type { ClientPlugin } from '@scalar/oas-utils/helpers'\nimport { ScalarToasts } from '@scalar/use-toasts'\nimport { extensions } from '@scalar/workspace-store/schemas/extensions'\nimport { computed, onBeforeUnmount, toValue, watch } from 'vue'\nimport { RouterView } from 'vue-router'\n\nimport { SidebarToggle } from '@/v2/components/sidebar'\nimport AppHeader from '@/v2/features/app/components/AppHeader.vue'\nimport AppSidebar from '@/v2/features/app/components/AppSidebar.vue'\nimport CreateWorkspaceModal from '@/v2/features/app/components/CreateWorkspaceModal.vue'\nimport SplashScreen from '@/v2/features/app/components/SplashScreen.vue'\nimport type { RouteProps } from '@/v2/features/app/helpers/routes'\nimport { useDocumentWatcher } from '@/v2/features/app/hooks/use-document-watcher'\nimport type { RegistryDocumentsState } from '@/v2/features/app/hooks/use-sidebar-documents'\nimport type { CommandPaletteState } from '@/v2/features/command-palette/hooks/use-command-palette-state'\nimport TheCommandPalette from '@/v2/features/command-palette/TheCommandPalette.vue'\nimport { useMonacoEditorConfiguration } from '@/v2/features/editor'\nimport { useColorMode } from '@/v2/hooks/use-color-mode'\nimport { useGlobalHotKeys } from '@/v2/hooks/use-global-hot-keys'\nimport type { ImportDocumentFromRegistry } from '@/v2/types/configuration'\nimport type { ClientLayout } from '@/v2/types/layout'\n\nimport { type AppState } from './app-state'\nimport DesktopTabs from './components/DesktopTabs.vue'\n\nconst {\n layout,\n plugins = [],\n getAppState,\n getCommandPaletteState,\n fetchRegistryDocument,\n registryDocuments = { status: 'success', documents: [] },\n} = defineProps<{\n layout: Exclude<ClientLayout, 'modal'>\n plugins?: ClientPlugin[]\n getAppState: () => AppState\n getCommandPaletteState: () => CommandPaletteState\n /** Fetches the full document from registry by meta. Passed through to route props for sync. */\n fetchRegistryDocument?: ImportDocumentFromRegistry\n /**\n * The list of all available registry documents, with a loading status so the\n * sidebar can render skeleton placeholders until the real list is ready.\n */\n registryDocuments?: RegistryDocumentsState\n}>()\n\ndefineSlots<{\n /**\n * Slot for customizing the create workspace modal.\n * This slot is used to render custom actions or components within the create workspace modal.\n */\n 'create-workspace'?: (payload: { state: ModalState }) => unknown\n /**\n * Slot for customizing the menu items section of the app header.\n * Defaults to a workspace picker bound to the current app state. Overriding this slot\n * replaces the default picker entirely, so the consumer is responsible for rendering\n * any workspace switcher (or other menu content) they need.\n */\n 'header-menu-items'?: () => unknown\n /**\n * Slot for customizing the end section of the app header.\n * Typically used for user menus, action buttons, or other trailing controls.\n */\n 'header-end'?: () => unknown\n}>()\n\ndefineExpose({\n openCreateWorkspace: () => createWorkspaceModalState.show(),\n})\n\nconst app = getAppState()\nconst paletteState = getCommandPaletteState()\n\n/** Expose workspace store to window for debugging purposes. */\nif (typeof window !== 'undefined') {\n window.dataDumpWorkspace = () => app.store.value\n window.dumpAppState = () => app\n}\n\n/** Call lifecycle hooks on plugins and subscribe to event bus events */\nconst pluginUnsubscribes: (() => void)[] = []\n\nfor (const plugin of plugins) {\n plugin.lifecycle?.onInit?.({ config: { telemetry: app.telemetry.value } })\n\n if (plugin.on) {\n for (const [event, handler] of Object.entries(plugin.on)) {\n pluginUnsubscribes.push(app.eventBus.on(event as any, handler as any))\n }\n }\n}\n\n/** Notify plugins when telemetry config changes */\nwatch(app.telemetry, () => {\n for (const plugin of plugins) {\n plugin.lifecycle?.onConfigChange?.({\n config: { telemetry: app.telemetry.value },\n })\n }\n})\n\nonBeforeUnmount(() => {\n for (const unsub of pluginUnsubscribes) {\n unsub()\n }\n for (const plugin of plugins) {\n plugin.lifecycle?.onDestroy?.()\n }\n})\n\n/** Register global hotkeys for the app, passing the workspace event bus and layout state */\nuseGlobalHotKeys(app.eventBus, layout)\n\nconst DEFAULT_DOCUMENT_WATCH_TIMEOUT = 5000\n\n/** Watch the active document for changes and rebase it with its remote source */\nuseDocumentWatcher({\n documentName: () =>\n app.store.value?.workspace[extensions.workspace.activeDocument],\n store: app.store,\n initialTimeout: DEFAULT_DOCUMENT_WATCH_TIMEOUT,\n})\n\n/** Color mode */\nuseColorMode({ workspaceStore: app.store })\n\nconst currentTheme = computed(() => app.theme.styles.value.themeStyles)\nconst isDarkMode = computed(() => app.isDarkMode.value)\n\n/** Setup monaco editor configuration */\nuseMonacoEditorConfiguration({\n theme: currentTheme,\n darkMode: isDarkMode,\n})\n\nconst navigateToWorkspaceOverview = (namespace?: string, slug?: string) => {\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'environment',\n namespace,\n workspaceSlug: slug,\n })\n}\n\n/** Sets the active workspace by ID: finds the workspace in the list and updates app state & navigation. */\nconst setActiveWorkspace = (id?: string) => {\n if (!id) {\n return\n }\n const workspace = app.workspace.workspaceList.value?.find(\n (workspace) => workspace.id === id,\n )\n if (!workspace) {\n return\n }\n\n navigateToWorkspaceOverview(workspace.namespace, workspace.slug)\n}\n\nconst createWorkspaceModalState = useModal()\n\n/** Props to pass to the RouterView component. */\nconst routerViewProps = computed<RouteProps>(() => {\n return {\n documentSlug: app.activeEntities.documentSlug.value ?? '',\n document: app.store.value?.workspace.activeDocument ?? null,\n environment: app.environment.value,\n eventBus: app.eventBus,\n exampleName: app.activeEntities.exampleName.value,\n fetchRegistryDocument,\n layout,\n method: app.activeEntities.method.value,\n path: app.activeEntities.path.value,\n workspaceStore: app.store.value!,\n activeWorkspace: app.workspace.activeWorkspace.value!,\n plugins,\n isDarkMode: app.isDarkMode.value,\n currentTheme: app.theme.styles.value.themeStyles,\n customThemes: toValue(app.theme.customThemes),\n telemetry: app.telemetry.value,\n onUpdateTelemetry: (value: boolean) => {\n app.telemetry.value = value\n },\n options: app.options,\n }\n})\n</script>\n\n<template>\n <ScalarTeleportRoot>\n <!-- Theme style tag -->\n <div v-html=\"app.theme.themeStyleTag.value\" />\n\n <!-- Toasts -->\n <ScalarToasts />\n\n <!-- Main content -->\n <main\n v-if=\"\n app.store.value !== null &&\n app.workspace.activeWorkspace.value !== null &&\n !app.loading.value\n \">\n <div class=\"relative flex h-dvh w-dvw flex-col\">\n <SidebarToggle\n v-model=\"app.sidebar.isOpen.value\"\n class=\"absolute z-60 md:hidden\"\n :class=\"layout === 'desktop' ? 'top-14 left-4' : 'top-4 left-4'\" />\n <AppHeader\n @navigate:to:settings=\"\n app.eventBus.emit('ui:navigate', {\n page: 'workspace',\n path: 'settings',\n })\n \">\n <template #menuItems>\n <slot name=\"header-menu-items\">\n <ScalarMenuWorkspacePicker\n :modelValue=\"app.workspace.activeWorkspace.value?.id\"\n :workspaceOptions=\"app.workspace.workspaceGroups.value\"\n @createWorkspace=\"createWorkspaceModalState.show()\"\n @update:modelValue=\"(value) => setActiveWorkspace(value)\" />\n </slot>\n </template>\n <template #end>\n <slot name=\"header-end\" />\n </template>\n </AppHeader>\n <div class=\"flex min-h-0 flex-1 flex-row\">\n <!-- App sidebar -->\n <AppSidebar\n :app=\"app\"\n :fetchRegistryDocument=\"fetchRegistryDocument\"\n :registryDocuments=\"registryDocuments\"\n :sidebarWidth=\"app.sidebar.width.value\"\n @update:sidebarWidth=\"app.sidebar.handleSidebarWidthUpdate\" />\n\n <div class=\"flex min-h-0 flex-1 flex-col\">\n <!-- App Tabs -->\n <DesktopTabs\n v-if=\"layout === 'desktop'\"\n :activeTabIndex=\"app.tabs.activeTabIndex.value\"\n :eventBus=\"app.eventBus\"\n :tabs=\"app.tabs.state.value\" />\n\n <!-- Router view min-h-0 is required for scrolling, do not remove it -->\n <div class=\"bg-b-1 relative min-h-0 flex-1\">\n <RouterView v-bind=\"routerViewProps\" />\n </div>\n </div>\n </div>\n </div>\n\n <slot\n name=\"create-workspace\"\n :state=\"createWorkspaceModalState\">\n <!-- Create workspace modal -->\n <CreateWorkspaceModal\n :state=\"createWorkspaceModalState\"\n @create:workspace=\"(payload) => app.workspace.create(payload)\" />\n </slot>\n <!-- Popup command palette to add resources from anywhere -->\n <TheCommandPalette\n :eventBus=\"app.eventBus\"\n :paletteState=\"paletteState\"\n :workspaceStore=\"app.store.value!\" />\n </main>\n <!-- Splash screen -->\n <main v-else>\n <SplashScreen />\n </main>\n </ScalarTeleportRoot>\n</template>\n\n<style>\n#scalar-client {\n position: relative;\n background-color: var(--scalar-background-2);\n}\n.dark-mode #scalar-client {\n background-color: color-mix(in srgb, var(--scalar-background-1) 65%, black);\n}\n</style>\n"],"mappings":""}
|