tguikit 0.5.0 → 0.6.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/README.md +8 -3
- package/dist/index.d.ts +480 -2
- package/dist/index.js +842 -670
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# tguikit
|
|
2
2
|
|
|
3
|
-
React 19 component library for Telegram Mini Apps
|
|
3
|
+
React 19 component library for Telegram Mini Apps. Telegram's iOS design language, bound to the user's theme, SSR-safe, one stylesheet.
|
|
4
4
|
|
|
5
5
|
> Pre-release. The API is still moving before `1.0`.
|
|
6
6
|
|
|
@@ -31,9 +31,14 @@ export function App() {
|
|
|
31
31
|
|
|
32
32
|
`TguiProvider` supplies the theme and platform. It follows the Telegram / system light–dark theme automatically; pass `appearance` or `platform` to pin them.
|
|
33
33
|
|
|
34
|
-
##
|
|
34
|
+
## Principles
|
|
35
35
|
|
|
36
|
-
|
|
36
|
+
- `ref` is a plain prop on every component — React 19 baseline, no `forwardRef`.
|
|
37
|
+
- Consumer `className` and `style` always win; components merge, never replace.
|
|
38
|
+
- Every colour is a `--tgui--*` token bound to a `--tg-theme-*` variable — components follow the user's Telegram theme and custom themes.
|
|
39
|
+
- Touch-safe: `:hover` is gated behind `(hover: hover)`.
|
|
40
|
+
- SSR-safe: platform and theme detection is `typeof window` guarded, tokens scoped to the provider — no hydration flash.
|
|
41
|
+
- One stylesheet, React externalised as a peer, `publint` + `arethetypeswrong` clean.
|
|
37
42
|
|
|
38
43
|
## Develop
|
|
39
44
|
|
package/dist/index.d.ts
CHANGED
|
@@ -907,6 +907,7 @@ declare namespace TguiProvider {
|
|
|
907
907
|
}
|
|
908
908
|
|
|
909
909
|
type HapticIntent = 'tap' | 'press' | 'select' | 'success' | 'warning' | 'error';
|
|
910
|
+
declare function triggerHaptic(intent: HapticIntent): void;
|
|
910
911
|
|
|
911
912
|
declare function useHaptic(): (intent: HapticIntent) => void;
|
|
912
913
|
|
|
@@ -959,5 +960,482 @@ declare namespace Tooltip {
|
|
|
959
960
|
var displayName: string;
|
|
960
961
|
}
|
|
961
962
|
|
|
962
|
-
|
|
963
|
-
|
|
963
|
+
type ColorScheme = 'light' | 'dark';
|
|
964
|
+
type BottomButtonType = 'main' | 'secondary';
|
|
965
|
+
type BottomButtonPosition = 'left' | 'right' | 'top' | 'bottom';
|
|
966
|
+
type BiometricType = 'finger' | 'face' | 'unknown';
|
|
967
|
+
type HapticImpactStyle = 'light' | 'medium' | 'heavy' | 'rigid' | 'soft';
|
|
968
|
+
type HapticNotificationType = 'error' | 'success' | 'warning';
|
|
969
|
+
type PopupButtonType = 'default' | 'ok' | 'close' | 'cancel' | 'destructive';
|
|
970
|
+
type HomeScreenStatus = 'unsupported' | 'unknown' | 'added' | 'missed';
|
|
971
|
+
type FullscreenError = 'UNSUPPORTED' | 'ALREADY_FULLSCREEN';
|
|
972
|
+
type WriteAccessStatus = 'allowed' | 'cancelled';
|
|
973
|
+
type ContactRequestStatus = 'sent' | 'cancelled';
|
|
974
|
+
type InvoiceStatus = 'paid' | 'cancelled' | 'failed' | 'pending';
|
|
975
|
+
type EmojiStatusAccessStatus = 'allowed' | 'cancelled';
|
|
976
|
+
type FileDownloadStatus = 'downloading' | 'cancelled';
|
|
977
|
+
type ShareMessageError = 'UNSUPPORTED' | 'MESSAGE_EXPIRED' | 'MESSAGE_SEND_FAILED' | 'USER_DECLINED' | 'UNKNOWN_ERROR';
|
|
978
|
+
type EmojiStatusError = 'UNSUPPORTED' | 'SUGGESTED_EMOJI_INVALID' | 'DURATION_INVALID' | 'USER_DECLINED' | 'SERVER_ERROR' | 'UNKNOWN_ERROR';
|
|
979
|
+
type DeviceMotionError = 'UNSUPPORTED';
|
|
980
|
+
interface ThemeParams {
|
|
981
|
+
bg_color?: string;
|
|
982
|
+
text_color?: string;
|
|
983
|
+
hint_color?: string;
|
|
984
|
+
link_color?: string;
|
|
985
|
+
button_color?: string;
|
|
986
|
+
button_text_color?: string;
|
|
987
|
+
secondary_bg_color?: string;
|
|
988
|
+
header_bg_color?: string;
|
|
989
|
+
bottom_bar_bg_color?: string;
|
|
990
|
+
accent_text_color?: string;
|
|
991
|
+
section_bg_color?: string;
|
|
992
|
+
section_header_text_color?: string;
|
|
993
|
+
section_separator_color?: string;
|
|
994
|
+
subtitle_text_color?: string;
|
|
995
|
+
destructive_text_color?: string;
|
|
996
|
+
}
|
|
997
|
+
interface WebAppUser {
|
|
998
|
+
id: number;
|
|
999
|
+
is_bot?: true;
|
|
1000
|
+
first_name: string;
|
|
1001
|
+
last_name?: string;
|
|
1002
|
+
username?: string;
|
|
1003
|
+
language_code?: string;
|
|
1004
|
+
is_premium?: true;
|
|
1005
|
+
added_to_attachment_menu?: true;
|
|
1006
|
+
allows_write_to_pm?: true;
|
|
1007
|
+
photo_url?: string;
|
|
1008
|
+
}
|
|
1009
|
+
interface WebAppChat {
|
|
1010
|
+
id: number;
|
|
1011
|
+
type: 'group' | 'supergroup' | 'channel';
|
|
1012
|
+
title: string;
|
|
1013
|
+
username?: string;
|
|
1014
|
+
photo_url?: string;
|
|
1015
|
+
}
|
|
1016
|
+
interface WebAppInitData {
|
|
1017
|
+
query_id?: string;
|
|
1018
|
+
chat_join_request_query_id?: string;
|
|
1019
|
+
user?: WebAppUser;
|
|
1020
|
+
receiver?: WebAppUser;
|
|
1021
|
+
chat?: WebAppChat;
|
|
1022
|
+
chat_type?: string;
|
|
1023
|
+
chat_instance?: string;
|
|
1024
|
+
start_param?: string;
|
|
1025
|
+
can_send_after?: number;
|
|
1026
|
+
auth_date: number;
|
|
1027
|
+
hash: string;
|
|
1028
|
+
signature?: string;
|
|
1029
|
+
}
|
|
1030
|
+
interface SafeAreaInset {
|
|
1031
|
+
top: number;
|
|
1032
|
+
bottom: number;
|
|
1033
|
+
left: number;
|
|
1034
|
+
right: number;
|
|
1035
|
+
}
|
|
1036
|
+
interface ContentSafeAreaInset {
|
|
1037
|
+
top: number;
|
|
1038
|
+
bottom: number;
|
|
1039
|
+
left: number;
|
|
1040
|
+
right: number;
|
|
1041
|
+
}
|
|
1042
|
+
interface StoryWidgetLink {
|
|
1043
|
+
url: string;
|
|
1044
|
+
name?: string;
|
|
1045
|
+
}
|
|
1046
|
+
interface StoryShareParams {
|
|
1047
|
+
text?: string;
|
|
1048
|
+
widget_link?: StoryWidgetLink;
|
|
1049
|
+
}
|
|
1050
|
+
interface ScanQrPopupParams {
|
|
1051
|
+
text?: string;
|
|
1052
|
+
}
|
|
1053
|
+
interface PopupButton {
|
|
1054
|
+
id?: string;
|
|
1055
|
+
type?: PopupButtonType;
|
|
1056
|
+
text?: string;
|
|
1057
|
+
}
|
|
1058
|
+
interface PopupParams {
|
|
1059
|
+
title?: string;
|
|
1060
|
+
message: string;
|
|
1061
|
+
buttons?: PopupButton[];
|
|
1062
|
+
}
|
|
1063
|
+
interface EmojiStatusParams {
|
|
1064
|
+
duration?: number;
|
|
1065
|
+
}
|
|
1066
|
+
interface DownloadFileParams {
|
|
1067
|
+
url: string;
|
|
1068
|
+
file_name: string;
|
|
1069
|
+
}
|
|
1070
|
+
interface BiometricRequestAccessParams {
|
|
1071
|
+
reason?: string;
|
|
1072
|
+
}
|
|
1073
|
+
interface BiometricAuthenticateParams {
|
|
1074
|
+
reason?: string;
|
|
1075
|
+
}
|
|
1076
|
+
interface AccelerometerStartParams {
|
|
1077
|
+
refresh_rate?: number;
|
|
1078
|
+
}
|
|
1079
|
+
interface DeviceOrientationStartParams {
|
|
1080
|
+
refresh_rate?: number;
|
|
1081
|
+
need_absolute?: boolean;
|
|
1082
|
+
}
|
|
1083
|
+
interface BackButton {
|
|
1084
|
+
isVisible: boolean;
|
|
1085
|
+
onClick(callback: () => void): BackButton;
|
|
1086
|
+
offClick(callback: () => void): BackButton;
|
|
1087
|
+
show(): BackButton;
|
|
1088
|
+
hide(): BackButton;
|
|
1089
|
+
}
|
|
1090
|
+
interface BottomButtonParams {
|
|
1091
|
+
icon_custom_emoji_id?: string;
|
|
1092
|
+
text?: string;
|
|
1093
|
+
color?: string;
|
|
1094
|
+
text_color?: string;
|
|
1095
|
+
has_shine_effect?: boolean;
|
|
1096
|
+
position?: BottomButtonPosition;
|
|
1097
|
+
is_active?: boolean;
|
|
1098
|
+
is_visible?: boolean;
|
|
1099
|
+
}
|
|
1100
|
+
interface BottomButton {
|
|
1101
|
+
readonly type: BottomButtonType;
|
|
1102
|
+
iconCustomEmojiId: string;
|
|
1103
|
+
text: string;
|
|
1104
|
+
color: string;
|
|
1105
|
+
textColor: string;
|
|
1106
|
+
isVisible: boolean;
|
|
1107
|
+
isActive: boolean;
|
|
1108
|
+
hasShineEffect: boolean;
|
|
1109
|
+
position: BottomButtonPosition;
|
|
1110
|
+
readonly isProgressVisible: boolean;
|
|
1111
|
+
setText(text: string): BottomButton;
|
|
1112
|
+
onClick(callback: () => void): BottomButton;
|
|
1113
|
+
offClick(callback: () => void): BottomButton;
|
|
1114
|
+
show(): BottomButton;
|
|
1115
|
+
hide(): BottomButton;
|
|
1116
|
+
enable(): BottomButton;
|
|
1117
|
+
disable(): BottomButton;
|
|
1118
|
+
showProgress(leaveActive?: boolean): BottomButton;
|
|
1119
|
+
hideProgress(): BottomButton;
|
|
1120
|
+
setParams(params: BottomButtonParams): BottomButton;
|
|
1121
|
+
}
|
|
1122
|
+
interface SettingsButton {
|
|
1123
|
+
isVisible: boolean;
|
|
1124
|
+
onClick(callback: () => void): SettingsButton;
|
|
1125
|
+
offClick(callback: () => void): SettingsButton;
|
|
1126
|
+
show(): SettingsButton;
|
|
1127
|
+
hide(): SettingsButton;
|
|
1128
|
+
}
|
|
1129
|
+
interface HapticFeedback {
|
|
1130
|
+
impactOccurred(style: HapticImpactStyle): HapticFeedback;
|
|
1131
|
+
notificationOccurred(type: HapticNotificationType): HapticFeedback;
|
|
1132
|
+
selectionChanged(): HapticFeedback;
|
|
1133
|
+
}
|
|
1134
|
+
interface CloudStorage {
|
|
1135
|
+
setItem(key: string, value: string, callback?: (error: string | null, success: boolean) => void): CloudStorage;
|
|
1136
|
+
getItem(key: string, callback: (error: string | null, value: string) => void): CloudStorage;
|
|
1137
|
+
getItems(keys: string[], callback: (error: string | null, values: Record<string, string>) => void): CloudStorage;
|
|
1138
|
+
removeItem(key: string, callback?: (error: string | null, success: boolean) => void): CloudStorage;
|
|
1139
|
+
removeItems(keys: string[], callback?: (error: string | null, success: boolean) => void): CloudStorage;
|
|
1140
|
+
getKeys(callback: (error: string | null, keys: string[]) => void): CloudStorage;
|
|
1141
|
+
}
|
|
1142
|
+
interface BiometricManager {
|
|
1143
|
+
isInited: boolean;
|
|
1144
|
+
isBiometricAvailable: boolean;
|
|
1145
|
+
biometricType: BiometricType;
|
|
1146
|
+
isAccessRequested: boolean;
|
|
1147
|
+
isAccessGranted: boolean;
|
|
1148
|
+
isBiometricTokenSaved: boolean;
|
|
1149
|
+
deviceId: string;
|
|
1150
|
+
init(callback?: () => void): BiometricManager;
|
|
1151
|
+
requestAccess(params: BiometricRequestAccessParams, callback?: (granted: boolean) => void): BiometricManager;
|
|
1152
|
+
authenticate(params: BiometricAuthenticateParams, callback?: (authenticated: boolean, biometricToken?: string) => void): BiometricManager;
|
|
1153
|
+
updateBiometricToken(token: string, callback?: (updated: boolean) => void): BiometricManager;
|
|
1154
|
+
openSettings(): BiometricManager;
|
|
1155
|
+
}
|
|
1156
|
+
interface Accelerometer {
|
|
1157
|
+
isStarted: boolean;
|
|
1158
|
+
x: number;
|
|
1159
|
+
y: number;
|
|
1160
|
+
z: number;
|
|
1161
|
+
start(params: AccelerometerStartParams, callback?: (started: boolean) => void): Accelerometer;
|
|
1162
|
+
stop(callback?: (stopped: boolean) => void): Accelerometer;
|
|
1163
|
+
}
|
|
1164
|
+
interface DeviceOrientation {
|
|
1165
|
+
isStarted: boolean;
|
|
1166
|
+
absolute: boolean;
|
|
1167
|
+
alpha: number;
|
|
1168
|
+
beta: number;
|
|
1169
|
+
gamma: number;
|
|
1170
|
+
start(params: DeviceOrientationStartParams, callback?: (started: boolean) => void): DeviceOrientation;
|
|
1171
|
+
stop(callback?: (stopped: boolean) => void): DeviceOrientation;
|
|
1172
|
+
}
|
|
1173
|
+
interface Gyroscope {
|
|
1174
|
+
isStarted: boolean;
|
|
1175
|
+
x: number;
|
|
1176
|
+
y: number;
|
|
1177
|
+
z: number;
|
|
1178
|
+
start(params: AccelerometerStartParams, callback?: (started: boolean) => void): Gyroscope;
|
|
1179
|
+
stop(callback?: (stopped: boolean) => void): Gyroscope;
|
|
1180
|
+
}
|
|
1181
|
+
interface LocationData {
|
|
1182
|
+
latitude: number;
|
|
1183
|
+
longitude: number;
|
|
1184
|
+
altitude?: number;
|
|
1185
|
+
course?: number;
|
|
1186
|
+
speed?: number;
|
|
1187
|
+
horizontal_accuracy?: number;
|
|
1188
|
+
vertical_accuracy?: number;
|
|
1189
|
+
course_accuracy?: number;
|
|
1190
|
+
speed_accuracy?: number;
|
|
1191
|
+
}
|
|
1192
|
+
interface LocationManager {
|
|
1193
|
+
isInited: boolean;
|
|
1194
|
+
isLocationAvailable: boolean;
|
|
1195
|
+
isAccessRequested: boolean;
|
|
1196
|
+
isAccessGranted: boolean;
|
|
1197
|
+
init(callback?: () => void): LocationManager;
|
|
1198
|
+
getLocation(callback: (location: LocationData | null) => void): LocationManager;
|
|
1199
|
+
openSettings(): LocationManager;
|
|
1200
|
+
}
|
|
1201
|
+
interface DeviceStorage {
|
|
1202
|
+
setItem(key: string, value: string, callback?: (error: string | null, success: boolean) => void): DeviceStorage;
|
|
1203
|
+
getItem(key: string, callback: (error: string | null, value: string | null) => void): DeviceStorage;
|
|
1204
|
+
removeItem(key: string, callback?: (error: string | null, success: boolean) => void): DeviceStorage;
|
|
1205
|
+
clear(callback?: (error: string | null, success: boolean) => void): DeviceStorage;
|
|
1206
|
+
}
|
|
1207
|
+
interface SecureStorage {
|
|
1208
|
+
setItem(key: string, value: string, callback?: (error: string | null, success: boolean) => void): SecureStorage;
|
|
1209
|
+
getItem(key: string, callback: (error: string | null, value: string | null, canRestore?: boolean) => void): SecureStorage;
|
|
1210
|
+
restoreItem(key: string, callback?: (error: string | null, value?: string) => void): SecureStorage;
|
|
1211
|
+
removeItem(key: string, callback?: (error: string | null, success: boolean) => void): SecureStorage;
|
|
1212
|
+
clear(callback?: (error: string | null, success: boolean) => void): SecureStorage;
|
|
1213
|
+
}
|
|
1214
|
+
interface TelegramEventMap {
|
|
1215
|
+
activated: undefined;
|
|
1216
|
+
deactivated: undefined;
|
|
1217
|
+
themeChanged: undefined;
|
|
1218
|
+
viewportChanged: {
|
|
1219
|
+
isStateStable: boolean;
|
|
1220
|
+
};
|
|
1221
|
+
safeAreaChanged: undefined;
|
|
1222
|
+
contentSafeAreaChanged: undefined;
|
|
1223
|
+
mainButtonClicked: undefined;
|
|
1224
|
+
secondaryButtonClicked: undefined;
|
|
1225
|
+
backButtonClicked: undefined;
|
|
1226
|
+
settingsButtonClicked: undefined;
|
|
1227
|
+
invoiceClosed: {
|
|
1228
|
+
url: string;
|
|
1229
|
+
status: InvoiceStatus;
|
|
1230
|
+
};
|
|
1231
|
+
popupClosed: {
|
|
1232
|
+
button_id: string | null;
|
|
1233
|
+
};
|
|
1234
|
+
qrTextReceived: {
|
|
1235
|
+
data: string;
|
|
1236
|
+
};
|
|
1237
|
+
scanQrPopupClosed: undefined;
|
|
1238
|
+
clipboardTextReceived: {
|
|
1239
|
+
data: string | null;
|
|
1240
|
+
};
|
|
1241
|
+
writeAccessRequested: {
|
|
1242
|
+
status: WriteAccessStatus;
|
|
1243
|
+
};
|
|
1244
|
+
contactRequested: {
|
|
1245
|
+
status: ContactRequestStatus;
|
|
1246
|
+
};
|
|
1247
|
+
biometricManagerUpdated: undefined;
|
|
1248
|
+
biometricAuthRequested: {
|
|
1249
|
+
isAuthenticated: boolean;
|
|
1250
|
+
biometricToken?: string;
|
|
1251
|
+
};
|
|
1252
|
+
biometricTokenUpdated: {
|
|
1253
|
+
isUpdated: boolean;
|
|
1254
|
+
};
|
|
1255
|
+
fullscreenChanged: undefined;
|
|
1256
|
+
fullscreenFailed: {
|
|
1257
|
+
error: FullscreenError;
|
|
1258
|
+
};
|
|
1259
|
+
homeScreenAdded: undefined;
|
|
1260
|
+
homeScreenChecked: {
|
|
1261
|
+
status: HomeScreenStatus;
|
|
1262
|
+
};
|
|
1263
|
+
accelerometerStarted: undefined;
|
|
1264
|
+
accelerometerStopped: undefined;
|
|
1265
|
+
accelerometerChanged: undefined;
|
|
1266
|
+
accelerometerFailed: {
|
|
1267
|
+
error: DeviceMotionError;
|
|
1268
|
+
};
|
|
1269
|
+
deviceOrientationStarted: undefined;
|
|
1270
|
+
deviceOrientationStopped: undefined;
|
|
1271
|
+
deviceOrientationChanged: undefined;
|
|
1272
|
+
deviceOrientationFailed: {
|
|
1273
|
+
error: DeviceMotionError;
|
|
1274
|
+
};
|
|
1275
|
+
gyroscopeStarted: undefined;
|
|
1276
|
+
gyroscopeStopped: undefined;
|
|
1277
|
+
gyroscopeChanged: undefined;
|
|
1278
|
+
gyroscopeFailed: {
|
|
1279
|
+
error: DeviceMotionError;
|
|
1280
|
+
};
|
|
1281
|
+
locationManagerUpdated: undefined;
|
|
1282
|
+
locationRequested: {
|
|
1283
|
+
locationData: LocationData;
|
|
1284
|
+
};
|
|
1285
|
+
shareMessageSent: undefined;
|
|
1286
|
+
shareMessageFailed: {
|
|
1287
|
+
error: ShareMessageError;
|
|
1288
|
+
};
|
|
1289
|
+
emojiStatusSet: undefined;
|
|
1290
|
+
emojiStatusFailed: {
|
|
1291
|
+
error: EmojiStatusError;
|
|
1292
|
+
};
|
|
1293
|
+
emojiStatusAccessRequested: {
|
|
1294
|
+
status: EmojiStatusAccessStatus;
|
|
1295
|
+
};
|
|
1296
|
+
fileDownloadRequested: {
|
|
1297
|
+
status: FileDownloadStatus;
|
|
1298
|
+
};
|
|
1299
|
+
}
|
|
1300
|
+
interface WebApp {
|
|
1301
|
+
initData: string;
|
|
1302
|
+
initDataUnsafe: WebAppInitData;
|
|
1303
|
+
version: string;
|
|
1304
|
+
platform: string;
|
|
1305
|
+
colorScheme: ColorScheme;
|
|
1306
|
+
themeParams: ThemeParams;
|
|
1307
|
+
isActive: boolean;
|
|
1308
|
+
isExpanded: boolean;
|
|
1309
|
+
viewportHeight: number;
|
|
1310
|
+
viewportStableHeight: number;
|
|
1311
|
+
headerColor: string;
|
|
1312
|
+
backgroundColor: string;
|
|
1313
|
+
bottomBarColor: string;
|
|
1314
|
+
isClosingConfirmationEnabled: boolean;
|
|
1315
|
+
isVerticalSwipesEnabled: boolean;
|
|
1316
|
+
isFullscreen: boolean;
|
|
1317
|
+
isOrientationLocked: boolean;
|
|
1318
|
+
safeAreaInset: SafeAreaInset;
|
|
1319
|
+
contentSafeAreaInset: ContentSafeAreaInset;
|
|
1320
|
+
BackButton: BackButton;
|
|
1321
|
+
MainButton: BottomButton;
|
|
1322
|
+
SecondaryButton: BottomButton;
|
|
1323
|
+
SettingsButton: SettingsButton;
|
|
1324
|
+
HapticFeedback: HapticFeedback;
|
|
1325
|
+
CloudStorage: CloudStorage;
|
|
1326
|
+
BiometricManager: BiometricManager;
|
|
1327
|
+
Accelerometer: Accelerometer;
|
|
1328
|
+
DeviceOrientation: DeviceOrientation;
|
|
1329
|
+
Gyroscope: Gyroscope;
|
|
1330
|
+
LocationManager: LocationManager;
|
|
1331
|
+
DeviceStorage: DeviceStorage;
|
|
1332
|
+
SecureStorage: SecureStorage;
|
|
1333
|
+
isVersionAtLeast(version: string): boolean;
|
|
1334
|
+
setHeaderColor(color: string): void;
|
|
1335
|
+
setBackgroundColor(color: string): void;
|
|
1336
|
+
setBottomBarColor(color: string): void;
|
|
1337
|
+
enableClosingConfirmation(): void;
|
|
1338
|
+
disableClosingConfirmation(): void;
|
|
1339
|
+
enableVerticalSwipes(): void;
|
|
1340
|
+
disableVerticalSwipes(): void;
|
|
1341
|
+
requestFullscreen(): void;
|
|
1342
|
+
exitFullscreen(): void;
|
|
1343
|
+
lockOrientation(): void;
|
|
1344
|
+
unlockOrientation(): void;
|
|
1345
|
+
addToHomeScreen(): void;
|
|
1346
|
+
checkHomeScreenStatus(callback?: (status: HomeScreenStatus) => void): void;
|
|
1347
|
+
onEvent<K extends keyof TelegramEventMap>(eventType: K, eventHandler: (...args: TelegramEventMap[K] extends undefined ? [] : [TelegramEventMap[K]]) => void): void;
|
|
1348
|
+
offEvent<K extends keyof TelegramEventMap>(eventType: K, eventHandler: (...args: TelegramEventMap[K] extends undefined ? [] : [TelegramEventMap[K]]) => void): void;
|
|
1349
|
+
sendData(data: string): void;
|
|
1350
|
+
switchInlineQuery(query: string, chooseChatTypes?: Array<'users' | 'bots' | 'groups' | 'channels'>): void;
|
|
1351
|
+
openLink(url: string, options?: {
|
|
1352
|
+
try_instant_view?: boolean;
|
|
1353
|
+
}): void;
|
|
1354
|
+
openTelegramLink(url: string): void;
|
|
1355
|
+
openInvoice(url: string, callback?: (status: InvoiceStatus) => void): void;
|
|
1356
|
+
shareToStory(mediaUrl: string, params?: StoryShareParams): void;
|
|
1357
|
+
shareMessage(msgId: number, callback?: (sent: boolean) => void): void;
|
|
1358
|
+
setEmojiStatus(customEmojiId: string, params?: EmojiStatusParams, callback?: (success: boolean) => void): void;
|
|
1359
|
+
requestEmojiStatusAccess(callback?: (granted: boolean) => void): void;
|
|
1360
|
+
downloadFile(params: DownloadFileParams, callback?: (accepted: boolean) => void): void;
|
|
1361
|
+
hideKeyboard(): void;
|
|
1362
|
+
showPopup(params: PopupParams, callback?: (buttonId: string) => void): void;
|
|
1363
|
+
showAlert(message: string, callback?: () => void): void;
|
|
1364
|
+
showConfirm(message: string, callback?: (confirmed: boolean) => void): void;
|
|
1365
|
+
showScanQrPopup(params: ScanQrPopupParams, callback?: (text: string) => boolean): void;
|
|
1366
|
+
closeScanQrPopup(): void;
|
|
1367
|
+
readTextFromClipboard(callback?: (text: string) => void): void;
|
|
1368
|
+
requestWriteAccess(callback?: (granted: boolean) => void): void;
|
|
1369
|
+
requestContact(callback?: (granted: boolean) => void): void;
|
|
1370
|
+
requestChat(reqId: number, callback?: (sent: boolean) => void): void;
|
|
1371
|
+
ready(): void;
|
|
1372
|
+
expand(): void;
|
|
1373
|
+
close(): void;
|
|
1374
|
+
}
|
|
1375
|
+
declare global {
|
|
1376
|
+
interface Window {
|
|
1377
|
+
Telegram?: {
|
|
1378
|
+
WebApp?: WebApp;
|
|
1379
|
+
};
|
|
1380
|
+
}
|
|
1381
|
+
}
|
|
1382
|
+
|
|
1383
|
+
declare function getTelegramWebApp(): WebApp | undefined;
|
|
1384
|
+
declare function isTelegramVersionAtLeast(version: string): boolean;
|
|
1385
|
+
|
|
1386
|
+
interface BottomButtonOptions {
|
|
1387
|
+
text?: string;
|
|
1388
|
+
onClick?: () => void;
|
|
1389
|
+
visible?: boolean;
|
|
1390
|
+
enabled?: boolean;
|
|
1391
|
+
loading?: boolean;
|
|
1392
|
+
color?: string;
|
|
1393
|
+
textColor?: string;
|
|
1394
|
+
hasShineEffect?: boolean;
|
|
1395
|
+
position?: BottomButtonPosition;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
declare function onTelegramEvent<K extends keyof TelegramEventMap>(event: K, handler: (...args: TelegramEventMap[K] extends undefined ? [] : [TelegramEventMap[K]]) => void): () => void;
|
|
1399
|
+
|
|
1400
|
+
declare function useBackButton(onClick: () => void, visible?: boolean): void;
|
|
1401
|
+
|
|
1402
|
+
declare function useClosingConfirmation(enabled: boolean): void;
|
|
1403
|
+
|
|
1404
|
+
interface CloudStorageApi {
|
|
1405
|
+
readonly isAvailable: boolean;
|
|
1406
|
+
getItem(key: string): Promise<string | null>;
|
|
1407
|
+
getItems(keys: string[]): Promise<Record<string, string>>;
|
|
1408
|
+
setItem(key: string, value: string): Promise<void>;
|
|
1409
|
+
removeItem(key: string): Promise<void>;
|
|
1410
|
+
removeItems(keys: string[]): Promise<void>;
|
|
1411
|
+
getKeys(): Promise<string[]>;
|
|
1412
|
+
}
|
|
1413
|
+
declare function useCloudStorage(): CloudStorageApi;
|
|
1414
|
+
|
|
1415
|
+
interface InitData {
|
|
1416
|
+
raw: string;
|
|
1417
|
+
unsafe: WebAppInitData | null;
|
|
1418
|
+
user: WebAppUser | null;
|
|
1419
|
+
startParam: string | null;
|
|
1420
|
+
}
|
|
1421
|
+
declare function useInitData(): InitData;
|
|
1422
|
+
|
|
1423
|
+
declare function useMainButton(options: BottomButtonOptions): void;
|
|
1424
|
+
|
|
1425
|
+
declare function useSecondaryButton(options: BottomButtonOptions): void;
|
|
1426
|
+
|
|
1427
|
+
declare function useSettingsButton(onClick: () => void, visible?: boolean): void;
|
|
1428
|
+
|
|
1429
|
+
declare function useVerticalSwipes(enabled: boolean): void;
|
|
1430
|
+
|
|
1431
|
+
interface Viewport {
|
|
1432
|
+
height: number;
|
|
1433
|
+
stableHeight: number;
|
|
1434
|
+
isExpanded: boolean;
|
|
1435
|
+
isStable: boolean;
|
|
1436
|
+
expand(): void;
|
|
1437
|
+
}
|
|
1438
|
+
declare function useViewport(): Viewport;
|
|
1439
|
+
|
|
1440
|
+
export { Accordion, AccordionItem, Avatar, AvatarStack, Badge, Banner, Blockquote, Breadcrumbs, Button, Callout, Caption, Card, CardCell, Cell, Checkbox, Chip, CircularProgress, CompactPagination, Dialog, Divider, DropdownMenu, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuTrigger, FixedLayout, Footnote, Headline, HorizontalScroll, IconButton, Image, InlineButtons, InlineButtonsItem, Input, LargeTitle, Link, List, Pagination, PinInput, Placeholder, Popover, PopoverContent, PopoverTrigger, Portal, Progress, Radio, Rating, SearchBar, Section, SectionFooter, SectionHeader, SegmentedControl, SegmentedControlItem, Select, Sheet, Skeleton, Slider, SnackbarProvider, Spinner, Spoiler, Stepper, Steps, Subheadline, Switch, TabBar, TabBarItem, Tappable, Text, Textarea, TguiProvider, Timeline, TimelineItem, Title, Tooltip, Typography, getTelegramWebApp, isTelegramVersionAtLeast, onTelegramEvent, triggerHaptic, useBackButton, useClosingConfirmation, useCloudStorage, useHaptic, useInitData, useMainButton, useSecondaryButton, useSettingsButton, useSnackbar, useTgui, useVerticalSwipes, useViewport };
|
|
1441
|
+
export type { Accelerometer, AccelerometerStartParams, AccordionItemProps, AccordionProps, AvatarProps, AvatarSize, AvatarStackProps, BackButton, BadgeMode, BadgeProps, BadgeType, BannerProps, BannerType, BiometricAuthenticateParams, BiometricManager, BiometricRequestAccessParams, BiometricType, BlockquoteProps, BottomButton, BottomButtonOptions, BottomButtonParams, BottomButtonPosition, BottomButtonType, BreadcrumbItem, BreadcrumbsProps, ButtonMode, ButtonProps, ButtonSize, CalloutProps, CaptionProps, CardCellProps, CardProps, CardType, CellProps, CheckboxProps, ChipMode, ChipProps, CircularProgressProps, CircularProgressSize, CloudStorage, CloudStorageApi, ColorScheme, CompactPaginationProps, ContactRequestStatus, ContentSafeAreaInset, DeviceMotionError, DeviceOrientation, DeviceOrientationStartParams, DeviceStorage, DialogAction, DialogActionRole, DialogProps, DividerProps, DownloadFileParams, DropdownMenuCheckboxItemProps, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps, DropdownMenuSeparatorProps, DropdownMenuTriggerProps, EmojiStatusAccessStatus, EmojiStatusError, EmojiStatusParams, FileDownloadStatus, FixedLayoutProps, FootnoteProps, FullscreenError, Gyroscope, HapticFeedback, HapticImpactStyle, HapticIntent, HapticNotificationType, HeadlineProps, HomeScreenStatus, HorizontalScrollProps, IconButtonMode, IconButtonProps, IconButtonSize, ImageProps, InitData, InlineButtonsItemProps, InlineButtonsMode, InlineButtonsProps, InputProps, InputStatus, InvoiceStatus, LargeTitleProps, LinkProps, ListProps, LocationData, LocationManager, PaginationProps, PinInputProps, PlaceholderProps, PopoverContentProps, PopoverProps, PopoverTriggerProps, PopupButton, PopupButtonType, PopupParams, PortalProps, ProgressProps, RadioProps, RatingProps, SafeAreaInset, ScanQrPopupParams, SearchBarProps, SectionFooterProps, SectionHeaderProps, SectionProps, SecureStorage, SegmentedControlItemProps, SegmentedControlProps, SelectProps, SettingsButton, ShareMessageError, SheetProps, SkeletonProps, SliderProps, SnackbarApi, SnackbarOptions, SnackbarProviderProps, SpinnerProps, SpinnerSize, SpoilerProps, StepperProps, StepsProps, StoryShareParams, StoryWidgetLink, SubheadlineProps, SwitchProps, TabBarItemProps, TabBarProps, TappableProps, TelegramEventMap, TextProps, TextareaProps, TextareaStatus, TguiProviderProps, ThemeParams, TimelineItemProps, TimelineProps, TitleProps, TooltipPlacement, TooltipProps, TypographyProps, Viewport, WebApp, WebAppChat, WebAppInitData, WebAppUser, WriteAccessStatus };
|