UNPKG

@telegram-apps/sdk

Version:

TypeScript Source Development Kit for Telegram Mini Apps client application.

77 lines (76 loc) 3.46 kB
import { Computed } from '@telegram-apps/signals'; import { SafeAreaInsets } from '@telegram-apps/bridge'; import { State } from './types.js'; /** * Signal containing the component complete state. */ export declare const _state: import('@telegram-apps/signals').Signal<State>, state: Computed<State>; export declare function signalFromState<K extends keyof State>(key: K): Computed<State[K]>; /** * Signal containing the current height of the **visible area** of the Mini App. * * The application can display just the top part of the Mini App, with its * lower part remaining outside the screen area. From this position, the user * can "pull" the Mini App to its maximum height, while the bot can do the same * by calling `expand` method. As the position of the Mini App changes, the * current height value of the visible area will be updated in real time. * * Please note that the refresh rate of this value is not sufficient to * smoothly follow the lower border of the window. It should not be used to pin * interface elements to the bottom of the visible area. It's more appropriate * to use the value of the `stableHeight` field for this purpose. * * @see stableHeight */ export declare const height: Computed<number>; /** * Signal containing the height of the visible area of the Mini App in its last stable state. * * The application can display just the top part of the Mini App, with its * lower part remaining outside the screen area. From this position, the user * can "pull" the Mini App to its maximum height, while the application can do * the same by calling `expand` method. * * Unlike the value of `height`, the value of `stableHeight` does not change as * the position of the Mini App changes with user gestures or during * animations. The value of `stableHeight` will be updated after all gestures * and animations are completed and the Mini App reaches its final size. * * @see height */ export declare const stableHeight: Computed<number>; /** * Signal containing the currently visible area width. */ export declare const width: Computed<number>; /** * Signal indicating if the Mini App is expanded to the maximum available height. Otherwise, * if the Mini App occupies part of the screen and can be expanded to the full * height using `expand` method. * @see expand */ export declare const isExpanded: Computed<boolean>; /** * Signal indicating if the current viewport height is stable and is not going to change in * the next moment. */ export declare const isStable: Computed<boolean>; /** * Updates the viewport signal state saving it in the storage. * @param s - state updates. */ export declare function setState(s: Partial<State>): void; /** * Retrieves the viewport state from the storage. */ export declare function getStateFromStorage(): State | undefined; export declare const contentSafeAreaInsets: Computed<SafeAreaInsets>; export declare const contentSafeAreaInsetBottom: Computed<number>; export declare const contentSafeAreaInsetLeft: Computed<number>; export declare const contentSafeAreaInsetRight: Computed<number>; export declare const contentSafeAreaInsetTop: Computed<number>; export declare const safeAreaInsets: Computed<SafeAreaInsets>; export declare const safeAreaInsetBottom: Computed<number>; export declare const safeAreaInsetLeft: Computed<number>; export declare const safeAreaInsetRight: Computed<number>; export declare const safeAreaInsetTop: Computed<number>;