import { type ModalState } from '@scalar/components/modal'; import { type ComputedRef, type InjectionKey, type MaybeRefOrGetter } from 'vue'; export type GenerateSdkContext = { /** * Whether the Generate SDK button should render at all. * * They hand the active document to Scalar, which only makes sense while the reference is being * developed locally ("offline mode"). Deployed references never show them, and neither does a * document that is still loading, is not an OpenAPI document, or already documents its own SDKs. */ enabled: ComputedRef; /** State of the Explore Scalar dialog the buttons open; ApiReference renders that dialog once */ dialog: ModalState; /** Open the Explore Scalar dialog */ open: () => void; /** * Set by the localhost shell, which shows the Explore Scalar content in its side panel instead of * the dialog on wide screens. The buttons then disclose that panel rather than announce a dialog. */ panel?: GenerateSdkPanel; }; /** The side panel the buttons disclose while the localhost shell has room for it */ type GenerateSdkPanel = { /** The panel element's id, for `aria-controls` */ id: string; /** Whether the buttons open the panel at the moment, rather than the dialog */ active: ComputedRef; /** Whether the panel shows the Explore Scalar content right now */ expanded: ComputedRef; }; type UseGenerateSdkOptions = { /** * Whether an OpenAPI document has loaded. Until it has, there is nothing to generate from and no * way to tell whether it already lists SDKs, so the buttons stay hidden. */ hasDocument: MaybeRefOrGetter; /** Whether the active document already lists SDK installation instructions. Hides every button. */ hasSdk: MaybeRefOrGetter; /** Hide every SDK generation entry point when developer tools are disabled. */ disabled?: MaybeRefOrGetter; /** Override the local-only check (e.g. for tests or docs config) */ enabled?: ComputedRef; }; export declare const GENERATE_SDK_CONTEXT_SYMBOL: InjectionKey; /** * Create the Generate SDK context. * * Call once from the API Reference root and provide it under `GENERATE_SDK_CONTEXT_SYMBOL`. * Every button opens the same Explore Scalar dialog, which takes care of uploading the document * and signing up, so the page only ever holds one copy of it. */ export declare const useGenerateSdk: (options: UseGenerateSdkOptions) => GenerateSdkContext; /** * Inject the Generate SDK context provided by ApiReference. * * Returns undefined outside a reference root, so buttons rendered on their own (e.g. in Storybook, * tests or a standalone block) never show up and never borrow another reference's state. */ export declare const useGenerateSdkContext: () => ComputedRef; export {}; //# sourceMappingURL=use-generate-sdk.d.ts.map