@tma.js/sdk 1.4.8 → 1.4.9

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.
Files changed (149) hide show
  1. package/dist/dts/bridge/errors/MethodUnsupportedError.d.ts +2 -2
  2. package/dist/dts/bridge/errors/ParameterUnsupportedError.d.ts +2 -2
  3. package/dist/dts/bridge/events/events.d.ts +13 -3
  4. package/dist/dts/bridge/events/on.d.ts +5 -3
  5. package/dist/dts/bridge/events/parsers/clipboardTextReceived.d.ts +2 -2
  6. package/dist/dts/bridge/events/parsers/customMethodInvoked.d.ts +2 -2
  7. package/dist/dts/bridge/events/parsers/invoiceClosed.d.ts +1 -1
  8. package/dist/dts/bridge/events/parsers/phoneRequested.d.ts +1 -1
  9. package/dist/dts/bridge/events/parsers/popupClosed.d.ts +1 -1
  10. package/dist/dts/bridge/events/parsers/qrTextReceived.d.ts +1 -1
  11. package/dist/dts/bridge/events/parsers/theme-changed.d.ts +2 -2
  12. package/dist/dts/bridge/events/parsers/viewportChanged.d.ts +1 -1
  13. package/dist/dts/bridge/events/parsers/writeAccessRequested.d.ts +1 -1
  14. package/dist/dts/bridge/events/singletonEmitter.d.ts +1 -1
  15. package/dist/dts/bridge/invokeCustomMethod.d.ts +2 -2
  16. package/dist/dts/bridge/methods/createPostEvent.d.ts +1 -1
  17. package/dist/dts/bridge/methods/custom-methods.d.ts +1 -1
  18. package/dist/dts/bridge/methods/methods.d.ts +5 -2
  19. package/dist/dts/bridge/request.d.ts +5 -3
  20. package/dist/dts/classnames/mergeClassNames.d.ts +2 -18
  21. package/dist/dts/{back-button → components/back-button}/BackButton.d.ts +4 -4
  22. package/dist/dts/{back-button → components/back-button}/types.d.ts +2 -2
  23. package/dist/dts/{closing-behavior → components/closing-behavior}/ClosingBehavior.d.ts +6 -3
  24. package/dist/dts/{closing-behavior → components/closing-behavior}/types.d.ts +1 -1
  25. package/dist/dts/{cloud-storage → components/cloud-storage}/CloudStorage.d.ts +5 -4
  26. package/dist/dts/{haptic-feedback → components/haptic-feedback}/HapticFeedback.d.ts +4 -3
  27. package/dist/dts/components/init-data/chatParser.d.ts +6 -0
  28. package/dist/dts/components/init-data/initDataParser.d.ts +6 -0
  29. package/dist/dts/components/init-data/userParser.d.ts +6 -0
  30. package/dist/dts/{invoice → components/invoice}/Invoice.d.ts +9 -5
  31. package/dist/dts/{invoice → components/invoice}/types.d.ts +1 -1
  32. package/dist/dts/{main-button → components/main-button}/MainButton.d.ts +2 -2
  33. package/dist/dts/{main-button → components/main-button}/types.d.ts +3 -3
  34. package/dist/dts/{mini-app → components/mini-app}/MiniApp.d.ts +11 -6
  35. package/dist/dts/components/mini-app/contactParser.d.ts +2 -0
  36. package/dist/dts/{mini-app → components/mini-app}/types.d.ts +6 -5
  37. package/dist/dts/{popup → components/popup}/Popup.d.ts +8 -5
  38. package/dist/dts/{popup → components/popup}/preparePopupParams.d.ts +1 -1
  39. package/dist/dts/{popup → components/popup}/types.d.ts +1 -1
  40. package/dist/dts/{qr-scanner → components/qr-scanner}/QRScanner.d.ts +8 -5
  41. package/dist/dts/{qr-scanner → components/qr-scanner}/types.d.ts +1 -1
  42. package/dist/dts/{settings-button → components/settings-button}/SettingsButton.d.ts +4 -4
  43. package/dist/dts/{settings-button → components/settings-button}/types.d.ts +2 -2
  44. package/dist/dts/{theme-params → components/theme-params}/ThemeParams.d.ts +8 -4
  45. package/dist/dts/{theme-params → components/theme-params}/requestThemeParams.d.ts +1 -1
  46. package/dist/dts/components/theme-params/themeParamsParser.d.ts +3 -0
  47. package/dist/dts/{theme-params → components/theme-params}/types.d.ts +2 -2
  48. package/dist/dts/{utils → components/utils}/Utils.d.ts +4 -4
  49. package/dist/dts/{viewport → components/viewport}/Viewport.d.ts +8 -4
  50. package/dist/dts/{viewport → components/viewport}/isStableViewportPlatform.d.ts +1 -1
  51. package/dist/dts/{viewport → components/viewport}/requestViewport.d.ts +1 -1
  52. package/dist/dts/{viewport → components/viewport}/types.d.ts +2 -2
  53. package/dist/dts/css/bindMiniAppCSSVars.d.ts +2 -2
  54. package/dist/dts/css/bindThemeCSSVars.d.ts +1 -1
  55. package/dist/dts/css/bindViewportCSSVars.d.ts +1 -1
  56. package/dist/dts/event-emitter/types.d.ts +1 -1
  57. package/dist/dts/globals.d.ts +1 -1
  58. package/dist/dts/index.d.ts +142 -27
  59. package/dist/dts/init/creators/createBackButton.d.ts +2 -2
  60. package/dist/dts/init/creators/createClosingBehavior.d.ts +2 -2
  61. package/dist/dts/init/creators/createMainButton.d.ts +3 -3
  62. package/dist/dts/init/creators/createMiniApp.d.ts +5 -5
  63. package/dist/dts/init/creators/createRequestIdGenerator.d.ts +1 -1
  64. package/dist/dts/init/creators/createSettingsButton.d.ts +2 -2
  65. package/dist/dts/init/creators/createThemeParams.d.ts +2 -1
  66. package/dist/dts/init/creators/createViewport.d.ts +3 -3
  67. package/dist/dts/init/css/processCSSVarsOption.d.ts +3 -3
  68. package/dist/dts/init/types.d.ts +16 -16
  69. package/dist/dts/launch-params/launchParamsParser.d.ts +2 -1
  70. package/dist/dts/launch-params/types.d.ts +3 -3
  71. package/dist/dts/navigation/HashNavigator/HashNavigator.d.ts +6 -3
  72. package/dist/dts/navigation/HashNavigator/types.d.ts +1 -2
  73. package/dist/dts/navigation/Navigator/Navigator.d.ts +1 -1
  74. package/dist/dts/parsing/ValueParser.d.ts +1 -1
  75. package/dist/dts/parsing/parsers/array.d.ts +2 -2
  76. package/dist/dts/parsing/parsers/boolean.d.ts +2 -1
  77. package/dist/dts/parsing/parsers/date.d.ts +2 -1
  78. package/dist/dts/parsing/parsers/number.d.ts +2 -1
  79. package/dist/dts/parsing/parsers/rgb.d.ts +3 -1
  80. package/dist/dts/parsing/parsers/string.d.ts +2 -1
  81. package/dist/dts/state/State.d.ts +2 -2
  82. package/dist/dts/state/types.d.ts +1 -1
  83. package/dist/dts/storage.d.ts +2 -2
  84. package/dist/dts/supports/createSupportsFunc.d.ts +2 -2
  85. package/dist/dts/supports/createSupportsParamFunc.d.ts +2 -2
  86. package/dist/dts/supports/supports.d.ts +2 -2
  87. package/dist/dts/supports/types.d.ts +3 -0
  88. package/dist/dts/types/logical.d.ts +16 -0
  89. package/dist/dts/types/methods.d.ts +1 -1
  90. package/dist/dts/types/unions.d.ts +20 -0
  91. package/dist/dts/types/utils.d.ts +0 -28
  92. package/dist/dts/version/compareVersions.d.ts +2 -1
  93. package/dist/dts/version/types.d.ts +1 -0
  94. package/dist/index.cjs +1 -1
  95. package/dist/index.iife.js +1 -1
  96. package/dist/index.mjs +1527 -1527
  97. package/package.json +1 -1
  98. package/dist/dts/back-button/index.d.ts +0 -2
  99. package/dist/dts/bridge/env/index.d.ts +0 -2
  100. package/dist/dts/bridge/errors/index.d.ts +0 -2
  101. package/dist/dts/bridge/events/index.d.ts +0 -9
  102. package/dist/dts/bridge/events/parsers/index.d.ts +0 -9
  103. package/dist/dts/bridge/index.d.ts +0 -7
  104. package/dist/dts/bridge/methods/index.d.ts +0 -6
  105. package/dist/dts/classnames/index.d.ts +0 -2
  106. package/dist/dts/closing-behavior/index.d.ts +0 -2
  107. package/dist/dts/cloud-storage/index.d.ts +0 -1
  108. package/dist/dts/colors/index.d.ts +0 -5
  109. package/dist/dts/css/index.d.ts +0 -4
  110. package/dist/dts/event-emitter/index.d.ts +0 -2
  111. package/dist/dts/haptic-feedback/index.d.ts +0 -1
  112. package/dist/dts/init/creators/index.d.ts +0 -8
  113. package/dist/dts/init/css/index.d.ts +0 -1
  114. package/dist/dts/init/index.d.ts +0 -2
  115. package/dist/dts/init-data/chatParser.d.ts +0 -5
  116. package/dist/dts/init-data/index.d.ts +0 -6
  117. package/dist/dts/init-data/initDataParser.d.ts +0 -5
  118. package/dist/dts/init-data/userParser.d.ts +0 -5
  119. package/dist/dts/invoice/index.d.ts +0 -2
  120. package/dist/dts/launch-params/index.d.ts +0 -10
  121. package/dist/dts/logger/index.d.ts +0 -1
  122. package/dist/dts/main-button/index.d.ts +0 -2
  123. package/dist/dts/mini-app/contactParser.d.ts +0 -2
  124. package/dist/dts/mini-app/index.d.ts +0 -2
  125. package/dist/dts/misc/index.d.ts +0 -5
  126. package/dist/dts/navigation/HashNavigator/index.d.ts +0 -2
  127. package/dist/dts/navigation/Navigator/index.d.ts +0 -2
  128. package/dist/dts/navigation/index.d.ts +0 -4
  129. package/dist/dts/parsing/index.d.ts +0 -10
  130. package/dist/dts/parsing/parsers/index.d.ts +0 -8
  131. package/dist/dts/popup/index.d.ts +0 -2
  132. package/dist/dts/qr-scanner/index.d.ts +0 -2
  133. package/dist/dts/settings-button/index.d.ts +0 -2
  134. package/dist/dts/state/index.d.ts +0 -2
  135. package/dist/dts/supports/index.d.ts +0 -4
  136. package/dist/dts/theme-params/index.d.ts +0 -6
  137. package/dist/dts/theme-params/themeParamsParser.d.ts +0 -2
  138. package/dist/dts/timeout/index.d.ts +0 -4
  139. package/dist/dts/types/index.d.ts +0 -4
  140. package/dist/dts/utils/index.d.ts +0 -1
  141. package/dist/dts/version/index.d.ts +0 -2
  142. package/dist/dts/viewport/index.d.ts +0 -4
  143. /package/dist/dts/{init-data → components/init-data}/InitData.d.ts +0 -0
  144. /package/dist/dts/{init-data → components/init-data}/parseInitData.d.ts +0 -0
  145. /package/dist/dts/{init-data → components/init-data}/types.d.ts +0 -0
  146. /package/dist/dts/{theme-params → components/theme-params}/keys.d.ts +0 -0
  147. /package/dist/dts/{theme-params → components/theme-params}/parseThemeParams.d.ts +0 -0
  148. /package/dist/dts/{theme-params → components/theme-params}/serializeThemeParams.d.ts +0 -0
  149. /package/dist/dts/{viewport → components/viewport}/utils.d.ts +0 -0
