@tma.js/sdk 2.7.0 → 3.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/LICENSE +1 -1
- package/README.md +9 -9
- package/dist/dts/composables/AsyncMountable.d.ts +44 -0
- package/dist/dts/composables/Button.d.ts +140 -0
- package/dist/dts/composables/Mountable.d.ts +43 -0
- package/dist/dts/composables/Stateful.d.ts +35 -0
- package/dist/dts/errors.d.ts +41 -0
- package/dist/dts/features/BackButton/BackButton.d.ts +96 -0
- package/dist/dts/features/BackButton/exports.d.ts +2 -0
- package/dist/dts/features/BackButton/instance.d.ts +2 -0
- package/dist/dts/features/Biometry/Biometry.d.ts +122 -0
- package/dist/dts/features/Biometry/exports.d.ts +3 -0
- package/dist/dts/features/Biometry/instance.d.ts +2 -0
- package/dist/dts/features/Biometry/types.d.ts +84 -0
- package/dist/dts/features/ClosingBehavior/ClosingBehavior.d.ts +51 -0
- package/dist/dts/features/ClosingBehavior/exports.d.ts +2 -0
- package/dist/dts/features/ClosingBehavior/instance.d.ts +2 -0
- package/dist/dts/features/CloudStorage/CloudStorage.d.ts +90 -0
- package/dist/dts/features/CloudStorage/exports.d.ts +2 -0
- package/dist/dts/features/CloudStorage/instance.d.ts +2 -0
- package/dist/dts/features/HapticFeedback/HapticFeedback.d.ts +57 -0
- package/dist/dts/features/HapticFeedback/exports.d.ts +2 -0
- package/dist/dts/features/HapticFeedback/instance.d.ts +2 -0
- package/dist/dts/features/InitData/InitData.d.ts +84 -0
- package/dist/dts/features/InitData/exports.d.ts +2 -0
- package/dist/dts/features/InitData/instance.d.ts +2 -0
- package/dist/dts/features/Invoice/Invoice.d.ts +54 -0
- package/dist/dts/features/Invoice/exports.d.ts +2 -0
- package/dist/dts/features/Invoice/instance.d.ts +2 -0
- package/dist/dts/features/LocationManager/LocationManager.d.ts +74 -0
- package/dist/dts/features/LocationManager/exports.d.ts +3 -0
- package/dist/dts/features/LocationManager/instance.d.ts +2 -0
- package/dist/dts/features/LocationManager/types.d.ts +65 -0
- package/dist/dts/features/MainButton/MainButton.d.ts +214 -0
- package/dist/dts/features/MainButton/exports.d.ts +2 -0
- package/dist/dts/features/MainButton/instance.d.ts +2 -0
- package/dist/dts/features/MiniApp/MiniApp.d.ts +192 -0
- package/dist/dts/features/MiniApp/exports.d.ts +2 -0
- package/dist/dts/features/MiniApp/instance.d.ts +2 -0
- package/dist/dts/features/Popup/Popup.d.ts +56 -0
- package/dist/dts/features/Popup/exports.d.ts +3 -0
- package/dist/dts/features/Popup/instance.d.ts +2 -0
- package/dist/dts/features/Popup/prepareParams.d.ts +9 -0
- package/dist/dts/{components → features}/Popup/types.d.ts +5 -12
- package/dist/dts/features/QrScanner/QrScanner.d.ts +132 -0
- package/dist/dts/features/QrScanner/exports.d.ts +2 -0
- package/dist/dts/features/QrScanner/instance.d.ts +2 -0
- package/dist/dts/features/SecondaryButton/SecondaryButton.d.ts +253 -0
- package/dist/dts/features/SecondaryButton/exports.d.ts +2 -0
- package/dist/dts/features/SecondaryButton/instance.d.ts +2 -0
- package/dist/dts/features/SettingsButton/SettingsButton.d.ts +96 -0
- package/dist/dts/features/SettingsButton/exports.d.ts +2 -0
- package/dist/dts/features/SettingsButton/instance.d.ts +2 -0
- package/dist/dts/features/SwipeBehavior/SwipeBehavior.d.ts +62 -0
- package/dist/dts/features/SwipeBehavior/exports.d.ts +2 -0
- package/dist/dts/features/SwipeBehavior/instance.d.ts +2 -0
- package/dist/dts/features/ThemeParams/ThemeParams.d.ts +127 -0
- package/dist/dts/features/ThemeParams/exports.d.ts +2 -0
- package/dist/dts/features/ThemeParams/instance.d.ts +2 -0
- package/dist/dts/features/Viewport/Viewport.d.ts +220 -0
- package/dist/dts/features/Viewport/exports.d.ts +2 -0
- package/dist/dts/features/Viewport/instance.d.ts +2 -0
- package/dist/dts/features/emoji-status/exports.d.ts +2 -0
- package/dist/dts/features/emoji-status/requestEmojiStatusAccess.d.ts +16 -0
- package/dist/dts/features/emoji-status/setEmojiStatus.d.ts +28 -0
- package/dist/dts/features/home-screen/addToHomeScreen.d.ts +11 -0
- package/dist/dts/features/home-screen/checkHomeScreenStatus.d.ts +14 -0
- package/dist/dts/features/home-screen/exports.d.ts +2 -0
- package/dist/dts/features/links/exports.d.ts +3 -0
- package/dist/dts/features/links/openLink.d.ts +31 -0
- package/dist/dts/features/links/openTelegramLink.d.ts +18 -0
- package/dist/dts/features/links/shareURL.d.ts +18 -0
- package/dist/dts/features/privacy/exports.d.ts +3 -0
- package/dist/dts/features/privacy/requestContact.d.ts +59 -0
- package/dist/dts/features/privacy/requestPhoneAccess.d.ts +19 -0
- package/dist/dts/features/privacy/requestWriteAccess.d.ts +14 -0
- package/dist/dts/features/uncategorized/copyTextToClipboard.d.ts +5 -0
- package/dist/dts/features/uncategorized/downloadFile.d.ts +21 -0
- package/dist/dts/features/uncategorized/exports.d.ts +11 -0
- package/dist/dts/features/uncategorized/getCurrentTime.d.ts +15 -0
- package/dist/dts/features/uncategorized/hideKeyboard.d.ts +13 -0
- package/dist/dts/features/uncategorized/readTextFromClipboard.d.ts +13 -0
- package/dist/dts/features/uncategorized/retrieveAndroidDeviceData.d.ts +6 -0
- package/dist/dts/features/uncategorized/retrieveAndroidDeviceDataFrom.d.ts +14 -0
- package/dist/dts/features/uncategorized/sendData.d.ts +20 -0
- package/dist/dts/features/uncategorized/shareMessage.d.ts +14 -0
- package/dist/dts/features/uncategorized/shareStory.d.ts +50 -0
- package/dist/dts/features/uncategorized/switchInlineQuery.d.ts +28 -0
- package/dist/dts/fn-options/bottomButtonOptions.d.ts +11 -0
- package/dist/dts/fn-options/buttonOptions.d.ts +10 -0
- package/dist/dts/fn-options/createFnOption.d.ts +2 -0
- package/dist/dts/fn-options/sharedFeatureOptions.d.ts +8 -0
- package/dist/dts/fn-options/withInvokeCustomMethod.d.ts +11 -0
- package/dist/dts/fn-options/withPostEvent.d.ts +8 -0
- package/dist/dts/fn-options/withRequest.d.ts +8 -0
- package/dist/dts/fn-options/withStateRestore.d.ts +13 -0
- package/dist/dts/fn-options/withVersion.d.ts +9 -0
- package/dist/dts/globals/createRequestId.d.ts +4 -0
- package/dist/dts/globals/inline-mode.d.ts +4 -0
- package/dist/dts/globals/invokeCustomMethod.d.ts +16 -0
- package/dist/dts/globals/post-event.d.ts +4 -0
- package/dist/dts/globals/request.d.ts +3 -0
- package/dist/dts/globals/resetGlobals.d.ts +4 -0
- package/dist/dts/globals/signals-registry.d.ts +39 -0
- package/dist/dts/globals/themeParams.d.ts +4 -0
- package/dist/dts/globals/version.d.ts +4 -0
- package/dist/dts/helpers/access.d.ts +2 -0
- package/dist/dts/helpers/component-storage.d.ts +9 -0
- package/dist/dts/helpers/createIsSupportedSignal.d.ts +5 -0
- package/dist/dts/helpers/css-vars.d.ts +11 -0
- package/dist/dts/helpers/isColorDark.d.ts +11 -0
- package/dist/dts/{navigation/isPageReload.d.ts → helpers/navigation.d.ts} +1 -1
- package/dist/dts/helpers/removeUndefined.d.ts +10 -0
- package/dist/dts/helpers/shallowEqual.d.ts +1 -0
- package/dist/dts/index.d.ts +33 -168
- package/dist/dts/init.d.ts +42 -0
- package/dist/dts/types.d.ts +6 -0
- package/dist/dts/with-checks/throwifyWithChecksFp.d.ts +3 -0
- package/dist/dts/with-checks/withChecksFp.d.ts +172 -0
- package/dist/index.cjs +1 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.iife.js +3 -3
- package/dist/index.iife.js.map +1 -1
- package/dist/index.js +3811 -2897
- package/dist/index.js.map +1 -1
- package/package.json +15 -5
- package/dist/dts/bridge/captureSameReq.d.ts +0 -10
- package/dist/dts/bridge/events/event-emitter/createMiniAppsEventEmitter.d.ts +0 -15
- package/dist/dts/bridge/events/event-emitter/singleton.d.ts +0 -8
- package/dist/dts/bridge/events/event-handlers/cleanupEventHandlers.d.ts +0 -4
- package/dist/dts/bridge/events/event-handlers/defineEventHandlers.d.ts +0 -6
- package/dist/dts/bridge/events/event-handlers/emitMiniAppsEvent.d.ts +0 -9
- package/dist/dts/bridge/events/listening/off.d.ts +0 -8
- package/dist/dts/bridge/events/listening/on.d.ts +0 -12
- package/dist/dts/bridge/events/listening/subscribe.d.ts +0 -9
- package/dist/dts/bridge/events/listening/unsubscribe.d.ts +0 -7
- package/dist/dts/bridge/events/types.d.ts +0 -302
- package/dist/dts/bridge/invokeCustomMethod.d.ts +0 -23
- package/dist/dts/bridge/methods/createPostEvent.d.ts +0 -14
- package/dist/dts/bridge/methods/postEvent.d.ts +0 -40
- package/dist/dts/bridge/methods/types/custom-methods.d.ts +0 -57
- package/dist/dts/bridge/methods/types/haptic.d.ts +0 -40
- package/dist/dts/bridge/methods/types/index.d.ts +0 -4
- package/dist/dts/bridge/methods/types/methods.d.ts +0 -392
- package/dist/dts/bridge/methods/types/popup.d.ts +0 -49
- package/dist/dts/bridge/parseMessage.d.ts +0 -18
- package/dist/dts/bridge/request.d.ts +0 -53
- package/dist/dts/bridge/target-origin.d.ts +0 -18
- package/dist/dts/classes/State/State.d.ts +0 -46
- package/dist/dts/classes/State/types.d.ts +0 -29
- package/dist/dts/classes/WithStateUtils.d.ts +0 -18
- package/dist/dts/classes/WithSupports.d.ts +0 -19
- package/dist/dts/classes/WithSupportsAndStateUtils.d.ts +0 -24
- package/dist/dts/classes/WithSupportsAndTrackableState.d.ts +0 -16
- package/dist/dts/classes/WithTrackableState.d.ts +0 -16
- package/dist/dts/classnames/classNames.d.ts +0 -12
- package/dist/dts/classnames/mergeClassNames.d.ts +0 -14
- package/dist/dts/colors/isColorDark.d.ts +0 -6
- package/dist/dts/colors/isRGB.d.ts +0 -7
- package/dist/dts/colors/isRGBShort.d.ts +0 -7
- package/dist/dts/colors/toRGB.d.ts +0 -12
- package/dist/dts/colors/types.d.ts +0 -8
- package/dist/dts/components/BackButton/BackButton.d.ts +0 -41
- package/dist/dts/components/BackButton/initBackButton.d.ts +0 -7
- package/dist/dts/components/BackButton/types.d.ts +0 -25
- package/dist/dts/components/BiometryManager/BiometryManager.d.ts +0 -61
- package/dist/dts/components/BiometryManager/formatEvent.d.ts +0 -34
- package/dist/dts/components/BiometryManager/initBiometryManager.d.ts +0 -7
- package/dist/dts/components/BiometryManager/requestBiometryInfo.d.ts +0 -8
- package/dist/dts/components/BiometryManager/types.d.ts +0 -40
- package/dist/dts/components/ClosingBehavior/ClosingBehavior.d.ts +0 -26
- package/dist/dts/components/ClosingBehavior/initClosingBehavior.d.ts +0 -7
- package/dist/dts/components/ClosingBehavior/types.d.ts +0 -20
- package/dist/dts/components/CloudStorage/CloudStorage.d.ts +0 -47
- package/dist/dts/components/CloudStorage/initCloudStorage.d.ts +0 -7
- package/dist/dts/components/HapticFeedback/HapticFeedback.d.ts +0 -34
- package/dist/dts/components/HapticFeedback/initHapticFeedback.d.ts +0 -7
- package/dist/dts/components/InitData/InitData.d.ts +0 -55
- package/dist/dts/components/InitData/initInitData.d.ts +0 -7
- package/dist/dts/components/InitData/parseInitData.d.ts +0 -7
- package/dist/dts/components/InitData/parsers/chat.d.ts +0 -3
- package/dist/dts/components/InitData/parsers/initData.d.ts +0 -7
- package/dist/dts/components/InitData/parsers/user.d.ts +0 -3
- package/dist/dts/components/InitData/types.d.ts +0 -132
- package/dist/dts/components/Invoice/Invoice.d.ts +0 -31
- package/dist/dts/components/Invoice/initInvoice.d.ts +0 -7
- package/dist/dts/components/Invoice/types.d.ts +0 -20
- package/dist/dts/components/MainButton/MainButton.d.ts +0 -106
- package/dist/dts/components/MainButton/initMainButton.d.ts +0 -7
- package/dist/dts/components/MainButton/types.d.ts +0 -40
- package/dist/dts/components/MiniApp/MiniApp.d.ts +0 -121
- package/dist/dts/components/MiniApp/initMiniApp.d.ts +0 -7
- package/dist/dts/components/MiniApp/parsing/contact.d.ts +0 -7
- package/dist/dts/components/MiniApp/types.d.ts +0 -53
- package/dist/dts/components/Popup/Popup.d.ts +0 -30
- package/dist/dts/components/Popup/initPopup.d.ts +0 -7
- package/dist/dts/components/Popup/preparePopupParams.d.ts +0 -8
- package/dist/dts/components/QRScanner/QRScanner.d.ts +0 -33
- package/dist/dts/components/QRScanner/initQRScanner.d.ts +0 -7
- package/dist/dts/components/QRScanner/types.d.ts +0 -31
- package/dist/dts/components/SettingsButton/SettingsButton.d.ts +0 -37
- package/dist/dts/components/SettingsButton/initSettingsButton.d.ts +0 -7
- package/dist/dts/components/SettingsButton/types.d.ts +0 -25
- package/dist/dts/components/ThemeParams/ThemeParams.d.ts +0 -57
- package/dist/dts/components/ThemeParams/initThemeParams.d.ts +0 -7
- package/dist/dts/components/ThemeParams/keys.d.ts +0 -11
- package/dist/dts/components/ThemeParams/parsing/parseThemeParams.d.ts +0 -7
- package/dist/dts/components/ThemeParams/parsing/serializeThemeParams.d.ts +0 -6
- package/dist/dts/components/ThemeParams/parsing/themeParams.d.ts +0 -4
- package/dist/dts/components/ThemeParams/requestThemeParams.d.ts +0 -8
- package/dist/dts/components/ThemeParams/types.d.ts +0 -29
- package/dist/dts/components/Utils/Utils.d.ts +0 -77
- package/dist/dts/components/Utils/initUtils.d.ts +0 -7
- package/dist/dts/components/Viewport/Viewport.d.ts +0 -77
- package/dist/dts/components/Viewport/initViewport.d.ts +0 -7
- package/dist/dts/components/Viewport/requestViewport.d.ts +0 -13
- package/dist/dts/components/Viewport/types.d.ts +0 -35
- package/dist/dts/css-vars/bindMiniAppCSSVars.d.ts +0 -29
- package/dist/dts/css-vars/bindThemeParamsCSSVars.d.ts +0 -29
- package/dist/dts/css-vars/bindViewportCSSVars.d.ts +0 -32
- package/dist/dts/css-vars/setCSSVar.d.ts +0 -6
- package/dist/dts/debug/debug.d.ts +0 -14
- package/dist/dts/env/hasExternalNotify.d.ts +0 -10
- package/dist/dts/env/hasWebviewProxy.d.ts +0 -10
- package/dist/dts/env/initWeb.d.ts +0 -11
- package/dist/dts/env/isIframe.d.ts +0 -5
- package/dist/dts/env/isSSR.d.ts +0 -4
- package/dist/dts/env/isTMA.d.ts +0 -4
- package/dist/dts/env/mockTelegramEnv.d.ts +0 -7
- package/dist/dts/errors/SDKError.d.ts +0 -9
- package/dist/dts/errors/createError.d.ts +0 -10
- package/dist/dts/errors/errors.d.ts +0 -49
- package/dist/dts/errors/isSDKError.d.ts +0 -7
- package/dist/dts/errors/isSDKErrorOfType.d.ts +0 -8
- package/dist/dts/events/event-emitter/EventEmitter.d.ts +0 -54
- package/dist/dts/events/event-emitter/types.d.ts +0 -45
- package/dist/dts/events/onWindow.d.ts +0 -10
- package/dist/dts/events/types.d.ts +0 -6
- package/dist/dts/index.low-level.d.ts +0 -41
- package/dist/dts/launch-params/parseLaunchParams.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromLocation.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromPerformance.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromStorage.d.ts +0 -7
- package/dist/dts/launch-params/retrieveFromUrl.d.ts +0 -8
- package/dist/dts/launch-params/retrieveLaunchParams.d.ts +0 -7
- package/dist/dts/launch-params/saveToStorage.d.ts +0 -7
- package/dist/dts/launch-params/serializeLaunchParams.d.ts +0 -7
- package/dist/dts/launch-params/types.d.ts +0 -51
- package/dist/dts/logger/Logger.d.ts +0 -29
- package/dist/dts/misc/createCleanup.d.ts +0 -11
- package/dist/dts/misc/createComponentInitFn/createComponentInitFn.d.ts +0 -16
- package/dist/dts/misc/createComponentInitFn/types.d.ts +0 -54
- package/dist/dts/misc/createSingleton.d.ts +0 -15
- package/dist/dts/misc/isRecord.d.ts +0 -5
- package/dist/dts/misc/objectFromKeys.d.ts +0 -6
- package/dist/dts/navigation/BasicNavigator/BasicNavigator.d.ts +0 -118
- package/dist/dts/navigation/BasicNavigator/prepareItem.d.ts +0 -8
- package/dist/dts/navigation/BasicNavigator/types.d.ts +0 -37
- package/dist/dts/navigation/BrowserNavigator/BrowserNavigator.d.ts +0 -198
- package/dist/dts/navigation/BrowserNavigator/basicItemToBrowser.d.ts +0 -7
- package/dist/dts/navigation/BrowserNavigator/createBrowserNavigatorFromLocation.d.ts +0 -4
- package/dist/dts/navigation/BrowserNavigator/prepareItem.d.ts +0 -25
- package/dist/dts/navigation/BrowserNavigator/types.d.ts +0 -64
- package/dist/dts/navigation/createSafeURL.d.ts +0 -7
- package/dist/dts/navigation/drop.d.ts +0 -4
- package/dist/dts/navigation/ensurePrefix.d.ts +0 -7
- package/dist/dts/navigation/getFirstNavigationEntry.d.ts +0 -6
- package/dist/dts/navigation/getHash.d.ts +0 -15
- package/dist/dts/navigation/getPathname.d.ts +0 -7
- package/dist/dts/navigation/go.d.ts +0 -5
- package/dist/dts/navigation/initNavigator.d.ts +0 -9
- package/dist/dts/navigation/urlToPath.d.ts +0 -7
- package/dist/dts/parsing/ArrayParser/ArrayParser.d.ts +0 -17
- package/dist/dts/parsing/ArrayParser/types.d.ts +0 -12
- package/dist/dts/parsing/ValueParser/ValueParser.d.ts +0 -17
- package/dist/dts/parsing/ValueParser/types.d.ts +0 -28
- package/dist/dts/parsing/createTypeError.d.ts +0 -6
- package/dist/dts/parsing/createValueParserGenerator.d.ts +0 -10
- package/dist/dts/parsing/parseBySchema.d.ts +0 -9
- package/dist/dts/parsing/parsers/array.d.ts +0 -7
- package/dist/dts/parsing/parsers/boolean.d.ts +0 -6
- package/dist/dts/parsing/parsers/date.d.ts +0 -6
- package/dist/dts/parsing/parsers/json.d.ts +0 -9
- package/dist/dts/parsing/parsers/number.d.ts +0 -6
- package/dist/dts/parsing/parsers/rgb.d.ts +0 -7
- package/dist/dts/parsing/parsers/searchParams.d.ts +0 -9
- package/dist/dts/parsing/parsers/string.d.ts +0 -6
- package/dist/dts/parsing/toRecord.d.ts +0 -7
- package/dist/dts/parsing/types.d.ts +0 -30
- package/dist/dts/request-id/createRequestIdGenerator.d.ts +0 -6
- package/dist/dts/request-id/types.d.ts +0 -9
- package/dist/dts/storage/storage.d.ts +0 -42
- package/dist/dts/supports/createSupportsFn.d.ts +0 -12
- package/dist/dts/supports/createSupportsParamFn.d.ts +0 -16
- package/dist/dts/supports/supports.d.ts +0 -16
- package/dist/dts/supports/types.d.ts +0 -4
- package/dist/dts/timeout/createTimeoutError.d.ts +0 -7
- package/dist/dts/timeout/sleep.d.ts +0 -5
- package/dist/dts/timeout/withTimeout.d.ts +0 -6
- package/dist/dts/types/index.d.ts +0 -6
- package/dist/dts/types/logical.d.ts +0 -16
- package/dist/dts/types/methods.d.ts +0 -16
- package/dist/dts/types/misc.d.ts +0 -12
- package/dist/dts/types/platform.d.ts +0 -4
- package/dist/dts/types/unions.d.ts +0 -20
- package/dist/dts/types/utils.d.ts +0 -24
- package/dist/dts/version/compareVersions.d.ts +0 -10
- package/dist/dts/version/types.d.ts +0 -5
- package/dist/index.low-level.iife.js +0 -4
- package/dist/index.low-level.iife.js.map +0 -1
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
import { Computed } from '@tma.js/signals';
|
|
2
|
+
import { RGB } from '@tma.js/types';
|
|
3
|
+
import { PostEventError, SecondaryButtonPosition } from '@tma.js/bridge';
|
|
4
|
+
import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
|
|
5
|
+
import { ButtonOptions } from '../../composables/Button.js';
|
|
6
|
+
import { MaybeAccessor } from '../../types.js';
|
|
7
|
+
import * as E from 'fp-ts/Either';
|
|
8
|
+
type SecondaryButtonEither = E.Either<PostEventError, void>;
|
|
9
|
+
export interface SecondaryButtonState {
|
|
10
|
+
isVisible: boolean;
|
|
11
|
+
bgColor?: RGB;
|
|
12
|
+
hasShineEffect: boolean;
|
|
13
|
+
isEnabled: boolean;
|
|
14
|
+
isLoaderVisible: boolean;
|
|
15
|
+
text: string;
|
|
16
|
+
textColor?: RGB;
|
|
17
|
+
position: SecondaryButtonPosition;
|
|
18
|
+
}
|
|
19
|
+
export interface SecondaryButtonOptions extends Omit<ButtonOptions<SecondaryButtonState, 'web_app_setup_secondary_button'>, 'initialState' | 'method' | 'payload'> {
|
|
20
|
+
/**
|
|
21
|
+
* Default values for different kinds of the button properties.
|
|
22
|
+
*/
|
|
23
|
+
defaults: {
|
|
24
|
+
bgColor: MaybeAccessor<RGB>;
|
|
25
|
+
textColor: MaybeAccessor<RGB>;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* @since Mini Apps v7.10
|
|
30
|
+
*/
|
|
31
|
+
export declare class SecondaryButton {
|
|
32
|
+
constructor({ defaults, ...options }: SecondaryButtonOptions);
|
|
33
|
+
/**
|
|
34
|
+
* Signal indicating if the component is supported.
|
|
35
|
+
*/
|
|
36
|
+
readonly isSupported: Computed<boolean>;
|
|
37
|
+
/**
|
|
38
|
+
* The button position relative to the main one.
|
|
39
|
+
*/
|
|
40
|
+
readonly position: Computed<SecondaryButtonPosition>;
|
|
41
|
+
/**
|
|
42
|
+
* The button background color.
|
|
43
|
+
*/
|
|
44
|
+
readonly bgColor: Computed<RGB>;
|
|
45
|
+
/**
|
|
46
|
+
* True if the button has a shining effect.
|
|
47
|
+
*/
|
|
48
|
+
readonly hasShineEffect: Computed<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* True if the button is clickable.
|
|
51
|
+
*/
|
|
52
|
+
readonly isEnabled: Computed<boolean>;
|
|
53
|
+
/**
|
|
54
|
+
* True if the button loader is visible.
|
|
55
|
+
*/
|
|
56
|
+
readonly isLoaderVisible: Computed<boolean>;
|
|
57
|
+
/**
|
|
58
|
+
* True if the button is visible.
|
|
59
|
+
*/
|
|
60
|
+
readonly isVisible: Computed<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Signal indicating if the component is currently mounted.
|
|
63
|
+
*/
|
|
64
|
+
readonly isMounted: Computed<boolean>;
|
|
65
|
+
/**
|
|
66
|
+
* The complete button state.
|
|
67
|
+
*/
|
|
68
|
+
readonly state: Computed<SecondaryButtonState>;
|
|
69
|
+
/**
|
|
70
|
+
* The button displayed text.
|
|
71
|
+
*/
|
|
72
|
+
readonly text: Computed<string>;
|
|
73
|
+
/**
|
|
74
|
+
* The button text color.
|
|
75
|
+
*
|
|
76
|
+
* Note that this value is computed based on the external defaults. For
|
|
77
|
+
* example, if not explicitly set, this value may be equal to one of theme
|
|
78
|
+
* params colors.
|
|
79
|
+
*/
|
|
80
|
+
readonly textColor: Computed<RGB>;
|
|
81
|
+
/**
|
|
82
|
+
* Shows the button.
|
|
83
|
+
* @since Mini Apps v7.10
|
|
84
|
+
*/
|
|
85
|
+
readonly showFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
86
|
+
/**
|
|
87
|
+
* @see showFp
|
|
88
|
+
*/
|
|
89
|
+
readonly show: WithChecks<() => void, true>;
|
|
90
|
+
/**
|
|
91
|
+
* Hides the button.
|
|
92
|
+
* @since Mini Apps v7.10
|
|
93
|
+
*/
|
|
94
|
+
readonly hideFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
95
|
+
/**
|
|
96
|
+
* @see hideFp
|
|
97
|
+
*/
|
|
98
|
+
readonly hide: WithChecks<() => void, true>;
|
|
99
|
+
/**
|
|
100
|
+
* Enables the button.
|
|
101
|
+
* @since Mini Apps v7.10
|
|
102
|
+
*/
|
|
103
|
+
readonly enableFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
104
|
+
/**
|
|
105
|
+
* @see enableFp
|
|
106
|
+
*/
|
|
107
|
+
readonly enable: WithChecks<() => void, true>;
|
|
108
|
+
/**
|
|
109
|
+
* Enables the button.
|
|
110
|
+
* @since Mini Apps v7.10
|
|
111
|
+
*/
|
|
112
|
+
readonly enableShineEffectFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
113
|
+
/**
|
|
114
|
+
* @see enableShineEffectFp
|
|
115
|
+
*/
|
|
116
|
+
readonly enableShineEffect: WithChecks<() => void, true>;
|
|
117
|
+
/**
|
|
118
|
+
* Disables the button.
|
|
119
|
+
* @since Mini Apps v7.10
|
|
120
|
+
*/
|
|
121
|
+
readonly disableFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
122
|
+
/**
|
|
123
|
+
* @see disableFp
|
|
124
|
+
*/
|
|
125
|
+
readonly disable: WithChecks<() => void, true>;
|
|
126
|
+
/**
|
|
127
|
+
* Enables the button.
|
|
128
|
+
* @since Mini Apps v7.10
|
|
129
|
+
*/
|
|
130
|
+
readonly disableShineEffectFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
131
|
+
/**
|
|
132
|
+
* @see disableShineEffectFp
|
|
133
|
+
*/
|
|
134
|
+
readonly disableShineEffect: WithChecks<() => void, true>;
|
|
135
|
+
/**
|
|
136
|
+
* Updates the button background color.
|
|
137
|
+
* @since Mini Apps v7.10
|
|
138
|
+
*/
|
|
139
|
+
readonly setBgColorFp: WithChecksFp<(value: RGB) => SecondaryButtonEither, true>;
|
|
140
|
+
/**
|
|
141
|
+
* @see setBgColorFp
|
|
142
|
+
*/
|
|
143
|
+
readonly setBgColor: WithChecks<(value: RGB) => void, true>;
|
|
144
|
+
/**
|
|
145
|
+
* Updates the button text color.
|
|
146
|
+
* @since Mini Apps v7.10
|
|
147
|
+
*/
|
|
148
|
+
readonly setTextColorFp: WithChecksFp<(value: RGB) => SecondaryButtonEither, true>;
|
|
149
|
+
/**
|
|
150
|
+
* @see setTextColorFp
|
|
151
|
+
*/
|
|
152
|
+
readonly setTextColor: WithChecks<(value: RGB) => void, true>;
|
|
153
|
+
/**
|
|
154
|
+
* Updates the button text.
|
|
155
|
+
* @since Mini Apps v7.10
|
|
156
|
+
*/
|
|
157
|
+
readonly setTextFp: WithChecksFp<(value: string) => SecondaryButtonEither, true>;
|
|
158
|
+
/**
|
|
159
|
+
* @see setTextFp
|
|
160
|
+
*/
|
|
161
|
+
readonly setText: WithChecks<(value: string) => void, true>;
|
|
162
|
+
/**
|
|
163
|
+
* Updates the button position.
|
|
164
|
+
* @since Mini Apps v7.10
|
|
165
|
+
*/
|
|
166
|
+
readonly setPositionFp: WithChecksFp<(position: SecondaryButtonPosition) => SecondaryButtonEither, true>;
|
|
167
|
+
/**
|
|
168
|
+
* @see setPositionFp
|
|
169
|
+
*/
|
|
170
|
+
readonly setPosition: WithChecks<(position: SecondaryButtonPosition) => void, true>;
|
|
171
|
+
/**
|
|
172
|
+
* Shows the button loader.
|
|
173
|
+
* @since Mini Apps v7.10
|
|
174
|
+
*/
|
|
175
|
+
readonly showLoaderFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
176
|
+
/**
|
|
177
|
+
* @see showLoaderFp
|
|
178
|
+
*/
|
|
179
|
+
readonly showLoader: WithChecks<() => void, true>;
|
|
180
|
+
/**
|
|
181
|
+
* Hides the button loader.
|
|
182
|
+
* @since Mini Apps v7.10
|
|
183
|
+
*/
|
|
184
|
+
readonly hideLoaderFp: WithChecksFp<() => SecondaryButtonEither, true>;
|
|
185
|
+
/**
|
|
186
|
+
* @see hideLoaderFp
|
|
187
|
+
*/
|
|
188
|
+
readonly hideLoader: WithChecks<() => void, true>;
|
|
189
|
+
/**
|
|
190
|
+
* Updates the button state.
|
|
191
|
+
* @param state - updates to apply.
|
|
192
|
+
* @since Mini Apps v7.10
|
|
193
|
+
* @example
|
|
194
|
+
* button.setParams({
|
|
195
|
+
* text: 'Submit',
|
|
196
|
+
* isEnabled: true,
|
|
197
|
+
* hasShineEffect: true,
|
|
198
|
+
* });
|
|
199
|
+
*/
|
|
200
|
+
readonly setParamsFp: WithChecksFp<(state: Partial<SecondaryButtonState>) => SecondaryButtonEither, true>;
|
|
201
|
+
/**
|
|
202
|
+
* @see setParamsFp
|
|
203
|
+
*/
|
|
204
|
+
readonly setParams: WithChecks<(state: Partial<SecondaryButtonState>) => void, true>;
|
|
205
|
+
/**
|
|
206
|
+
* Mounts the component restoring its state.
|
|
207
|
+
* @since Mini Apps v7.10
|
|
208
|
+
*/
|
|
209
|
+
readonly mountFp: WithChecksFp<() => void, true>;
|
|
210
|
+
/**
|
|
211
|
+
* @see mountFp
|
|
212
|
+
*/
|
|
213
|
+
readonly mount: WithChecks<() => void, true>;
|
|
214
|
+
/**
|
|
215
|
+
* Unmounts the component.
|
|
216
|
+
*/
|
|
217
|
+
readonly unmount: () => void;
|
|
218
|
+
/**
|
|
219
|
+
* Adds a new button listener.
|
|
220
|
+
* @param listener - event listener.
|
|
221
|
+
* @param once - should the listener be called only once.
|
|
222
|
+
* @returns A function to remove bound listener.
|
|
223
|
+
* @since Mini Apps v7.10
|
|
224
|
+
* @example
|
|
225
|
+
* const off = button.onClick(() => {
|
|
226
|
+
* console.log('User clicked the button');
|
|
227
|
+
* off();
|
|
228
|
+
* });
|
|
229
|
+
*/
|
|
230
|
+
readonly onClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;
|
|
231
|
+
/**
|
|
232
|
+
* @see onClick
|
|
233
|
+
*/
|
|
234
|
+
readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;
|
|
235
|
+
/**
|
|
236
|
+
* Removes the button click listener.
|
|
237
|
+
* @param listener - event listener.
|
|
238
|
+
* @param once - should the listener be called only once.
|
|
239
|
+
* @since Mini Apps v7.10
|
|
240
|
+
* @example
|
|
241
|
+
* function listener() {
|
|
242
|
+
* console.log('User clicked the button');
|
|
243
|
+
* button.offClick(listener);
|
|
244
|
+
* }
|
|
245
|
+
* button.onClick(listener);
|
|
246
|
+
*/
|
|
247
|
+
readonly offClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => void, true>;
|
|
248
|
+
/**
|
|
249
|
+
* @see offClick
|
|
250
|
+
*/
|
|
251
|
+
readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, true>;
|
|
252
|
+
}
|
|
253
|
+
export {};
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Computed } from '@tma.js/signals';
|
|
2
|
+
import { PostEventError } from '@tma.js/bridge';
|
|
3
|
+
import { ButtonOptions } from '../../composables/Button.js';
|
|
4
|
+
import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
|
|
5
|
+
import * as E from 'fp-ts/Either';
|
|
6
|
+
export interface SettingsButtonState {
|
|
7
|
+
isVisible: boolean;
|
|
8
|
+
}
|
|
9
|
+
export type SettingsButtonOptions = Omit<ButtonOptions<SettingsButtonState, 'web_app_setup_settings_button'>, 'method' | 'payload' | 'initialState'>;
|
|
10
|
+
/**
|
|
11
|
+
* @since Mini Apps v6.10
|
|
12
|
+
*/
|
|
13
|
+
export declare class SettingsButton {
|
|
14
|
+
constructor(options: SettingsButtonOptions);
|
|
15
|
+
/**
|
|
16
|
+
* Signal indicating if the component is currently visible.
|
|
17
|
+
*/
|
|
18
|
+
readonly isVisible: Computed<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* Signal indicating if the component is currently mounted.
|
|
21
|
+
*/
|
|
22
|
+
readonly isMounted: Computed<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Signal indicating if the component is supported.
|
|
25
|
+
*/
|
|
26
|
+
readonly isSupported: Computed<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Hides the button.
|
|
29
|
+
* @since Mini Apps v6.10
|
|
30
|
+
*/
|
|
31
|
+
readonly hideFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;
|
|
32
|
+
/**
|
|
33
|
+
* @see hideFp
|
|
34
|
+
*/
|
|
35
|
+
readonly hide: WithChecks<() => void, true>;
|
|
36
|
+
/**
|
|
37
|
+
* Shows the button.
|
|
38
|
+
* @since Mini Apps v6.10
|
|
39
|
+
*/
|
|
40
|
+
readonly showFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;
|
|
41
|
+
/**
|
|
42
|
+
* @see showFp
|
|
43
|
+
*/
|
|
44
|
+
readonly show: WithChecks<() => void, true>;
|
|
45
|
+
/**
|
|
46
|
+
* Adds a new button listener.
|
|
47
|
+
* @param listener - event listener.
|
|
48
|
+
* @param once - should the listener be called only once.
|
|
49
|
+
* @returns A function to remove bound listener.
|
|
50
|
+
* @since Mini Apps v6.10
|
|
51
|
+
* @example
|
|
52
|
+
* const off = button.onClick(() => {
|
|
53
|
+
* console.log('User clicked the button');
|
|
54
|
+
* off();
|
|
55
|
+
* });
|
|
56
|
+
*/
|
|
57
|
+
readonly onClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;
|
|
58
|
+
/**
|
|
59
|
+
* @see onClickFp
|
|
60
|
+
*/
|
|
61
|
+
readonly onClick: WithChecks<(listener: VoidFunction, once?: boolean) => VoidFunction, true>;
|
|
62
|
+
/**
|
|
63
|
+
* Removes the button click listener.
|
|
64
|
+
* @param listener - event listener.
|
|
65
|
+
* @param once - should the listener be called only once.
|
|
66
|
+
* @since Mini Apps v6.10
|
|
67
|
+
* @example
|
|
68
|
+
* function listener() {
|
|
69
|
+
* console.log('User clicked the button');
|
|
70
|
+
* button.offClick(listener);
|
|
71
|
+
* }
|
|
72
|
+
* button.onClick(listener);
|
|
73
|
+
*/
|
|
74
|
+
readonly offClickFp: WithChecksFp<(listener: VoidFunction, once?: boolean) => void, true>;
|
|
75
|
+
/**
|
|
76
|
+
* @see offClickFp
|
|
77
|
+
*/
|
|
78
|
+
readonly offClick: WithChecks<(listener: VoidFunction, once?: boolean) => void, true>;
|
|
79
|
+
/**
|
|
80
|
+
* Mounts the component restoring its state.
|
|
81
|
+
* @since Mini Apps v6.10
|
|
82
|
+
*/
|
|
83
|
+
readonly mountFp: WithChecksFp<() => void, true>;
|
|
84
|
+
/**
|
|
85
|
+
* @see mountFp
|
|
86
|
+
*/
|
|
87
|
+
readonly mount: WithChecks<() => void, true>;
|
|
88
|
+
/**
|
|
89
|
+
* Unmounts the component.
|
|
90
|
+
*
|
|
91
|
+
* Note that this function does not remove listeners added via the `onClick`
|
|
92
|
+
* function, so you have to remove them on your own.
|
|
93
|
+
* @see onClick
|
|
94
|
+
*/
|
|
95
|
+
readonly unmount: () => void;
|
|
96
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Computed } from '@tma.js/signals';
|
|
2
|
+
import { PostEventError } from '@tma.js/bridge';
|
|
3
|
+
import { WithChecksFp, WithChecks } from '../../with-checks/withChecksFp.js';
|
|
4
|
+
import { WithStateRestore } from '../../fn-options/withStateRestore.js';
|
|
5
|
+
import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
|
|
6
|
+
import { WithVersion } from '../../fn-options/withVersion.js';
|
|
7
|
+
import { WithPostEvent } from '../../fn-options/withPostEvent.js';
|
|
8
|
+
import * as E from 'fp-ts/Either';
|
|
9
|
+
export interface SwipeBehaviorState {
|
|
10
|
+
isVerticalEnabled: boolean;
|
|
11
|
+
}
|
|
12
|
+
export interface SwipeBehaviorOptions extends WithStateRestore<SwipeBehaviorState>, WithVersion, WithPostEvent, SharedFeatureOptions {
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @since Mini Apps v7.7
|
|
16
|
+
*/
|
|
17
|
+
export declare class SwipeBehavior {
|
|
18
|
+
constructor({ postEvent, storage, isTma, isPageReload, version }: SwipeBehaviorOptions);
|
|
19
|
+
/**
|
|
20
|
+
* Signal indicating if the component is supported.
|
|
21
|
+
*/
|
|
22
|
+
readonly isSupported: Computed<boolean>;
|
|
23
|
+
/**
|
|
24
|
+
* Signal indicating if vertical swipes are enabled.
|
|
25
|
+
*/
|
|
26
|
+
readonly isVerticalEnabled: Computed<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Signal indicating if the component is currently mounted.
|
|
29
|
+
*/
|
|
30
|
+
readonly isMounted: Computed<boolean>;
|
|
31
|
+
/**
|
|
32
|
+
* Mounts the component restoring its state.
|
|
33
|
+
* @since Mini Apps v7.7
|
|
34
|
+
*/
|
|
35
|
+
readonly mountFp: WithChecksFp<() => void, true>;
|
|
36
|
+
/**
|
|
37
|
+
* @see mountFp
|
|
38
|
+
*/
|
|
39
|
+
readonly mount: WithChecks<() => void, true>;
|
|
40
|
+
/**
|
|
41
|
+
* Unmounts the component.
|
|
42
|
+
*/
|
|
43
|
+
readonly unmount: () => void;
|
|
44
|
+
/**
|
|
45
|
+
* Disables the closing confirmation dialog.
|
|
46
|
+
* @since Mini Apps v7.7
|
|
47
|
+
*/
|
|
48
|
+
readonly disableVerticalFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;
|
|
49
|
+
/**
|
|
50
|
+
* @see disableVerticalFp
|
|
51
|
+
*/
|
|
52
|
+
readonly disableVertical: WithChecks<() => void, true>;
|
|
53
|
+
/**
|
|
54
|
+
* Enables the closing confirmation dialog.
|
|
55
|
+
* @since Mini Apps v7.7
|
|
56
|
+
*/
|
|
57
|
+
readonly enableVerticalFp: WithChecksFp<() => E.Either<PostEventError, void>, true>;
|
|
58
|
+
/**
|
|
59
|
+
* @see enableVerticalFp
|
|
60
|
+
*/
|
|
61
|
+
readonly enableVertical: WithChecks<() => void, true>;
|
|
62
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { Computed } from '@tma.js/signals';
|
|
2
|
+
import { ThemeParams as ThemeParamsType, RGB } from '@tma.js/types';
|
|
3
|
+
import { EventListener } from '@tma.js/bridge';
|
|
4
|
+
import { WithChecks, WithChecksFp } from '../../with-checks/withChecksFp.js';
|
|
5
|
+
import { CSSVarsBoundError } from '../../errors.js';
|
|
6
|
+
import { WithStateRestore } from '../../fn-options/withStateRestore.js';
|
|
7
|
+
import { SharedFeatureOptions } from '../../fn-options/sharedFeatureOptions.js';
|
|
8
|
+
import { MaybeAccessor } from '../../types.js';
|
|
9
|
+
import * as E from 'fp-ts/Either';
|
|
10
|
+
export type ThemeParamsState = ThemeParamsType;
|
|
11
|
+
export interface ThemeParamsOptions extends WithStateRestore<ThemeParamsState>, SharedFeatureOptions {
|
|
12
|
+
/**
|
|
13
|
+
* Removes a theme change listener.
|
|
14
|
+
* @param listener - a listener to remove.
|
|
15
|
+
*/
|
|
16
|
+
offChange: (listener: EventListener<'theme_changed'>) => void;
|
|
17
|
+
/**
|
|
18
|
+
* Adds a theme change listener.
|
|
19
|
+
* @returns A function to remove listener.
|
|
20
|
+
* @param listener - a listener to add.
|
|
21
|
+
*/
|
|
22
|
+
onChange: (listener: EventListener<'theme_changed'>) => void;
|
|
23
|
+
/**
|
|
24
|
+
* Theme parameters initial state.
|
|
25
|
+
*/
|
|
26
|
+
initialState: MaybeAccessor<ThemeParamsType>;
|
|
27
|
+
}
|
|
28
|
+
export interface ThemeParamsGetCssVarNameFn {
|
|
29
|
+
/**
|
|
30
|
+
* @param property - palette key.
|
|
31
|
+
* @returns Computed complete CSS variable name.
|
|
32
|
+
*/
|
|
33
|
+
(property: Extract<keyof ThemeParamsType, string>): string;
|
|
34
|
+
}
|
|
35
|
+
export declare class ThemeParams {
|
|
36
|
+
constructor({ initialState, onChange, offChange, isTma, storage, isPageReload, }: ThemeParamsOptions);
|
|
37
|
+
/**
|
|
38
|
+
* @since v6.10
|
|
39
|
+
*/
|
|
40
|
+
readonly accentTextColor: Computed<RGB | undefined>;
|
|
41
|
+
readonly bgColor: Computed<RGB | undefined>;
|
|
42
|
+
readonly buttonColor: Computed<RGB | undefined>;
|
|
43
|
+
readonly buttonTextColor: Computed<RGB | undefined>;
|
|
44
|
+
/**
|
|
45
|
+
* @since v7.10
|
|
46
|
+
*/
|
|
47
|
+
readonly bottomBarBgColor: Computed<RGB | undefined>;
|
|
48
|
+
readonly destructiveTextColor: Computed<RGB | undefined>;
|
|
49
|
+
/**
|
|
50
|
+
* @since v6.10
|
|
51
|
+
*/
|
|
52
|
+
readonly headerBgColor: Computed<RGB | undefined>;
|
|
53
|
+
readonly hintColor: Computed<RGB | undefined>;
|
|
54
|
+
readonly linkColor: Computed<RGB | undefined>;
|
|
55
|
+
readonly secondaryBgColor: Computed<RGB | undefined>;
|
|
56
|
+
/**
|
|
57
|
+
* @since v6.10
|
|
58
|
+
*/
|
|
59
|
+
readonly sectionBgColor: Computed<RGB | undefined>;
|
|
60
|
+
/**
|
|
61
|
+
* @since v6.10
|
|
62
|
+
*/
|
|
63
|
+
readonly sectionHeaderTextColor: Computed<RGB | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* @since v7.6
|
|
66
|
+
*/
|
|
67
|
+
readonly sectionSeparatorColor: Computed<RGB | undefined>;
|
|
68
|
+
/**
|
|
69
|
+
* @since v6.10
|
|
70
|
+
*/
|
|
71
|
+
readonly subtitleTextColor: Computed<RGB | undefined>;
|
|
72
|
+
readonly textColor: Computed<RGB | undefined>;
|
|
73
|
+
private readonly _isCssVarsBound;
|
|
74
|
+
/**
|
|
75
|
+
* True if CSS variables are currently bound.
|
|
76
|
+
*/
|
|
77
|
+
readonly isCssVarsBound: Computed<boolean>;
|
|
78
|
+
/**
|
|
79
|
+
* Creates CSS variables connected with the current theme parameters.
|
|
80
|
+
*
|
|
81
|
+
* By default, created CSS variables names are following the pattern "--tg-theme-{name}", where
|
|
82
|
+
* {name} is a theme parameters key name converted from snake case to kebab case.
|
|
83
|
+
*
|
|
84
|
+
* Default variables:
|
|
85
|
+
* - `--tg-theme-bg-color`
|
|
86
|
+
* - `--tg-theme-secondary-text-color`
|
|
87
|
+
*
|
|
88
|
+
* Variables are being automatically updated if theme parameters were changed.
|
|
89
|
+
*
|
|
90
|
+
* @param getCSSVarName - function, returning complete CSS variable name for the specified
|
|
91
|
+
* theme parameters key.
|
|
92
|
+
* @returns Function to stop updating variables.
|
|
93
|
+
* @throws {CSSVarsBoundError} CSS variables are already bound
|
|
94
|
+
* @example Using custom CSS vars generator
|
|
95
|
+
* themeParams.bindCssVars(key => `--my-prefix-${key}`);
|
|
96
|
+
*/
|
|
97
|
+
readonly bindCssVarsFp: WithChecksFp<(getCSSVarName?: ThemeParamsGetCssVarNameFn) => E.Either<CSSVarsBoundError, VoidFunction>, false>;
|
|
98
|
+
/**
|
|
99
|
+
* @see bindCssVarsFp
|
|
100
|
+
*/
|
|
101
|
+
readonly bindCssVars: WithChecks<(getCSSVarName?: ThemeParamsGetCssVarNameFn) => VoidFunction, false>;
|
|
102
|
+
/**
|
|
103
|
+
* Complete component state.
|
|
104
|
+
*/
|
|
105
|
+
readonly state: Computed<ThemeParamsType>;
|
|
106
|
+
/**
|
|
107
|
+
* @returns True if the current color scheme is recognized as dark.
|
|
108
|
+
* This value is calculated based on the current theme's background color.
|
|
109
|
+
*/
|
|
110
|
+
readonly isDark: Computed<boolean>;
|
|
111
|
+
/**
|
|
112
|
+
* Signal indicating if the component is currently mounted.
|
|
113
|
+
*/
|
|
114
|
+
readonly isMounted: Computed<boolean>;
|
|
115
|
+
/**
|
|
116
|
+
* Mounts the component restoring its state.
|
|
117
|
+
*/
|
|
118
|
+
readonly mountFp: WithChecksFp<() => E.Either<never, void>, false>;
|
|
119
|
+
/**
|
|
120
|
+
* @see mountFp
|
|
121
|
+
*/
|
|
122
|
+
readonly mount: WithChecks<() => void, false>;
|
|
123
|
+
/**
|
|
124
|
+
* Unmounts the component.
|
|
125
|
+
*/
|
|
126
|
+
readonly unmount: () => void;
|
|
127
|
+
}
|