@tma.js/sdk 1.5.3 → 2.0.1
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/dist/dts/bridge/events/event-emitter/createMiniAppsEventEmitter.d.ts +15 -0
- package/dist/dts/bridge/events/event-emitter/singleton.d.ts +8 -0
- package/dist/dts/bridge/events/event-handlers/cleanupEventHandlers.d.ts +4 -0
- package/dist/dts/bridge/events/event-handlers/defineEventHandlers.d.ts +6 -0
- package/dist/dts/bridge/events/event-handlers/emitMiniAppsEvent.d.ts +9 -0
- package/dist/dts/bridge/events/{off.d.ts → listening/off.d.ts} +3 -2
- package/dist/dts/bridge/events/listening/on.d.ts +12 -0
- package/dist/dts/bridge/events/listening/subscribe.d.ts +9 -0
- package/dist/dts/bridge/events/listening/unsubscribe.d.ts +7 -0
- package/dist/dts/bridge/events/types.d.ts +294 -2
- package/dist/dts/bridge/methods/createPostEvent.d.ts +7 -4
- package/dist/dts/bridge/methods/postEvent.d.ts +24 -15
- package/dist/dts/bridge/methods/{custom-methods.d.ts → types/custom-methods.d.ts} +2 -1
- package/dist/dts/bridge/methods/types/index.d.ts +4 -0
- package/dist/dts/bridge/methods/{methods.d.ts → types/methods.d.ts} +70 -17
- package/dist/dts/{globals.d.ts → bridge/target-origin.d.ts} +0 -9
- package/dist/dts/bridge/{invokeCustomMethod.d.ts → utils/invokeCustomMethod.d.ts} +7 -2
- package/dist/dts/bridge/utils/request.d.ts +35 -0
- package/dist/dts/classes/State/State.d.ts +46 -0
- package/dist/dts/classes/State/types.d.ts +29 -0
- package/dist/dts/classes/WithStateUtils.d.ts +18 -0
- package/dist/dts/classes/WithSupports.d.ts +19 -0
- package/dist/dts/classes/WithSupportsAndStateUtils.d.ts +24 -0
- package/dist/dts/classes/WithSupportsAndTrackableState.d.ts +16 -0
- package/dist/dts/classes/WithTrackableState.d.ts +16 -0
- package/dist/dts/classnames/mergeClassNames.d.ts +2 -1
- package/dist/dts/colors/isRGB.d.ts +2 -1
- package/dist/dts/colors/isRGBShort.d.ts +2 -1
- package/dist/dts/colors/toRGB.d.ts +2 -1
- package/dist/dts/components/BackButton/BackButton.d.ts +41 -0
- package/dist/dts/components/BackButton/initBackButton.d.ts +7 -0
- package/dist/dts/components/BackButton/types.d.ts +25 -0
- package/dist/dts/components/BiometryManager/BiometryManager.d.ts +61 -0
- package/dist/dts/components/BiometryManager/formatEvent.d.ts +34 -0
- package/dist/dts/components/BiometryManager/initBiometryManager.d.ts +7 -0
- package/dist/dts/components/BiometryManager/requestBiometryInfo.d.ts +8 -0
- package/dist/dts/components/BiometryManager/types.d.ts +40 -0
- package/dist/dts/components/ClosingBehavior/ClosingBehavior.d.ts +26 -0
- package/dist/dts/components/ClosingBehavior/initClosingBehavior.d.ts +7 -0
- package/dist/dts/components/{closing-behavior → ClosingBehavior}/types.d.ts +14 -1
- package/dist/dts/components/{cloud-storage → CloudStorage}/CloudStorage.d.ts +11 -11
- package/dist/dts/components/CloudStorage/initCloudStorage.d.ts +7 -0
- package/dist/dts/components/{haptic-feedback → HapticFeedback}/HapticFeedback.d.ts +9 -13
- package/dist/dts/components/HapticFeedback/initHapticFeedback.d.ts +7 -0
- package/dist/dts/components/{init-data → InitData}/InitData.d.ts +4 -2
- package/dist/dts/components/InitData/initInitData.d.ts +7 -0
- package/dist/dts/components/{init-data → InitData}/parseInitData.d.ts +2 -1
- package/dist/dts/components/InitData/parsers/chat.d.ts +3 -0
- package/dist/dts/components/InitData/parsers/initData.d.ts +7 -0
- package/dist/dts/components/InitData/parsers/user.d.ts +3 -0
- package/dist/dts/components/{init-data → InitData}/types.d.ts +2 -3
- package/dist/dts/components/Invoice/Invoice.d.ts +31 -0
- package/dist/dts/components/Invoice/initInvoice.d.ts +7 -0
- package/dist/dts/components/{invoice → Invoice}/types.d.ts +14 -1
- package/dist/dts/components/MainButton/MainButton.d.ts +106 -0
- package/dist/dts/components/MainButton/initMainButton.d.ts +7 -0
- package/dist/dts/components/MainButton/types.d.ts +40 -0
- package/dist/dts/components/{mini-app → MiniApp}/MiniApp.d.ts +29 -43
- package/dist/dts/components/MiniApp/initMiniApp.d.ts +7 -0
- package/dist/dts/components/MiniApp/parsing/contact.d.ts +7 -0
- package/dist/dts/components/MiniApp/types.d.ts +53 -0
- package/dist/dts/components/Popup/Popup.d.ts +30 -0
- package/dist/dts/components/Popup/initPopup.d.ts +7 -0
- package/dist/dts/components/{popup → Popup}/preparePopupParams.d.ts +3 -2
- package/dist/dts/components/{popup → Popup}/types.d.ts +2 -1
- package/dist/dts/components/QRScanner/QRScanner.d.ts +28 -0
- package/dist/dts/components/QRScanner/initQRScanner.d.ts +7 -0
- package/dist/dts/components/{qr-scanner → QRScanner}/types.d.ts +14 -1
- package/dist/dts/components/SettingsButton/SettingsButton.d.ts +37 -0
- package/dist/dts/components/SettingsButton/initSettingsButton.d.ts +7 -0
- package/dist/dts/components/{settings-button → SettingsButton}/types.d.ts +18 -3
- package/dist/dts/components/ThemeParams/ThemeParams.d.ts +53 -0
- package/dist/dts/components/ThemeParams/initThemeParams.d.ts +7 -0
- package/dist/dts/components/ThemeParams/keys.d.ts +11 -0
- package/dist/dts/components/{theme-params → ThemeParams/parsing}/parseThemeParams.d.ts +2 -1
- package/dist/dts/components/{theme-params → ThemeParams/parsing}/serializeThemeParams.d.ts +2 -1
- package/dist/dts/components/ThemeParams/parsing/themeParams.d.ts +4 -0
- package/dist/dts/components/ThemeParams/requestThemeParams.d.ts +8 -0
- package/dist/dts/components/ThemeParams/types.d.ts +29 -0
- package/dist/dts/components/{utils → Utils}/Utils.d.ts +10 -12
- package/dist/dts/components/Utils/initUtils.d.ts +7 -0
- package/dist/dts/components/Viewport/Viewport.d.ts +77 -0
- package/dist/dts/components/Viewport/initViewport.d.ts +8 -0
- package/dist/dts/components/Viewport/initViewportFromRequest.d.ts +10 -0
- package/dist/dts/components/{viewport → Viewport}/requestViewport.d.ts +3 -2
- package/dist/dts/components/Viewport/types.d.ts +35 -0
- package/dist/dts/css-vars/bindMiniAppCSSVars.d.ts +29 -0
- package/dist/dts/css-vars/bindThemeParamsCSSVars.d.ts +29 -0
- package/dist/dts/css-vars/bindViewportCSSVars.d.ts +32 -0
- package/dist/dts/{css → css-vars}/setCSSVar.d.ts +1 -1
- package/dist/dts/debug/debug.d.ts +14 -0
- package/dist/dts/{bridge/env → env}/hasExternalNotify.d.ts +5 -7
- package/dist/dts/{bridge/env → env}/hasWebviewProxy.d.ts +5 -7
- package/dist/dts/env/initWeb.d.ts +11 -0
- package/dist/dts/env/isSSR.d.ts +4 -0
- package/dist/dts/{misc → env}/isTMA.d.ts +1 -1
- package/dist/dts/errors/SDKError.d.ts +9 -0
- package/dist/dts/errors/createError.d.ts +10 -0
- package/dist/dts/errors/errors.d.ts +53 -0
- package/dist/dts/errors/isSDKError.d.ts +7 -0
- package/dist/dts/errors/isSDKErrorOfType.d.ts +8 -0
- package/dist/dts/{event-emitter → events/event-emitter}/EventEmitter.d.ts +20 -30
- package/dist/dts/{event-emitter → events/event-emitter}/types.d.ts +10 -9
- package/dist/dts/events/onWindow.d.ts +10 -0
- package/dist/dts/events/types.d.ts +6 -0
- package/dist/dts/index.d.ts +114 -92
- package/dist/dts/index.low-level.d.ts +41 -0
- package/dist/dts/launch-params/parseLaunchParams.d.ts +2 -1
- package/dist/dts/launch-params/retrieveFromLocation.d.ts +2 -1
- package/dist/dts/launch-params/retrieveFromPerformance.d.ts +3 -3
- package/dist/dts/launch-params/{storage.d.ts → retrieveFromStorage.d.ts} +2 -6
- package/dist/dts/launch-params/retrieveFromUrl.d.ts +2 -1
- package/dist/dts/launch-params/retrieveLaunchParams.d.ts +2 -1
- package/dist/dts/launch-params/saveToStorage.d.ts +7 -0
- package/dist/dts/launch-params/serializeLaunchParams.d.ts +2 -1
- package/dist/dts/launch-params/types.d.ts +12 -13
- package/dist/dts/logger/Logger.d.ts +9 -18
- package/dist/dts/misc/createComponentInitFn/createComponentInitFn.d.ts +15 -0
- package/dist/dts/misc/createComponentInitFn/types.d.ts +47 -0
- package/dist/dts/misc/createSingleton.d.ts +15 -0
- package/dist/dts/misc/objectFromKeys.d.ts +6 -0
- package/dist/dts/navigation/BasicNavigator/BasicNavigator.d.ts +118 -0
- package/dist/dts/navigation/BasicNavigator/prepareItem.d.ts +8 -0
- package/dist/dts/navigation/BasicNavigator/types.d.ts +37 -0
- package/dist/dts/navigation/BrowserNavigator/BrowserNavigator.d.ts +198 -0
- package/dist/dts/navigation/BrowserNavigator/basicItemToBrowser.d.ts +7 -0
- package/dist/dts/navigation/BrowserNavigator/createBrowserNavigatorFromLocation.d.ts +4 -0
- package/dist/dts/navigation/BrowserNavigator/prepareItem.d.ts +25 -0
- package/dist/dts/navigation/BrowserNavigator/types.d.ts +63 -0
- package/dist/dts/navigation/createSafeURL.d.ts +7 -0
- package/dist/dts/navigation/getHash.d.ts +2 -1
- package/dist/dts/navigation/getPathname.d.ts +7 -0
- package/dist/dts/navigation/initNavigator.d.ts +9 -0
- package/dist/dts/navigation/urlToPath.d.ts +7 -0
- package/dist/dts/parsing/ArrayParser/ArrayParser.d.ts +17 -0
- package/dist/dts/parsing/ArrayParser/types.d.ts +12 -0
- package/dist/dts/parsing/ValueParser/ValueParser.d.ts +17 -0
- package/dist/dts/parsing/{ValueParser.d.ts → ValueParser/types.d.ts} +6 -14
- package/dist/dts/parsing/createTypeError.d.ts +6 -0
- package/dist/dts/parsing/createValueParserGenerator.d.ts +3 -2
- package/dist/dts/parsing/parseBySchema.d.ts +2 -1
- package/dist/dts/parsing/parsers/array.d.ts +3 -2
- package/dist/dts/parsing/parsers/boolean.d.ts +2 -1
- package/dist/dts/parsing/parsers/date.d.ts +2 -1
- package/dist/dts/parsing/parsers/json.d.ts +3 -2
- package/dist/dts/parsing/parsers/number.d.ts +2 -1
- package/dist/dts/parsing/parsers/rgb.d.ts +3 -2
- package/dist/dts/parsing/parsers/searchParams.d.ts +3 -2
- package/dist/dts/parsing/parsers/string.d.ts +2 -1
- package/dist/dts/{init/creators → request-id}/createRequestIdGenerator.d.ts +3 -2
- package/dist/dts/{types/request-id.d.ts → request-id/types.d.ts} +1 -1
- package/dist/dts/storage/storage.d.ts +42 -0
- package/dist/dts/supports/createSupportsFn.d.ts +12 -0
- package/dist/dts/supports/{createSupportsParamFunc.d.ts → createSupportsParamFn.d.ts} +5 -4
- package/dist/dts/supports/supports.d.ts +3 -2
- package/dist/dts/supports/types.d.ts +1 -1
- package/dist/dts/timeout/createTimeoutError.d.ts +7 -0
- package/dist/dts/timeout/sleep.d.ts +1 -1
- package/dist/dts/timeout/withTimeout.d.ts +1 -2
- package/dist/dts/types/index.d.ts +6 -0
- package/dist/dts/types/methods.d.ts +2 -1
- package/dist/dts/types/misc.d.ts +12 -0
- package/dist/dts/types/utils.d.ts +16 -0
- package/dist/dts/version/compareVersions.d.ts +2 -1
- package/dist/index.cjs +2 -1
- package/dist/index.cjs.map +1 -0
- package/dist/index.iife.js +2 -1
- package/dist/index.iife.js.map +1 -0
- package/dist/index.js +3001 -0
- package/dist/index.js.map +1 -0
- package/dist/index.low-level.iife.js +2 -0
- package/dist/index.low-level.iife.js.map +1 -0
- package/package.json +7 -9
- package/dist/dts/bridge/errors/MethodUnsupportedError.d.ts +0 -8
- package/dist/dts/bridge/errors/ParameterUnsupportedError.d.ts +0 -8
- package/dist/dts/bridge/events/createEmitter.d.ts +0 -6
- package/dist/dts/bridge/events/events.d.ts +0 -140
- package/dist/dts/bridge/events/on.d.ts +0 -9
- package/dist/dts/bridge/events/onTelegramEvent.d.ts +0 -7
- package/dist/dts/bridge/events/once.d.ts +0 -8
- package/dist/dts/bridge/events/parsers/clipboardTextReceived.d.ts +0 -13
- package/dist/dts/bridge/events/parsers/customMethodInvoked.d.ts +0 -16
- package/dist/dts/bridge/events/parsers/invoiceClosed.d.ts +0 -12
- package/dist/dts/bridge/events/parsers/phoneRequested.d.ts +0 -8
- package/dist/dts/bridge/events/parsers/popupClosed.d.ts +0 -8
- package/dist/dts/bridge/events/parsers/qrTextReceived.d.ts +0 -7
- package/dist/dts/bridge/events/parsers/theme-changed.d.ts +0 -42
- package/dist/dts/bridge/events/parsers/viewportChanged.d.ts +0 -19
- package/dist/dts/bridge/events/parsers/writeAccessRequested.d.ts +0 -8
- package/dist/dts/bridge/events/singletonEmitter.d.ts +0 -6
- package/dist/dts/bridge/events/subscribe.d.ts +0 -8
- package/dist/dts/bridge/events/unsubscribe.d.ts +0 -6
- package/dist/dts/bridge/request.d.ts +0 -54
- package/dist/dts/components/back-button/BackButton.d.ts +0 -47
- package/dist/dts/components/back-button/types.d.ts +0 -10
- package/dist/dts/components/closing-behavior/ClosingBehavior.d.ts +0 -39
- package/dist/dts/components/init-data/chatParser.d.ts +0 -6
- package/dist/dts/components/init-data/initDataParser.d.ts +0 -6
- package/dist/dts/components/init-data/userParser.d.ts +0 -6
- package/dist/dts/components/invoice/Invoice.d.ts +0 -47
- package/dist/dts/components/main-button/MainButton.d.ts +0 -104
- package/dist/dts/components/main-button/types.d.ts +0 -20
- package/dist/dts/components/mini-app/contactParser.d.ts +0 -2
- package/dist/dts/components/mini-app/types.d.ts +0 -32
- package/dist/dts/components/popup/Popup.d.ts +0 -48
- package/dist/dts/components/qr-scanner/QRScanner.d.ts +0 -44
- package/dist/dts/components/settings-button/SettingsButton.d.ts +0 -42
- package/dist/dts/components/theme-params/ThemeParams.d.ts +0 -66
- package/dist/dts/components/theme-params/keys.d.ts +0 -11
- package/dist/dts/components/theme-params/requestThemeParams.d.ts +0 -7
- package/dist/dts/components/theme-params/themeParamsParser.d.ts +0 -3
- package/dist/dts/components/theme-params/types.d.ts +0 -14
- package/dist/dts/components/viewport/Viewport.d.ts +0 -90
- package/dist/dts/components/viewport/isStableViewportPlatform.d.ts +0 -7
- package/dist/dts/components/viewport/types.d.ts +0 -18
- package/dist/dts/components/viewport/utils.d.ts +0 -5
- package/dist/dts/css/bindMiniAppCSSVars.d.ts +0 -16
- package/dist/dts/css/bindThemeCSSVars.d.ts +0 -12
- package/dist/dts/css/bindViewportCSSVars.d.ts +0 -20
- package/dist/dts/init/catchCustomStyles.d.ts +0 -4
- package/dist/dts/init/creators/createBackButton.d.ts +0 -10
- package/dist/dts/init/creators/createClosingBehavior.d.ts +0 -9
- package/dist/dts/init/creators/createMainButton.d.ts +0 -12
- package/dist/dts/init/creators/createMiniApp.d.ts +0 -16
- package/dist/dts/init/creators/createSettingsButton.d.ts +0 -10
- package/dist/dts/init/creators/createThemeParams.d.ts +0 -7
- package/dist/dts/init/creators/createViewport.d.ts +0 -11
- package/dist/dts/init/css/processCSSVarsOption.d.ts +0 -12
- package/dist/dts/init/init.d.ts +0 -9
- package/dist/dts/init/types.d.ts +0 -85
- package/dist/dts/launch-params/launchParamsParser.d.ts +0 -6
- package/dist/dts/launch-params/retrieveLaunchData.d.ts +0 -7
- package/dist/dts/navigation/HashNavigator/HashNavigator.d.ts +0 -46
- package/dist/dts/navigation/HashNavigator/types.d.ts +0 -33
- package/dist/dts/navigation/Navigator/Navigator.d.ts +0 -104
- package/dist/dts/navigation/Navigator/types.d.ts +0 -44
- package/dist/dts/parsing/ArrayValueParser.d.ts +0 -18
- package/dist/dts/parsing/ParseError.d.ts +0 -22
- package/dist/dts/parsing/ParseSchemaFieldError.d.ts +0 -17
- package/dist/dts/parsing/unexpectedTypeError.d.ts +0 -4
- package/dist/dts/state/State.d.ts +0 -28
- package/dist/dts/state/types.d.ts +0 -27
- package/dist/dts/storage.d.ts +0 -50
- package/dist/dts/supports/createSupportsFunc.d.ts +0 -10
- package/dist/dts/timeout/TimeoutError.d.ts +0 -3
- package/dist/dts/timeout/isTimeoutError.d.ts +0 -6
- package/dist/index.mjs +0 -2813
- /package/dist/dts/bridge/methods/{haptic.d.ts → types/haptic.d.ts} +0 -0
- /package/dist/dts/bridge/methods/{popup.d.ts → types/popup.d.ts} +0 -0
- /package/dist/dts/bridge/{captureSameReq.d.ts → utils/captureSameReq.d.ts} +0 -0
- /package/dist/dts/{misc → env}/isIframe.d.ts +0 -0
- /package/dist/dts/navigation/{HashNavigator/drop.d.ts → drop.d.ts} +0 -0
- /package/dist/dts/{misc → navigation}/getFirstNavigationEntry.d.ts +0 -0
- /package/dist/dts/navigation/{HashNavigator/go.d.ts → go.d.ts} +0 -0
- /package/dist/dts/{misc → navigation}/isPageReload.d.ts +0 -0
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import type { ThemeParamsEvents, ThemeParamsParsed } from './types.js';
|
|
2
|
-
import type { RemoveListenerFn } from '../../bridge/events/types.js';
|
|
3
|
-
import type { RGB } from '../../colors/types.js';
|
|
4
|
-
import { EventEmitter } from '../../event-emitter/EventEmitter.js';
|
|
5
|
-
type Emitter = EventEmitter<ThemeParamsEvents>;
|
|
6
|
-
export declare class ThemeParams {
|
|
7
|
-
private readonly ee;
|
|
8
|
-
private readonly state;
|
|
9
|
-
constructor(params: ThemeParamsParsed);
|
|
10
|
-
/**
|
|
11
|
-
* @since v6.10
|
|
12
|
-
*/
|
|
13
|
-
get accentTextColor(): RGB | undefined;
|
|
14
|
-
get backgroundColor(): RGB | undefined;
|
|
15
|
-
get buttonColor(): RGB | undefined;
|
|
16
|
-
get buttonTextColor(): RGB | undefined;
|
|
17
|
-
get destructiveTextColor(): RGB | undefined;
|
|
18
|
-
/**
|
|
19
|
-
* Retrieves palette color value by its name.
|
|
20
|
-
* @param key - palette key name.
|
|
21
|
-
*/
|
|
22
|
-
get(key: Extract<keyof ThemeParamsParsed, string>): RGB | undefined;
|
|
23
|
-
/**
|
|
24
|
-
* Returns the copy of the internal state of the current component instance.
|
|
25
|
-
*/
|
|
26
|
-
getState(): ThemeParamsParsed;
|
|
27
|
-
/**
|
|
28
|
-
* @since v6.10
|
|
29
|
-
*/
|
|
30
|
-
get headerBackgroundColor(): RGB | undefined;
|
|
31
|
-
get hintColor(): RGB | undefined;
|
|
32
|
-
/**
|
|
33
|
-
* Returns true in case, current color scheme is recognized as dark. This
|
|
34
|
-
* value is calculated according to theme background color.
|
|
35
|
-
*/
|
|
36
|
-
get isDark(): boolean;
|
|
37
|
-
get linkColor(): RGB | undefined;
|
|
38
|
-
/**
|
|
39
|
-
* Adds new event listener.
|
|
40
|
-
*/
|
|
41
|
-
on: Emitter['on'];
|
|
42
|
-
/**
|
|
43
|
-
* Removes event listener.
|
|
44
|
-
*/
|
|
45
|
-
off: Emitter['off'];
|
|
46
|
-
get secondaryBackgroundColor(): RGB | undefined;
|
|
47
|
-
/**
|
|
48
|
-
* @since v6.10
|
|
49
|
-
*/
|
|
50
|
-
get sectionBackgroundColor(): RGB | undefined;
|
|
51
|
-
/**
|
|
52
|
-
* @since v6.10
|
|
53
|
-
*/
|
|
54
|
-
get sectionHeaderTextColor(): RGB | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Starts listening to theme changes and applies them.
|
|
57
|
-
* @returns Function to stop listening.
|
|
58
|
-
*/
|
|
59
|
-
listen(): RemoveListenerFn;
|
|
60
|
-
/**
|
|
61
|
-
* @since v6.10
|
|
62
|
-
*/
|
|
63
|
-
get subtitleTextColor(): RGB | undefined;
|
|
64
|
-
get textColor(): RGB | undefined;
|
|
65
|
-
}
|
|
66
|
-
export {};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Converts palette key from Telegram application to representation used by the package.
|
|
3
|
-
* @param key - palette key.
|
|
4
|
-
*/
|
|
5
|
-
export declare function keyToLocal(key: string): string;
|
|
6
|
-
/**
|
|
7
|
-
* Converts palette key from local representation to representation sent from the Telegram
|
|
8
|
-
* application.
|
|
9
|
-
* @param key - palette key.
|
|
10
|
-
*/
|
|
11
|
-
export declare function keyToExternal(key: string): string;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { ThemeParamsParsed } from './types.js';
|
|
2
|
-
import type { RequestSimpleOptions } from '../../bridge/request.js';
|
|
3
|
-
/**
|
|
4
|
-
* Requests current theme parameters from the Telegram application.
|
|
5
|
-
* @param options - request options.
|
|
6
|
-
*/
|
|
7
|
-
export declare function requestThemeParams(options?: RequestSimpleOptions<'web_app_request_theme'>): Promise<ThemeParamsParsed>;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RGB } from '../../colors/types.js';
|
|
2
|
-
import type { StateEvents } from '../../state/types.js';
|
|
3
|
-
export type ThemeParamsKey = 'accentTextColor' | 'backgroundColor' | 'buttonColor' | 'buttonTextColor' | 'destructiveTextColor' | 'headerBackgroundColor' | 'hintColor' | 'linkColor' | 'secondaryBackgroundColor' | 'sectionBackgroundColor' | 'sectionHeaderTextColor' | 'subtitleTextColor' | 'textColor';
|
|
4
|
-
/**
|
|
5
|
-
* Application [theme parameters](https://docs.telegram-mini-apps.com/platform/theming).
|
|
6
|
-
* Defines palette used by the Telegram application.
|
|
7
|
-
*/
|
|
8
|
-
export interface ThemeParamsParsed {
|
|
9
|
-
[key: ThemeParamsKey | string]: RGB | undefined;
|
|
10
|
-
}
|
|
11
|
-
export type ThemeParamsState = ThemeParamsParsed;
|
|
12
|
-
export type ThemeParamsEvents = StateEvents<ThemeParamsState>;
|
|
13
|
-
export type ThemeParamsEventName = keyof ThemeParamsEvents;
|
|
14
|
-
export type ThemeParamsEventListener<E extends ThemeParamsEventName> = ThemeParamsEvents[E];
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import type { ViewportEvents, ViewportProps } from './types.js';
|
|
2
|
-
import type { RemoveListenerFn } from '../../bridge/events/types.js';
|
|
3
|
-
import type { RequestSimpleOptions } from '../../bridge/request.js';
|
|
4
|
-
import { EventEmitter } from '../../event-emitter/EventEmitter.js';
|
|
5
|
-
type Emitter = EventEmitter<ViewportEvents>;
|
|
6
|
-
/**
|
|
7
|
-
* Contains information about current WebApp device viewport, its dimensions
|
|
8
|
-
* and state.
|
|
9
|
-
*/
|
|
10
|
-
export declare class Viewport {
|
|
11
|
-
private readonly ee;
|
|
12
|
-
private readonly state;
|
|
13
|
-
private readonly postEvent;
|
|
14
|
-
constructor(props: ViewportProps);
|
|
15
|
-
/**
|
|
16
|
-
* Request viewport information from the Telegram application and updates current Viewport
|
|
17
|
-
* instance.
|
|
18
|
-
* @param options - options to request fresh data.
|
|
19
|
-
*/
|
|
20
|
-
sync(options?: RequestSimpleOptions<'web_app_request_viewport'>): Promise<void>;
|
|
21
|
-
/**
|
|
22
|
-
* The current height of the visible area of the Mini App.
|
|
23
|
-
*
|
|
24
|
-
* The application can display just the top part of the Mini App, with its
|
|
25
|
-
* lower part remaining outside the screen area. From this position, the
|
|
26
|
-
* user can "pull" the Mini App to its maximum height, while the bot can do
|
|
27
|
-
* the same by calling `expand` method. As the position of the Mini App
|
|
28
|
-
* changes, the current height value of the visible area will be updated
|
|
29
|
-
* in real time.
|
|
30
|
-
*
|
|
31
|
-
* Please note that the refresh rate of this value is not sufficient
|
|
32
|
-
* to smoothly follow the lower border of the window. It should not be
|
|
33
|
-
* used to pin interface elements to the bottom of the visible area. It's
|
|
34
|
-
* more appropriate to use the value of the `stableHeight`
|
|
35
|
-
* field for this purpose.
|
|
36
|
-
*/
|
|
37
|
-
get height(): number;
|
|
38
|
-
/**
|
|
39
|
-
* The height of the visible area of the Mini App in its last stable state.
|
|
40
|
-
*
|
|
41
|
-
* The application can display just the top part of the Mini App, with its
|
|
42
|
-
* lower part remaining outside the screen area. From this position,
|
|
43
|
-
* the user can "pull" the Mini App to its maximum height, while the bot can
|
|
44
|
-
* do the same by calling `expand` method.
|
|
45
|
-
*
|
|
46
|
-
* Unlike the value of `height`, the value of `stableHeight`
|
|
47
|
-
* does not change as the position of the Mini App changes with user
|
|
48
|
-
* gestures or during animations. The value of `stableHeight`
|
|
49
|
-
* will be updated after all gestures and animations are completed and
|
|
50
|
-
* the Mini App reaches its final size.
|
|
51
|
-
*/
|
|
52
|
-
get stableHeight(): number;
|
|
53
|
-
/**
|
|
54
|
-
* Starts listening to viewport changes and applies them.
|
|
55
|
-
* @returns Function to stop listening.
|
|
56
|
-
*/
|
|
57
|
-
listen(): RemoveListenerFn;
|
|
58
|
-
/**
|
|
59
|
-
* Returns true if the Mini App is expanded to the maximum available height.
|
|
60
|
-
* Otherwise, if the Mini App occupies part of the screen and can be expanded
|
|
61
|
-
* to the full height using `expand` method.
|
|
62
|
-
* @see expand
|
|
63
|
-
*/
|
|
64
|
-
get isExpanded(): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Current viewport width.
|
|
67
|
-
*/
|
|
68
|
-
get width(): number;
|
|
69
|
-
/**
|
|
70
|
-
* A method that expands the Mini App to the maximum available height. To
|
|
71
|
-
* find out if the Mini App is expanded to the maximum height, refer to the
|
|
72
|
-
* value of the `isExpanded`.
|
|
73
|
-
* @see isExpanded
|
|
74
|
-
*/
|
|
75
|
-
expand(): void;
|
|
76
|
-
/**
|
|
77
|
-
* Returns true in case current viewport height is stable and is not going to
|
|
78
|
-
* change in the next moment.
|
|
79
|
-
*/
|
|
80
|
-
get isStable(): boolean;
|
|
81
|
-
/**
|
|
82
|
-
* Adds new event listener.
|
|
83
|
-
*/
|
|
84
|
-
on: Emitter['on'];
|
|
85
|
-
/**
|
|
86
|
-
* Removes event listener.
|
|
87
|
-
*/
|
|
88
|
-
off: Emitter['off'];
|
|
89
|
-
}
|
|
90
|
-
export {};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Platform } from '../../types/platform.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns true if specified platform has stable viewport. Stable means not changing from time to
|
|
4
|
-
* time.
|
|
5
|
-
* @param platform - platform identifier.
|
|
6
|
-
*/
|
|
7
|
-
export declare function isStableViewportPlatform(platform: Platform): boolean;
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import type { StateEvents } from '../../state/types.js';
|
|
3
|
-
export interface ViewportProps {
|
|
4
|
-
height: number;
|
|
5
|
-
width: number;
|
|
6
|
-
stableHeight: number;
|
|
7
|
-
isExpanded: boolean;
|
|
8
|
-
postEvent?: PostEvent;
|
|
9
|
-
}
|
|
10
|
-
export interface ViewportState {
|
|
11
|
-
height: number;
|
|
12
|
-
isExpanded: boolean;
|
|
13
|
-
stableHeight: number;
|
|
14
|
-
width: number;
|
|
15
|
-
}
|
|
16
|
-
export type ViewportEvents = StateEvents<ViewportState>;
|
|
17
|
-
export type ViewportEventName = keyof ViewportEvents;
|
|
18
|
-
export type ViewportEventListener<E extends ViewportEventName> = ViewportEvents[E];
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { MiniApp } from '../components/mini-app/MiniApp.js';
|
|
2
|
-
import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates CSS variables connected with WebApp background and header colors based on
|
|
5
|
-
* passed WebApp and ThemeParams instances.
|
|
6
|
-
*
|
|
7
|
-
* Created variables:
|
|
8
|
-
* - `--tg-background-color`
|
|
9
|
-
* - `--tg-header-color`
|
|
10
|
-
*
|
|
11
|
-
* Variables are being automatically updated in case, corresponding properties are updating.
|
|
12
|
-
*
|
|
13
|
-
* @param miniApp - MiniApp instance.
|
|
14
|
-
* @param themeParams - ThemeParams instance.
|
|
15
|
-
*/
|
|
16
|
-
export declare function bindMiniAppCSSVars(miniApp: MiniApp, themeParams: ThemeParams): void;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
|
|
2
|
-
/**
|
|
3
|
-
* Creates CSS variables connected with theme parameters. Created CSS variables names are
|
|
4
|
-
* following the pattern "--tg-theme-{name}". {name} is a theme parameters key name converted
|
|
5
|
-
* from snake to kebab case.
|
|
6
|
-
*
|
|
7
|
-
* Variables are being automatically updated in case, corresponding properties
|
|
8
|
-
* updated in passed ThemeParams instance.
|
|
9
|
-
*
|
|
10
|
-
* @param themeParams - ThemeParams instance.
|
|
11
|
-
*/
|
|
12
|
-
export declare function bindThemeCSSVars(themeParams: ThemeParams): void;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { Viewport } from '../components/viewport/Viewport.js';
|
|
2
|
-
/**
|
|
3
|
-
* Accepts Viewport instance and sets CSS variables connected with viewport
|
|
4
|
-
* sizes.
|
|
5
|
-
*
|
|
6
|
-
* Be careful using this function as long as it can impact application
|
|
7
|
-
* performance. Viewport size is changing rather often, this makes CSS
|
|
8
|
-
* variables update, which leads to possible layout redraw.
|
|
9
|
-
*
|
|
10
|
-
* Variables:
|
|
11
|
-
* - `--tg-viewport-height`
|
|
12
|
-
* - `--tg-viewport-width`
|
|
13
|
-
* - `--tg-viewport-stable-height`
|
|
14
|
-
*
|
|
15
|
-
* Variables are being automatically updated in case, corresponding properties
|
|
16
|
-
* updated in passed Viewport instance.
|
|
17
|
-
*
|
|
18
|
-
* @param viewport - Viewport instance.
|
|
19
|
-
*/
|
|
20
|
-
export declare function bindViewportCSSVars(viewport: Viewport): void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import { BackButton } from '../../components/back-button/BackButton.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates BackButton instance using last locally saved data also saving each state in
|
|
5
|
-
* the storage.
|
|
6
|
-
* @param isPageReload - was current page reloaded.
|
|
7
|
-
* @param version - platform version.
|
|
8
|
-
* @param postEvent - Bridge postEvent function
|
|
9
|
-
*/
|
|
10
|
-
export declare function createBackButton(isPageReload: boolean, version: string, postEvent: PostEvent): BackButton;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import { ClosingBehavior } from '../../components/closing-behavior/ClosingBehavior.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates ClosingBehaviour instance using last locally saved data also saving each state in
|
|
5
|
-
* the storage.
|
|
6
|
-
* @param isPageReload - was current page reloaded.
|
|
7
|
-
* @param postEvent - Bridge postEvent function
|
|
8
|
-
*/
|
|
9
|
-
export declare function createClosingBehavior(isPageReload: boolean, postEvent: PostEvent): ClosingBehavior;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import type { RGB } from '../../colors/types.js';
|
|
3
|
-
import { MainButton } from '../../components/main-button/MainButton.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates MainButton instance using last locally saved data also saving each state in
|
|
6
|
-
* the storage.
|
|
7
|
-
* @param isPageReload - was current page reloaded.
|
|
8
|
-
* @param backgroundColor - background color.
|
|
9
|
-
* @param textColor - text color.
|
|
10
|
-
* @param postEvent - Bridge postEvent function
|
|
11
|
-
*/
|
|
12
|
-
export declare function createMainButton(isPageReload: boolean, backgroundColor: RGB, textColor: RGB, postEvent: PostEvent): MainButton;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import type { RGB } from '../../colors/types.js';
|
|
3
|
-
import { MiniApp } from '../../components/mini-app/MiniApp.js';
|
|
4
|
-
import type { CreateRequestIdFunc } from '../../types/request-id.js';
|
|
5
|
-
import type { Version } from '../../version/types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Creates MiniApp instance using last locally saved data also saving each state in
|
|
8
|
-
* the storage.
|
|
9
|
-
* @param isPageReload - was current page reloaded.
|
|
10
|
-
* @param backgroundColor - web app background color.
|
|
11
|
-
* @param version - platform version.
|
|
12
|
-
* @param botInline - is Mini App launched in inline mode.
|
|
13
|
-
* @param createRequestId - function which generates request identifiers.
|
|
14
|
-
* @param postEvent - Bridge postEvent function
|
|
15
|
-
*/
|
|
16
|
-
export declare function createMiniApp(isPageReload: boolean, backgroundColor: RGB, version: Version, botInline: boolean, createRequestId: CreateRequestIdFunc, postEvent: PostEvent): MiniApp;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import { SettingsButton } from '../../components/settings-button/SettingsButton.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates SettingsButton instance using last locally saved data also saving each state in
|
|
5
|
-
* the storage.
|
|
6
|
-
* @param isPageReload - was current page reloaded.
|
|
7
|
-
* @param version - platform version.
|
|
8
|
-
* @param postEvent - Bridge postEvent function
|
|
9
|
-
*/
|
|
10
|
-
export declare function createSettingsButton(isPageReload: boolean, version: string, postEvent: PostEvent): SettingsButton;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { ThemeParams } from '../../components/theme-params/ThemeParams.js';
|
|
2
|
-
import type { ThemeParamsParsed } from '../../components/theme-params/types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates synced instance of ThemeParams.
|
|
5
|
-
* @param params - theme parameters.
|
|
6
|
-
*/
|
|
7
|
-
export declare function createThemeParams(params: ThemeParamsParsed): ThemeParams;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../../bridge/methods/postEvent.js';
|
|
2
|
-
import { Viewport } from '../../components/viewport/Viewport.js';
|
|
3
|
-
import type { Platform } from '../../types/platform.js';
|
|
4
|
-
/**
|
|
5
|
-
* Creates Viewport instance using its actual state from the Telegram application.
|
|
6
|
-
* @param isPageReload - was page reloaded.
|
|
7
|
-
* @param platform - platform identifier.
|
|
8
|
-
* @param postEvent - Bridge postEvent function.
|
|
9
|
-
* @param complete - is initialization complete.
|
|
10
|
-
*/
|
|
11
|
-
export declare function createViewport(isPageReload: boolean, platform: Platform, postEvent: PostEvent, complete: boolean): Viewport | Promise<Viewport>;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { MiniApp } from '../../components/mini-app/MiniApp.js';
|
|
2
|
-
import type { ThemeParams } from '../../components/theme-params/ThemeParams.js';
|
|
3
|
-
import type { Viewport } from '../../components/viewport/Viewport.js';
|
|
4
|
-
import type { InitCSSVarsOption } from '../types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Process initialization CSS vars option.
|
|
7
|
-
* @param option - option value.
|
|
8
|
-
* @param miniApp - MiniApp instance.
|
|
9
|
-
* @param themeParams - ThemeParams instance.
|
|
10
|
-
* @param viewportOrPromise - Viewport instance or promise resolving it.
|
|
11
|
-
*/
|
|
12
|
-
export declare function processCSSVars(option: InitCSSVarsOption, miniApp: MiniApp, themeParams: ThemeParams, viewportOrPromise: Viewport | Promise<Viewport>): void;
|
package/dist/dts/init/init.d.ts
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { InitOptions, InitResult } from './types.js';
|
|
2
|
-
type ComputedInitResult<O> = O extends {
|
|
3
|
-
async: true;
|
|
4
|
-
} | {
|
|
5
|
-
complete: true;
|
|
6
|
-
} ? Promise<InitResult> : InitResult;
|
|
7
|
-
export declare function init(): InitResult;
|
|
8
|
-
export declare function init<O extends InitOptions>(options: O): ComputedInitResult<O>;
|
|
9
|
-
export {};
|
package/dist/dts/init/types.d.ts
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import type { PostEvent } from '../bridge/methods/postEvent.js';
|
|
2
|
-
import type { BackButton } from '../components/back-button/BackButton.js';
|
|
3
|
-
import type { ClosingBehavior } from '../components/closing-behavior/ClosingBehavior.js';
|
|
4
|
-
import type { CloudStorage } from '../components/cloud-storage/CloudStorage.js';
|
|
5
|
-
import type { HapticFeedback } from '../components/haptic-feedback/HapticFeedback.js';
|
|
6
|
-
import type { InitData } from '../components/init-data/InitData.js';
|
|
7
|
-
import type { Invoice } from '../components/invoice/Invoice.js';
|
|
8
|
-
import type { MainButton } from '../components/main-button/MainButton.js';
|
|
9
|
-
import type { MiniApp } from '../components/mini-app/MiniApp.js';
|
|
10
|
-
import type { Popup } from '../components/popup/Popup.js';
|
|
11
|
-
import type { QRScanner } from '../components/qr-scanner/QRScanner.js';
|
|
12
|
-
import type { SettingsButton } from '../components/settings-button/SettingsButton.js';
|
|
13
|
-
import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
|
|
14
|
-
import type { Utils } from '../components/utils/Utils.js';
|
|
15
|
-
import type { Viewport } from '../components/viewport/Viewport.js';
|
|
16
|
-
import type { CreateRequestIdFunc } from '../types/request-id.js';
|
|
17
|
-
export interface InitResult {
|
|
18
|
-
backButton: BackButton;
|
|
19
|
-
closingBehavior: ClosingBehavior;
|
|
20
|
-
cloudStorage: CloudStorage;
|
|
21
|
-
createRequestId: CreateRequestIdFunc;
|
|
22
|
-
hapticFeedback: HapticFeedback;
|
|
23
|
-
initData?: InitData;
|
|
24
|
-
initDataRaw?: string;
|
|
25
|
-
invoice: Invoice;
|
|
26
|
-
mainButton: MainButton;
|
|
27
|
-
miniApp: MiniApp;
|
|
28
|
-
popup: Popup;
|
|
29
|
-
postEvent: PostEvent;
|
|
30
|
-
qrScanner: QRScanner;
|
|
31
|
-
settingsButton: SettingsButton;
|
|
32
|
-
themeParams: ThemeParams;
|
|
33
|
-
utils: Utils;
|
|
34
|
-
viewport: Viewport;
|
|
35
|
-
}
|
|
36
|
-
export interface InitCSSVarsSpecificOption {
|
|
37
|
-
/**
|
|
38
|
-
* Enables theme parameters CSS variables.
|
|
39
|
-
* @see bindThemeCSSVars
|
|
40
|
-
* @default false
|
|
41
|
-
*/
|
|
42
|
-
themeParams?: boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Enables viewport CSS variables.
|
|
45
|
-
* @see bindViewportCSSVars
|
|
46
|
-
* @default false
|
|
47
|
-
*/
|
|
48
|
-
viewport?: boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Enables mini app CSS variables.
|
|
51
|
-
* @see bindMiniAppCSSVars
|
|
52
|
-
* @default false
|
|
53
|
-
*/
|
|
54
|
-
miniApp?: boolean;
|
|
55
|
-
}
|
|
56
|
-
export type InitCSSVarsOption = boolean | InitCSSVarsSpecificOption;
|
|
57
|
-
export interface InitOptions {
|
|
58
|
-
/**
|
|
59
|
-
* @deprecated This option name was considered inappropriate. Use `complete` instead.
|
|
60
|
-
*/
|
|
61
|
-
async?: boolean;
|
|
62
|
-
/**
|
|
63
|
-
* True if SDK should accept styles sent from the Telegram web application. This option is only
|
|
64
|
-
* used in web versions of Telegram.
|
|
65
|
-
* @default false
|
|
66
|
-
*/
|
|
67
|
-
acceptCustomStyles?: boolean;
|
|
68
|
-
/**
|
|
69
|
-
* Should SDK create global CSS variables related to current Telegram application colors.
|
|
70
|
-
*
|
|
71
|
-
* Possible values:
|
|
72
|
-
* - `false` - no CSS variables will be created.
|
|
73
|
-
* - `true` - all CSS variables will be created.
|
|
74
|
-
* - object - applies specific CSS variables.
|
|
75
|
-
*
|
|
76
|
-
* @default false
|
|
77
|
-
*/
|
|
78
|
-
cssVars?: InitCSSVarsOption;
|
|
79
|
-
/**
|
|
80
|
-
* True if initialization must be performed completely. This includes retrieving some components
|
|
81
|
-
* state from the Telegram application, and as a result, this makes initialization asynchronous.
|
|
82
|
-
* @default false
|
|
83
|
-
*/
|
|
84
|
-
complete?: boolean;
|
|
85
|
-
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { LaunchData } from './types.js';
|
|
2
|
-
/**
|
|
3
|
-
* Returns launch data information. Function ignores passed options in case, it was already
|
|
4
|
-
* called. It caches the last returned value.
|
|
5
|
-
* @deprecated Use `retrieveLaunchParams` and `isPageReload` functions separately where required.
|
|
6
|
-
*/
|
|
7
|
-
export declare function retrieveLaunchData(): LaunchData;
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { HashNavigatorEventsMap, HashNavigatorOptions } from './types.js';
|
|
2
|
-
import { EventEmitter } from '../../event-emitter/EventEmitter.js';
|
|
3
|
-
import { Navigator } from '../Navigator/Navigator.js';
|
|
4
|
-
import type { NavigatorConEntry, PerformGoOptions, PerformPushOptions, PerformReplaceOptions } from '../Navigator/types.js';
|
|
5
|
-
type HashNavigatorEventEmitter = EventEmitter<HashNavigatorEventsMap>;
|
|
6
|
-
export declare class HashNavigator extends Navigator<Promise<void>> {
|
|
7
|
-
/**
|
|
8
|
-
* Creates navigator from current window location hash.
|
|
9
|
-
* @param options - options passed to constructor.
|
|
10
|
-
*/
|
|
11
|
-
static fromLocation(options?: HashNavigatorOptions): HashNavigator;
|
|
12
|
-
private readonly ee;
|
|
13
|
-
private attached;
|
|
14
|
-
constructor(entries: NavigatorConEntry[], entriesCursor: number, options?: HashNavigatorOptions);
|
|
15
|
-
/**
|
|
16
|
-
* Handles window "popstate" event.
|
|
17
|
-
* @param state - event state.
|
|
18
|
-
*/
|
|
19
|
-
private onPopState;
|
|
20
|
-
protected performGo(options: PerformGoOptions): Promise<void>;
|
|
21
|
-
protected performPush({ before, after }: PerformPushOptions): Promise<void>;
|
|
22
|
-
protected performReplace(options: PerformReplaceOptions): Promise<void>;
|
|
23
|
-
/**
|
|
24
|
-
* Synchronizes current navigator state with browser history.
|
|
25
|
-
*/
|
|
26
|
-
private syncHistory;
|
|
27
|
-
private emitChanged;
|
|
28
|
-
/**
|
|
29
|
-
* Attaches current navigator to the browser history allowing navigator to manipulate it.
|
|
30
|
-
*/
|
|
31
|
-
attach(): Promise<void>;
|
|
32
|
-
back: () => Promise<void>;
|
|
33
|
-
/**
|
|
34
|
-
* Detaches current navigator from the browser history.
|
|
35
|
-
*/
|
|
36
|
-
detach(): void;
|
|
37
|
-
/**
|
|
38
|
-
* Adds new event listener.
|
|
39
|
-
*/
|
|
40
|
-
on: HashNavigatorEventEmitter['on'];
|
|
41
|
-
/**
|
|
42
|
-
* Removes event listener.
|
|
43
|
-
*/
|
|
44
|
-
off: HashNavigatorEventEmitter['off'];
|
|
45
|
-
}
|
|
46
|
-
export {};
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import type { HashNavigator } from './HashNavigator.js';
|
|
2
|
-
import type { NavigationEntry, NavigatorOptions } from '../Navigator/types.js';
|
|
3
|
-
export type HashNavigatorOptions = Omit<NavigatorOptions, 'loggerPrefix'>;
|
|
4
|
-
interface ChangeEventPayload {
|
|
5
|
-
/**
|
|
6
|
-
* Navigator instance.
|
|
7
|
-
*/
|
|
8
|
-
navigator: HashNavigator;
|
|
9
|
-
/**
|
|
10
|
-
* Previous navigation state.
|
|
11
|
-
*/
|
|
12
|
-
from: NavigationEntry;
|
|
13
|
-
/**
|
|
14
|
-
* Current navigation state.
|
|
15
|
-
*/
|
|
16
|
-
to: NavigationEntry;
|
|
17
|
-
}
|
|
18
|
-
export interface HashNavigatorEventsMap {
|
|
19
|
-
/**
|
|
20
|
-
* Being called whenever current history changes.
|
|
21
|
-
* @param event - generated event.
|
|
22
|
-
*/
|
|
23
|
-
change: (event: ChangeEventPayload) => void;
|
|
24
|
-
}
|
|
25
|
-
/**
|
|
26
|
-
* Navigator event name.
|
|
27
|
-
*/
|
|
28
|
-
export type HashNavigatorEventName = keyof HashNavigatorEventsMap;
|
|
29
|
-
/**
|
|
30
|
-
* Navigator event listener.
|
|
31
|
-
*/
|
|
32
|
-
export type HashNavigatorEventListener<E extends HashNavigatorEventName> = HashNavigatorEventsMap[E];
|
|
33
|
-
export {};
|