@@ -1,5 +1,5 @@
1
- import type { RGB } from '../colors/index.js';
2
- import type { StateEvents } from '../state/index.js';
1
+ import type { RGB } from '../../colors/types.js';
2
+ import type { StateEvents } from '../../state/types.js';
3
3
  export type ThemeParamsKey = 'accentTextColor' | 'backgroundColor' | 'buttonColor' | 'buttonTextColor' | 'destructiveTextColor' | 'headerBackgroundColor' | 'hintColor' | 'linkColor' | 'secondaryBackgroundColor' | 'sectionBackgroundColor' | 'sectionHeaderTextColor' | 'subtitleTextColor' | 'textColor';
4
4
  /**
5
5
  * Application [theme parameters](https://docs.telegram-mini-apps.com/platform/theming).
@@ -1,7 +1,7 @@
1
- import { type PostEvent } from '../bridge/index.js';
2
- import { type SupportsFunc } from '../supports/index.js';
3
- import type { CreateRequestIdFunc } from '../types/index.js';
4
- import type { Version } from '../version/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { SupportsFunc } from '../../supports/types.js';
3
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
4
+ import type { Version } from '../../version/types.js';
5
5
  /**
6
6
  * Provides common Mini Apps functionality not covered by other system components.
7
7
  */
