@tonconnect/ui 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +268 -2
- package/dist/tonconnect-ui.min.js +467 -0
- package/dist/tonconnect-ui.min.js.map +1 -0
- package/lib/index.d.ts +94 -35
- package/lib/index.js +642 -427
- package/lib/index.js.map +1 -1
- package/lib/index.umd.js +643 -428
- package/lib/index.umd.js.map +1 -1
- package/package.json +5 -4
package/lib/index.d.ts
CHANGED
|
@@ -1,24 +1,85 @@
|
|
|
1
1
|
import { WalletInfoBase, WalletInfoInjected, WalletInfoRemote, ITonConnect, WalletInfo, Account, Wallet, TonConnectError, SendTransactionRequest, SendTransactionResponse } from '@tonconnect/sdk';
|
|
2
2
|
import { Property } from 'csstype';
|
|
3
3
|
|
|
4
|
+
declare type Locales = 'en' | 'ru';
|
|
5
|
+
|
|
4
6
|
declare enum THEME {
|
|
5
7
|
DARK = "DARK",
|
|
6
8
|
LIGHT = "LIGHT"
|
|
7
9
|
}
|
|
8
10
|
declare type Theme = THEME | 'SYSTEM';
|
|
9
11
|
|
|
10
|
-
declare type
|
|
12
|
+
declare type BorderRadius = 'm' | 's' | 'none';
|
|
11
13
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
14
|
+
declare type Color$1 = Property.Color;
|
|
15
|
+
declare type ColorsSet = {
|
|
16
|
+
constant: {
|
|
17
|
+
black: Color$1;
|
|
18
|
+
white: Color$1;
|
|
19
|
+
};
|
|
20
|
+
connectButton: {
|
|
21
|
+
background: Color$1;
|
|
22
|
+
foreground: Color$1;
|
|
23
|
+
};
|
|
24
|
+
accent: Color$1;
|
|
25
|
+
icon: {
|
|
26
|
+
primary: Color$1;
|
|
27
|
+
secondary: Color$1;
|
|
28
|
+
tertiary: Color$1;
|
|
29
|
+
success: Color$1;
|
|
30
|
+
};
|
|
31
|
+
background: {
|
|
32
|
+
primary: Color$1;
|
|
33
|
+
secondary: Color$1;
|
|
34
|
+
};
|
|
35
|
+
text: {
|
|
36
|
+
primary: Color$1;
|
|
37
|
+
subhead: Color$1;
|
|
38
|
+
secondary: Color$1;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
declare type PartialColorsSet = {
|
|
42
|
+
constant?: {
|
|
43
|
+
black?: Color$1;
|
|
44
|
+
white?: Color$1;
|
|
45
|
+
};
|
|
46
|
+
connectButton?: {
|
|
47
|
+
background?: Color$1;
|
|
48
|
+
foreground?: Color$1;
|
|
49
|
+
};
|
|
50
|
+
accent?: Color$1;
|
|
51
|
+
icon?: {
|
|
52
|
+
primary?: Color$1;
|
|
53
|
+
secondary?: Color$1;
|
|
54
|
+
tertiary?: Color$1;
|
|
55
|
+
success?: Color$1;
|
|
56
|
+
};
|
|
57
|
+
background?: {
|
|
58
|
+
primary?: Color$1;
|
|
59
|
+
secondary?: Color$1;
|
|
60
|
+
};
|
|
61
|
+
text?: {
|
|
62
|
+
primary?: Color$1;
|
|
63
|
+
subhead?: Color$1;
|
|
64
|
+
secondary?: Color$1;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
16
67
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
68
|
+
interface UIPreferences {
|
|
69
|
+
/**
|
|
70
|
+
* Color theme for the UI elements.
|
|
71
|
+
* @default SYSTEM theme.
|
|
72
|
+
*/
|
|
73
|
+
theme?: Theme;
|
|
74
|
+
/**
|
|
75
|
+
* Birder radius for UI elements.
|
|
76
|
+
* @default 'm'
|
|
77
|
+
*/
|
|
78
|
+
borderRadius?: BorderRadius;
|
|
79
|
+
/**
|
|
80
|
+
* Configure colors scheme for different themes.
|
|
81
|
+
*/
|
|
82
|
+
colorsSet?: Partial<Record<THEME, PartialColorsSet>>;
|
|
22
83
|
}
|
|
23
84
|
|
|
24
85
|
declare type UIWallet = WalletInfoBase & (Omit<WalletInfoInjected, 'injected' | 'embedded'> | WalletInfoRemote);
|
|
@@ -52,27 +113,24 @@ declare type WalletsListConfigurationImplicit = {
|
|
|
52
113
|
includeWalletsOrder?: 'start' | 'end';
|
|
53
114
|
};
|
|
54
115
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
116
|
+
interface ActionConfiguration {
|
|
117
|
+
/**
|
|
118
|
+
* Configure action modals behavior.
|
|
119
|
+
* @default ['before']
|
|
120
|
+
*/
|
|
121
|
+
modals?: ('before' | 'success' | 'error')[] | 'all';
|
|
122
|
+
/**
|
|
123
|
+
* Configure action notifications behavior.
|
|
124
|
+
* @default 'all'
|
|
125
|
+
*/
|
|
126
|
+
notifications?: ('before' | 'success' | 'error')[] | 'all';
|
|
59
127
|
}
|
|
60
128
|
|
|
61
|
-
declare type Locales = 'en' | 'ru';
|
|
62
|
-
|
|
63
|
-
declare type Color = Property.Color;
|
|
64
|
-
|
|
65
129
|
interface TonConnectUiOptions {
|
|
66
130
|
/**
|
|
67
|
-
*
|
|
68
|
-
* @default SYSTEM theme.
|
|
131
|
+
* UI elements configuration.
|
|
69
132
|
*/
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Accent color for the UI elements.
|
|
73
|
-
* @default #31A6F5 (blue).
|
|
74
|
-
*/
|
|
75
|
-
accentColor?: Color;
|
|
133
|
+
uiPreferences?: UIPreferences;
|
|
76
134
|
/**
|
|
77
135
|
* HTML element id to attach the wallet connect button. If not passed button won't appear.
|
|
78
136
|
* @default null.
|
|
@@ -84,13 +142,13 @@ interface TonConnectUiOptions {
|
|
|
84
142
|
*/
|
|
85
143
|
language?: Locales;
|
|
86
144
|
/**
|
|
87
|
-
* Configuration for the
|
|
145
|
+
* Configuration for the wallets list in the connect wallet modal.
|
|
88
146
|
*/
|
|
89
|
-
|
|
147
|
+
walletsList?: WalletsListConfiguration;
|
|
90
148
|
/**
|
|
91
|
-
* Configuration for
|
|
149
|
+
* Configuration for action-period (e.g. sendTransaction) UI elements: modals and notifications.
|
|
92
150
|
*/
|
|
93
|
-
|
|
151
|
+
actionsConfiguration?: ActionConfiguration;
|
|
94
152
|
/**
|
|
95
153
|
* @deprecated Don't use it
|
|
96
154
|
*/
|
|
@@ -130,6 +188,7 @@ declare class TonConnectUI {
|
|
|
130
188
|
private readonly connector;
|
|
131
189
|
private _walletInfo;
|
|
132
190
|
private systemThemeChangeUnsubscribe;
|
|
191
|
+
private actionsConfiguration?;
|
|
133
192
|
/**
|
|
134
193
|
* Current connection status.
|
|
135
194
|
*/
|
|
@@ -174,18 +233,18 @@ declare class TonConnectUI {
|
|
|
174
233
|
* @param tx transaction to send.
|
|
175
234
|
* @param options modal and notifications behaviour settings. Default is show only 'before' modal and all notifications.
|
|
176
235
|
*/
|
|
177
|
-
sendTransaction(tx: SendTransactionRequest, options?:
|
|
178
|
-
modals?: ('before' | 'success' | 'error')[];
|
|
179
|
-
notifications?: ('before' | 'success' | 'error')[];
|
|
180
|
-
}): Promise<SendTransactionResponse>;
|
|
236
|
+
sendTransaction(tx: SendTransactionRequest, options?: ActionConfiguration): Promise<SendTransactionResponse>;
|
|
181
237
|
private subscribeToWalletChange;
|
|
182
238
|
private updateWalletInfo;
|
|
183
239
|
private normalizeWidgetRoot;
|
|
184
240
|
private checkButtonRootExist;
|
|
241
|
+
private getModalsAndNotificationsConfiguration;
|
|
185
242
|
}
|
|
186
243
|
|
|
244
|
+
declare type Color = Property.Color;
|
|
245
|
+
|
|
187
246
|
declare class TonConnectUIError extends TonConnectError {
|
|
188
247
|
constructor(...args: ConstructorParameters<typeof Error>);
|
|
189
248
|
}
|
|
190
249
|
|
|
191
|
-
export {
|
|
250
|
+
export { ActionConfiguration, BorderRadius, Color, ColorsSet, Locales, PartialColorsSet, THEME, Theme, TonConnectUI, TonConnectUIError, TonConnectUiCreateOptions, TonConnectUiCreateOptionsBase, TonConnectUiOptions, TonConnectUiOptionsWithConnector, TonConnectUiOptionsWithManifest, UIPreferences, UIWallet, WalletsListConfiguration, WalletsListConfigurationExplicit, WalletsListConfigurationImplicit, TonConnectUI as default };
|