@arcblock/ux 2.10.67 → 2.10.68
Sign up to get free protection for your applications and to get access to all the features.
- package/lib/Address/did-address.d.ts +6 -5
- package/lib/Address/index.d.ts +1 -1
- package/lib/Avatar/index.d.ts +10 -8
- package/lib/Avatar/index.js +6 -4
- package/lib/Blocklet/blocklet.d.ts +4 -4
- package/lib/Blocklet/blocklet.js +2 -2
- package/lib/BlockletContext/index.d.ts +3 -3
- package/lib/BlockletNFT/index.d.ts +6 -6
- package/lib/BlockletNFT/index.js +3 -3
- package/lib/BlockletV2/blocklet.d.ts +2 -2
- package/lib/Button/wrap.d.ts +4 -4
- package/lib/Button/wrap.js +2 -2
- package/lib/CardSelector/index.js +0 -1
- package/lib/Center/index.d.ts +1 -1
- package/lib/ClickToCopy/copy-button.d.ts +5 -4
- package/lib/ClickToCopy/copy-button.js +0 -1
- package/lib/ClickToCopy/hook.d.ts +3 -8
- package/lib/ClickToCopy/index.d.ts +6 -4
- package/lib/CodeBlock/index.d.ts +3 -1
- package/lib/CookieConsent/index.d.ts +8 -29
- package/lib/CookieConsent/index.js +3 -17
- package/lib/CountDown/index.d.ts +21 -25
- package/lib/CountDown/index.js +12 -11
- package/lib/DID/index.d.ts +9 -8
- package/lib/Datatable/index.d.ts +5 -5
- package/lib/Datatable/index.js +5 -5
- package/lib/Dialog/confirm.d.ts +6 -6
- package/lib/Dialog/confirm.js +3 -3
- package/lib/Dialog/types.d.ts +1 -1
- package/lib/DidLogo/index.d.ts +5 -25
- package/lib/DidLogo/index.js +4 -15
- package/lib/DriftBot/index.d.ts +13 -19
- package/lib/DriftBot/index.js +5 -6
- package/lib/Earth/index.d.ts +28 -10
- package/lib/Earth/index.js +12 -52
- package/lib/Earth/util.d.ts +10 -5
- package/lib/Earth/util.js +1 -0
- package/lib/ErrorBoundary/fallback.d.ts +12 -19
- package/lib/ErrorBoundary/fallback.js +2 -19
- package/lib/ErrorBoundary/index.d.ts +1 -1
- package/lib/Footer/index.d.ts +17 -24
- package/lib/Footer/index.js +2 -11
- package/lib/Header/header.d.ts +2 -2
- package/lib/Icon/image.d.ts +3 -2
- package/lib/Icon/index.d.ts +6 -4
- package/lib/Img/index.d.ts +1 -1
- package/lib/Img/index.js +1 -1
- package/lib/InfoRow/index.d.ts +9 -32
- package/lib/InfoRow/index.js +10 -23
- package/lib/Layout/dashboard/external-link.d.ts +13 -14
- package/lib/Layout/dashboard/external-link.js +5 -22
- package/lib/Layout/dashboard/full-page.d.ts +19 -11
- package/lib/Layout/dashboard/full-page.js +2 -6
- package/lib/Layout/dashboard/index.d.ts +20 -39
- package/lib/Layout/dashboard/index.js +10 -38
- package/lib/Layout/dashboard/sidebar.d.ts +17 -20
- package/lib/Layout/dashboard/sidebar.js +3 -16
- package/lib/Layout/dashboard-legacy/header.d.ts +10 -36
- package/lib/Layout/dashboard-legacy/header.js +5 -24
- package/lib/Layout/dashboard-legacy/index.d.ts +17 -56
- package/lib/Layout/dashboard-legacy/index.js +12 -41
- package/lib/Layout/dashboard-legacy/sidebar.d.ts +15 -26
- package/lib/Layout/dashboard-legacy/sidebar.js +5 -15
- package/lib/Layout/index.d.ts +17 -56
- package/lib/Layout/index.js +24 -50
- package/lib/LoadingMask/index.d.ts +8 -31
- package/lib/LoadingMask/index.js +2 -18
- package/lib/Locale/browser-lang.d.ts +4 -1
- package/lib/Locale/browser-lang.js +8 -3
- package/lib/Locale/context.d.ts +18 -8
- package/lib/Locale/context.js +1 -1
- package/lib/Locale/languages.d.ts +9 -55
- package/lib/Locale/selector.d.ts +10 -26
- package/lib/Locale/selector.js +8 -25
- package/lib/Locale/util.d.ts +4 -3
- package/lib/Locale/util.js +0 -1
- package/lib/Logo/index.d.ts +9 -40
- package/lib/Logo/index.js +88 -46
- package/lib/Metric/index.d.ts +9 -31
- package/lib/Metric/index.js +5 -20
- package/lib/NFTDisplay/aspect-ratio-container.d.ts +5 -12
- package/lib/NFTDisplay/aspect-ratio-container.js +0 -5
- package/lib/NFTDisplay/broken.d.ts +3 -13
- package/lib/NFTDisplay/broken.js +80 -10
- package/lib/NFTDisplay/displayApi.d.ts +1 -1
- package/lib/NFTDisplay/index.d.ts +28 -6
- package/lib/NFTDisplay/index.js +17 -51
- package/lib/NFTDisplay/svg-embedder/img.d.ts +8 -23
- package/lib/NFTDisplay/svg-embedder/img.js +3 -17
- package/lib/NFTDisplay/svg-embedder/inline-svg.d.ts +7 -13
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +1 -8
- package/lib/NavMenu/nav-menu.d.ts +2 -0
- package/lib/NavMenu/nav-menu.js +0 -1
- package/lib/PageScroller/index.d.ts +14 -13
- package/lib/PageScroller/index.js +12 -37
- package/lib/PageScroller/usePrevValue.d.ts +1 -1
- package/lib/PageScroller/usePrevValue.js +1 -2
- package/lib/Passport/index.d.ts +1 -1
- package/lib/Passport/passport.d.ts +10 -30
- package/lib/Passport/passport.js +5 -19
- package/lib/PoweredByArcBlock/index.d.ts +4 -14
- package/lib/PoweredByArcBlock/index.js +1 -8
- package/lib/PricingTable/PricingPlan.d.ts +11 -9
- package/lib/PricingTable/PricingPlan.js +0 -4
- package/lib/PricingTable/index.d.ts +5 -3
- package/lib/PricingTable/index.js +1 -5
- package/lib/QRCode/index.d.ts +11 -22
- package/lib/QRCode/index.js +1 -15
- package/lib/RelativeTime/index.d.ts +12 -40
- package/lib/RelativeTime/index.js +7 -27
- package/lib/Result/common.d.ts +26 -45
- package/lib/Result/common.js +2 -4
- package/lib/Result/index.d.ts +5 -18
- package/lib/Result/index.js +1 -9
- package/lib/Result/result.d.ts +7 -29
- package/lib/Result/result.js +2 -17
- package/lib/Result/translations.d.ts +2 -54
- package/lib/Screenshot/BaseScreenshot/index.d.ts +7 -24
- package/lib/Screenshot/BaseScreenshot/index.js +2 -15
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.d.ts +25 -19
- package/lib/Screenshot/BaseScreenshot/shells/Phone.d.ts +25 -19
- package/lib/Screenshot/index.d.ts +84 -28
- package/lib/Screenshot/index.js +14 -43
- package/lib/SessionBlocklet/index.d.ts +6 -19
- package/lib/SessionBlocklet/index.js +3 -14
- package/lib/SessionManager/index.d.ts +1 -1
- package/lib/SessionPermission/index.d.ts +9 -17
- package/lib/SessionPermission/index.js +3 -11
- package/lib/SessionUser/components/logged-in.d.ts +9 -31
- package/lib/SessionUser/components/logged-in.js +13 -29
- package/lib/SessionUser/components/session-user-item.d.ts +8 -1
- package/lib/SessionUser/components/session-user-item.js +2 -12
- package/lib/SessionUser/components/session-user-switch.d.ts +9 -21
- package/lib/SessionUser/components/session-user-switch.js +3 -15
- package/lib/SessionUser/components/un-login.d.ts +7 -23
- package/lib/SessionUser/components/un-login.js +4 -16
- package/lib/SessionUser/components/user-info.d.ts +12 -29
- package/lib/SessionUser/components/user-info.js +4 -19
- package/lib/SessionUser/index.d.ts +7 -30
- package/lib/SessionUser/index.js +5 -26
- package/lib/SessionUser/libs/translation.d.ts +2 -31
- package/lib/SessionUser/libs/translation.js +1 -0
- package/lib/SessionUser/libs/utils.d.ts +10 -9
- package/lib/Sparkline/index.d.ts +22 -1
- package/lib/Sparkline/index.js +25 -17
- package/lib/Spinner/index.d.ts +6 -1
- package/lib/Spinner/index.js +4 -11
- package/lib/Success/index.d.ts +5 -21
- package/lib/Success/index.js +4 -16
- package/lib/Tabs/index.d.ts +12 -26
- package/lib/Tabs/index.js +7 -37
- package/lib/TextCollapse/index.d.ts +10 -10
- package/lib/TextCollapse/index.js +4 -21
- package/lib/Theme/index.js +0 -2
- package/lib/Theme/theme-provider.d.ts +1 -1
- package/lib/Theme/theme.d.ts +4 -1
- package/lib/Theme/theme.js +1 -2
- package/lib/Typography/index.d.ts +5 -24
- package/lib/Typography/index.js +5 -17
- package/lib/Util/index.d.ts +11 -6
- package/lib/Util/index.js +6 -0
- package/lib/Video/index.d.ts +12 -16
- package/lib/Video/index.js +0 -14
- package/lib/Wallet/Action.d.ts +13 -18
- package/lib/Wallet/Action.js +0 -7
- package/lib/Wallet/Download.d.ts +24 -30
- package/lib/Wallet/Download.js +201 -18
- package/lib/Wallet/Open.d.ts +5 -15
- package/lib/Wallet/Open.js +5 -11
- package/lib/WalletOSIcon/index.d.ts +6 -25
- package/lib/WalletOSIcon/index.js +3 -16
- package/lib/WebWalletSWKeeper/index.d.ts +8 -20
- package/lib/WebWalletSWKeeper/index.js +14 -19
- package/lib/WechatPrompt/index.js +2 -0
- package/lib/global.d.ts +15 -0
- package/lib/type.d.ts +12 -3
- package/lib/withTheme/index.d.ts +8 -6
- package/lib/withTracker/index.d.ts +1 -1
- package/lib/withTracker/index.js +3 -0
- package/package.json +9 -5
- package/src/Address/did-address.tsx +7 -6
- package/src/Address/index.tsx +1 -1
- package/src/Avatar/index.jsx +6 -4
- package/src/Blocklet/blocklet.jsx +2 -2
- package/src/BlockletContext/index.tsx +3 -3
- package/src/BlockletNFT/index.jsx +3 -3
- package/src/BlockletV2/blocklet.tsx +2 -2
- package/src/Button/wrap.jsx +2 -2
- package/src/CardSelector/index.tsx +0 -1
- package/src/Center/index.tsx +1 -1
- package/src/ClickToCopy/copy-button.tsx +4 -4
- package/src/ClickToCopy/hook.ts +3 -2
- package/src/ClickToCopy/index.tsx +6 -5
- package/src/CodeBlock/index.tsx +3 -1
- package/src/CookieConsent/{index.jsx → index.tsx} +16 -19
- package/src/CountDown/{index.jsx → index.tsx} +30 -16
- package/src/DID/index.tsx +9 -8
- package/src/Datatable/index.jsx +5 -5
- package/src/Dialog/confirm.jsx +3 -3
- package/src/Dialog/types.d.ts +1 -1
- package/src/DidLogo/{index.jsx → index.tsx} +7 -14
- package/src/DriftBot/{index.jsx → index.tsx} +13 -11
- package/src/Earth/{index.jsx → index.tsx} +94 -66
- package/src/Earth/{util.js → util.ts} +20 -17
- package/src/ErrorBoundary/{fallback.jsx → fallback.tsx} +20 -21
- package/src/Footer/{index.jsx → index.tsx} +17 -14
- package/src/Header/header.tsx +2 -3
- package/src/Header/responsive-header.tsx +0 -1
- package/src/Icon/image.tsx +3 -3
- package/src/Icon/index.tsx +7 -4
- package/src/Img/index.jsx +1 -1
- package/src/InfoRow/{index.jsx → index.tsx} +32 -25
- package/src/Layout/dashboard/external-link.tsx +46 -0
- package/src/Layout/dashboard/{full-page.jsx → full-page.tsx} +20 -9
- package/src/Layout/dashboard/{index.jsx → index.tsx} +42 -44
- package/src/Layout/dashboard/{sidebar.jsx → sidebar.tsx} +23 -20
- package/src/Layout/dashboard-legacy/{header.jsx → header.tsx} +16 -26
- package/src/Layout/dashboard-legacy/{index.jsx → index.tsx} +32 -46
- package/src/Layout/dashboard-legacy/{sidebar.jsx → sidebar.tsx} +27 -19
- package/src/Layout/{index.jsx → index.tsx} +41 -47
- package/src/LoadingMask/{index.jsx → index.tsx} +17 -19
- package/src/Locale/{browser-lang.js → browser-lang.ts} +9 -7
- package/src/Locale/context.tsx +18 -11
- package/src/Locale/{languages.js → languages.ts} +1 -1
- package/src/Locale/{selector.jsx → selector.tsx} +32 -29
- package/src/Locale/{util.js → util.ts} +9 -2
- package/src/Logo/index.tsx +58 -0
- package/src/Metric/{index.jsx → index.tsx} +23 -18
- package/src/NFTDisplay/{aspect-ratio-container.jsx → aspect-ratio-container.tsx} +9 -7
- package/src/NFTDisplay/{broken.jsx → broken.tsx} +7 -12
- package/src/NFTDisplay/{displayApi.js → displayApi.ts} +4 -4
- package/src/NFTDisplay/{index.jsx → index.tsx} +59 -64
- package/src/NFTDisplay/svg-embedder/{img.jsx → img.tsx} +10 -18
- package/src/NFTDisplay/svg-embedder/{inline-svg.jsx → inline-svg.tsx} +8 -9
- package/src/NavMenu/nav-menu.tsx +2 -3
- package/src/PageScroller/{index.jsx → index.tsx} +40 -53
- package/src/PageScroller/{usePrevValue.js → usePrevValue.ts} +2 -3
- package/src/Passport/{passport.jsx → passport.tsx} +22 -19
- package/src/PoweredByArcBlock/{index.jsx → index.tsx} +6 -11
- package/src/PricingTable/{PricingPlan.jsx → PricingPlan.tsx} +15 -5
- package/src/PricingTable/{index.jsx → index.tsx} +9 -6
- package/src/QRCode/{index.jsx → index.tsx} +13 -17
- package/src/RelativeTime/{index.jsx → index.tsx} +24 -24
- package/src/Result/{common.jsx → common.tsx} +17 -13
- package/src/Result/index.tsx +30 -0
- package/src/Result/{result.jsx → result.tsx} +8 -17
- package/src/Result/{translations.js → translations.ts} +3 -1
- package/src/Screenshot/BaseScreenshot/{index.jsx → index.tsx} +9 -15
- package/src/Screenshot/BaseScreenshot/shells/{Macbook.jsx → Macbook.tsx} +3 -1
- package/src/Screenshot/BaseScreenshot/shells/{Phone.jsx → Phone.tsx} +3 -1
- package/src/Screenshot/{index.jsx → index.tsx} +60 -54
- package/src/SessionBlocklet/{index.jsx → index.tsx} +8 -14
- package/src/SessionPermission/index.tsx +25 -0
- package/src/SessionUser/components/{logged-in.jsx → logged-in.tsx} +49 -31
- package/src/SessionUser/components/session-user-item.tsx +97 -0
- package/src/SessionUser/components/{session-user-switch.jsx → session-user-switch.tsx} +16 -21
- package/src/SessionUser/components/{un-login.jsx → un-login.tsx} +10 -15
- package/src/SessionUser/components/{user-info.jsx → user-info.tsx} +16 -22
- package/src/SessionUser/index.tsx +26 -0
- package/src/SessionUser/libs/{translation.js → translation.ts} +3 -1
- package/src/SessionUser/libs/utils.ts +39 -0
- package/src/Sparkline/{index.jsx → index.tsx} +38 -22
- package/src/Spinner/index.tsx +20 -0
- package/src/Success/{index.jsx → index.tsx} +7 -13
- package/src/Tabs/{index.jsx → index.tsx} +26 -40
- package/src/TextCollapse/{index.jsx → index.tsx} +26 -21
- package/src/Theme/index.ts +0 -1
- package/src/Theme/theme-provider.tsx +1 -1
- package/src/Theme/theme.ts +6 -3
- package/src/Typography/{index.jsx → index.tsx} +19 -22
- package/src/Util/index.ts +14 -8
- package/src/Video/{index.jsx → index.tsx} +7 -10
- package/src/Wallet/{Action.jsx → Action.tsx} +16 -12
- package/src/Wallet/{Download.jsx → Download.tsx} +25 -21
- package/src/Wallet/{Open.jsx → Open.tsx} +8 -11
- package/src/WalletOSIcon/{index.jsx → index.tsx} +8 -16
- package/src/WebWalletSWKeeper/{index.jsx → index.tsx} +21 -24
- package/src/WechatPrompt/{index.jsx → index.tsx} +1 -0
- package/src/global.d.ts +15 -0
- package/src/type.d.ts +12 -3
- package/src/withTheme/{index.jsx → index.tsx} +12 -2
- package/src/withTracker/{index.jsx → index.tsx} +6 -4
- package/src/Layout/dashboard/external-link.jsx +0 -47
- package/src/Logo/index.jsx +0 -66
- package/src/Result/index.jsx +0 -33
- package/src/SessionPermission/index.jsx +0 -28
- package/src/SessionUser/components/session-user-item.jsx +0 -93
- package/src/SessionUser/index.jsx +0 -38
- package/src/SessionUser/libs/utils.js +0 -37
- package/src/Spinner/index.jsx +0 -21
- /package/src/ErrorBoundary/{index.jsx → index.ts} +0 -0
- /package/src/NFTDisplay/{loading.jsx → loading.tsx} +0 -0
- /package/src/Passport/{index.jsx → index.ts} +0 -0
- /package/src/SessionManager/{index.jsx → index.tsx} +0 -0
@@ -1,21 +1,9 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
webWalletUrl: any;
|
5
|
-
maxIdleTime: any;
|
6
|
-
}) => import("react/jsx-runtime").JSX.Element;
|
7
|
-
declare function WebWalletSWKeeper({ webWalletUrl, maxIdleTime }: {
|
8
|
-
webWalletUrl: any;
|
9
|
-
maxIdleTime: any;
|
10
|
-
}): null;
|
11
|
-
declare namespace WebWalletSWKeeper {
|
12
|
-
namespace propTypes {
|
13
|
-
let webWalletUrl: PropTypes.Validator<string>;
|
14
|
-
let maxIdleTime: PropTypes.Requireable<number>;
|
15
|
-
}
|
16
|
-
namespace defaultProps {
|
17
|
-
export { DEFAULT_MAX_IDLE_TIME as maxIdleTime };
|
18
|
-
}
|
1
|
+
interface WebWalletSWKeeperProps {
|
2
|
+
webWalletUrl: string;
|
3
|
+
maxIdleTime: number;
|
19
4
|
}
|
20
|
-
|
21
|
-
declare const
|
5
|
+
declare function WebWalletSWKeeper({ webWalletUrl, maxIdleTime }: WebWalletSWKeeperProps): null;
|
6
|
+
export declare const withWebWalletSWKeeper: <P extends {
|
7
|
+
webWalletUrl: string;
|
8
|
+
}>(Component: React.ComponentType<P>) => ({ webWalletUrl, maxIdleTime, ...rest }: WebWalletSWKeeperProps & P) => import("react/jsx-runtime").JSX.Element;
|
9
|
+
export default WebWalletSWKeeper;
|
@@ -1,6 +1,5 @@
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
2
2
|
import { useEffect, useRef } from 'react';
|
3
|
-
import PropTypes from 'prop-types';
|
4
3
|
import useIdle from 'react-use/lib/useIdle';
|
5
4
|
import { useLocalStorageState } from 'ahooks';
|
6
5
|
import useBrowser from '@arcblock/react-hooks/lib/useBrowser';
|
@@ -17,15 +16,15 @@ const injectIframe = webWalletUrl => {
|
|
17
16
|
const iframe = document.createElement('iframe');
|
18
17
|
iframe.title = 'abt wallet';
|
19
18
|
iframe.id = id;
|
20
|
-
iframe.style.width = 0;
|
21
|
-
iframe.style.height = 0;
|
22
|
-
iframe.style.border = 0;
|
19
|
+
iframe.style.width = '0';
|
20
|
+
iframe.style.height = '0';
|
21
|
+
iframe.style.border = '0';
|
23
22
|
// https://stackoverflow.com/questions/27858989/iframe-with-0-height-creates-a-gap
|
24
23
|
iframe.style.display = 'block';
|
25
24
|
// fix: 页面自动滚动到底部问题 (https://github.com/blocklet/abt-wallet/issues/1160)
|
26
25
|
// top: 0 可能不是必须的, 但测试中发现, 如果不设置, 在某些特殊情况下似乎也会导致页面自动滚动到底部
|
27
26
|
iframe.style.position = 'absolute';
|
28
|
-
iframe.style.top = 0;
|
27
|
+
iframe.style.top = '0';
|
29
28
|
iframe.src = `${webWalletUrl}?action=iframe`;
|
30
29
|
document.body.appendChild(iframe);
|
31
30
|
};
|
@@ -37,7 +36,7 @@ const removeIframe = () => {
|
|
37
36
|
};
|
38
37
|
const cleanup = () => {
|
39
38
|
removeIframe();
|
40
|
-
id =
|
39
|
+
id = '';
|
41
40
|
};
|
42
41
|
const enable = webWalletUrl => {
|
43
42
|
if (!id) {
|
@@ -45,11 +44,10 @@ const enable = webWalletUrl => {
|
|
45
44
|
injectIframe(webWalletUrl);
|
46
45
|
}
|
47
46
|
};
|
48
|
-
|
49
47
|
// 该组件通过嵌入一个 web wallet iframe 帮助 web wallet service worker 延最大空闲时间
|
50
48
|
function WebWalletSWKeeper({
|
51
49
|
webWalletUrl,
|
52
|
-
maxIdleTime
|
50
|
+
maxIdleTime = DEFAULT_MAX_IDLE_TIME
|
53
51
|
}) {
|
54
52
|
// 渲染前先记录是否已经存在一个 WebWalletSWKeeper 实例
|
55
53
|
const instanceExists = useRef(!!id);
|
@@ -73,14 +71,6 @@ function WebWalletSWKeeper({
|
|
73
71
|
useEffect(() => () => _cleanup(), []);
|
74
72
|
return null;
|
75
73
|
}
|
76
|
-
WebWalletSWKeeper.propTypes = {
|
77
|
-
webWalletUrl: PropTypes.string.isRequired,
|
78
|
-
maxIdleTime: PropTypes.number
|
79
|
-
};
|
80
|
-
WebWalletSWKeeper.defaultProps = {
|
81
|
-
maxIdleTime: DEFAULT_MAX_IDLE_TIME
|
82
|
-
};
|
83
|
-
export default WebWalletSWKeeper;
|
84
74
|
export const withWebWalletSWKeeper = Component => {
|
85
75
|
// eslint-disable-next-line react/prop-types
|
86
76
|
return function WithWebWalletSWKeeperComponent({
|
@@ -102,14 +92,19 @@ export const withWebWalletSWKeeper = Component => {
|
|
102
92
|
// - 检查到 wallet 浏览器插件
|
103
93
|
// - webWalletUrl 与当前页面 url 的 protocol 不同
|
104
94
|
// - wallet webview
|
95
|
+
|
96
|
+
const props = {
|
97
|
+
webWalletUrl,
|
98
|
+
...rest
|
99
|
+
};
|
105
100
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
106
101
|
children: [!disabled && !extension && isSameProtocol && !isWalletWebview && /*#__PURE__*/_jsx(WebWalletSWKeeper, {
|
107
102
|
webWalletUrl: webWalletUrl,
|
108
103
|
maxIdleTime: maxIdleTime
|
109
104
|
}), /*#__PURE__*/_jsx(Component, {
|
110
|
-
|
111
|
-
...rest
|
105
|
+
...props
|
112
106
|
})]
|
113
107
|
});
|
114
108
|
};
|
115
|
-
};
|
109
|
+
};
|
110
|
+
export default WebWalletSWKeeper;
|
package/lib/global.d.ts
CHANGED
@@ -1,4 +1,19 @@
|
|
1
1
|
declare module '@arcblock/did-motif';
|
2
|
+
declare module 'd3-geo';
|
3
|
+
declare module 'topojson-client';
|
4
|
+
declare module 'versor';
|
5
|
+
declare module 'axios/*';
|
6
|
+
|
7
|
+
// ux svg 由 babel-plugin-inline-react-svg 处理
|
8
|
+
declare module '*.svg' {
|
9
|
+
import * as React from 'react';
|
10
|
+
const ReactComponent: React.FunctionComponent<React.SVGProps<SVGSVGElement>>;
|
11
|
+
export { ReactComponent };
|
12
|
+
}
|
13
|
+
|
14
|
+
declare module '*.png' {
|
15
|
+
export default string;
|
16
|
+
}
|
2
17
|
|
3
18
|
type Blocklet = import('./type').Blocklet;
|
4
19
|
|
package/lib/type.d.ts
CHANGED
@@ -1,5 +1,14 @@
|
|
1
|
+
import type { Theme } from '@mui/material';
|
2
|
+
import type { LiteralUnion } from 'type-fest';
|
3
|
+
|
1
4
|
export type $TSFixMe = any;
|
5
|
+
export type Translations = Record<string, Record<string, any>>;
|
6
|
+
export type Locale = LiteralUnion<'en' | 'zh', string>;
|
2
7
|
|
8
|
+
// TODO: 以下为 blocklet 应用专属的全局对象类型,可以更加具体
|
9
|
+
export type User = Record<string, any>;
|
10
|
+
export type Session = Record<string, any>;
|
11
|
+
export type Passport = Record<string, any>;
|
3
12
|
export type Blocklet = {
|
4
13
|
appId: string;
|
5
14
|
appIds: string[];
|
@@ -16,15 +25,15 @@ export type Blocklet = {
|
|
16
25
|
version: string;
|
17
26
|
mode: string;
|
18
27
|
tenantMode: 'single' | 'multiple';
|
19
|
-
theme:
|
20
|
-
navigation:
|
28
|
+
theme: Theme;
|
29
|
+
navigation: $TSFixMe[];
|
21
30
|
preferences: Record<string, any>;
|
22
31
|
languages: {
|
23
32
|
code: string;
|
24
33
|
name: string;
|
25
34
|
}[];
|
26
35
|
passportColor: string;
|
27
|
-
componentMountPoints:
|
36
|
+
componentMountPoints: $TSFixMe[];
|
28
37
|
alsoKnownAs: string[];
|
29
38
|
trustedFactories: string[];
|
30
39
|
[x: string]: any;
|
package/lib/withTheme/index.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
+
import { type PaletteOptions } from '@mui/material/styles/createPalette';
|
2
|
+
import { type TypographyOptions } from '@mui/material/styles/createTypography';
|
3
|
+
declare function withTheme<P extends object>(Component: React.ComponentType<P>, { mode, pageWidth, palette, typography, }?: {
|
4
|
+
mode?: string;
|
5
|
+
pageWidth?: string;
|
6
|
+
palette?: PaletteOptions;
|
7
|
+
typography?: TypographyOptions;
|
8
|
+
}): (props: P) => import("react/jsx-runtime").JSX.Element;
|
1
9
|
export default withTheme;
|
2
|
-
declare function withTheme(Component: any, { mode, pageWidth, palette, typography }?: {
|
3
|
-
mode?: string | undefined;
|
4
|
-
pageWidth?: string | undefined;
|
5
|
-
palette: any;
|
6
|
-
typography: any;
|
7
|
-
}): (props: any) => import("react/jsx-runtime").JSX.Element;
|
@@ -1,2 +1,2 @@
|
|
1
|
-
declare
|
1
|
+
declare const _default: <P extends object>(WrappedComponent: React.ComponentType<P>) => (props: P) => import("react/jsx-runtime").JSX.Element;
|
2
2
|
export default _default;
|
package/lib/withTracker/index.js
CHANGED
@@ -30,7 +30,10 @@ export default WrappedComponent => {
|
|
30
30
|
if (trackingId) {
|
31
31
|
ReactGA.initialize(trackingId);
|
32
32
|
}
|
33
|
+
|
34
|
+
// @ts-ignore
|
33
35
|
window.trackPage = trackPage;
|
36
|
+
// @ts-ignore
|
34
37
|
window.trackEvent = trackEvent;
|
35
38
|
return function TrackedComponent(props) {
|
36
39
|
const location = useLocation();
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@arcblock/ux",
|
3
|
-
"version": "2.10.
|
3
|
+
"version": "2.10.68",
|
4
4
|
"description": "Common used react components for arcblock products",
|
5
5
|
"keywords": [
|
6
6
|
"react",
|
@@ -43,7 +43,10 @@
|
|
43
43
|
"@babel/preset-env": "^7.19.3",
|
44
44
|
"@babel/preset-react": "^7.18.6",
|
45
45
|
"@babel/preset-typescript": "^7.24.7",
|
46
|
+
"@types/base64-url": "^2.2.2",
|
47
|
+
"@types/pako": "^2.0.3",
|
46
48
|
"@types/react": "^18.3.4",
|
49
|
+
"@types/react-helmet": "^6.1.11",
|
47
50
|
"@typescript-eslint/eslint-plugin": "^8.7.0",
|
48
51
|
"@typescript-eslint/parser": "^8.7.0",
|
49
52
|
"babel-plugin-inline-react-svg": "^1.1.2",
|
@@ -64,12 +67,12 @@
|
|
64
67
|
"react": ">=18.2.0",
|
65
68
|
"react-router-dom": ">=6.22.3"
|
66
69
|
},
|
67
|
-
"gitHead": "
|
70
|
+
"gitHead": "abe3ae3ba176e5429ca94d3309ef99ed9544f39e",
|
68
71
|
"dependencies": {
|
69
72
|
"@arcblock/did-motif": "^1.1.13",
|
70
|
-
"@arcblock/icons": "^2.10.
|
71
|
-
"@arcblock/nft-display": "^2.10.
|
72
|
-
"@arcblock/react-hooks": "^2.10.
|
73
|
+
"@arcblock/icons": "^2.10.68",
|
74
|
+
"@arcblock/nft-display": "^2.10.68",
|
75
|
+
"@arcblock/react-hooks": "^2.10.68",
|
73
76
|
"@babel/plugin-syntax-dynamic-import": "^7.8.3",
|
74
77
|
"@fontsource/inter": "^5.0.16",
|
75
78
|
"@fontsource/ubuntu-mono": "^5.0.18",
|
@@ -111,6 +114,7 @@
|
|
111
114
|
"react-use": "^17.4.0",
|
112
115
|
"rebound": "^0.1.0",
|
113
116
|
"topojson-client": "^3.1.0",
|
117
|
+
"type-fest": "^4.28.0",
|
114
118
|
"versor": "^0.0.4"
|
115
119
|
}
|
116
120
|
}
|
@@ -8,8 +8,9 @@ import React, { forwardRef, ReactNode, useImperativeHandle, useRef, useState } f
|
|
8
8
|
import { styled } from '../Theme';
|
9
9
|
import { getFontSize } from '../Util';
|
10
10
|
import CompactText from './compact-text';
|
11
|
+
import type { Locale, Translations } from '../type';
|
11
12
|
|
12
|
-
const translations = {
|
13
|
+
const translations: Translations = {
|
13
14
|
en: {
|
14
15
|
copy: 'Click To Copy',
|
15
16
|
copied: 'Copied!',
|
@@ -26,18 +27,18 @@ export interface HTMLDidAddressElement extends HTMLDivElement {
|
|
26
27
|
export interface IDidAddressProps extends BoxProps {
|
27
28
|
component?: React.ElementType;
|
28
29
|
size?: number;
|
29
|
-
copyable?:
|
30
|
+
copyable?: true | false;
|
30
31
|
// compact mode 下, hover 时会在 tooltip 中显示完整地址, showCopyButtonInTooltip = true 时会在完整地址后显示一个复制按钮
|
31
|
-
showCopyButtonInTooltip?:
|
32
|
+
showCopyButtonInTooltip?: false | true;
|
32
33
|
content?: string;
|
33
|
-
inline?:
|
34
|
+
inline?: false | true;
|
34
35
|
prepend?: ReactNode;
|
35
36
|
append?: ReactNode;
|
36
37
|
// 紧凑模式
|
37
|
-
compact?:
|
38
|
+
compact?: false | true;
|
38
39
|
startChars?: number;
|
39
40
|
endChars?: number;
|
40
|
-
locale?:
|
41
|
+
locale?: Locale;
|
41
42
|
}
|
42
43
|
|
43
44
|
/**
|
package/src/Address/index.tsx
CHANGED
@@ -3,7 +3,7 @@ import DidAddress, { HTMLDidAddressElement, IDidAddressProps } from './did-addre
|
|
3
3
|
import ResponsiveDidAddress from './responsive-did-address';
|
4
4
|
|
5
5
|
export interface IDidAddressWrapper extends IDidAddressProps {
|
6
|
-
responsive?:
|
6
|
+
responsive?: true | false;
|
7
7
|
}
|
8
8
|
|
9
9
|
const DidAddressWrapper = forwardRef<HTMLDidAddressElement, IDidAddressWrapper>(
|
package/src/Avatar/index.jsx
CHANGED
@@ -13,14 +13,15 @@ import { DID_PREFIX } from '../Util/constant';
|
|
13
13
|
/**
|
14
14
|
* Avatar component
|
15
15
|
* @typedef {{
|
16
|
+
* src?: string;
|
16
17
|
* did?: string;
|
17
18
|
* size?: number;
|
18
19
|
* variant?: 'circle' | 'rounded' | 'default';
|
19
|
-
* animation?:
|
20
|
+
* animation?: false | true;
|
20
21
|
* shape?: '' | 'rectangle' | 'square' | 'hexagon' | 'circle';
|
21
|
-
* blockiesPadding?:
|
22
|
-
* responsive?:
|
23
|
-
* } & Omit<import('../Img').ImgProps, 'size'>} AvatarProps
|
22
|
+
* blockiesPadding?: true | false;
|
23
|
+
* responsive?: false | true;
|
24
|
+
* } & Omit<import('../Img').ImgProps, 'size' | 'src'>} AvatarProps
|
24
25
|
*/
|
25
26
|
|
26
27
|
/**
|
@@ -30,6 +31,7 @@ import { DID_PREFIX } from '../Util/constant';
|
|
30
31
|
*/
|
31
32
|
function Avatar(props) {
|
32
33
|
const [imgError, setImgError] = useState(false);
|
34
|
+
/** @type {AvatarProps} */
|
33
35
|
const newProps = mergeProps(props, Avatar, []);
|
34
36
|
const { did = '', size, src, variant, animation, shape, blockiesPadding, responsive, ...rest } = newProps;
|
35
37
|
|
@@ -132,8 +132,8 @@ const Div = styled('div')`
|
|
132
132
|
* cover?: string;
|
133
133
|
* version?: string;
|
134
134
|
* buttonText?: string;
|
135
|
-
* buttonDisabled?:
|
136
|
-
* buttonLoading?:
|
135
|
+
* buttonDisabled?: false | true;
|
136
|
+
* buttonLoading?: false | true;
|
137
137
|
* button?: JSX.Element;
|
138
138
|
* onButtonClick?: Function;
|
139
139
|
* onMainClick?: Function;
|
@@ -11,12 +11,12 @@ function BlockletProvider({
|
|
11
11
|
baseUrl = '',
|
12
12
|
loading = null,
|
13
13
|
}: {
|
14
|
-
children
|
14
|
+
children?: React.ReactNode;
|
15
15
|
/**
|
16
16
|
* baseUrl 为 blocklet origin + blocklet prefix
|
17
17
|
*/
|
18
|
-
baseUrl
|
19
|
-
loading
|
18
|
+
baseUrl?: string;
|
19
|
+
loading?: React.ReactNode;
|
20
20
|
}) {
|
21
21
|
const [blockletData, setBlockletData] = useState<Blocklet | null>(null);
|
22
22
|
const getBlockleData = useMemoizedFn(async () => {
|
@@ -208,10 +208,10 @@ BlockletIcon.propTypes = {
|
|
208
208
|
* description?: string;
|
209
209
|
* cover?: string;
|
210
210
|
* did?: string;
|
211
|
-
* isStickyButton?:
|
211
|
+
* isStickyButton?: false | true;
|
212
212
|
* buttonText?: string;
|
213
|
-
* buttonDisabled?:
|
214
|
-
* buttonLoading?:
|
213
|
+
* buttonDisabled?: false | true;
|
214
|
+
* buttonLoading?: false | true;
|
215
215
|
* button?: JSX.Element;
|
216
216
|
* addons?: Array<any>;
|
217
217
|
* size?: 'xs' | 'sm' | 'md' | 'auto';
|
@@ -26,8 +26,8 @@ export interface IBlockletStore extends CardProps {
|
|
26
26
|
};
|
27
27
|
button?: React.ReactNode;
|
28
28
|
buttonText?: string;
|
29
|
-
buttonDisabled?:
|
30
|
-
buttonLoading?:
|
29
|
+
buttonDisabled?: false | true;
|
30
|
+
buttonLoading?: false | true;
|
31
31
|
onButtonClick?: Function;
|
32
32
|
onMainClick?: Function;
|
33
33
|
className?: string;
|
package/src/Button/wrap.jsx
CHANGED
@@ -21,8 +21,8 @@ const extendedColors = {
|
|
21
21
|
/**
|
22
22
|
* @typedef {import('@mui/material').ButtonProps} MuiButtonProps
|
23
23
|
* @typedef {{
|
24
|
-
* rounded?:
|
25
|
-
* loading?:
|
24
|
+
* rounded?: false | true,
|
25
|
+
* loading?: false | true,
|
26
26
|
* forwardedRef?: import('react').ForwardedRef<any>,
|
27
27
|
* color?: MuiButtonProps['color'] | 'reverse' | 'did'
|
28
28
|
* }} CustomButtonProps
|
package/src/Center/index.tsx
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
/* eslint-disable no-unused-vars */
|
2
1
|
import Tooltip from '@mui/material/Tooltip';
|
3
2
|
import { green } from '@mui/material/colors';
|
4
3
|
import CopyIcon from '@mui/icons-material/ContentCopy';
|
5
4
|
import CheckIcon from '@mui/icons-material/Check';
|
6
5
|
import useCopy from './hook';
|
6
|
+
import type { Locale } from '../type';
|
7
7
|
|
8
8
|
export interface CopyButtonProps extends React.HTMLAttributes<HTMLSpanElement> {
|
9
9
|
content?: string;
|
10
|
-
locale?:
|
11
|
-
render?: (props: { copyButton: React.ReactNode; containerRef: React.RefObject<HTMLElement> }) =>
|
12
|
-
showTooltip?:
|
10
|
+
locale?: Locale;
|
11
|
+
render?: (props: { copyButton: React.ReactNode; containerRef: React.RefObject<HTMLElement> }) => JSX.Element | null;
|
12
|
+
showTooltip?: true | false;
|
13
13
|
}
|
14
14
|
|
15
15
|
export default function CopyButton({
|
package/src/ClickToCopy/hook.ts
CHANGED
@@ -1,7 +1,8 @@
|
|
1
1
|
import { useState, useEffect, useRef } from 'react';
|
2
2
|
import Copy from 'copy-to-clipboard';
|
3
|
+
import type { Locale, Translations } from '../type';
|
3
4
|
|
4
|
-
const translations = {
|
5
|
+
const translations: Translations = {
|
5
6
|
en: {
|
6
7
|
copy: 'Click To Copy',
|
7
8
|
copied: 'Copied!',
|
@@ -12,7 +13,7 @@ const translations = {
|
|
12
13
|
},
|
13
14
|
};
|
14
15
|
|
15
|
-
export default function useCopy({ content, locale = 'en' }: { content?: string; locale?:
|
16
|
+
export default function useCopy({ content, locale = 'en' }: { content?: string; locale?: Locale }) {
|
16
17
|
const [copied, setCopied] = useState(false);
|
17
18
|
const containerRef = useRef<HTMLElement | null>(null);
|
18
19
|
const copy = (e: React.MouseEvent) => {
|
@@ -1,11 +1,12 @@
|
|
1
1
|
import { useSize } from 'ahooks';
|
2
|
-
import Tooltip from '@mui/material/Tooltip';
|
2
|
+
import Tooltip, { type TooltipProps } from '@mui/material/Tooltip';
|
3
3
|
|
4
4
|
import { useSnackbar } from 'notistack';
|
5
5
|
import useCopy from './hook';
|
6
6
|
import Toast, { ToastProvider } from '../Toast';
|
7
7
|
import { mergeProps } from '../Util';
|
8
8
|
import { styled } from '../Theme';
|
9
|
+
import type { Locale } from '../type';
|
9
10
|
|
10
11
|
export { default as CopyButton } from './copy-button';
|
11
12
|
|
@@ -26,13 +27,13 @@ const UnstyledContainer = styled('span')`
|
|
26
27
|
cursor: pointer;
|
27
28
|
`;
|
28
29
|
|
29
|
-
export interface ClickToCopyProps extends
|
30
|
+
export interface ClickToCopyProps extends TooltipProps {
|
30
31
|
content?: string;
|
31
|
-
locale?:
|
32
|
+
locale?: Locale;
|
32
33
|
tip?: string;
|
33
34
|
tipPlacement?: string;
|
34
35
|
copiedTip?: string;
|
35
|
-
unstyled?:
|
36
|
+
unstyled?: false | true;
|
36
37
|
}
|
37
38
|
|
38
39
|
export default function ClickToCopy(props: ClickToCopyProps) {
|
@@ -74,6 +75,6 @@ ClickToCopy.defaultProps = {
|
|
74
75
|
tip: '',
|
75
76
|
copiedTip: '',
|
76
77
|
tipPlacement: 'right',
|
77
|
-
locale: 'en'
|
78
|
+
locale: 'en',
|
78
79
|
unstyled: false,
|
79
80
|
};
|
package/src/CodeBlock/index.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
/* eslint-disable react/no-danger */
|
2
2
|
import { useState } from 'react';
|
3
3
|
import Copy from 'copy-to-clipboard';
|
4
|
+
import { type SxProps } from '@mui/material';
|
4
5
|
|
5
6
|
import hljs from 'highlight.js/lib/core';
|
6
7
|
import javascript from 'highlight.js/lib/languages/javascript';
|
@@ -59,7 +60,8 @@ export interface CodeBlockProps extends React.HTMLAttributes<HTMLPreElement> {
|
|
59
60
|
code?: string;
|
60
61
|
language?: string;
|
61
62
|
children?: React.ReactNode;
|
62
|
-
dark?:
|
63
|
+
dark?: true | false;
|
64
|
+
sx?: SxProps;
|
63
65
|
}
|
64
66
|
|
65
67
|
export default function CodeBlock({
|
@@ -1,12 +1,12 @@
|
|
1
|
-
import
|
2
|
-
import Button from '@mui/material/Button';
|
1
|
+
import Button, { type ButtonProps } from '@mui/material/Button';
|
3
2
|
import CookieConsent, { resetCookieConsentValue } from 'react-cookie-consent';
|
4
3
|
|
5
4
|
import { styled } from '../Theme';
|
5
|
+
import type { Locale, Translations } from '../type';
|
6
6
|
|
7
7
|
export { resetCookieConsentValue };
|
8
8
|
|
9
|
-
const translations = {
|
9
|
+
const translations: Translations = {
|
10
10
|
en: {
|
11
11
|
content:
|
12
12
|
'We use cookies and other tracking technologies to improve your browsing experience on our website, to show you personalized content, to analyze our website traffic, and to understand where our visitors are coming from.',
|
@@ -27,16 +27,27 @@ function inIframe() {
|
|
27
27
|
}
|
28
28
|
}
|
29
29
|
|
30
|
-
function AcceptButton(props) {
|
30
|
+
function AcceptButton(props: ButtonProps) {
|
31
31
|
return <Button variant="contained" {...props} />;
|
32
32
|
}
|
33
33
|
|
34
|
+
export interface CookieConsentProps extends React.ComponentProps<typeof CookieConsent> {
|
35
|
+
locale?: Locale;
|
36
|
+
displayInIframe?: false | true;
|
37
|
+
}
|
38
|
+
|
34
39
|
/**
|
35
40
|
* DefaultCookieConsent, 对 react-cookie-consent package 封装, 以便 arcblock 内部产品可以快速使用
|
36
41
|
* - 默认内容
|
37
42
|
* - 默认配置/样式
|
38
43
|
*/
|
39
|
-
export default function DefaultCookieConsent({
|
44
|
+
export default function DefaultCookieConsent({
|
45
|
+
children,
|
46
|
+
locale = 'en',
|
47
|
+
style = {},
|
48
|
+
displayInIframe = false,
|
49
|
+
...rest
|
50
|
+
}: CookieConsentProps) {
|
40
51
|
if (!displayInIframe && inIframe()) {
|
41
52
|
return null;
|
42
53
|
}
|
@@ -59,20 +70,6 @@ export default function DefaultCookieConsent({ children, locale, style, displayI
|
|
59
70
|
);
|
60
71
|
}
|
61
72
|
|
62
|
-
DefaultCookieConsent.propTypes = {
|
63
|
-
children: PropTypes.any,
|
64
|
-
style: PropTypes.object,
|
65
|
-
locale: PropTypes.string,
|
66
|
-
displayInIframe: PropTypes.bool,
|
67
|
-
};
|
68
|
-
|
69
|
-
DefaultCookieConsent.defaultProps = {
|
70
|
-
children: null,
|
71
|
-
style: {},
|
72
|
-
locale: 'en',
|
73
|
-
displayInIframe: false,
|
74
|
-
};
|
75
|
-
|
76
73
|
const Wrapper = styled('div')`
|
77
74
|
box-sizing: border-box;
|
78
75
|
position: fixed;
|