@@ -1,5 +1,8 @@
1
- import { type RequestOptions } from '../bridge/index.js';
2
1
  import type { ViewportEvents, ViewportProps } from './types.js';
2
+ import type { RemoveListenerFn } from '../../bridge/events/on.js';
3
+ import type { RequestOptions } from '../../bridge/request.js';
4
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
5
+ type Emitter = EventEmitter<ViewportEvents>;
3
6
  /**
4
7
  * Contains information about current WebApp device viewport, its dimensions
5
8
  * and state.
@@ -51,7 +54,7 @@ export declare class Viewport {
51
54
  * Starts listening to viewport changes and applies them.
52
55
  * @returns Function to stop listening.
53
56
  */
54
- listen(): () => void;
57
+ listen(): RemoveListenerFn;
55
58
  /**
56
59
  * Returns true if the Mini App is expanded to the maximum available height.
57
60
  * Otherwise, if the Mini App occupies part of the screen and can be expanded
@@ -78,9 +81,10 @@ export declare class Viewport {
78
81
  /**
79
82
  * Adds new event listener.
80
83
  */
81
- on: <E extends "change" | "change:height" | "change:width" | "change:isExpanded" | "change:stableHeight">(event: E, listener: import('../event-emitter/index.js').EventListener<ViewportEvents[E]>) => import('../event-emitter/index.js').RemoveEventListener;
84
+ on: Emitter['on'];
82
85
  /**
83
86
  * Removes event listener.
84
87
  */
85
- off: <E extends "change" | "change:height" | "change:width" | "change:isExpanded" | "change:stableHeight">(event: E, listener: import('../event-emitter/index.js').EventListener<ViewportEvents[E]>) => void;
88
+ off: Emitter['off'];
86
89
  }
90
+ export {};
@@ -1,4 +1,4 @@
1
- import type { Platform } from '../types/index.js';
1
+ import type { Platform } from '../../types/platform.js';
2
2
  /**
3
3
  * Returns true if specified platform has stable viewport. Stable means not changing from time to
4
4
  * time.
@@ -1,4 +1,4 @@
1
- import { type RequestOptions } from '../bridge/index.js';
1
+ import type { RequestOptions } from '../../bridge/request.js';
2
2
  export interface RequestViewportResult {
3
3
  height: number;
4
4
  isStateStable: boolean;
@@ -1,5 +1,5 @@
1
- import type { PostEvent } from '../bridge/index.js';
2
- import type { StateEvents } from '../state/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import type { StateEvents } from '../../state/types.js';
3
3
  export interface ViewportProps {
4
4
  height: number;
5
5
  width: number;
@@ -1,5 +1,5 @@
1
- import type { MiniApp } from '../mini-app/index.js';
2
- import type { ThemeParams } from '../theme-params/index.js';
1
+ import type { MiniApp } from '../components/mini-app/MiniApp.js';
2
+ import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
3
3
  /**
4
4
  * Creates CSS variables connected with WebApp background and header colors based on
5
5
  * passed WebApp and ThemeParams instances.
@@ -1,4 +1,4 @@
1
- import type { ThemeParams } from '../theme-params/index.js';
1
+ import type { ThemeParams } from '../components/theme-params/ThemeParams.js';
2
2
  /**
3
3
  * Creates CSS variables connected with theme parameters. Created CSS variables names are
4
4
  * following the pattern "--tg-theme-{name}". {name} is a theme parameters key name converted
@@ -1,4 +1,4 @@
1
- import type { Viewport } from '../viewport/index.js';
1
+ import type { Viewport } from '../components/viewport/Viewport.js';
2
2
  /**
3
3
  * Accepts Viewport instance and sets CSS variables connected with viewport
4
4
  * sizes.
@@ -1,4 +1,4 @@
1
- import type { IsNever } from '../types/index.js';
1
+ import type { IsNever } from '../types/utils.js';
2
2
  /**
3
3
  * Function accepting the list of passed arguments and returning nothing.
4
4
  */
