@tma.js/sdk 0.13.2 → 1.0.0
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/{components/BackButton → back-button}/BackButton.d.ts +12 -9
- package/dist/dts/back-button/index.d.ts +2 -0
- package/dist/dts/{components/BackButton → back-button}/types.d.ts +3 -2
- package/dist/dts/bridge/env/hasExternalNotify.d.ts +12 -0
- package/dist/dts/bridge/env/hasWebviewProxy.d.ts +12 -0
- package/dist/dts/bridge/env/index.d.ts +3 -0
- package/dist/dts/bridge/env/isIframe.d.ts +5 -0
- package/dist/dts/bridge/errors/MethodUnsupportedError.d.ts +8 -0
- package/dist/dts/bridge/errors/ParameterUnsupportedError.d.ts +8 -0
- package/dist/dts/bridge/errors/index.d.ts +2 -0
- package/dist/dts/bridge/events/createEmitter.d.ts +6 -0
- package/dist/dts/bridge/events/events.d.ts +130 -0
- package/dist/dts/bridge/events/index.d.ts +9 -0
- package/dist/dts/bridge/events/off.d.ts +7 -0
- package/dist/dts/bridge/events/on.d.ts +10 -0
- package/dist/dts/bridge/events/onTelegramEvent.d.ts +7 -0
- package/dist/dts/bridge/events/once.d.ts +9 -0
- package/dist/dts/bridge/events/parsers/clipboardTextReceived.d.ts +13 -0
- package/dist/dts/bridge/events/parsers/customMethodInvoked.d.ts +16 -0
- package/dist/dts/bridge/events/parsers/index.d.ts +9 -0
- package/dist/dts/bridge/events/parsers/invoiceClosed.d.ts +12 -0
- package/dist/dts/bridge/events/parsers/phoneRequested.d.ts +8 -0
- package/dist/dts/bridge/events/parsers/popupClosed.d.ts +8 -0
- package/dist/dts/bridge/events/parsers/qrTextReceived.d.ts +7 -0
- package/dist/dts/bridge/events/parsers/theme-changed.d.ts +42 -0
- package/dist/dts/bridge/events/parsers/viewportChanged.d.ts +19 -0
- package/dist/dts/bridge/events/parsers/writeAccessRequested.d.ts +8 -0
- package/dist/dts/bridge/events/singletonEmitter.d.ts +6 -0
- package/dist/dts/bridge/events/subscribe.d.ts +9 -0
- package/dist/dts/bridge/events/unsubscribe.d.ts +6 -0
- package/dist/dts/bridge/index.d.ts +5 -0
- package/dist/dts/bridge/methods/createPostEvent.d.ts +10 -0
- package/dist/dts/bridge/methods/haptic.d.ts +40 -0
- package/dist/dts/bridge/methods/index.d.ts +6 -0
- package/dist/dts/bridge/methods/invoke-custom-method.d.ts +24 -0
- package/dist/dts/bridge/methods/methods.d.ts +329 -0
- package/dist/dts/bridge/methods/popup.d.ts +49 -0
- package/dist/dts/bridge/methods/postEvent.d.ts +29 -0
- package/dist/dts/bridge/request.d.ts +65 -0
- package/dist/dts/classnames/classNames.d.ts +10 -0
- package/dist/dts/classnames/index.d.ts +2 -0
- package/dist/dts/classnames/mergeClassNames.d.ts +32 -0
- package/dist/dts/{components/ClosingBehaviour/ClosingBehaviour.d.ts → closing-behavior/ClosingBehavior.d.ts} +5 -4
- package/dist/dts/closing-behavior/index.d.ts +2 -0
- package/dist/dts/closing-behavior/types.d.ts +7 -0
- package/dist/dts/{components/CloudStorage → cloud-storage}/CloudStorage.d.ts +19 -11
- package/dist/dts/colors/index.d.ts +5 -0
- package/dist/dts/colors/isColorDark.d.ts +6 -0
- package/dist/dts/colors/isRGB.d.ts +6 -0
- package/dist/dts/colors/isRGBShort.d.ts +6 -0
- package/dist/dts/colors/toRGB.d.ts +11 -0
- package/dist/dts/colors/types.d.ts +8 -0
- package/dist/dts/event-emitter/EventEmitter.d.ts +64 -0
- package/dist/dts/event-emitter/index.d.ts +2 -0
- package/dist/dts/event-emitter/types.d.ts +44 -0
- package/dist/dts/globals.d.ts +22 -0
- package/dist/dts/{components/HapticFeedback → haptic-feedback}/HapticFeedback.d.ts +3 -3
- package/dist/dts/index.d.ts +24 -6
- package/dist/dts/init/catchCustomStyles.d.ts +4 -0
- package/dist/dts/init/creators/createBackButton.d.ts +2 -2
- package/dist/dts/init/creators/createClosingBehavior.d.ts +3 -3
- package/dist/dts/init/creators/createMainButton.d.ts +3 -3
- package/dist/dts/init/creators/createMiniApp.d.ts +14 -0
- package/dist/dts/init/creators/createRequestIdGenerator.d.ts +1 -1
- package/dist/dts/init/creators/createThemeParams.d.ts +2 -3
- package/dist/dts/init/creators/createViewport.d.ts +16 -9
- package/dist/dts/init/creators/index.d.ts +1 -1
- package/dist/dts/init/css/bindMiniAppCSSVars.d.ts +16 -0
- package/dist/dts/init/css/bindThemeCSSVars.d.ts +12 -0
- package/dist/dts/init/css/bindViewportCSSVars.d.ts +20 -0
- package/dist/dts/init/css/index.d.ts +1 -0
- package/dist/dts/init/css/processCSSVarsOption.d.ts +12 -0
- package/dist/dts/init/css/setCSSVar.d.ts +6 -0
- package/dist/dts/init/init.d.ts +5 -5
- package/dist/dts/init/types.d.ts +42 -69
- package/dist/dts/init-data/InitData.d.ts +53 -0
- package/dist/dts/init-data/chatParser.d.ts +5 -0
- package/dist/dts/init-data/index.d.ts +6 -0
- package/dist/dts/init-data/initDataParser.d.ts +5 -0
- package/dist/dts/init-data/parseInitData.d.ts +6 -0
- package/dist/dts/init-data/types.d.ts +133 -0
- package/dist/dts/init-data/userParser.d.ts +5 -0
- package/dist/dts/invoice/Invoice.d.ts +43 -0
- package/dist/dts/invoice/index.d.ts +2 -0
- package/dist/dts/invoice/types.d.ts +7 -0
- package/dist/dts/launch-params/computeLaunchData.d.ts +6 -0
- package/dist/dts/launch-params/computePageReload.d.ts +6 -0
- package/dist/dts/launch-params/getFirstNavigationEntry.d.ts +6 -0
- package/dist/dts/launch-params/index.d.ts +12 -0
- package/dist/dts/launch-params/launchParamsParser.d.ts +5 -0
- package/dist/dts/launch-params/parseLaunchParams.d.ts +6 -0
- package/dist/dts/launch-params/retrieveCurrent.d.ts +5 -0
- package/dist/dts/launch-params/retrieveFromLocation.d.ts +6 -0
- package/dist/dts/launch-params/retrieveFromPerformance.d.ts +8 -0
- package/dist/dts/launch-params/retrieveLaunchData.d.ts +6 -0
- package/dist/dts/launch-params/serializeLaunchParams.d.ts +6 -0
- package/dist/dts/launch-params/storage.d.ts +13 -0
- package/dist/dts/launch-params/types.d.ts +48 -0
- package/dist/dts/logger/Logger.d.ts +38 -0
- package/dist/dts/logger/index.d.ts +1 -0
- package/dist/dts/main-button/MainButton.d.ts +104 -0
- package/dist/dts/main-button/index.d.ts +2 -0
- package/dist/dts/main-button/types.d.ts +20 -0
- package/dist/dts/mini-app/MiniApp.d.ts +99 -0
- package/dist/dts/mini-app/index.d.ts +2 -0
- package/dist/dts/mini-app/types.d.ts +19 -0
- package/dist/dts/misc/index.d.ts +2 -0
- package/dist/dts/misc/isRecord.d.ts +5 -0
- package/dist/dts/misc/isTMA.d.ts +4 -0
- package/dist/dts/navigation/HashNavigator/HashNavigator.d.ts +43 -0
- package/dist/dts/navigation/HashNavigator/drop.d.ts +4 -0
- package/dist/dts/navigation/HashNavigator/go.d.ts +5 -0
- package/dist/dts/navigation/HashNavigator/index.d.ts +2 -0
- package/dist/dts/navigation/HashNavigator/types.d.ts +34 -0
- package/dist/dts/navigation/Navigator/Navigator.d.ts +104 -0
- package/dist/dts/navigation/Navigator/index.d.ts +2 -0
- package/dist/dts/navigation/Navigator/types.d.ts +44 -0
- package/dist/dts/navigation/ensurePrefix.d.ts +7 -0
- package/dist/dts/navigation/getHash.d.ts +14 -0
- package/dist/dts/navigation/index.d.ts +4 -0
- package/dist/dts/parsing/ArrayValueParser.d.ts +18 -0
- package/dist/dts/parsing/ParseError.d.ts +22 -0
- package/dist/dts/parsing/ParseSchemaFieldError.d.ts +17 -0
- package/dist/dts/parsing/ValueParser.d.ts +36 -0
- package/dist/dts/parsing/createValueParserGenerator.d.ts +9 -0
- package/dist/dts/parsing/index.d.ts +10 -0
- package/dist/dts/parsing/parseBySchema.d.ts +8 -0
- package/dist/dts/parsing/parsers/array.d.ts +6 -0
- package/dist/dts/parsing/parsers/boolean.d.ts +4 -0
- package/dist/dts/parsing/parsers/date.d.ts +4 -0
- package/dist/dts/parsing/parsers/index.d.ts +8 -0
- package/dist/dts/parsing/parsers/json.d.ts +8 -0
- package/dist/dts/parsing/parsers/number.d.ts +4 -0
- package/dist/dts/parsing/parsers/rgb.d.ts +4 -0
- package/dist/dts/parsing/parsers/searchParams.d.ts +8 -0
- package/dist/dts/parsing/parsers/string.d.ts +4 -0
- package/dist/dts/parsing/toRecord.d.ts +7 -0
- package/dist/dts/parsing/types.d.ts +30 -0
- package/dist/dts/parsing/unexpectedTypeError.d.ts +4 -0
- package/dist/dts/{components/Popup → popup}/Popup.d.ts +10 -9
- package/dist/dts/popup/index.d.ts +2 -0
- package/dist/dts/popup/preparePopupParams.d.ts +7 -0
- package/dist/dts/{components/Popup → popup}/types.d.ts +4 -4
- package/dist/dts/{components/QRScanner → qr-scanner}/QRScanner.d.ts +6 -5
- package/dist/dts/qr-scanner/index.d.ts +2 -0
- package/dist/dts/{components/QRScanner → qr-scanner}/types.d.ts +1 -1
- package/dist/dts/state/State.d.ts +19 -6
- package/dist/dts/state/types.d.ts +4 -7
- package/dist/dts/storage.d.ts +4 -4
- package/dist/dts/supports/createSupportsFunc.d.ts +10 -0
- package/dist/dts/supports/createSupportsParamFunc.d.ts +15 -0
- package/dist/dts/supports/index.d.ts +4 -0
- package/dist/dts/supports/supports.d.ts +15 -0
- package/dist/dts/supports/types.d.ts +1 -0
- package/dist/dts/theme-params/ThemeParams.d.ts +62 -0
- package/dist/dts/theme-params/index.d.ts +6 -0
- package/dist/dts/theme-params/keys.d.ts +11 -0
- package/dist/dts/theme-params/parseThemeParams.d.ts +6 -0
- package/dist/dts/theme-params/requestThemeParams.d.ts +7 -0
- package/dist/dts/theme-params/serializeThemeParams.d.ts +5 -0
- package/dist/dts/theme-params/themeParamsParser.d.ts +2 -0
- package/dist/dts/theme-params/types.d.ts +14 -0
- package/dist/dts/timeout/TimeoutError.d.ts +3 -0
- package/dist/dts/timeout/index.d.ts +3 -0
- package/dist/dts/timeout/isTimeoutError.d.ts +6 -0
- package/dist/dts/timeout/withTimeout.d.ts +14 -0
- package/dist/dts/types/index.d.ts +3 -0
- package/dist/dts/types/platform.d.ts +4 -0
- package/dist/dts/types/request-id.d.ts +9 -0
- package/dist/dts/types/utils.d.ts +36 -0
- package/dist/dts/utils/Utils.d.ts +45 -0
- package/dist/dts/utils/index.d.ts +1 -0
- package/dist/dts/version/compareVersions.d.ts +8 -0
- package/dist/dts/version/index.d.ts +2 -0
- package/dist/dts/version/types.d.ts +4 -0
- package/dist/dts/{components/Viewport → viewport}/Viewport.d.ts +16 -38
- package/dist/dts/viewport/index.d.ts +3 -0
- package/dist/dts/viewport/requestViewport.d.ts +12 -0
- package/dist/dts/{components/Viewport → viewport}/types.d.ts +9 -1
- package/dist/dts/viewport/utils.d.ts +5 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/index.mjs +2249 -1036
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -16
- package/src/{components/BackButton → back-button}/BackButton.ts +23 -21
- package/src/back-button/index.ts +2 -0
- package/src/{components/BackButton → back-button}/types.ts +3 -2
- package/src/bridge/env/hasExternalNotify.ts +19 -0
- package/src/bridge/env/hasWebviewProxy.ts +19 -0
- package/src/bridge/env/index.ts +3 -0
- package/src/bridge/env/isIframe.ts +11 -0
- package/src/bridge/errors/MethodUnsupportedError.ts +13 -0
- package/src/bridge/errors/ParameterUnsupportedError.ts +13 -0
- package/src/bridge/errors/index.ts +2 -0
- package/src/bridge/events/createEmitter.ts +108 -0
- package/src/bridge/events/events.ts +170 -0
- package/src/bridge/events/index.ts +9 -0
- package/src/bridge/events/off.ts +14 -0
- package/src/bridge/events/on.ts +19 -0
- package/src/bridge/events/onTelegramEvent.ts +83 -0
- package/src/bridge/events/once.ts +18 -0
- package/src/bridge/events/parsers/clipboardTextReceived.ts +26 -0
- package/src/bridge/events/parsers/customMethodInvoked.ts +25 -0
- package/src/bridge/events/parsers/index.ts +9 -0
- package/src/bridge/events/parsers/invoiceClosed.ts +26 -0
- package/src/bridge/events/parsers/phoneRequested.ts +14 -0
- package/src/bridge/events/parsers/popupClosed.ts +19 -0
- package/src/bridge/events/parsers/qrTextReceived.ts +14 -0
- package/src/bridge/events/parsers/theme-changed.ts +58 -0
- package/src/bridge/events/parsers/viewportChanged.ts +33 -0
- package/src/bridge/events/parsers/writeAccessRequested.ts +14 -0
- package/src/bridge/events/singletonEmitter.ts +19 -0
- package/src/bridge/events/subscribe.ts +15 -0
- package/src/bridge/events/unsubscribe.ts +10 -0
- package/src/bridge/index.ts +5 -0
- package/src/bridge/methods/createPostEvent.ts +40 -0
- package/src/bridge/methods/haptic.ts +52 -0
- package/src/bridge/methods/index.ts +6 -0
- package/src/bridge/methods/invoke-custom-method.ts +25 -0
- package/src/bridge/methods/methods.ts +372 -0
- package/src/bridge/methods/popup.ts +53 -0
- package/src/bridge/methods/postEvent.ts +101 -0
- package/src/bridge/request.ts +185 -0
- package/src/classnames/classNames.ts +34 -0
- package/src/classnames/index.ts +2 -0
- package/src/classnames/mergeClassNames.ts +68 -0
- package/src/{components/ClosingBehaviour/ClosingBehaviour.ts → closing-behavior/ClosingBehavior.ts} +12 -10
- package/src/closing-behavior/index.ts +2 -0
- package/src/closing-behavior/types.ts +12 -0
- package/src/{components/CloudStorage → cloud-storage}/CloudStorage.ts +50 -28
- package/src/colors/index.ts +5 -0
- package/src/colors/isColorDark.ts +22 -0
- package/src/colors/isRGB.ts +9 -0
- package/src/colors/isRGBShort.ts +9 -0
- package/src/colors/toRGB.ts +49 -0
- package/src/colors/types.ts +9 -0
- package/src/event-emitter/EventEmitter.ts +146 -0
- package/src/event-emitter/index.ts +2 -0
- package/src/event-emitter/types.ts +60 -0
- package/src/globals.ts +38 -0
- package/src/{components/HapticFeedback → haptic-feedback}/HapticFeedback.ts +16 -8
- package/src/index.ts +171 -6
- package/src/init/catchCustomStyles.ts +17 -0
- package/src/init/creators/createBackButton.ts +4 -6
- package/src/init/creators/createClosingBehavior.ts +6 -8
- package/src/init/creators/createMainButton.ts +13 -20
- package/src/init/creators/createMiniApp.ts +44 -0
- package/src/init/creators/createRequestIdGenerator.ts +1 -1
- package/src/init/creators/createThemeParams.ts +3 -6
- package/src/init/creators/createViewport.ts +92 -42
- package/src/init/creators/index.ts +1 -1
- package/src/init/css/bindMiniAppCSSVars.ts +48 -0
- package/src/init/css/bindThemeCSSVars.ts +31 -0
- package/src/init/css/bindViewportCSSVars.ts +36 -0
- package/src/init/css/index.ts +1 -0
- package/src/init/css/processCSSVarsOption.ts +57 -0
- package/src/init/css/setCSSVar.ts +8 -0
- package/src/init/init.ts +96 -138
- package/src/init/types.ts +42 -87
- package/src/init-data/InitData.ts +96 -0
- package/src/init-data/chatParser.ts +19 -0
- package/src/init-data/index.ts +6 -0
- package/src/init-data/initDataParser.ts +41 -0
- package/src/init-data/parseInitData.ts +10 -0
- package/src/init-data/types.ts +164 -0
- package/src/init-data/userParser.ts +45 -0
- package/src/invoice/Invoice.ts +123 -0
- package/src/invoice/index.ts +2 -0
- package/src/invoice/types.ts +11 -0
- package/src/launch-params/computeLaunchData.ts +81 -0
- package/src/launch-params/computePageReload.ts +13 -0
- package/src/launch-params/getFirstNavigationEntry.ts +10 -0
- package/src/launch-params/index.ts +12 -0
- package/src/launch-params/launchParamsParser.ts +41 -0
- package/src/launch-params/parseLaunchParams.ts +10 -0
- package/src/launch-params/retrieveCurrent.ts +27 -0
- package/src/launch-params/retrieveFromLocation.ts +10 -0
- package/src/launch-params/retrieveFromPerformance.ts +23 -0
- package/src/launch-params/retrieveLaunchData.ts +30 -0
- package/src/launch-params/serializeLaunchParams.ts +37 -0
- package/src/launch-params/storage.ts +33 -0
- package/src/launch-params/types.ts +57 -0
- package/src/logger/Logger.ts +72 -0
- package/src/logger/index.ts +1 -0
- package/src/main-button/MainButton.ts +239 -0
- package/src/main-button/index.ts +2 -0
- package/src/main-button/types.ts +26 -0
- package/src/mini-app/MiniApp.ts +237 -0
- package/src/mini-app/index.ts +2 -0
- package/src/mini-app/types.ts +25 -0
- package/src/misc/index.ts +2 -0
- package/src/misc/isRecord.ts +7 -0
- package/src/misc/isTMA.ts +13 -0
- package/src/navigation/HashNavigator/HashNavigator.ts +220 -0
- package/src/navigation/HashNavigator/drop.ts +36 -0
- package/src/navigation/HashNavigator/go.ts +28 -0
- package/src/navigation/HashNavigator/index.ts +2 -0
- package/src/navigation/HashNavigator/types.ts +41 -0
- package/src/navigation/Navigator/Navigator.ts +282 -0
- package/src/navigation/Navigator/index.ts +2 -0
- package/src/navigation/Navigator/types.ts +55 -0
- package/src/navigation/ensurePrefix.ts +9 -0
- package/src/navigation/getHash.ts +17 -0
- package/src/navigation/index.ts +4 -0
- package/src/parsing/ArrayValueParser.ts +79 -0
- package/src/parsing/ParseError.ts +27 -0
- package/src/parsing/ParseSchemaFieldError.ts +21 -0
- package/src/parsing/ValueParser.ts +71 -0
- package/src/parsing/createValueParserGenerator.ts +16 -0
- package/src/parsing/index.ts +10 -0
- package/src/parsing/parseBySchema.ts +65 -0
- package/src/parsing/parsers/array.ts +9 -0
- package/src/parsing/parsers/boolean.ts +22 -0
- package/src/parsing/parsers/date.ts +13 -0
- package/src/parsing/parsers/index.ts +8 -0
- package/src/parsing/parsers/json.ts +17 -0
- package/src/parsing/parsers/number.ts +21 -0
- package/src/parsing/parsers/rgb.ts +12 -0
- package/src/parsing/parsers/searchParams.ts +24 -0
- package/src/parsing/parsers/string.ts +12 -0
- package/src/parsing/toRecord.ts +27 -0
- package/src/parsing/types.ts +32 -0
- package/src/parsing/unexpectedTypeError.ts +6 -0
- package/src/{components/Popup → popup}/Popup.ts +38 -28
- package/src/popup/index.ts +2 -0
- package/src/{components/Popup/utils.ts → popup/preparePopupParams.ts} +3 -3
- package/src/{components/Popup → popup}/types.ts +4 -4
- package/src/{components/QRScanner → qr-scanner}/QRScanner.ts +18 -10
- package/src/qr-scanner/index.ts +2 -0
- package/src/{components/QRScanner → qr-scanner}/types.ts +1 -1
- package/src/state/State.ts +30 -16
- package/src/state/types.ts +5 -8
- package/src/storage.ts +6 -4
- package/src/supports/createSupportsFunc.ts +18 -0
- package/src/supports/createSupportsParamFunc.ts +27 -0
- package/src/supports/index.ts +4 -0
- package/src/supports/supports.ts +84 -0
- package/src/supports/types.ts +1 -0
- package/src/theme-params/ThemeParams.ts +131 -0
- package/src/theme-params/index.ts +6 -0
- package/src/theme-params/keys.ts +24 -0
- package/src/theme-params/parseThemeParams.ts +10 -0
- package/src/theme-params/requestThemeParams.ts +13 -0
- package/src/theme-params/serializeThemeParams.ts +20 -0
- package/src/theme-params/themeParamsParser.ts +20 -0
- package/src/theme-params/types.ts +33 -0
- package/src/timeout/TimeoutError.ts +6 -0
- package/src/timeout/index.ts +3 -0
- package/src/timeout/isTimeoutError.ts +9 -0
- package/src/timeout/withTimeout.ts +36 -0
- package/src/types/index.ts +3 -0
- package/src/types/platform.ts +14 -0
- package/src/types/request-id.ts +10 -0
- package/src/types/utils.ts +50 -0
- package/src/utils/Utils.ts +107 -0
- package/src/utils/index.ts +1 -0
- package/src/version/compareVersions.ts +28 -0
- package/src/version/index.ts +2 -0
- package/src/version/types.ts +4 -0
- package/src/{components/Viewport → viewport}/Viewport.ts +72 -98
- package/src/viewport/index.ts +3 -0
- package/src/viewport/requestViewport.ts +23 -0
- package/src/{components/Viewport → viewport}/types.ts +10 -1
- package/src/viewport/utils.ts +7 -0
- package/dist/dts/components/BackButton/index.d.ts +0 -2
- package/dist/dts/components/ClosingBehaviour/index.d.ts +0 -2
- package/dist/dts/components/ClosingBehaviour/types.d.ts +0 -7
- package/dist/dts/components/InitData/InitData.d.ts +0 -60
- package/dist/dts/components/InitData/index.d.ts +0 -1
- package/dist/dts/components/MainButton/MainButton.d.ts +0 -114
- package/dist/dts/components/MainButton/index.d.ts +0 -2
- package/dist/dts/components/MainButton/types.d.ts +0 -15
- package/dist/dts/components/Popup/index.d.ts +0 -2
- package/dist/dts/components/Popup/utils.d.ts +0 -7
- package/dist/dts/components/QRScanner/index.d.ts +0 -2
- package/dist/dts/components/ThemeParams/ThemeParams.d.ts +0 -73
- package/dist/dts/components/ThemeParams/index.d.ts +0 -2
- package/dist/dts/components/ThemeParams/types.d.ts +0 -9
- package/dist/dts/components/Viewport/index.d.ts +0 -2
- package/dist/dts/components/WebApp/WebApp.d.ts +0 -146
- package/dist/dts/components/WebApp/index.d.ts +0 -2
- package/dist/dts/components/WebApp/types.d.ts +0 -11
- package/dist/dts/components/index.d.ts +0 -11
- package/dist/dts/env.d.ts +0 -10
- package/dist/dts/errors/MethodNotSupportedError.d.ts +0 -6
- package/dist/dts/errors/ParameterNotSupportedError.d.ts +0 -6
- package/dist/dts/errors/index.d.ts +0 -2
- package/dist/dts/init/creators/createWebApp.d.ts +0 -16
- package/dist/dts/init/css.d.ts +0 -57
- package/dist/dts/supports.d.ts +0 -22
- package/dist/dts/types.d.ts +0 -10
- package/dist/dts/url.d.ts +0 -7
- package/src/components/BackButton/index.ts +0 -2
- package/src/components/ClosingBehaviour/index.ts +0 -6
- package/src/components/ClosingBehaviour/types.ts +0 -12
- package/src/components/InitData/InitData.ts +0 -139
- package/src/components/InitData/index.ts +0 -1
- package/src/components/MainButton/MainButton.ts +0 -242
- package/src/components/MainButton/index.ts +0 -2
- package/src/components/MainButton/types.ts +0 -20
- package/src/components/Popup/index.ts +0 -8
- package/src/components/QRScanner/index.ts +0 -2
- package/src/components/ThemeParams/ThemeParams.ts +0 -166
- package/src/components/ThemeParams/index.ts +0 -2
- package/src/components/ThemeParams/types.ts +0 -18
- package/src/components/Viewport/index.ts +0 -2
- package/src/components/WebApp/WebApp.ts +0 -311
- package/src/components/WebApp/index.ts +0 -2
- package/src/components/WebApp/types.ts +0 -17
- package/src/components/index.ts +0 -11
- package/src/env.ts +0 -22
- package/src/errors/MethodNotSupportedError.ts +0 -9
- package/src/errors/ParameterNotSupportedError.ts +0 -9
- package/src/errors/index.ts +0 -2
- package/src/init/creators/createWebApp.ts +0 -52
- package/src/init/css.ts +0 -166
- package/src/supports.ts +0 -44
- package/src/types.ts +0 -13
- package/src/url.ts +0 -23
- /package/dist/dts/{components/CloudStorage → cloud-storage}/index.d.ts +0 -0
- /package/dist/dts/{components/HapticFeedback → haptic-feedback}/index.d.ts +0 -0
- /package/src/{components/CloudStorage → cloud-storage}/index.ts +0 -0
- /package/src/{components/HapticFeedback → haptic-feedback}/index.ts +0 -0
|
@@ -1,114 +0,0 @@
|
|
|
1
|
-
import { type PostEvent } from '@tma.js/bridge';
|
|
2
|
-
import type { RGB } from '@tma.js/colors';
|
|
3
|
-
/**
|
|
4
|
-
* Controls the main button, which is displayed at the bottom
|
|
5
|
-
* of the Mini App in the Telegram interface.
|
|
6
|
-
*/
|
|
7
|
-
export declare class MainButton {
|
|
8
|
-
private readonly postEvent;
|
|
9
|
-
private readonly ee;
|
|
10
|
-
private readonly state;
|
|
11
|
-
constructor(backgroundColor: RGB, isEnabled: boolean, isVisible: boolean, isProgressVisible: boolean, text: string, textColor: RGB, postEvent?: PostEvent);
|
|
12
|
-
private set isEnabled(value);
|
|
13
|
-
/**
|
|
14
|
-
* Returns true in case, MainButton is currently enabled.
|
|
15
|
-
*/
|
|
16
|
-
get isEnabled(): boolean;
|
|
17
|
-
private set isProgressVisible(value);
|
|
18
|
-
/**
|
|
19
|
-
* Returns true in case, MainButton loading progress is currently visible.
|
|
20
|
-
*/
|
|
21
|
-
get isProgressVisible(): boolean;
|
|
22
|
-
private set isVisible(value);
|
|
23
|
-
/**
|
|
24
|
-
* Returns true in case, MainButton is currently visible.
|
|
25
|
-
*/
|
|
26
|
-
get isVisible(): boolean;
|
|
27
|
-
/**
|
|
28
|
-
* Sends current local button state to Telegram application.
|
|
29
|
-
*/
|
|
30
|
-
private commit;
|
|
31
|
-
/**
|
|
32
|
-
* Returns current main button background color.
|
|
33
|
-
*/
|
|
34
|
-
get backgroundColor(): RGB;
|
|
35
|
-
/**
|
|
36
|
-
* Returns current main button text.
|
|
37
|
-
*/
|
|
38
|
-
get text(): string;
|
|
39
|
-
/**
|
|
40
|
-
* Returns current main button text color.
|
|
41
|
-
*/
|
|
42
|
-
get textColor(): RGB;
|
|
43
|
-
/**
|
|
44
|
-
* Disables button. Returns current button instance for chaining.
|
|
45
|
-
*/
|
|
46
|
-
disable(): this;
|
|
47
|
-
/**
|
|
48
|
-
* Enables button. Returns current button instance for chaining.
|
|
49
|
-
*/
|
|
50
|
-
enable(): this;
|
|
51
|
-
/**
|
|
52
|
-
* Hides button. Returns current button instance for chaining.
|
|
53
|
-
*/
|
|
54
|
-
hide(): this;
|
|
55
|
-
/**
|
|
56
|
-
* Hides button progress. Returns current button instance for chaining.
|
|
57
|
-
*/
|
|
58
|
-
hideProgress(): this;
|
|
59
|
-
/**
|
|
60
|
-
* Adds new event listener.
|
|
61
|
-
* FIXME: Event 'main_button_pressed' is still being received on Android
|
|
62
|
-
* even if the main button is disabled.
|
|
63
|
-
* Issue: https://github.com/Telegram-Mini-Apps/tma.js/issues/3
|
|
64
|
-
* @param event - event name.
|
|
65
|
-
* @param listener - event listener.
|
|
66
|
-
*/
|
|
67
|
-
on: typeof this.ee.on;
|
|
68
|
-
/**
|
|
69
|
-
* Removes event listener.
|
|
70
|
-
* @param event - event name.
|
|
71
|
-
* @param listener - event listener.
|
|
72
|
-
*/
|
|
73
|
-
off: typeof this.ee.off;
|
|
74
|
-
/**
|
|
75
|
-
* Shows the button. Note that opening the Mini App from the attachment
|
|
76
|
-
* menu hides the main button until the user interacts with the Mini App
|
|
77
|
-
* interface.
|
|
78
|
-
*
|
|
79
|
-
* Returns current button instance for chaining.
|
|
80
|
-
*/
|
|
81
|
-
show(): this;
|
|
82
|
-
/**
|
|
83
|
-
* A method to show a loading indicator on the button.
|
|
84
|
-
* It is recommended to display loading progress if the action tied to the
|
|
85
|
-
* button may take a long time.
|
|
86
|
-
*
|
|
87
|
-
* Returns current button instance for chaining.
|
|
88
|
-
*/
|
|
89
|
-
showProgress(): this;
|
|
90
|
-
/**
|
|
91
|
-
* Sets new main button text. Returns current button instance for chaining.
|
|
92
|
-
* Minimal length for text is 1 symbol, and maximum is 64 symbols.
|
|
93
|
-
*
|
|
94
|
-
* Returns current button instance for chaining.
|
|
95
|
-
* @param value - new text.
|
|
96
|
-
*/
|
|
97
|
-
setText(value: string): this;
|
|
98
|
-
/**
|
|
99
|
-
* Sets new main button text color. Returns current button instance for
|
|
100
|
-
* chaining.
|
|
101
|
-
*
|
|
102
|
-
* Returns current button instance for chaining.
|
|
103
|
-
* @param value - new text color.
|
|
104
|
-
*/
|
|
105
|
-
setTextColor(value: RGB): this;
|
|
106
|
-
/**
|
|
107
|
-
* Updates current button color. Returns current button instance for
|
|
108
|
-
* chaining.
|
|
109
|
-
*
|
|
110
|
-
* Returns current button instance for chaining.
|
|
111
|
-
* @param value - color to set.
|
|
112
|
-
*/
|
|
113
|
-
setBackgroundColor(value: RGB): this;
|
|
114
|
-
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { RGB } from '@tma.js/colors';
|
|
2
|
-
import type { StateEvents } from '../../state/index.js';
|
|
3
|
-
export interface MainButtonState {
|
|
4
|
-
backgroundColor: RGB;
|
|
5
|
-
isEnabled: boolean;
|
|
6
|
-
isVisible: boolean;
|
|
7
|
-
isProgressVisible: boolean;
|
|
8
|
-
text: string;
|
|
9
|
-
textColor: RGB;
|
|
10
|
-
}
|
|
11
|
-
export interface MainButtonEvents extends StateEvents<MainButtonState> {
|
|
12
|
-
click: () => void;
|
|
13
|
-
}
|
|
14
|
-
export type MainButtonEventName = keyof MainButtonEvents;
|
|
15
|
-
export type MainButtonEventListener<E extends MainButtonEventName> = MainButtonEvents[E];
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { PopupParams as BridgePopupParams } from '@tma.js/bridge';
|
|
2
|
-
import type { PopupParams } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Prepares popup parameters before sending them to native app.
|
|
5
|
-
* @param params - popup parameters.
|
|
6
|
-
*/
|
|
7
|
-
export declare function preparePopupParams(params: PopupParams): BridgePopupParams;
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { type ThemeParams as ThemeParamsType } from '@tma.js/theme-params';
|
|
2
|
-
import { type RequestOptions } from '@tma.js/bridge';
|
|
3
|
-
import type { RGB } from '@tma.js/colors';
|
|
4
|
-
import type { ThemeParamsEvents } from './types.js';
|
|
5
|
-
/**
|
|
6
|
-
* Contains information about currently used theme by application.
|
|
7
|
-
* @see https://core.telegram.org/bots/webapps#themeparams
|
|
8
|
-
*/
|
|
9
|
-
export declare class ThemeParams {
|
|
10
|
-
/**
|
|
11
|
-
* Requests fresh information about current theme.
|
|
12
|
-
* FIXME: Be careful using this function in desktop version of Telegram as
|
|
13
|
-
* long as method web_app_request_theme does not work on `macos` platform.
|
|
14
|
-
* @param options - method options.
|
|
15
|
-
*/
|
|
16
|
-
static request(options?: RequestOptions): Promise<ThemeParamsType>;
|
|
17
|
-
/**
|
|
18
|
-
* Synchronizes specified instance of ThemeParams with the actual value in the native
|
|
19
|
-
* application.
|
|
20
|
-
* @param themeParams - ThemeParams instance.
|
|
21
|
-
*/
|
|
22
|
-
static sync(themeParams: ThemeParams): void;
|
|
23
|
-
/**
|
|
24
|
-
* Returns instance of ThemeParams which is synchronized with external
|
|
25
|
-
* environment.
|
|
26
|
-
* @param options - method options.
|
|
27
|
-
*/
|
|
28
|
-
static synced(options?: RequestOptions): Promise<ThemeParams>;
|
|
29
|
-
private readonly ee;
|
|
30
|
-
private readonly state;
|
|
31
|
-
constructor(params: ThemeParamsType);
|
|
32
|
-
/**
|
|
33
|
-
* Returns background color.
|
|
34
|
-
*/
|
|
35
|
-
get backgroundColor(): RGB | null;
|
|
36
|
-
/**
|
|
37
|
-
* Returns button color.
|
|
38
|
-
*/
|
|
39
|
-
get buttonColor(): RGB | null;
|
|
40
|
-
/**
|
|
41
|
-
* Returns button text color.
|
|
42
|
-
*/
|
|
43
|
-
get buttonTextColor(): RGB | null;
|
|
44
|
-
/**
|
|
45
|
-
* Returns hint color.
|
|
46
|
-
*/
|
|
47
|
-
get hintColor(): RGB | null;
|
|
48
|
-
/**
|
|
49
|
-
* Returns true in case, current color scheme is recognized as dark. This
|
|
50
|
-
* value is calculated according to theme background color.
|
|
51
|
-
*/
|
|
52
|
-
get isDark(): boolean;
|
|
53
|
-
/**
|
|
54
|
-
* Returns current link color.
|
|
55
|
-
*/
|
|
56
|
-
get linkColor(): RGB | null;
|
|
57
|
-
/**
|
|
58
|
-
* Adds new event listener.
|
|
59
|
-
*/
|
|
60
|
-
on: <E extends "changed" | "backgroundColorChanged" | "textColorChanged" | "accentTextColorChanged" | "buttonColorChanged" | "buttonTextColorChanged" | "destructiveTextColorChanged" | "headerBackgroundColorChanged" | "hintColorChanged" | "linkColorChanged" | "secondaryBackgroundColorChanged" | "sectionBackgroundColorChanged" | "sectionHeaderTextColorChanged" | "subtitleTextColorChanged">(event: E, listener: import("@tma.js/event-emitter").EventListener<ThemeParamsEvents[E]>) => import("@tma.js/event-emitter").RemoveEventListener;
|
|
61
|
-
/**
|
|
62
|
-
* Removes event listener.
|
|
63
|
-
*/
|
|
64
|
-
off: <E extends "changed" | "backgroundColorChanged" | "textColorChanged" | "accentTextColorChanged" | "buttonColorChanged" | "buttonTextColorChanged" | "destructiveTextColorChanged" | "headerBackgroundColorChanged" | "hintColorChanged" | "linkColorChanged" | "secondaryBackgroundColorChanged" | "sectionBackgroundColorChanged" | "sectionHeaderTextColorChanged" | "subtitleTextColorChanged">(event: E, listener: import("@tma.js/event-emitter").EventListener<ThemeParamsEvents[E]>) => void;
|
|
65
|
-
/**
|
|
66
|
-
* Returns secondary background color.
|
|
67
|
-
*/
|
|
68
|
-
get secondaryBackgroundColor(): RGB | null;
|
|
69
|
-
/**
|
|
70
|
-
* Returns text color.
|
|
71
|
-
*/
|
|
72
|
-
get textColor(): RGB | null;
|
|
73
|
-
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { HasUndefined, If } from '@tma.js/util-types';
|
|
2
|
-
import type { ThemeParams } from '@tma.js/theme-params';
|
|
3
|
-
import type { StateEvents } from '../../state/index.js';
|
|
4
|
-
export type ThemeParamsState = {
|
|
5
|
-
[K in keyof ThemeParams]-?: If<HasUndefined<ThemeParams[K]>, Exclude<ThemeParams[K], undefined> | null, ThemeParams[K]>;
|
|
6
|
-
};
|
|
7
|
-
export type ThemeParamsEvents = StateEvents<ThemeParamsState>;
|
|
8
|
-
export type ThemeParamsEventName = keyof ThemeParamsEvents;
|
|
9
|
-
export type ThemeParamsEventListener<E extends ThemeParamsEventName> = ThemeParamsEvents[E];
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { type Version } from '@tma.js/utils';
|
|
2
|
-
import { type RGB } from '@tma.js/colors';
|
|
3
|
-
import { type PhoneRequestedStatus, type WriteAccessRequestedStatus, type InvoiceStatus, type PostEvent } from '@tma.js/bridge';
|
|
4
|
-
import type { Platform } from '@tma.js/launch-params';
|
|
5
|
-
import { type SupportsFunc } from '../../supports.js';
|
|
6
|
-
import type { ColorScheme } from '../../types.js';
|
|
7
|
-
import type { WebAppEvents, WebAppHeaderColor } from './types.js';
|
|
8
|
-
/**
|
|
9
|
-
* Provides common Mini Apps functionality not covered by other system
|
|
10
|
-
* components.
|
|
11
|
-
*/
|
|
12
|
-
export declare class WebApp {
|
|
13
|
-
private readonly currentVersion;
|
|
14
|
-
private readonly currentPlatform;
|
|
15
|
-
private readonly createRequestId;
|
|
16
|
-
private readonly postEvent;
|
|
17
|
-
private readonly ee;
|
|
18
|
-
private readonly state;
|
|
19
|
-
constructor(headerColor: WebAppHeaderColor, backgroundColor: RGB, currentVersion: Version, currentPlatform: Platform, createRequestId: () => string, postEvent?: PostEvent);
|
|
20
|
-
/**
|
|
21
|
-
* Returns current application background color.
|
|
22
|
-
*/
|
|
23
|
-
get backgroundColor(): RGB;
|
|
24
|
-
/**
|
|
25
|
-
* Returns current application color scheme. This value is
|
|
26
|
-
* computed based on the current background color.
|
|
27
|
-
*/
|
|
28
|
-
get colorScheme(): ColorScheme;
|
|
29
|
-
/**
|
|
30
|
-
* Closes the Mini App.
|
|
31
|
-
*/
|
|
32
|
-
close(): void;
|
|
33
|
-
/**
|
|
34
|
-
* Returns current application header color.
|
|
35
|
-
*/
|
|
36
|
-
get headerColor(): WebAppHeaderColor;
|
|
37
|
-
/**
|
|
38
|
-
* Returns true if passed version is more than or equal to current
|
|
39
|
-
* Mini App version.
|
|
40
|
-
* @param version - compared version.
|
|
41
|
-
*/
|
|
42
|
-
isVersionAtLeast(version: Version): boolean;
|
|
43
|
-
/**
|
|
44
|
-
* Opens a link in an external browser. The Mini App will not be closed.
|
|
45
|
-
*
|
|
46
|
-
* Note that this method can be called only in response to the user
|
|
47
|
-
* interaction with the Mini App interface (e.g. click inside the Mini App
|
|
48
|
-
* or on the main button).
|
|
49
|
-
* @param url - URL to be opened.
|
|
50
|
-
* @param tryInstantView
|
|
51
|
-
*/
|
|
52
|
-
openLink(url: string, tryInstantView?: boolean): void;
|
|
53
|
-
/**
|
|
54
|
-
* Opens a Telegram link inside Telegram app. The Mini App will be closed.
|
|
55
|
-
* It expects passing link in full format, with hostname "t.me".
|
|
56
|
-
* @param url - URL to be opened.
|
|
57
|
-
* @throws {Error} URL has not allowed hostname.
|
|
58
|
-
*/
|
|
59
|
-
openTelegramLink(url: string): void;
|
|
60
|
-
/**
|
|
61
|
-
* Opens an invoice using its url. It expects passing link in full format,
|
|
62
|
-
* with hostname "t.me".
|
|
63
|
-
* @param url - invoice URL.
|
|
64
|
-
*/
|
|
65
|
-
openInvoice(url: string): Promise<InvoiceStatus>;
|
|
66
|
-
/**
|
|
67
|
-
* Adds new event listener.
|
|
68
|
-
*/
|
|
69
|
-
on: <E extends "changed" | "backgroundColorChanged" | "headerColorChanged">(event: E, listener: import("@tma.js/event-emitter").EventListener<WebAppEvents[E]>) => import("@tma.js/event-emitter").RemoveEventListener;
|
|
70
|
-
/**
|
|
71
|
-
* Removes event listener.
|
|
72
|
-
*/
|
|
73
|
-
off: <E extends "changed" | "backgroundColorChanged" | "headerColorChanged">(event: E, listener: import("@tma.js/event-emitter").EventListener<WebAppEvents[E]>) => void;
|
|
74
|
-
/**
|
|
75
|
-
* Returns current Mini App platform.
|
|
76
|
-
*/
|
|
77
|
-
get platform(): Platform;
|
|
78
|
-
/**
|
|
79
|
-
* Informs the Telegram app that the Mini App is ready to be displayed.
|
|
80
|
-
*
|
|
81
|
-
* It is recommended to call this method as early as possible, as soon as
|
|
82
|
-
* all essential interface elements loaded. Once this method called,
|
|
83
|
-
* the loading placeholder is hidden and the Mini App shown.
|
|
84
|
-
*
|
|
85
|
-
* If the method not called, the placeholder will be hidden only when
|
|
86
|
-
* the page fully loaded.
|
|
87
|
-
*/
|
|
88
|
-
ready(): void;
|
|
89
|
-
/**
|
|
90
|
-
* Reads text from clipboard and returns string or null. null is returned
|
|
91
|
-
* in cases:
|
|
92
|
-
* - Value in clipboard is not text
|
|
93
|
-
* - Access to clipboard is not allowed
|
|
94
|
-
*/
|
|
95
|
-
readTextFromClipboard(): Promise<string | null>;
|
|
96
|
-
/**
|
|
97
|
-
* Requests current user phone access.
|
|
98
|
-
*/
|
|
99
|
-
requestPhoneAccess(): Promise<PhoneRequestedStatus>;
|
|
100
|
-
/**
|
|
101
|
-
* Requests write message access to current user.
|
|
102
|
-
*/
|
|
103
|
-
requestWriteAccess(): Promise<WriteAccessRequestedStatus>;
|
|
104
|
-
/**
|
|
105
|
-
* A method used to send data to the bot. When this method called, a
|
|
106
|
-
* service message sent to the bot containing the data of the
|
|
107
|
-
* length up to 4096 bytes, and the Mini App closed. See the field
|
|
108
|
-
* `web_app_data` in the class Message.
|
|
109
|
-
*
|
|
110
|
-
* This method is only available for Mini Apps launched via a Keyboard button.
|
|
111
|
-
* @param data - data to send to bot.
|
|
112
|
-
* @throws {Error} data has incorrect size.
|
|
113
|
-
*/
|
|
114
|
-
sendData(data: string): void;
|
|
115
|
-
/**
|
|
116
|
-
* Updates current application header color.
|
|
117
|
-
* FIXME: Has no effect on desktop, works incorrectly on Android.
|
|
118
|
-
* Issues:
|
|
119
|
-
* https://github.com/Telegram-Mini-Apps/tma.js/issues/9
|
|
120
|
-
* https://github.com/Telegram-Mini-Apps/tma.js/issues/8
|
|
121
|
-
* @param color - color key or RGB color.
|
|
122
|
-
*/
|
|
123
|
-
setHeaderColor(color: WebAppHeaderColor): void;
|
|
124
|
-
/**
|
|
125
|
-
* Updates current application background color.
|
|
126
|
-
* FIXME: Has no effect on desktop, works incorrectly in Android.
|
|
127
|
-
* Issues:
|
|
128
|
-
* https://github.com/Telegram-Mini-Apps/tma.js/issues/9
|
|
129
|
-
* https://github.com/Telegram-Mini-Apps/tma.js/issues/8
|
|
130
|
-
* @param color - RGB color.
|
|
131
|
-
*/
|
|
132
|
-
setBackgroundColor(color: RGB): void;
|
|
133
|
-
/**
|
|
134
|
-
* Checks if specified method is supported by current component.
|
|
135
|
-
*/
|
|
136
|
-
supports: SupportsFunc<'openInvoice' | 'readTextFromClipboard' | 'setHeaderColor' | 'setBackgroundColor' | 'requestWriteAccess' | 'requestPhoneAccess'>;
|
|
137
|
-
/**
|
|
138
|
-
* Checks if specified method parameter is supported by current component.
|
|
139
|
-
*/
|
|
140
|
-
supportsParam: SupportsFunc<'setHeaderColor.color' | 'openLink.tryInstantView'>;
|
|
141
|
-
/**
|
|
142
|
-
* Current Mini App version. This property is used by other components to check if
|
|
143
|
-
* some functionality is available on current device.
|
|
144
|
-
*/
|
|
145
|
-
get version(): Version;
|
|
146
|
-
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { RGB } from '@tma.js/colors';
|
|
2
|
-
import type { HeaderColorKey } from '@tma.js/bridge';
|
|
3
|
-
import type { StateEvents } from '../../state/index.js';
|
|
4
|
-
export type WebAppHeaderColor = HeaderColorKey | RGB;
|
|
5
|
-
export interface WebAppState {
|
|
6
|
-
backgroundColor: RGB;
|
|
7
|
-
headerColor: WebAppHeaderColor;
|
|
8
|
-
}
|
|
9
|
-
export type WebAppEvents = StateEvents<WebAppState>;
|
|
10
|
-
export type WebAppEventName = keyof WebAppEvents;
|
|
11
|
-
export type WebAppEventListener<E extends WebAppEventName> = WebAppEvents[E];
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './BackButton/index.js';
|
|
2
|
-
export * from './ClosingBehaviour/index.js';
|
|
3
|
-
export * from './CloudStorage/index.js';
|
|
4
|
-
export * from './HapticFeedback/index.js';
|
|
5
|
-
export * from './InitData/index.js';
|
|
6
|
-
export * from './MainButton/index.js';
|
|
7
|
-
export * from './Popup/index.js';
|
|
8
|
-
export * from './QRScanner/index.js';
|
|
9
|
-
export * from './ThemeParams/index.js';
|
|
10
|
-
export * from './Viewport/index.js';
|
|
11
|
-
export * from './WebApp/index.js';
|
package/dist/dts/env.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Returns true in case, current environment is Telegram Mini Apps.
|
|
3
|
-
*/
|
|
4
|
-
export declare function isTMA(): boolean;
|
|
5
|
-
/**
|
|
6
|
-
* Returns true in case, current environment is Telegram Mini Apps.
|
|
7
|
-
* @see computeLaunchData
|
|
8
|
-
* @deprecated Use `isTMA`
|
|
9
|
-
*/
|
|
10
|
-
export declare function isTWA(): boolean;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { RGB } from '@tma.js/colors';
|
|
2
|
-
import type { PostEvent } from '@tma.js/bridge';
|
|
3
|
-
import type { Platform } from '@tma.js/launch-params';
|
|
4
|
-
import { WebApp } from '../../components/index.js';
|
|
5
|
-
import type { CreateRequestIdFunc } from '../../types.js';
|
|
6
|
-
/**
|
|
7
|
-
* Creates WebApp 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 platform - Telegram Mini Apps platform name.
|
|
13
|
-
* @param createRequestId - function which generates request identifiers.
|
|
14
|
-
* @param postEvent - Bridge postEvent function
|
|
15
|
-
*/
|
|
16
|
-
export declare function createWebApp(isPageReload: boolean, backgroundColor: RGB, version: string, platform: Platform, createRequestId: CreateRequestIdFunc, postEvent: PostEvent): WebApp;
|
package/dist/dts/init/css.d.ts
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import type { ThemeParams, WebApp, Viewport } from '../components/index.js';
|
|
2
|
-
import type { InitCSSVarsOption, InitCSSVarsSpecificOption } from './types.js';
|
|
3
|
-
/**
|
|
4
|
-
* Creates CSS variables connected with theme parameters.
|
|
5
|
-
*
|
|
6
|
-
* Created variables:
|
|
7
|
-
* - `--tg-theme-bg-color`
|
|
8
|
-
* - `--tg-theme-button-color`
|
|
9
|
-
* - `--tg-theme-button-text-color`
|
|
10
|
-
* - `--tg-theme-hint-color`
|
|
11
|
-
* - `--tg-theme-link-color`
|
|
12
|
-
* - `--tg-theme-secondary-bg-color`
|
|
13
|
-
* - `--tg-theme-text-color`
|
|
14
|
-
*
|
|
15
|
-
* Variables are being automatically updated in case, corresponding properties
|
|
16
|
-
* updated in passed ThemeParams instance.
|
|
17
|
-
*
|
|
18
|
-
* @param themeParams - ThemeParams instance.
|
|
19
|
-
*/
|
|
20
|
-
export declare function bindThemeCSSVariables(themeParams: ThemeParams): void;
|
|
21
|
-
/**
|
|
22
|
-
* Creates CSS variables connected with WebApp background and header colors based on
|
|
23
|
-
* passed WebApp and ThemeParams instances.
|
|
24
|
-
*
|
|
25
|
-
* Created variables:
|
|
26
|
-
* - `--tg-bg-color`
|
|
27
|
-
* - `--tg-header-color`
|
|
28
|
-
*
|
|
29
|
-
* Variables are being automatically updated in case, corresponding properties are updating.
|
|
30
|
-
*
|
|
31
|
-
* @param webApp - WebApp instance.
|
|
32
|
-
* @param themeParams - ThemeParams instance.
|
|
33
|
-
*/
|
|
34
|
-
export declare function bindWebAppVariables(webApp: WebApp, themeParams: ThemeParams): void;
|
|
35
|
-
/**
|
|
36
|
-
* Accepts Viewport instance and sets CSS variables connected with viewport
|
|
37
|
-
* sizes.
|
|
38
|
-
*
|
|
39
|
-
* Be careful using this function as long as it can impact application
|
|
40
|
-
* performance. Viewport size is changing rather often, this makes CSS
|
|
41
|
-
* variables update, which leads to possible layout redraw.
|
|
42
|
-
*
|
|
43
|
-
* Variables:
|
|
44
|
-
* - `--tg-viewport-height`
|
|
45
|
-
* - `--tg-viewport-stable-height`
|
|
46
|
-
*
|
|
47
|
-
* Variables are being automatically updated in case, corresponding properties
|
|
48
|
-
* updated in passed Viewport instance.
|
|
49
|
-
*
|
|
50
|
-
* @param viewport - Viewport instance.
|
|
51
|
-
*/
|
|
52
|
-
export declare function bindViewportCSSVariables(viewport: Viewport): void;
|
|
53
|
-
/**
|
|
54
|
-
* Converts init cssVars option to more narrow type.
|
|
55
|
-
* @param option - option value.
|
|
56
|
-
*/
|
|
57
|
-
export declare function parseCSSVarsOptions(option: InitCSSVarsOption): InitCSSVarsSpecificOption;
|
package/dist/dts/supports.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { Version } from '@tma.js/utils';
|
|
2
|
-
import { type MethodName, type MethodVersionedParams, type MethodWithVersionedParams } from '@tma.js/bridge';
|
|
3
|
-
export type SupportsFunc<M extends string> = (method: M) => boolean;
|
|
4
|
-
type HasCheckSupportMethodTuple = {
|
|
5
|
-
[M in MethodWithVersionedParams]: [M, MethodVersionedParams<M>];
|
|
6
|
-
}[MethodWithVersionedParams];
|
|
7
|
-
/**
|
|
8
|
-
* Returns function, which accepts predefined method name and checks if it is supported
|
|
9
|
-
* via passed schema and version.
|
|
10
|
-
* @param schema - object which contains methods names and TWA method as a dependency.
|
|
11
|
-
* @param version - platform version.
|
|
12
|
-
*/
|
|
13
|
-
export declare function createSupportsFunc<M extends string>(version: Version, schema: Record<M, MethodName>): SupportsFunc<M>;
|
|
14
|
-
/**
|
|
15
|
-
* Returns function, which accepts predefined method name and checks if it is supported
|
|
16
|
-
* via passed schema and version.
|
|
17
|
-
* @param schema - object which contains methods names and TWA methods with specified parameter
|
|
18
|
-
* as a dependency.
|
|
19
|
-
* @param version - platform version.
|
|
20
|
-
*/
|
|
21
|
-
export declare function createSupportsParamFunc<P extends string>(version: Version, schema: Record<P, HasCheckSupportMethodTuple>): SupportsFunc<P>;
|
|
22
|
-
export {};
|
package/dist/dts/types.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { PostEvent as BridgePostEvent } from '@tma.js/bridge';
|
|
2
|
-
export type PostEvent = BridgePostEvent;
|
|
3
|
-
/**
|
|
4
|
-
* Color scheme.
|
|
5
|
-
*/
|
|
6
|
-
export type ColorScheme = 'dark' | 'light';
|
|
7
|
-
/**
|
|
8
|
-
* Function which generates unique request identifiers.
|
|
9
|
-
*/
|
|
10
|
-
export type CreateRequestIdFunc = () => string;
|
package/dist/dts/url.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { StateEvents } from '../../state/index.js';
|
|
2
|
-
|
|
3
|
-
export interface ClosingBehaviourState {
|
|
4
|
-
isConfirmationNeeded: boolean;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export type ClosingBehaviourEvents = StateEvents<ClosingBehaviourState>;
|
|
8
|
-
|
|
9
|
-
export type ClosingBehaviourEventName = keyof ClosingBehaviourEvents;
|
|
10
|
-
|
|
11
|
-
export type ClosingBehaviourEventListener<E extends ClosingBehaviourEventName> =
|
|
12
|
-
ClosingBehaviourEvents[E];
|