import { App, InjectionKey } from "vue"; //#region src/composables/createContext/index.d.ts type ContextKey = InjectionKey | string; interface CreateContextOptions { /** Optional suffix to append to the runtime key */ suffix?: string; } /** * Injects a context provided by an ancestor component. * * @param key The key of the context to inject. * @param defaultValue Optional default value if context is not found. * @template Z The type of the context. * @returns The injected context. * @throws An error if the context is not found and no default is provided. * * @see https://vuejs.org/api/composition-api-dependency-injection.html#inject * @see https://0.vuetifyjs.com/composables/foundation/create-context * * @example * ```ts * // Without default value * const context = useContext('my-context') * * // With default value * const context = useContext('my-context', defaultContext) * ``` */ declare function useContext(key: ContextKey, defaultValue?: Z): Z; /** * Provides a context to all descendant components. * * @param key The key of the context to provide. * @param context The context to provide. * @param app Optional Vue app instance to provide the context at app level instead of component level. * @template Z The type of the context. * @returns The provided context. * * @remarks * When `app` parameter is provided, the context is made available to all components in the app. * When omitted, the context is provided at the current component level and available to descendants only. * * @see https://vuejs.org/api/composition-api-dependency-injection.html#provide * @see https://0.vuetifyjs.com/composables/foundation/create-context * * @example * ```ts * // Component-level provision * provideContext('my-context', context) * * // App-level provision (typically used in plugins) * const app = createApp() * provideContext('my-context', context, app) * ``` */ declare function provideContext(key: ContextKey, context: Z, app?: App): Z; /** * Creates a new context for providing and injecting data. * * Supports two modes: * - **Static key mode**: Pass a string/symbol key. The key is fixed at creation time. * - **Dynamic key mode**: Pass nothing or an options object. The key is provided at runtime. * * @template Z The type of the context. * @returns A tuple containing the `useContext` and `provideContext` functions. * * @see https://vuejs.org/api/composition-api-dependency-injection.html * @see https://0.vuetifyjs.com/composables/foundation/create-context * * @example * ```ts * // Static key mode - key fixed at creation * const [useContext, provideContext] = createContext('v0:theme') * provideContext(context) // provides to 'v0:theme' * useContext() // injects from 'v0:theme' * * // Dynamic key mode - key provided at runtime * const [useContext, provideContext] = createContext() * provideContext('v0:panel', context) // provides to 'v0:panel' * useContext('v0:panel') // injects from 'v0:panel' * * // Dynamic key with suffix - suffix appended to runtime key * const [useContext, provideContext] = createContext({ suffix: 'item' }) * provideContext('v0:panel', context) // provides to 'v0:panel:item' * useContext('v0:panel') // injects from 'v0:panel:item' * ``` */ declare function createContext(key: ContextKey, defaultValue?: Z): readonly [() => Z, (context: Z, app?: App) => Z]; declare function createContext(options?: CreateContextOptions): readonly [(key: string, defaultValue?: Z) => Z, (key: string, context: Z, app?: App) => Z]; //#endregion export { ContextKey, CreateContextOptions, createContext, provideContext, useContext };