@@ -1,4 +1,4 @@
1
- import { Logger } from './logger/index.js';
1
+ import { Logger } from './logger/Logger.js';
2
2
  export declare const logger: Logger;
3
3
  /**
4
4
  * Sets new debug mode. Enabling debug mode leads to printing
@@ -1,28 +1,143 @@
1
- export { BackButton, type BackButtonEventName, type BackButtonEventListener, } from './back-button/index.js';
2
- export { createPostEvent, invokeCustomMethod, on, off, once, parseMessage, postEvent, request, subscribe, unsubscribe, MethodUnsupportedError, ParameterUnsupportedError, type HeaderColorKey, type InvoiceStatus, type ImpactHapticFeedbackStyle, type MiniAppsMethodName, type MiniAppsEventName, type MiniAppsEventParams, type MiniAppsEventListener, type MiniAppsGlobalEventListener, type MiniAppsEmptyMethodName, type MiniAppsMethodAcceptParams, type MiniAppsMethodParams, type MiniAppsNonEmptyMethodName, type MiniAppsMethods, type MiniAppsEventEmitter, type MiniAppsEventHasParams, type MiniAppsEvents, type NotificationHapticFeedbackType, type PhoneRequestedStatus, type PostEvent, type RequestOptions, type RequestOptionsAdvanced, type SwitchInlineQueryChatType, type WriteAccessRequestedStatus, } from './bridge/index.js';
3
- export { classNames, mergeClassNames } from './classnames/index.js';
4
- export { ClosingBehavior, type ClosingBehaviorEventListener, type ClosingBehaviorEventName, type ClosingBehaviorEvents, } from './closing-behavior/index.js';
5
- export { CloudStorage } from './cloud-storage/index.js';
6
- export { isRGB, isRGBShort, isColorDark, toRGB, type RGB, type RGBShort, } from './colors/index.js';
7
- export { setCSSVar, bindMiniAppCSSVars, bindThemeCSSVars, bindViewportCSSVars, } from './css/index.js';
8
- export { HapticFeedback } from './haptic-feedback/index.js';
9
- export { init, type InitOptions, type InitResult, } from './init/index.js';
10
- export { chatParser, InitData, initDataParser, parseInitData, userParser, type Chat, type ChatType, type InitDataParsed, type User, } from './init-data/index.js';
11
- export { Invoice, type InvoiceEvents, type InvoiceEventListener, type InvoiceEventName, } from './invoice/index.js';
12
- export { launchParamsParser, parseLaunchParams, retrieveLaunchData, retrieveLaunchParams, serializeLaunchParams, type LaunchParams, type LaunchData, } from './launch-params/index.js';
13
- export { MainButton, type MainButtonParams, type MainButtonProps, type MainButtonEvents, type MainButtonEventName, type MainButtonEventListener, } from './main-button/index.js';
14
- export { MiniApp, type MiniAppHeaderColor, type MiniAppEventName, type MiniAppEventListener, type MiniAppEvents, type MiniAppProps, } from './mini-app/index.js';
15
- export { isTMA, isRecord, isIframe, isPageReload, } from './misc/index.js';
16
- export { getHash, HashNavigator, Navigator, type NavigationEntry, type NavigatorConEntry, type NavigatorOptions, type HashNavigatorOptions, type HashNavigatorEventsMap, type HashNavigatorEventListener, type HashNavigatorEventName, } from './navigation/index.js';
17
- export { boolean, searchParams, string, rgb, array, date, json, number, ParseError, ParseSchemaFieldError, } from './parsing/index.js';
18
- export { Popup, type PopupEventName, type PopupEventListener, type PopupEvents, type OpenPopupOptions, type OpenPopupOptionsButton, } from './popup/index.js';
19
- export { QRScanner, type QRScannerEventListener, type QRScannerEventName, type QRScannerEvents, } from './qr-scanner/index.js';
20
- export { SettingsButton, type SettingsButtonEventName, type SettingsButtonEventListener, type SettingsButtonEvents, } from './settings-button/index.js';
21
- export { supports } from './supports/index.js';
22
- export { parseThemeParams, requestThemeParams, serializeThemeParams, themeParamsParser, ThemeParams, type ThemeParamsEventListener, type ThemeParamsEventName, type ThemeParamsEvents, type ThemeParamsKey, type ThemeParamsParsed, } from './theme-params/index.js';
23
- export { withTimeout, TimeoutError, isTimeoutError } from './timeout/index.js';
24
- export type { RequestId, CreateRequestIdFunc } from './types/index.js';
25
- export { Utils } from './utils/index.js';
26
- export { compareVersions, type Version } from './version/index.js';
27
- export { isStableViewportPlatform, requestViewport, Viewport, type RequestViewportResult, type ViewportProps, type ViewportEventName, type ViewportEventListener, type ViewportEvents, } from './viewport/index.js';
1
+ /**
2
+ * Bridge.
3
+ */
4
+ export { createPostEvent } from './bridge/methods/createPostEvent.js';
5
+ export { invokeCustomMethod } from './bridge/invokeCustomMethod.js';
6
+ export { on } from './bridge/events/on.js';
7
+ export { off } from './bridge/events/off.js';
8
+ export { once } from './bridge/events/once.js';
9
+ export { parseMessage } from './bridge/parseMessage.js';
10
+ export { postEvent, type PostEvent } from './bridge/methods/postEvent.js';
11
+ export { request, type RequestOptions, type RequestOptionsAdvanced } from './bridge/request.js';
12
+ export { subscribe } from './bridge/events/subscribe.js';
13
+ export { unsubscribe } from './bridge/events/unsubscribe.js';
14
+ export { MethodUnsupportedError } from './bridge/errors/MethodUnsupportedError.js';
15
+ export { ParameterUnsupportedError } from './bridge/errors/ParameterUnsupportedError.js';
16
+ export type { HeaderColorKey, MiniAppsEmptyMethodName, MiniAppsMethodAcceptParams, MiniAppsMethodName, MiniAppsMethodParams, MiniAppsMethods, MiniAppsNonEmptyMethodName, SwitchInlineQueryChatType, } from './bridge/methods/methods.js';
17
+ export type { InvoiceStatus } from './bridge/events/parsers/invoiceClosed.js';
18
+ export type { ImpactHapticFeedbackStyle, NotificationHapticFeedbackType, } from './bridge/methods/haptic.js';
19
+ export type { MiniAppsEventEmitter, MiniAppsEventHasParams, MiniAppsEventListener, MiniAppsEventName, MiniAppsEventParams, MiniAppsEvents, MiniAppsGlobalEventListener, } from './bridge/events/events.js';
20
+ export type { PhoneRequestedStatus } from './bridge/events/parsers/phoneRequested.js';
21
+ export type { WriteAccessRequestedStatus } from './bridge/events/parsers/writeAccessRequested.js';
22
+ /**
23
+ * Classnames.
24
+ */
25
+ export { classNames } from './classnames/classNames.js';
26
+ export { mergeClassNames } from './classnames/mergeClassNames.js';
27
+ /**
28
+ * Colors.
29
+ */
30
+ export { isRGB } from './colors/isRGB.js';
31
+ export { isRGBShort } from './colors/isRGBShort.js';
32
+ export { isColorDark } from './colors/isColorDark.js';
33
+ export { toRGB } from './colors/toRGB.js';
34
+ export type { RGB, RGBShort } from './colors/types.js';
35
+ /**
36
+ * Components.
37
+ */
38
+ export { ClosingBehavior } from './components/closing-behavior/ClosingBehavior.js';
39
+ export type { ClosingBehaviorEventListener, ClosingBehaviorEventName, ClosingBehaviorEvents, } from './components/closing-behavior/types.js';
40
+ export { CloudStorage } from './components/cloud-storage/CloudStorage.js';
41
+ export { HapticFeedback } from './components/haptic-feedback/HapticFeedback.js';
42
+ export { chatParser } from './components/init-data/chatParser.js';
43
+ export { InitData } from './components/init-data/InitData.js';
44
+ export { initDataParser } from './components/init-data/initDataParser.js';
45
+ export { parseInitData } from './components/init-data/parseInitData.js';
46
+ export { userParser } from './components/init-data/userParser.js';
47
+ export type { Chat, User, ChatType, InitDataParsed } from './components/init-data/types.js';
48
+ export { Invoice } from './components/invoice/Invoice.js';
49
+ export type { InvoiceState, InvoiceEventListener, InvoiceEventName, InvoiceEvents, } from './components/invoice/types.js';
50
+ export { MainButton } from './components/main-button/MainButton.js';
51
+ export type { MainButtonParams, MainButtonEvents, MainButtonEventListener, MainButtonEventName, MainButtonProps, } from './components/main-button/types.js';
52
+ export { MiniApp } from './components/mini-app/MiniApp.js';
53
+ export type { MiniAppHeaderColor, MiniAppProps, MiniAppEvents, MiniAppEventListener, MiniAppEventName, } from './components/mini-app/types.js';
54
+ export { Popup } from './components/popup/Popup.js';
55
+ export type { PopupEventName, PopupEventListener, OpenPopupOptions, OpenPopupOptionsButton, PopupEvents, } from './components/popup/types.js';
56
+ export { QRScanner } from './components/qr-scanner/QRScanner.js';
57
+ export type { QRScannerEvents, QRScannerEventListener, QRScannerEventName, } from './components/qr-scanner/types.js';
58
+ export { SettingsButton } from './components/settings-button/SettingsButton.js';
59
+ export type { SettingsButtonEventListener, SettingsButtonEventName, SettingsButtonEvents, } from './components/settings-button/types.js';
60
+ export { parseThemeParams } from './components/theme-params/parseThemeParams.js';
61
+ export { requestThemeParams } from './components/theme-params/requestThemeParams.js';
62
+ export { serializeThemeParams } from './components/theme-params/serializeThemeParams.js';
63
+ export { themeParamsParser } from './components/theme-params/themeParamsParser.js';
64
+ export { ThemeParams } from './components/theme-params/ThemeParams.js';
65
+ export type { ThemeParamsEventListener, ThemeParamsEventName, ThemeParamsKey, ThemeParamsEvents, ThemeParamsParsed, } from './components/theme-params/types.js';
66
+ export { Utils } from './components/utils/Utils.js';
67
+ export { isStableViewportPlatform } from './components/viewport/isStableViewportPlatform.js';
68
+ export { requestViewport, type RequestViewportResult, } from './components/viewport/requestViewport.js';
69
+ export { Viewport } from './components/viewport/Viewport.js';
70
+ export type { ViewportProps, ViewportEventListener, ViewportEventName, ViewportEvents, } from './components/viewport/types.js';
71
+ /**
72
+ * CSS.
73
+ */
74
+ export { setCSSVar } from './css/setCSSVar.js';
75
+ export { bindMiniAppCSSVars } from './css/bindMiniAppCSSVars.js';
76
+ export { bindThemeCSSVars } from './css/bindThemeCSSVars.js';
77
+ export { bindViewportCSSVars } from './css/bindViewportCSSVars.js';
78
+ /**
79
+ * Init.
80
+ */
81
+ export { init } from './init/init.js';
82
+ export type { InitOptions, InitResult } from './init/types.js';
83
+ /**
84
+ * Launch params.
85
+ */
86
+ export { launchParamsParser } from './launch-params/launchParamsParser.js';
87
+ export { parseLaunchParams } from './launch-params/parseLaunchParams.js';
88
+ export { retrieveLaunchParams } from './launch-params/retrieveLaunchParams.js';
89
+ export { retrieveLaunchData } from './launch-params/retrieveLaunchData.js';
90
+ export { serializeLaunchParams } from './launch-params/serializeLaunchParams.js';
91
+ export type { LaunchParams } from './launch-params/types.js';
92
+ export type { LaunchData } from './launch-params/types.js';
93
+ /**
94
+ * Misc.
95
+ */
96
+ export { isTMA } from './misc/isTMA.js';
97
+ export { isRecord } from './misc/isRecord.js';
98
+ export { isIframe } from './misc/isIframe.js';
99
+ export { isPageReload } from './misc/isPageReload.js';
100
+ /**
101
+ * Navigation.
102
+ */
103
+ export { getHash } from './navigation/getHash.js';
104
+ export { HashNavigator } from './navigation/HashNavigator/HashNavigator.js';
105
+ export { Navigator } from './navigation/Navigator/Navigator.js';
106
+ export type { NavigationEntry, NavigatorConEntry, NavigatorOptions, } from './navigation/Navigator/types.js';
107
+ export type { HashNavigatorOptions, HashNavigatorEventListener, HashNavigatorEventsMap, HashNavigatorEventName, } from './navigation/HashNavigator/types.js';
108
+ /**
109
+ * Parsing.
110
+ */
111
+ export { boolean } from './parsing/parsers/boolean.js';
112
+ export { searchParams } from './parsing/parsers/searchParams.js';
113
+ export { string } from './parsing/parsers/string.js';
114
+ export { rgb } from './parsing/parsers/rgb.js';
115
+ export { array } from './parsing/parsers/array.js';
116
+ export { date } from './parsing/parsers/date.js';
117
+ export { json } from './parsing/parsers/json.js';
118
+ export { number } from './parsing/parsers/number.js';
119
+ export { ParseError } from './parsing/ParseError.js';
120
+ export { ParseSchemaFieldError } from './parsing/ParseSchemaFieldError.js';
121
+ /**
122
+ * Supports.
123
+ */
124
+ export { supports } from './supports/supports.js';
125
+ /**
126
+ * Timeout.
127
+ */
128
+ export { withTimeout } from './timeout/withTimeout.js';
129
+ export { TimeoutError } from './timeout/TimeoutError.js';
130
+ export { isTimeoutError } from './timeout/isTimeoutError.js';
131
+ /**
132
+ * Types.
133
+ */
134
+ export type { RequestId, CreateRequestIdFunc } from './types/request-id.js';
135
+ /**
136
+ * Version.
137
+ */
138
+ export { compareVersions } from './version/compareVersions.js';
139
+ export type { Version } from './version/types.js';
140
+ /**
141
+ * Globals.
142
+ */
28
143
  export { setTargetOrigin, setDebug } from './globals.js';
