@arcblock/ux 2.10.66 → 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,5 +1,5 @@
|
|
1
1
|
import { Component } from 'react';
|
2
|
-
import
|
2
|
+
import { type SxProps } from '@mui/material';
|
3
3
|
|
4
4
|
import { getColor, mergeProps } from '../Util';
|
5
5
|
import { styled } from '../Theme';
|
@@ -8,7 +8,7 @@ const SECONDS_OF_MINUTE = 60;
|
|
8
8
|
const SECONDS_OF_HOUR = 60 * SECONDS_OF_MINUTE;
|
9
9
|
const SECONDS_OF_DAY = 24 * SECONDS_OF_HOUR;
|
10
10
|
|
11
|
-
function getRemaining(endTime) {
|
11
|
+
function getRemaining(endTime: number) {
|
12
12
|
const now = new Date().getTime();
|
13
13
|
const diff = Math.round((endTime - now) / 1000);
|
14
14
|
const days = Math.floor(diff / SECONDS_OF_DAY);
|
@@ -19,7 +19,7 @@ function getRemaining(endTime) {
|
|
19
19
|
}
|
20
20
|
|
21
21
|
// eslint-disable-next-line react/prop-types
|
22
|
-
function FixWidthNumber({ number, label, length = 2 }) {
|
22
|
+
function FixWidthNumber({ number, label, length = 2 }: { number: number; label: string; length?: number }) {
|
23
23
|
let str = number.toString();
|
24
24
|
while (str.length < length) {
|
25
25
|
str = `0${str}`;
|
@@ -41,12 +41,32 @@ function FixWidthNumber({ number, label, length = 2 }) {
|
|
41
41
|
);
|
42
42
|
}
|
43
43
|
|
44
|
-
export
|
45
|
-
|
44
|
+
export interface CountDownProps extends React.HTMLAttributes<HTMLDivElement> {
|
45
|
+
/** endTime should be UTC */
|
46
|
+
endTime: number;
|
47
|
+
dark?: true | false;
|
48
|
+
sx?: SxProps;
|
49
|
+
}
|
50
|
+
|
51
|
+
export interface CountDownState {
|
52
|
+
days: number;
|
53
|
+
hours: number;
|
54
|
+
minutes: number;
|
55
|
+
seconds: number;
|
56
|
+
done: boolean;
|
57
|
+
}
|
58
|
+
|
59
|
+
export default class CountDown extends Component<CountDownProps, CountDownState> {
|
60
|
+
// eslint-disable-next-line react/static-property-placement
|
61
|
+
static defaultProps: { dark: boolean; style: {} };
|
62
|
+
|
63
|
+
timer?: NodeJS.Timeout;
|
64
|
+
|
65
|
+
constructor(props: CountDownProps) {
|
46
66
|
super(props);
|
47
67
|
const newProps = mergeProps(props, CountDown, ['dark', 'endTime', 'style']);
|
48
68
|
this.state = getRemaining(newProps.endTime);
|
49
|
-
this.timer =
|
69
|
+
this.timer = undefined;
|
50
70
|
}
|
51
71
|
|
52
72
|
componentDidMount() {
|
@@ -54,7 +74,7 @@ export default class CountDown extends Component {
|
|
54
74
|
const remaining = getRemaining(this.props.endTime);
|
55
75
|
if (remaining.done) {
|
56
76
|
clearInterval(this.timer);
|
57
|
-
this.timer =
|
77
|
+
this.timer = undefined;
|
58
78
|
}
|
59
79
|
|
60
80
|
this.setState(remaining);
|
@@ -64,7 +84,7 @@ export default class CountDown extends Component {
|
|
64
84
|
componentWillUnmount() {
|
65
85
|
if (this.timer) {
|
66
86
|
clearInterval(this.timer);
|
67
|
-
this.timer =
|
87
|
+
this.timer = undefined;
|
68
88
|
}
|
69
89
|
}
|
70
90
|
|
@@ -72,7 +92,7 @@ export default class CountDown extends Component {
|
|
72
92
|
const { dark, endTime, ...rest } = this.props;
|
73
93
|
const { days, hours, minutes, seconds } = this.state;
|
74
94
|
return (
|
75
|
-
<Container dark={dark} {...rest}>
|
95
|
+
<Container dark={dark!} {...rest}>
|
76
96
|
<FixWidthNumber number={days} label="D" />
|
77
97
|
<span className="num-sep">:</span>
|
78
98
|
<FixWidthNumber number={hours} label="H" />
|
@@ -85,12 +105,6 @@ export default class CountDown extends Component {
|
|
85
105
|
}
|
86
106
|
}
|
87
107
|
|
88
|
-
CountDown.propTypes = {
|
89
|
-
endTime: PropTypes.number.isRequired, // endTime should be UTC
|
90
|
-
dark: PropTypes.bool,
|
91
|
-
style: PropTypes.object,
|
92
|
-
};
|
93
|
-
|
94
108
|
CountDown.defaultProps = {
|
95
109
|
dark: true,
|
96
110
|
style: {},
|
@@ -99,7 +113,7 @@ CountDown.defaultProps = {
|
|
99
113
|
const textBackground = `linear-gradient(to bottom, rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
|
100
114
|
linear-gradient(to bottom, rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5) 77%, rgba(0, 0, 0, 0.5))`;
|
101
115
|
|
102
|
-
const Container = styled('div')
|
116
|
+
const Container = styled('div', { shouldForwardProp: (prop) => prop !== 'dark' })<{ dark: boolean }>`
|
103
117
|
color: ${(props) => getColor(props)};
|
104
118
|
font-size: 50px;
|
105
119
|
display: flex;
|
package/src/DID/index.tsx
CHANGED
@@ -15,6 +15,7 @@ import { DID_PREFIX } from '../Util/constant';
|
|
15
15
|
import { HTMLDidAddressElement } from '../Address/did-address';
|
16
16
|
import { translate } from '../Locale/util';
|
17
17
|
import { getDIDColor, isEthereumDid } from '../Util';
|
18
|
+
import type { Locale } from '../type';
|
18
19
|
|
19
20
|
const translations = {
|
20
21
|
en: {
|
@@ -33,17 +34,17 @@ interface IDIDPropTypes extends IDidAddressWrapper {
|
|
33
34
|
did: string;
|
34
35
|
size?: number;
|
35
36
|
component?: React.ElementType;
|
36
|
-
copyable?:
|
37
|
-
responsive?:
|
38
|
-
showCopyButtonInTooltip?:
|
39
|
-
showAvatar?:
|
40
|
-
showQrcode?:
|
41
|
-
inline?:
|
37
|
+
copyable?: true | false;
|
38
|
+
responsive?: true | false;
|
39
|
+
showCopyButtonInTooltip?: false | true;
|
40
|
+
showAvatar?: true | false;
|
41
|
+
showQrcode?: false | true;
|
42
|
+
inline?: false | true;
|
42
43
|
append?: any;
|
43
|
-
compact?:
|
44
|
+
compact?: false | true;
|
44
45
|
startChars?: number;
|
45
46
|
endChars?: number;
|
46
|
-
locale?:
|
47
|
+
locale?: Locale;
|
47
48
|
chainId?: string;
|
48
49
|
roleType?: number;
|
49
50
|
}
|
package/src/Datatable/index.jsx
CHANGED
@@ -43,16 +43,16 @@ import { styled } from '../Theme';
|
|
43
43
|
* @typedef {{
|
44
44
|
* data: Array<object | number[] | string[]>,
|
45
45
|
* columns: Array<DataTableColumn>,
|
46
|
-
* locale?:
|
46
|
+
* locale?: import('../type').Locale,
|
47
47
|
* options?: { searchDebounceTime?: number } & import('mui-datatables').MUIDataTableOptions,
|
48
48
|
* style?: import('react').CSSProperties,
|
49
49
|
* customButtons?: Array<DataTableCustomButton>,
|
50
50
|
* onChange?: (state: DataTableState, action: string) => void | Promise<void>,
|
51
|
-
* loading?:
|
52
|
-
* disabled?:
|
53
|
-
* stripped?:
|
51
|
+
* loading?: false | true,
|
52
|
+
* disabled?: false | true,
|
53
|
+
* stripped?: false | true,
|
54
54
|
* verticalKeyWidth?: number | string,
|
55
|
-
* hideTableHeader?:
|
55
|
+
* hideTableHeader?: false | true,
|
56
56
|
* components?: ModifiedMUIDataTableProps['components'],
|
57
57
|
* emptyNode?: import('react').ReactNode,
|
58
58
|
* durable?: string,
|
package/src/Dialog/confirm.jsx
CHANGED
@@ -13,9 +13,9 @@ import Dialog from './dialog';
|
|
13
13
|
* onConfirm: Function,
|
14
14
|
* onCancel: Function,
|
15
15
|
* children?: React.ReactNode,
|
16
|
-
* showCancelButton?:
|
17
|
-
* showCloseButton?:
|
18
|
-
* fullScreen?:
|
16
|
+
* showCancelButton?: true | false,
|
17
|
+
* showCloseButton?: true | false,
|
18
|
+
* fullScreen?: false | true,
|
19
19
|
* confirmButton?: {text: string, props?: ButtonProps}
|
20
20
|
* cancelButton?: {text: string, props?: ButtonProps}
|
21
21
|
* PaperProps?: PaperProps
|
package/src/Dialog/types.d.ts
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
import PropTypes from 'prop-types';
|
2
1
|
import DidLogoIcon from '@arcblock/icons/lib/DidLogo';
|
3
2
|
|
4
3
|
const defaultStyle = {
|
@@ -7,7 +6,13 @@ const defaultStyle = {
|
|
7
6
|
fill: 'currentColor',
|
8
7
|
};
|
9
8
|
|
10
|
-
export
|
9
|
+
export interface DidLogoProps {
|
10
|
+
style?: React.CSSProperties;
|
11
|
+
size?: string | number;
|
12
|
+
className?: string;
|
13
|
+
}
|
14
|
+
|
15
|
+
export default function DidLogo({ style = defaultStyle, size = 0, className = '' }: DidLogoProps) {
|
11
16
|
const height = Number(size) > 0 ? `${Number(size)}px` : size;
|
12
17
|
return (
|
13
18
|
<DidLogoIcon
|
@@ -16,15 +21,3 @@ export default function DidLogo({ style, size, className }) {
|
|
16
21
|
/>
|
17
22
|
);
|
18
23
|
}
|
19
|
-
|
20
|
-
DidLogo.propTypes = {
|
21
|
-
style: PropTypes.object,
|
22
|
-
size: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
23
|
-
className: PropTypes.string,
|
24
|
-
};
|
25
|
-
|
26
|
-
DidLogo.defaultProps = {
|
27
|
-
style: defaultStyle,
|
28
|
-
size: 0,
|
29
|
-
className: '',
|
30
|
-
};
|
@@ -1,19 +1,27 @@
|
|
1
1
|
/* eslint-disable max-len */
|
2
2
|
import { Component } from 'react';
|
3
|
-
import PropTypes from 'prop-types';
|
4
3
|
|
5
4
|
import { mergeProps } from '../Util';
|
6
5
|
|
7
|
-
export
|
8
|
-
|
9
|
-
|
6
|
+
export interface DriftBotProps {
|
7
|
+
appId: string;
|
8
|
+
userId?: string;
|
9
|
+
attributes?: Record<string, any>;
|
10
|
+
}
|
11
|
+
|
12
|
+
export default class DriftBot extends Component<DriftBotProps> {
|
13
|
+
// eslint-disable-next-line react/static-property-placement
|
14
|
+
static defaultProps: { userId: string; attributes: Record<string, any> };
|
15
|
+
|
16
|
+
constructor(props: DriftBotProps) {
|
17
|
+
super(mergeProps(props, DriftBot, ['attributes']) as DriftBotProps);
|
10
18
|
|
11
19
|
this.addMainScript = this.addMainScript.bind(this);
|
12
20
|
this.addIdentityVariables = this.addIdentityVariables.bind(this);
|
13
21
|
this.insertScript = this.insertScript.bind(this);
|
14
22
|
}
|
15
23
|
|
16
|
-
insertScript(scriptText) {
|
24
|
+
insertScript(scriptText: string) {
|
17
25
|
const script = document.createElement('script');
|
18
26
|
script.innerText = scriptText;
|
19
27
|
script.async = true;
|
@@ -69,12 +77,6 @@ export default class DriftBot extends Component {
|
|
69
77
|
}
|
70
78
|
}
|
71
79
|
|
72
|
-
DriftBot.propTypes = {
|
73
|
-
appId: PropTypes.string.isRequired,
|
74
|
-
userId: PropTypes.string,
|
75
|
-
attributes: PropTypes.object,
|
76
|
-
};
|
77
|
-
|
78
80
|
DriftBot.defaultProps = {
|
79
81
|
userId: '',
|
80
82
|
attributes: {},
|
@@ -1,13 +1,13 @@
|
|
1
1
|
/* eslint-disable consistent-return */
|
2
2
|
import { useReducer, useRef, useEffect } from 'react';
|
3
3
|
import useSpring from 'react-use/lib/useSpring';
|
4
|
-
import PropTypes from 'prop-types';
|
5
4
|
import * as d3 from 'd3-geo';
|
6
5
|
import * as topojson from 'topojson-client';
|
7
6
|
import versor from 'versor';
|
8
7
|
|
9
8
|
import json from './countries.json';
|
10
9
|
import util from './util';
|
10
|
+
import type { Vec2, Vec3, Quaternion, Angles, Rotation } from './util';
|
11
11
|
import { withDeprecated } from '../Util/deprecate';
|
12
12
|
import { styled } from '../Theme';
|
13
13
|
|
@@ -33,7 +33,20 @@ const themes = {
|
|
33
33
|
},
|
34
34
|
};
|
35
35
|
|
36
|
-
|
36
|
+
type State = {
|
37
|
+
rotation: Angles;
|
38
|
+
isDragging: boolean;
|
39
|
+
animateDuration: number;
|
40
|
+
mousePosition: [number, number] | null;
|
41
|
+
tooltipIndex: number;
|
42
|
+
};
|
43
|
+
|
44
|
+
type Action = {
|
45
|
+
type: string;
|
46
|
+
payload: Record<string, any>;
|
47
|
+
};
|
48
|
+
|
49
|
+
function stateReducer(state: State, action: Action) {
|
37
50
|
switch (action.type) {
|
38
51
|
case 'dragEnd':
|
39
52
|
return { ...state, isDragging: false };
|
@@ -52,8 +65,47 @@ function stateReducer(state, action) {
|
|
52
65
|
}
|
53
66
|
}
|
54
67
|
|
55
|
-
|
56
|
-
|
68
|
+
export type Marker = {
|
69
|
+
id: string;
|
70
|
+
title: string;
|
71
|
+
description: string;
|
72
|
+
country: string;
|
73
|
+
latitude: number;
|
74
|
+
longitude: number;
|
75
|
+
};
|
76
|
+
|
77
|
+
export type Colors = {
|
78
|
+
ocean: string;
|
79
|
+
graticule: string;
|
80
|
+
land: string;
|
81
|
+
activeLand: string;
|
82
|
+
border: string;
|
83
|
+
marker: string;
|
84
|
+
activeMarker: string;
|
85
|
+
};
|
86
|
+
|
87
|
+
export interface EarthProps {
|
88
|
+
theme?: 'light' | 'dark';
|
89
|
+
width?: number;
|
90
|
+
height?: number;
|
91
|
+
enableRotation?: false | true;
|
92
|
+
rotationSpeed?: number;
|
93
|
+
activeMarkerId?: string;
|
94
|
+
markers?: Marker[];
|
95
|
+
colors?: Partial<Colors>;
|
96
|
+
}
|
97
|
+
|
98
|
+
function Earth({
|
99
|
+
theme = 'dark',
|
100
|
+
width = 1200,
|
101
|
+
height = 600,
|
102
|
+
enableRotation = false,
|
103
|
+
rotationSpeed = 5,
|
104
|
+
activeMarkerId,
|
105
|
+
markers = [],
|
106
|
+
colors: _colors = {},
|
107
|
+
}: EarthProps) {
|
108
|
+
const colors: Colors = Object.assign(_colors, themes[theme]);
|
57
109
|
const [state, dispatch] = useReducer(stateReducer, {
|
58
110
|
rotation: [0, 0, 0],
|
59
111
|
isDragging: false,
|
@@ -62,17 +114,25 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
62
114
|
tooltipIndex: -1,
|
63
115
|
});
|
64
116
|
|
65
|
-
const svgRef = useRef(null);
|
117
|
+
const svgRef = useRef<SVGSVGElement>(null);
|
66
118
|
|
67
119
|
// variables used to track drag and rotate
|
68
|
-
const dragRef = useRef
|
69
|
-
v0
|
70
|
-
r0
|
71
|
-
q0
|
72
|
-
});
|
120
|
+
const dragRef = useRef<{
|
121
|
+
v0?: Vec3;
|
122
|
+
r0?: Rotation;
|
123
|
+
q0?: Quaternion;
|
124
|
+
}>({});
|
73
125
|
|
74
126
|
// variables used to track start and end position when there is active marker
|
75
|
-
const rotateRef = useRef
|
127
|
+
const rotateRef = useRef<{
|
128
|
+
p1: Vec2 | null;
|
129
|
+
p2: Vec2;
|
130
|
+
r1: Rotation | null;
|
131
|
+
r2: Rotation;
|
132
|
+
step: number;
|
133
|
+
markerId: string | null;
|
134
|
+
iv: ((t: number) => Angles) | null;
|
135
|
+
}>({
|
76
136
|
p1: null,
|
77
137
|
p2: [0, 0],
|
78
138
|
r1: null,
|
@@ -99,7 +159,7 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
99
159
|
geoJson
|
100
160
|
)
|
101
161
|
.rotate(
|
102
|
-
t <= 1 || state.isDragging || !activeMarkerId ? state.rotation : rotateRef.current.iv(t / state.animateDuration)
|
162
|
+
t <= 1 || state.isDragging || !activeMarkerId ? state.rotation : rotateRef.current.iv!(t / state.animateDuration)
|
103
163
|
);
|
104
164
|
|
105
165
|
const pathGenerator = d3.geoPath().projection(projection).pointRadius(2);
|
@@ -111,7 +171,7 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
111
171
|
let { p1, p2, r1, r2, markerId } = rotateRef.current;
|
112
172
|
// We should only start new animation if the marker has changed
|
113
173
|
if (markerId !== activeMarkerId && !state.isDragging) {
|
114
|
-
const marker = markers.find((x) => x.id === activeMarkerId)
|
174
|
+
const marker = markers.find((x) => x.id === activeMarkerId)!;
|
115
175
|
p1 = p2;
|
116
176
|
p2 = [marker.longitude, marker.latitude];
|
117
177
|
r1 = r2;
|
@@ -149,16 +209,16 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
149
209
|
}
|
150
210
|
});
|
151
211
|
|
152
|
-
const getMousePosition = (event) => {
|
153
|
-
const node = svgRef.current
|
154
|
-
const rect = node
|
212
|
+
const getMousePosition = (event: MouseEvent) => {
|
213
|
+
const node = svgRef.current!;
|
214
|
+
const rect = node?.getBoundingClientRect();
|
155
215
|
const mousePosition = [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
156
216
|
|
157
217
|
return mousePosition;
|
158
218
|
};
|
159
219
|
|
160
|
-
const onDragStart = (event) => {
|
161
|
-
const mousePosition = getMousePosition(event);
|
220
|
+
const onDragStart = (event: React.MouseEvent<SVGSVGElement>) => {
|
221
|
+
const mousePosition = getMousePosition(event as unknown as MouseEvent);
|
162
222
|
|
163
223
|
if (!mousePosition[0]) {
|
164
224
|
return;
|
@@ -171,12 +231,12 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
171
231
|
dispatch({ type: 'dragStart', payload: { mousePosition } });
|
172
232
|
};
|
173
233
|
|
174
|
-
const onDrag = (event) => {
|
234
|
+
const onDrag = (event: React.MouseEvent<SVGSVGElement>) => {
|
175
235
|
if (state.isDragging === false) {
|
176
236
|
return;
|
177
237
|
}
|
178
238
|
|
179
|
-
const mousePosition = getMousePosition(event);
|
239
|
+
const mousePosition = getMousePosition(event as unknown as MouseEvent);
|
180
240
|
const { r0, v0, q0 } = dragRef.current;
|
181
241
|
|
182
242
|
const v1 = versor.cartesian(projection.rotate(r0).invert(mousePosition));
|
@@ -192,7 +252,7 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
192
252
|
}, 200);
|
193
253
|
};
|
194
254
|
|
195
|
-
const onShowTooltip = (event, i) =>
|
255
|
+
const onShowTooltip = (event: MouseEvent, i: number) =>
|
196
256
|
dispatch({
|
197
257
|
type: 'tooltip',
|
198
258
|
payload: { tooltipIndex: i, mousePosition: getMousePosition(event) },
|
@@ -213,9 +273,9 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
213
273
|
<g
|
214
274
|
key={x.id}
|
215
275
|
className={`marker ${isActive ? 'marker--active' : ''}`}
|
216
|
-
onFocus={(event) => onShowTooltip(event, i)}
|
276
|
+
onFocus={(event) => onShowTooltip(event as unknown as MouseEvent, i)}
|
217
277
|
onBlur={onHideTooltip}
|
218
|
-
onMouseOver={(event) => onShowTooltip(event, i)}
|
278
|
+
onMouseOver={(event) => onShowTooltip(event as unknown as MouseEvent, i)}
|
219
279
|
onMouseOut={onHideTooltip}>
|
220
280
|
<circle
|
221
281
|
key="marker-inner"
|
@@ -260,12 +320,12 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
260
320
|
if (activeMarkerId && markers.some((x) => x.id === activeMarkerId)) {
|
261
321
|
const activeMarker = markers.find((x) => x.id === activeMarkerId);
|
262
322
|
activeCountry = geoJson.features.findIndex(
|
263
|
-
(x) => x.properties && x.properties.name && x.properties.name === activeMarker
|
323
|
+
(x: any) => x.properties && x.properties.name && x.properties.name === activeMarker!.country
|
264
324
|
);
|
265
325
|
}
|
266
326
|
|
267
327
|
return (
|
268
|
-
<Container width={width} height={height} theme={theme} colors={colors} onMouseLeave={onDragEnd}>
|
328
|
+
<Container width={width} height={height} $theme={theme} colors={colors} onMouseLeave={onDragEnd}>
|
269
329
|
{renderTooltip()}
|
270
330
|
<svg
|
271
331
|
className="earth"
|
@@ -279,7 +339,7 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
279
339
|
<circle cx={width / 2} cy={height / 2} r={projection.scale()} className="globe" filter="url(#glow)" />
|
280
340
|
<path className="graticule" d={pathGenerator(d3.geoGraticule().step([10, 10])())} />
|
281
341
|
<g className="features">
|
282
|
-
{geoJson.features.map((x, i) => (
|
342
|
+
{geoJson.features.map((x: any, i: number) => (
|
283
343
|
<path
|
284
344
|
key={x.properties.name}
|
285
345
|
className={`country ${activeCountry === i ? 'country--active' : ''}`}
|
@@ -324,49 +384,17 @@ function Earth({ theme, width, height, enableRotation, rotationSpeed, markers, a
|
|
324
384
|
);
|
325
385
|
}
|
326
386
|
|
327
|
-
Earth
|
328
|
-
theme: PropTypes.oneOf(['light', 'dark']),
|
329
|
-
width: PropTypes.number,
|
330
|
-
height: PropTypes.number,
|
331
|
-
enableRotation: PropTypes.bool,
|
332
|
-
rotationSpeed: PropTypes.number,
|
333
|
-
activeMarkerId: PropTypes.string,
|
334
|
-
markers: PropTypes.arrayOf(
|
335
|
-
PropTypes.shape({
|
336
|
-
id: PropTypes.string.isRequired,
|
337
|
-
title: PropTypes.string.isRequired,
|
338
|
-
description: PropTypes.string.isRequired,
|
339
|
-
country: PropTypes.string.isRequired,
|
340
|
-
latitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
341
|
-
longitude: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
342
|
-
})
|
343
|
-
),
|
344
|
-
colors: PropTypes.shape({
|
345
|
-
ocean: PropTypes.string,
|
346
|
-
graticule: PropTypes.string,
|
347
|
-
land: PropTypes.string,
|
348
|
-
activeLand: PropTypes.string,
|
349
|
-
border: PropTypes.string,
|
350
|
-
marker: PropTypes.string,
|
351
|
-
activeMarker: PropTypes.string,
|
352
|
-
}),
|
353
|
-
};
|
387
|
+
export default withDeprecated(Earth, { name: 'Earth' });
|
354
388
|
|
355
|
-
|
356
|
-
theme: 'dark'
|
357
|
-
width:
|
358
|
-
height:
|
359
|
-
|
360
|
-
rotationSpeed: 5,
|
361
|
-
markers: [],
|
362
|
-
activeMarkerId: undefined,
|
363
|
-
colors: {},
|
389
|
+
type ContainerProps = {
|
390
|
+
$theme: 'light' | 'dark';
|
391
|
+
width: number;
|
392
|
+
height: number;
|
393
|
+
colors: Colors;
|
364
394
|
};
|
365
395
|
|
366
|
-
|
367
|
-
|
368
|
-
const Container = styled('div')`
|
369
|
-
background-color: ${(props) => (props.theme === 'light' ? '#f7f7f7' : '#222')};
|
396
|
+
const Container = styled('div')<ContainerProps>`
|
397
|
+
background-color: ${(props) => (props.$theme === 'light' ? '#f7f7f7' : '#222')};
|
370
398
|
width: ${(props) => props.width}px;
|
371
399
|
height: ${(props) => props.height}px;
|
372
400
|
position: relative;
|
@@ -1,7 +1,13 @@
|
|
1
1
|
/* eslint-disable */
|
2
2
|
// Code from: https://observablehq.com/@d3/world-tour
|
3
|
+
export type Vec3 = [number, number, number];
|
4
|
+
export type Vec2 = [number, number];
|
5
|
+
export type Quaternion = [number, number, number, number];
|
6
|
+
export type Rotation = Vec3;
|
7
|
+
export type Angles = Vec3;
|
8
|
+
|
3
9
|
export default class Util {
|
4
|
-
static fromAngles([l, p, g]) {
|
10
|
+
static fromAngles([l, p, g]: Angles) {
|
5
11
|
l *= Math.PI / 360;
|
6
12
|
p *= Math.PI / 360;
|
7
13
|
g *= Math.PI / 360;
|
@@ -16,10 +22,10 @@ export default class Util {
|
|
16
22
|
sl * cp * cg - cl * sp * sg,
|
17
23
|
cl * sp * cg + sl * cp * sg,
|
18
24
|
cl * cp * sg - sl * sp * cg,
|
19
|
-
];
|
25
|
+
] as Quaternion;
|
20
26
|
}
|
21
27
|
|
22
|
-
static toAngles([a, b, c, d]) {
|
28
|
+
static toAngles([a, b, c, d]: Quaternion) {
|
23
29
|
return [
|
24
30
|
(Math.atan2(2 * (a * b + c * d), 1 - 2 * (b * b + c * c)) * 180) / Math.PI,
|
25
31
|
(Math.asin(Math.max(-1, Math.min(1, 2 * (a * c - d * b)))) * 180) / Math.PI,
|
@@ -27,27 +33,24 @@ export default class Util {
|
|
27
33
|
];
|
28
34
|
}
|
29
35
|
|
30
|
-
static interpolateAngles(a, b) {
|
36
|
+
static interpolateAngles(a: [number, number, number], b: [number, number, number]) {
|
31
37
|
const i = Util.interpolate(Util.fromAngles(a), Util.fromAngles(b));
|
32
|
-
return t => Util.toAngles(i(t));
|
38
|
+
return (t: number) => Util.toAngles(i(t));
|
33
39
|
}
|
34
40
|
|
35
|
-
static interpolateLinear([a1, b1, c1, d1], [a2, b2, c2, d2]) {
|
41
|
+
static interpolateLinear([a1, b1, c1, d1]: Quaternion, [a2, b2, c2, d2]: Quaternion) {
|
36
42
|
(a2 -= a1), (b2 -= b1), (c2 -= c1), (d2 -= d1);
|
37
43
|
const x = new Array(4);
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
(x[1] = b1 + b2 * t),
|
42
|
-
(x[2] = c1 + c2 * t),
|
43
|
-
(x[3] = d1 + d2 * t)
|
44
|
-
);
|
44
|
+
|
45
|
+
return (t: number) => {
|
46
|
+
const l = Math.hypot((x[0] = a1 + a2 * t), (x[1] = b1 + b2 * t), (x[2] = c1 + c2 * t), (x[3] = d1 + d2 * t));
|
45
47
|
(x[0] /= l), (x[1] /= l), (x[2] /= l), (x[3] /= l);
|
46
|
-
|
48
|
+
|
49
|
+
return x as Quaternion;
|
47
50
|
};
|
48
51
|
}
|
49
52
|
|
50
|
-
static interpolate([a1, b1, c1, d1], [a2, b2, c2, d2]) {
|
53
|
+
static interpolate([a1, b1, c1, d1]: Quaternion, [a2, b2, c2, d2]: Quaternion) {
|
51
54
|
let dot = a1 * a2 + b1 * b2 + c1 * c2 + d1 * d2;
|
52
55
|
if (dot < 0) (a2 = -a2), (b2 = -b2), (c2 = -c2), (d2 = -d2), (dot = -dot);
|
53
56
|
if (dot > 0.9995) return Util.interpolateLinear([a1, b1, c1, d1], [a2, b2, c2, d2]);
|
@@ -55,7 +58,7 @@ export default class Util {
|
|
55
58
|
const x = new Array(4);
|
56
59
|
const l = Math.hypot((a2 -= a1 * dot), (b2 -= b1 * dot), (c2 -= c1 * dot), (d2 -= d1 * dot));
|
57
60
|
(a2 /= l), (b2 /= l), (c2 /= l), (d2 /= l);
|
58
|
-
return t => {
|
61
|
+
return (t: number) => {
|
59
62
|
const theta = theta0 * t;
|
60
63
|
const s = Math.sin(theta);
|
61
64
|
const c = Math.cos(theta);
|
@@ -63,7 +66,7 @@ export default class Util {
|
|
63
66
|
x[1] = b1 * c + b2 * s;
|
64
67
|
x[2] = c1 * c + c2 * s;
|
65
68
|
x[3] = d1 * c + d2 * s;
|
66
|
-
return x;
|
69
|
+
return x as Quaternion;
|
67
70
|
};
|
68
71
|
}
|
69
72
|
}
|