@@ -1,5 +1,5 @@
1
- import { BackButton } from '../../back-button/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { BackButton } from '../../components/back-button/BackButton.js';
3
3
  /**
4
4
  * Creates BackButton instance using last locally saved data also saving each state in
5
5
  * the storage.
@@ -1,5 +1,5 @@
1
- import { ClosingBehavior } from '../../closing-behavior/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { ClosingBehavior } from '../../components/closing-behavior/ClosingBehavior.js';
3
3
  /**
4
4
  * Creates ClosingBehaviour instance using last locally saved data also saving each state in
5
5
  * the storage.
@@ -1,6 +1,6 @@
1
- import { MainButton } from '../../main-button/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
3
- import type { RGB } from '../../colors/index.js';
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
4
  /**
5
5
  * Creates MainButton instance using last locally saved data also saving each state in
6
6
  * the storage.
@@ -1,8 +1,8 @@
1
- import { MiniApp } from '../../mini-app/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
3
- import type { RGB } from '../../colors/index.js';
4
- import type { CreateRequestIdFunc } from '../../types/index.js';
5
- import type { Version } from '../../version/index.js';
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
6
  /**
7
7
  * Creates MiniApp instance using last locally saved data also saving each state in
8
8
  * the storage.
@@ -1,4 +1,4 @@
1
- import type { CreateRequestIdFunc } from '../../types/index.js';
1
+ import type { CreateRequestIdFunc } from '../../types/request-id.js';
2
2
  /**
3
3
  * Creates function which generated request identifiers.
4
4
  */
@@ -1,5 +1,5 @@
1
- import { SettingsButton } from '../../settings-button/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
1
+ import type { PostEvent } from '../../bridge/methods/postEvent.js';
2
+ import { SettingsButton } from '../../components/settings-button/SettingsButton.js';
3
3
  /**
4
4
  * Creates SettingsButton instance using last locally saved data also saving each state in
5
5
  * the storage.
@@ -1,4 +1,5 @@
1
- import { ThemeParams, type ThemeParamsParsed } from '../../theme-params/index.js';
1
+ import { ThemeParams } from '../../components/theme-params/ThemeParams.js';
2
+ import type { ThemeParamsParsed } from '../../components/theme-params/types.js';
2
3
  /**
3
4
  * Creates synced instance of ThemeParams.
4
5
  * @param params - theme parameters.
@@ -1,6 +1,6 @@
1
- import { Viewport } from '../../viewport/index.js';
2
- import type { PostEvent } from '../../bridge/index.js';
3
- import type { Platform } from '../../types/index.js';
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
4
  /**
5
5
  * Creates Viewport instance using its actual state from the Telegram application.
6
6
  * @param isPageReload - was page reloaded.
@@ -1,6 +1,6 @@
1
- import type { MiniApp } from '../../mini-app/index.js';
2
- import type { ThemeParams } from '../../theme-params/index.js';
3
- import type { Viewport } from '../../viewport/index.js';
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
4
  import type { InitCSSVarsOption } from '../types.js';
5
5
  /**
6
6
  * Process initialization CSS vars option.
@@ -1,19 +1,19 @@
1
- import type { BackButton } from '../back-button/index.js';
2
- import type { PostEvent } from '../bridge/index.js';
3
- import type { ClosingBehavior } from '../closing-behavior/index.js';
4
- import type { CloudStorage } from '../cloud-storage/index.js';
5
- import type { HapticFeedback } from '../haptic-feedback/index.js';
6
- import type { InitData } from '../init-data/index.js';
7
- import type { Invoice } from '../invoice/index.js';
8
- import type { MainButton } from '../main-button/index.js';
9
- import type { MiniApp } from '../mini-app/index.js';
10
- import type { Popup } from '../popup/index.js';
11
- import type { QRScanner } from '../qr-scanner/index.js';
12
- import type { SettingsButton } from '../settings-button/index.js';
13
- import type { ThemeParams } from '../theme-params/index.js';
14
- import type { CreateRequestIdFunc } from '../types/index.js';
15
- import type { Utils } from '../utils/index.js';
16
- import type { Viewport } from '../viewport/index.js';
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
17
  export interface InitResult {
18
18
  backButton: BackButton;
19
19
  closingBehavior: ClosingBehavior;
@@ -1,5 +1,6 @@
1
1
  import type { LaunchParams } from './types.js';
2
+ import type { ValueParser } from '../parsing/ValueParser.js';
2
3
  /**
3
4
  * Returns parser used to parse launch params.
4
5
  */
5
- export declare function launchParamsParser(): import('../parsing/index.js').ValueParser<LaunchParams, false>;
6
+ export declare function launchParamsParser(): ValueParser<LaunchParams, false>;
@@ -1,6 +1,6 @@
1
- import type { InitDataParsed } from '../init-data/index.js';
2
- import type { ThemeParamsParsed } from '../theme-params/index.js';
3
- import type { Platform } from '../types/index.js';
1
+ import type { InitDataParsed } from '../components/init-data/types.js';
2
+ import type { ThemeParamsParsed } from '../components/theme-params/types.js';
3
+ import type { Platform } from '../types/platform.js';
4
4
  /**
5
5
  * Telegram Mini Apps launch parameters.
6
6
  * @see https://docs.telegram-mini-apps.com/platform/launch-parameters
@@ -1,6 +1,8 @@
1
1
  import type { HashNavigatorEventsMap, HashNavigatorOptions } from './types.js';
2
- import { Navigator } from '../Navigator/index.js';
2
+ import { EventEmitter } from '../../event-emitter/EventEmitter.js';
3
+ import { Navigator } from '../Navigator/Navigator.js';
3
4
  import type { NavigatorConEntry, PerformGoOptions, PerformPushOptions, PerformReplaceOptions } from '../Navigator/types.js';
5
+ type HashNavigatorEventEmitter = EventEmitter<HashNavigatorEventsMap>;
4
6
  export declare class HashNavigator extends Navigator<Promise<void>> {
5
7
  /**
6
8
  * Creates navigator from current window location hash.
@@ -35,9 +37,10 @@ export declare class HashNavigator extends Navigator<Promise<void>> {
35
37
  /**
36
38
  * Adds new event listener.
37
39
  */
38
- on: <E extends "change">(event: E, listener: import('../../event-emitter/index.js').EventListener<HashNavigatorEventsMap[E]>) => import('../../event-emitter/index.js').RemoveEventListener;
40
+ on: HashNavigatorEventEmitter['on'];
39
41
  /**
40
42
  * Removes event listener.
41
43
  */
42
- off: <E extends "change">(event: E, listener: import('../../event-emitter/index.js').EventListener<HashNavigatorEventsMap[E]>) => void;
44
+ off: HashNavigatorEventEmitter['off'];
43
45
  }
46
+ export {};
@@ -1,6 +1,5 @@
1
1
  import type { HashNavigator } from './HashNavigator.js';
2
- import type { NavigatorOptions } from '../Navigator/index.js';
3
- import type { NavigationEntry } from '../Navigator/types.js';
2
+ import type { NavigationEntry, NavigatorOptions } from '../Navigator/types.js';
4
3
  export type HashNavigatorOptions = Omit<NavigatorOptions, 'loggerPrefix'>;
5
4
  interface ChangeEventPayload {
6
5
  /**
@@ -1,5 +1,5 @@
1
- import { Logger } from '../../logger/index.js';
2
1
  import type { AnyEntry, NavigationEntry, NavigatorConEntry, NavigatorOptions, PerformGoOptions, PerformPushOptions, PerformReplaceOptions } from './types.js';
2
+ import { Logger } from '../../logger/Logger.js';
3
3
  /**
4
4
  * Represents basic navigator implementation which uses only memory to store and control
5
5
  * navigation state.
@@ -1,5 +1,5 @@
1
- import type { If } from '../types/index.js';
2
1
  import type { Parser } from './types.js';
2
+ import type { If } from '../types/logical.js';
3
3
  /**
4
4
  * Result of "parse" function.
5
5
  */
@@ -1,6 +1,6 @@
1
1
  import { ArrayValueParser } from '../ArrayValueParser.js';
2
2
  /**
3
3
  * Parses incoming value as an array.
4
- * @param type - parser type name.
4
+ * @param parserTypeName - parser type name.
5
5
  */
6
- export declare function array(type?: string): ArrayValueParser<unknown, false>;
6
+ export declare function array(parserTypeName?: string): ArrayValueParser<unknown, false>;
@@ -1,4 +1,5 @@
1
+ import type { ValueParserGenerator } from '../createValueParserGenerator.js';
1
2
  /**
2
3
  * Returns parser to parse value as boolean.
3
4
  */
4
- export declare const boolean: import("../createValueParserGenerator.js").ValueParserGenerator<boolean>;
5
+ export declare const boolean: ValueParserGenerator<boolean>;
@@ -1,4 +1,5 @@
1
+ import type { ValueParserGenerator } from '../createValueParserGenerator.js';
1
2
  /**
2
3
  * Returns parser to parse value as Date.
3
4
  */
4
- export declare const date: import("../createValueParserGenerator.js").ValueParserGenerator<Date>;
5
+ export declare const date: ValueParserGenerator<Date>;
@@ -1,4 +1,5 @@
1
+ import type { ValueParserGenerator } from '../createValueParserGenerator.js';
1
2
  /**
2
3
  * Returns parser to parse value as number.
3
4
  */
4
- export declare const number: import("../createValueParserGenerator.js").ValueParserGenerator<number>;
5
+ export declare const number: ValueParserGenerator<number>;
@@ -1,4 +1,6 @@
1
+ import type { RGB } from '../../colors/types.js';
2
+ import type { ValueParserGenerator } from '../createValueParserGenerator.js';
1
3
  /**
2
4
  * Returns parser to parse value as RGB color.
3
5
  */
4
- export declare const rgb: import("../createValueParserGenerator.js").ValueParserGenerator<`#${string}`>;
6
+ export declare const rgb: ValueParserGenerator<RGB>;
@@ -1,4 +1,5 @@
1
+ import type { ValueParserGenerator } from '../createValueParserGenerator.js';
1
2
  /**
2
3
  * Returns parser to parse value as string.
3
4
  */
4
- export declare const string: import("../createValueParserGenerator.js").ValueParserGenerator<string>;
5
+ export declare const string: ValueParserGenerator<string>;
@@ -1,6 +1,6 @@
1
- import type { EventEmitter } from '../event-emitter/index.js';
2
- import type { StringKeys } from '../types/index.js';
3
1
  import type { StateEvents } from './types.js';
2
+ import type { EventEmitter } from '../event-emitter/EventEmitter.js';
3
+ import type { StringKeys } from '../types/utils.js';
4
4
  /**
5
5
  * Represents state which is observable via passed EventEmitter.
6
6
  */
@@ -1,4 +1,4 @@
1
- import type { StringKeys } from '../types/index.js';
1
+ import type { StringKeys } from '../types/utils.js';
2
2
  /**
3
3
  * Computes state property changed event.
4
4
  */
@@ -1,5 +1,5 @@
1
- import type { HeaderColorKey } from './bridge/index.js';
2
- import type { RGB } from './colors/index.js';
1
+ import type { HeaderColorKey } from './bridge/methods/methods.js';
2
+ import type { RGB } from './colors/types.js';
3
3
  /**
4
4
  * Describes storage keys and according values.
5
5
  */
@@ -1,6 +1,6 @@
1
- import type { MiniAppsMethodName } from '../bridge/index.js';
2
- import type { Version } from '../version/index.js';
3
1
  import type { SupportsFunc } from './types.js';
2
+ import type { MiniAppsMethodName } from '../bridge/methods/methods.js';
3
+ import type { Version } from '../version/types.js';
4
4
  /**
5
5
  * Returns function, which accepts predefined method name and checks if it is supported
6
6
  * via passed schema and version.
@@ -1,6 +1,6 @@
1
- import type { MiniAppsMethodVersionedParams, MiniAppsMethodWithVersionedParams } from '../bridge/index.js';
2
- import type { Version } from '../version/index.js';
3
1
  import type { SupportsFunc } from './types.js';
2
+ import type { MiniAppsMethodVersionedParams, MiniAppsMethodWithVersionedParams } from '../bridge/methods/methods.js';
3
+ import type { Version } from '../version/types.js';
4
4
  type HasCheckSupportMethodTuple = {
5
5
  [M in MiniAppsMethodWithVersionedParams]: [M, MiniAppsMethodVersionedParams<M>];
6
6
  }[MiniAppsMethodWithVersionedParams];
@@ -1,5 +1,5 @@
1
- import { type Version } from '../version/index.js';
2
- import type { MiniAppsMethodName, MiniAppsMethodVersionedParams, MiniAppsMethodWithVersionedParams } from '../bridge/methods/index.js';
1
+ import type { MiniAppsMethodName, MiniAppsMethodVersionedParams, MiniAppsMethodWithVersionedParams } from '../bridge/methods/methods.js';
2
+ import type { Version } from '../version/types.js';
3
3
  /**
4
4
  * Returns true in case, passed parameter in specified method is supported.
5
5
  * @param method - method name