@arcblock/ux 3.4.15 → 3.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/package.json.js +1 -1
- package/package.json +10 -7
- package/src/ActionButton/ActionButton.stories.jsx +0 -61
- package/src/ActionButton/index.jsx +0 -106
- package/src/ActivityIndicator/ActivityIndicator.stories.jsx +0 -9
- package/src/ActivityIndicator/index.jsx +0 -140
- package/src/Address/Address.stories.jsx +0 -38
- package/src/Address/compact-text.jsx +0 -76
- package/src/Address/did-address.tsx +0 -223
- package/src/Address/index.tsx +0 -21
- package/src/Address/responsive-did-address.tsx +0 -154
- package/src/Alert/Alert.stories.jsx +0 -100
- package/src/Alert/index.jsx +0 -130
- package/src/AnimationWaiter/AnimationWaiter.stories.jsx +0 -35
- package/src/AnimationWaiter/dark-animation.json +0 -1
- package/src/AnimationWaiter/default-animation.json +0 -1
- package/src/AnimationWaiter/index.jsx +0 -296
- package/src/Async/index.tsx +0 -44
- package/src/Avatar/Avatar.stories.jsx +0 -11
- package/src/Avatar/did-motif.jsx +0 -38
- package/src/Avatar/etherscan-blockies.js +0 -81
- package/src/Avatar/index.jsx +0 -195
- package/src/Badge/Badge.stories.jsx +0 -41
- package/src/Badge/index.jsx +0 -101
- package/src/Blocklet/Blocklet.stories.jsx +0 -21
- package/src/Blocklet/blocklet.jsx +0 -276
- package/src/Blocklet/index.js +0 -5
- package/src/Blocklet/utils.jsx +0 -58
- package/src/BlockletContext/index.tsx +0 -72
- package/src/BlockletNFT/BlockletNFT.stories.jsx +0 -21
- package/src/BlockletNFT/index.jsx +0 -378
- package/src/BlockletV2/Blocklet.stories.jsx +0 -34
- package/src/BlockletV2/blocklet.tsx +0 -247
- package/src/BlockletV2/components/icon-text.tsx +0 -47
- package/src/BlockletV2/components/tooltip-icon.tsx +0 -52
- package/src/BlockletV2/index.ts +0 -6
- package/src/BlockletV2/utils.js +0 -75
- package/src/Button/Button.stories.jsx +0 -24
- package/src/Button/index.js +0 -9
- package/src/Button/wrap.jsx +0 -126
- package/src/ButtonGroup/index.js +0 -16
- package/src/CardSelector/index.tsx +0 -136
- package/src/Center/Center.stories.jsx +0 -20
- package/src/Center/index.tsx +0 -33
- package/src/ClickToCopy/ClickToCopy.stories.jsx +0 -24
- package/src/ClickToCopy/copy-button.tsx +0 -43
- package/src/ClickToCopy/hook.ts +0 -42
- package/src/ClickToCopy/index.tsx +0 -96
- package/src/CloseButton/index.tsx +0 -37
- package/src/CodeBlock/CodeBlock.stories.jsx +0 -22
- package/src/CodeBlock/LightBox.tsx +0 -87
- package/src/CodeBlock/index.tsx +0 -217
- package/src/Colors/Colors.stories.jsx +0 -211
- package/src/Colors/index.ts +0 -4
- package/src/Colors/themes/default.ts +0 -8
- package/src/Colors/themes/did-connect.ts +0 -64
- package/src/Colors/themes/temp.ts +0 -52
- package/src/Config/Config.stories.jsx +0 -16
- package/src/Config/config-provider.tsx +0 -62
- package/src/Config/index.ts +0 -2
- package/src/Config/theme-mode-toggle.tsx +0 -38
- package/src/ContactForm/ContactForm.stories.jsx +0 -32
- package/src/ContactForm/index.tsx +0 -264
- package/src/CookieConsent/CookieConsent.stories.jsx +0 -33
- package/src/CookieConsent/index.tsx +0 -104
- package/src/CountDown/CountDown.stories.jsx +0 -15
- package/src/CountDown/index.tsx +0 -170
- package/src/DID/DID.stories.jsx +0 -37
- package/src/DID/index.tsx +0 -393
- package/src/DIDConnect/app-icon.tsx +0 -37
- package/src/DIDConnect/app-info-item.tsx +0 -93
- package/src/DIDConnect/auth-apps/auth-apps-info.tsx +0 -77
- package/src/DIDConnect/auth-apps/index.tsx +0 -278
- package/src/DIDConnect/auth-apps/switch-role.tsx +0 -47
- package/src/DIDConnect/did-connect-container.tsx +0 -326
- package/src/DIDConnect/did-connect-footer.tsx +0 -76
- package/src/DIDConnect/did-connect-logo.tsx +0 -8
- package/src/DIDConnect/icons/did-wallet-logo.tsx +0 -18
- package/src/DIDConnect/icons/github-logo.tsx +0 -17
- package/src/DIDConnect/index.ts +0 -11
- package/src/DIDConnect/landing-page.tsx +0 -218
- package/src/DIDConnect/powered-by.tsx +0 -48
- package/src/DIDConnect/provider-icon.tsx +0 -62
- package/src/DIDConnect/request-storage-access-api-dialog.tsx +0 -304
- package/src/DIDConnect/with-container.tsx +0 -323
- package/src/DIDConnect/with-ux-theme.tsx +0 -22
- package/src/DIDLogo/Logo.stories.jsx +0 -11
- package/src/DIDLogo/index.tsx +0 -168
- package/src/Datatable/CustomToolbar.jsx +0 -415
- package/src/Datatable/Datatable.stories.jsx +0 -92
- package/src/Datatable/DatatableContext.jsx +0 -35
- package/src/Datatable/TableSearch.jsx +0 -166
- package/src/Datatable/index.jsx +0 -652
- package/src/Datatable/utils.js +0 -161
- package/src/Dialog/Dialog.stories.jsx +0 -21
- package/src/Dialog/confirm.jsx +0 -143
- package/src/Dialog/dialog.jsx +0 -199
- package/src/Dialog/index.js +0 -4
- package/src/Dialog/types.d.ts +0 -20
- package/src/Dialog/use-confirm.jsx +0 -188
- package/src/DriftBot/index.tsx +0 -81
- package/src/Earth/Earth.stories.jsx +0 -39
- package/src/Earth/countries.json +0 -8057
- package/src/Earth/index.tsx +0 -515
- package/src/Earth/util.ts +0 -72
- package/src/Empty/Empty.stories.jsx +0 -23
- package/src/Empty/index.jsx +0 -48
- package/src/ErrorBoundary/ErrorBoundary.stories.jsx +0 -13
- package/src/ErrorBoundary/fallback.tsx +0 -85
- package/src/ErrorBoundary/index.ts +0 -1
- package/src/Footer/Footer.stories.jsx +0 -13
- package/src/Footer/index.tsx +0 -130
- package/src/Header/Header.stories.jsx +0 -30
- package/src/Header/addon-button.tsx +0 -41
- package/src/Header/auto-hidden.tsx +0 -31
- package/src/Header/header-addons.tsx +0 -37
- package/src/Header/header.tsx +0 -214
- package/src/Header/index.ts +0 -3
- package/src/Header/responsive-header.tsx +0 -145
- package/src/Icon/Icon.stories.jsx +0 -45
- package/src/Icon/image.tsx +0 -53
- package/src/Icon/index.tsx +0 -63
- package/src/Img/Img.stories.jsx +0 -17
- package/src/Img/index.jsx +0 -258
- package/src/InfoRow/InfoRow.stories.jsx +0 -14
- package/src/InfoRow/index.tsx +0 -91
- package/src/Layout/Layout.stories.jsx +0 -24
- package/src/Layout/dashboard/external-link.tsx +0 -59
- package/src/Layout/dashboard/full-page.tsx +0 -58
- package/src/Layout/dashboard/index.tsx +0 -260
- package/src/Layout/dashboard/sidebar.tsx +0 -198
- package/src/Layout/dashboard-legacy/header.tsx +0 -156
- package/src/Layout/dashboard-legacy/index.tsx +0 -127
- package/src/Layout/dashboard-legacy/sidebar.tsx +0 -129
- package/src/Layout/index.tsx +0 -310
- package/src/LoadingMask/index.tsx +0 -108
- package/src/Locale/LocaleSelector.stories.jsx +0 -44
- package/src/Locale/browser-lang.ts +0 -65
- package/src/Locale/context.tsx +0 -162
- package/src/Locale/languages.ts +0 -58
- package/src/Locale/selector.tsx +0 -174
- package/src/Locale/util.ts +0 -38
- package/src/Logo/Logo.stories.jsx +0 -23
- package/src/Logo/images/logo-dark-text.svg +0 -3
- package/src/Logo/images/logo-dark-top.svg +0 -6
- package/src/Logo/images/logo-light-text.svg +0 -3
- package/src/Logo/images/logo-light-top.svg +0 -6
- package/src/Logo/index.tsx +0 -58
- package/src/Metric/Metric.stories.jsx +0 -29
- package/src/Metric/index.tsx +0 -130
- package/src/MuiWrap/index.tsx +0 -10
- package/src/NFTDisplay/NFTBroken.svg +0 -34
- package/src/NFTDisplay/NFTDisplay.stories.jsx +0 -30
- package/src/NFTDisplay/README.md +0 -59
- package/src/NFTDisplay/aspect-ratio-container.tsx +0 -36
- package/src/NFTDisplay/broken.tsx +0 -51
- package/src/NFTDisplay/displayApi.ts +0 -43
- package/src/NFTDisplay/index.tsx +0 -393
- package/src/NFTDisplay/loading.tsx +0 -16
- package/src/NFTDisplay/preview.tsx +0 -84
- package/src/NFTDisplay/render-svg.tsx +0 -21
- package/src/NFTDisplay/svg-embedder/img.tsx +0 -27
- package/src/NFTDisplay/svg-embedder/inline-svg.tsx +0 -36
- package/src/NavMenu/NavMenu.stories.jsx +0 -17
- package/src/NavMenu/images/OCAP.svg +0 -1
- package/src/NavMenu/images/abt-network.svg +0 -1
- package/src/NavMenu/images/ai-kit.svg +0 -1
- package/src/NavMenu/images/aigne-image-smith.svg +0 -1
- package/src/NavMenu/images/aigne.svg +0 -1
- package/src/NavMenu/images/aistro.png +0 -0
- package/src/NavMenu/images/arcsphere.svg +0 -1
- package/src/NavMenu/images/blocklet-framework.svg +0 -1
- package/src/NavMenu/images/blocklet-launcher.svg +0 -1
- package/src/NavMenu/images/blocklet-server.svg +0 -1
- package/src/NavMenu/images/blocklet-store.svg +0 -1
- package/src/NavMenu/images/creator-studio.svg +0 -1
- package/src/NavMenu/images/did-wallet.svg +0 -1
- package/src/NavMenu/images/did.svg +0 -1
- package/src/NavMenu/images/nft-studio.svg +0 -1
- package/src/NavMenu/images/payment-kit.png +0 -0
- package/src/NavMenu/images/vc.svg +0 -1
- package/src/NavMenu/images/web3-kit.svg +0 -1
- package/src/NavMenu/index.ts +0 -3
- package/src/NavMenu/nav-menu-context.tsx +0 -30
- package/src/NavMenu/nav-menu.tsx +0 -441
- package/src/NavMenu/products.tsx +0 -830
- package/src/NavMenu/style.ts +0 -258
- package/src/NavMenu/sub-container.tsx +0 -125
- package/src/NavMenu/sub-item-group.tsx +0 -42
- package/src/OrgTransfer/index.tsx +0 -53
- package/src/OrgTransfer/locales.ts +0 -25
- package/src/OrgTransfer/selector.tsx +0 -252
- package/src/OrgTransfer/type.ts +0 -31
- package/src/PageScroller/index.tsx +0 -316
- package/src/PageScroller/story/FifthComponent.jsx +0 -7
- package/src/PageScroller/story/FirstComponent.jsx +0 -7
- package/src/PageScroller/story/FourthComponent.jsx +0 -7
- package/src/PageScroller/story/FullPage.jsx +0 -55
- package/src/PageScroller/story/PageContain.jsx +0 -59
- package/src/PageScroller/story/PageScroller.stories.jsx +0 -18
- package/src/PageScroller/story/SecondComponent.jsx +0 -7
- package/src/PageScroller/story/ThirdComponent.jsx +0 -7
- package/src/PageScroller/story/index.css +0 -115
- package/src/PageScroller/usePrevValue.ts +0 -11
- package/src/Passport/index.ts +0 -3
- package/src/Passport/passport.tsx +0 -118
- package/src/PhoneInput/PhoneInput.stories.jsx +0 -12
- package/src/PhoneInput/country-select.tsx +0 -148
- package/src/PhoneInput/index.tsx +0 -269
- package/src/PoweredByArcBlock/index.tsx +0 -27
- package/src/PricingTable/PricingPlan.tsx +0 -120
- package/src/PricingTable/PricingTable.stories.jsx +0 -38
- package/src/PricingTable/index.tsx +0 -59
- package/src/QRCode/QRCode.stories.jsx +0 -13
- package/src/QRCode/index.tsx +0 -66
- package/src/RelativeTime/RelativeTime.stories.jsx +0 -20
- package/src/RelativeTime/index.tsx +0 -334
- package/src/Result/Result.stories.jsx +0 -61
- package/src/Result/common.tsx +0 -119
- package/src/Result/index.tsx +0 -30
- package/src/Result/result.tsx +0 -65
- package/src/Result/translations.ts +0 -57
- package/src/Screenshot/BaseScreenshot/index.tsx +0 -73
- package/src/Screenshot/BaseScreenshot/shells/Macbook.tsx +0 -38
- package/src/Screenshot/BaseScreenshot/shells/Phone.tsx +0 -35
- package/src/Screenshot/Screenshot.stories.jsx +0 -44
- package/src/Screenshot/devices.css +0 -1366
- package/src/Screenshot/index.tsx +0 -300
- package/src/SessionBlocklet/index.tsx +0 -178
- package/src/SessionManager/SessionManager.stories.jsx +0 -9
- package/src/SessionManager/index.tsx +0 -3
- package/src/SessionPermission/index.tsx +0 -26
- package/src/SessionUser/components/did-space.tsx +0 -68
- package/src/SessionUser/components/logged-in.tsx +0 -338
- package/src/SessionUser/components/quick-login-item.tsx +0 -132
- package/src/SessionUser/components/session-user-item.tsx +0 -93
- package/src/SessionUser/components/session-user-switch.tsx +0 -240
- package/src/SessionUser/components/un-login.tsx +0 -257
- package/src/SessionUser/components/user-info.tsx +0 -201
- package/src/SessionUser/index.tsx +0 -68
- package/src/SessionUser/libs/translation.ts +0 -30
- package/src/SessionUser/libs/utils.ts +0 -39
- package/src/SharedBridge/index.tsx +0 -126
- package/src/SocialShare/index.tsx +0 -194
- package/src/Sparkline/Sparkline.stories.jsx +0 -13
- package/src/Sparkline/index.tsx +0 -231
- package/src/Spinner/Spinner.stories.jsx +0 -98
- package/src/Spinner/index.tsx +0 -20
- package/src/SplitButton/SplitButton.stories.jsx +0 -32
- package/src/SplitButton/index.tsx +0 -116
- package/src/SplitButton/useClickAway.tsx +0 -24
- package/src/Success/index.tsx +0 -175
- package/src/Switch/Switch.stories.jsx +0 -16
- package/src/Switch/index.jsx +0 -79
- package/src/Tabs/Tabs.stories.jsx +0 -18
- package/src/Tabs/index.tsx +0 -255
- package/src/Tag/Tag.stories.jsx +0 -15
- package/src/Tag/index.jsx +0 -106
- package/src/TextCollapse/TextCollapse.stories.jsx +0 -73
- package/src/TextCollapse/index.tsx +0 -85
- package/src/Theme/Theme.stories.jsx +0 -11
- package/src/Theme/index.ts +0 -21
- package/src/Theme/theme-provider.tsx +0 -374
- package/src/Theme/theme.ts +0 -229
- package/src/Toast/Toast.stories.jsx +0 -28
- package/src/Toast/index.tsx +0 -80
- package/src/Typography/index.tsx +0 -124
- package/src/UserCard/Cards/avatar-only.tsx +0 -27
- package/src/UserCard/Cards/basic-info.tsx +0 -43
- package/src/UserCard/Cards/index.tsx +0 -16
- package/src/UserCard/Cards/social-actions.tsx +0 -196
- package/src/UserCard/Container/card.tsx +0 -63
- package/src/UserCard/Container/dialog.tsx +0 -37
- package/src/UserCard/Content/basic.tsx +0 -330
- package/src/UserCard/Content/clock.tsx +0 -82
- package/src/UserCard/Content/minimal.tsx +0 -113
- package/src/UserCard/Content/shorten-label.tsx +0 -32
- package/src/UserCard/Content/tooltip-avatar.tsx +0 -80
- package/src/UserCard/UserCard.stories.jsx +0 -19
- package/src/UserCard/components.tsx +0 -81
- package/src/UserCard/index.tsx +0 -132
- package/src/UserCard/types.ts +0 -165
- package/src/UserCard/use-follow.tsx +0 -111
- package/src/UserCard/utils.ts +0 -155
- package/src/Util/WebWalletOpener.stories.jsx +0 -5
- package/src/Util/client.ts +0 -4
- package/src/Util/constant.ts +0 -70
- package/src/Util/deprecate.tsx +0 -29
- package/src/Util/federated.ts +0 -125
- package/src/Util/iframe.ts +0 -19
- package/src/Util/index.ts +0 -760
- package/src/Util/logger.ts +0 -44
- package/src/Util/passport.ts +0 -127
- package/src/Util/security.ts +0 -72
- package/src/Util/style.ts +0 -17
- package/src/Util/wallet.ts +0 -35
- package/src/VerificationCode/index.tsx +0 -83
- package/src/Video/Video.stories.jsx +0 -6
- package/src/Video/index.tsx +0 -70
- package/src/Wallet/Action.stories.jsx +0 -8
- package/src/Wallet/Action.tsx +0 -118
- package/src/Wallet/Download.stories.jsx +0 -9
- package/src/Wallet/Download.tsx +0 -157
- package/src/Wallet/Open.tsx +0 -47
- package/src/Wallet/OpenInWallet.stories.jsx +0 -5
- package/src/Wallet/images/abtwallet.png +0 -0
- package/src/Wallet/images/android_download.svg +0 -22
- package/src/Wallet/images/app-store.svg +0 -30
- package/src/Wallet/images/google-play.svg +0 -69
- package/src/WalletOSIcon/index.tsx +0 -47
- package/src/WebWalletSWKeeper/index.tsx +0 -117
- package/src/WechatPrompt/images/android.png +0 -0
- package/src/WechatPrompt/images/ios.png +0 -0
- package/src/WechatPrompt/index.tsx +0 -75
- package/src/global.d.ts +0 -28
- package/src/hooks/use-blocklet-logo.tsx +0 -32
- package/src/hooks/use-clock.tsx +0 -62
- package/src/hooks/use-location-state.tsx +0 -117
- package/src/hooks/use-mobile.tsx +0 -6
- package/src/index.ts +0 -79
- package/src/type.d.ts +0 -44
- package/src/withTheme/index.tsx +0 -72
- package/src/withTracker/README.md +0 -37
- package/src/withTracker/action/bind-wallet.tsx +0 -17
- package/src/withTracker/action/login.tsx +0 -18
- package/src/withTracker/action/pay.tsx +0 -14
- package/src/withTracker/action/switch-passport.tsx +0 -20
- package/src/withTracker/constant/index.tsx +0 -3
- package/src/withTracker/env.tsx +0 -1
- package/src/withTracker/error_boundary.jsx +0 -34
- package/src/withTracker/index.tsx +0 -50
- package/src/withTracker/libs/utm.ts +0 -46
- package/vite.config.mjs +0 -37
package/src/Earth/index.tsx
DELETED
|
@@ -1,515 +0,0 @@
|
|
|
1
|
-
/* eslint-disable consistent-return */
|
|
2
|
-
import { useReducer, useRef, useEffect } from 'react';
|
|
3
|
-
import useSpring from 'react-use/lib/useSpring';
|
|
4
|
-
import * as d3 from 'd3-geo';
|
|
5
|
-
import * as topojson from 'topojson-client';
|
|
6
|
-
import versor from 'versor';
|
|
7
|
-
|
|
8
|
-
import json from './countries.json';
|
|
9
|
-
import util from './util';
|
|
10
|
-
import type { Vec2, Vec3, Quaternion, Angles, Rotation } from './util';
|
|
11
|
-
import { withDeprecated } from '../Util/deprecate';
|
|
12
|
-
import { styled } from '../Theme';
|
|
13
|
-
|
|
14
|
-
const geoJson = topojson.feature(json, json.objects.ne_110m_admin_0_countries);
|
|
15
|
-
const themes = {
|
|
16
|
-
light: {
|
|
17
|
-
ocean: '#EDF4F4',
|
|
18
|
-
graticule: '#EDF4F4',
|
|
19
|
-
land: '#CCEAEA',
|
|
20
|
-
activeLand: '#AFD3D3',
|
|
21
|
-
border: '#AFD3D3',
|
|
22
|
-
marker: '#4E6AF6',
|
|
23
|
-
activeMarker: '#4E6AF6',
|
|
24
|
-
},
|
|
25
|
-
dark: {
|
|
26
|
-
ocean: '#09233B',
|
|
27
|
-
graticule: '#09233B',
|
|
28
|
-
land: '#0D2344',
|
|
29
|
-
activeLand: '#173159',
|
|
30
|
-
border: '#89DDD9',
|
|
31
|
-
marker: '#ffffff',
|
|
32
|
-
activeMarker: '#FFD159',
|
|
33
|
-
},
|
|
34
|
-
};
|
|
35
|
-
|
|
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) {
|
|
50
|
-
switch (action.type) {
|
|
51
|
-
case 'dragEnd':
|
|
52
|
-
return { ...state, isDragging: false };
|
|
53
|
-
case 'dragStart':
|
|
54
|
-
return {
|
|
55
|
-
...state,
|
|
56
|
-
isDragging: true,
|
|
57
|
-
animationDuration: 1,
|
|
58
|
-
mousePosition: action.payload.mousePosition,
|
|
59
|
-
};
|
|
60
|
-
case 'tooltip':
|
|
61
|
-
case 'rotate':
|
|
62
|
-
return Object.assign({}, state, action.payload);
|
|
63
|
-
default:
|
|
64
|
-
return state;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
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 = undefined,
|
|
105
|
-
markers = [],
|
|
106
|
-
colors: _colors = {},
|
|
107
|
-
}: EarthProps) {
|
|
108
|
-
const colors: Colors = Object.assign(_colors, themes[theme]);
|
|
109
|
-
const [state, dispatch] = useReducer(stateReducer, {
|
|
110
|
-
rotation: [0, 0, 0],
|
|
111
|
-
isDragging: false,
|
|
112
|
-
animateDuration: 1,
|
|
113
|
-
mousePosition: null,
|
|
114
|
-
tooltipIndex: -1,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
const svgRef = useRef<SVGSVGElement>(null);
|
|
118
|
-
|
|
119
|
-
// variables used to track drag and rotate
|
|
120
|
-
const dragRef = useRef<{
|
|
121
|
-
v0?: Vec3;
|
|
122
|
-
r0?: Rotation;
|
|
123
|
-
q0?: Quaternion;
|
|
124
|
-
}>({});
|
|
125
|
-
|
|
126
|
-
// variables used to track start and end position when there is active marker
|
|
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
|
-
}>({
|
|
136
|
-
p1: null,
|
|
137
|
-
p2: [0, 0],
|
|
138
|
-
r1: null,
|
|
139
|
-
r2: [0, 0, 0],
|
|
140
|
-
step: 0,
|
|
141
|
-
markerId: null,
|
|
142
|
-
iv: null,
|
|
143
|
-
});
|
|
144
|
-
|
|
145
|
-
// console.log('renderGlobe', state, dragRef.current, rotateRef.current, geoJson);
|
|
146
|
-
const t = useSpring(state.animateDuration, 170, 26);
|
|
147
|
-
|
|
148
|
-
const isValid =
|
|
149
|
-
activeMarkerId && rotateRef.current.markerId !== activeMarkerId && markers.some((x) => x.id === activeMarkerId);
|
|
150
|
-
|
|
151
|
-
// Setup path for globe
|
|
152
|
-
const projection = d3
|
|
153
|
-
.geoOrthographic()
|
|
154
|
-
.fitExtent(
|
|
155
|
-
[
|
|
156
|
-
[30, 30],
|
|
157
|
-
[width - 30, height - 30],
|
|
158
|
-
],
|
|
159
|
-
geoJson
|
|
160
|
-
)
|
|
161
|
-
.rotate(
|
|
162
|
-
t <= 1 || state.isDragging || !activeMarkerId ? state.rotation : rotateRef.current.iv!(t / state.animateDuration)
|
|
163
|
-
);
|
|
164
|
-
|
|
165
|
-
const pathGenerator = d3.geoPath().projection(projection).pointRadius(2);
|
|
166
|
-
|
|
167
|
-
useEffect(() => {
|
|
168
|
-
// Rotate to active marker
|
|
169
|
-
if (isValid) {
|
|
170
|
-
// eslint-disable-next-line prefer-const
|
|
171
|
-
let { p1, p2, r1, r2, markerId } = rotateRef.current;
|
|
172
|
-
// We should only start new animation if the marker has changed
|
|
173
|
-
if (markerId !== activeMarkerId && !state.isDragging) {
|
|
174
|
-
const marker = markers.find((x) => x.id === activeMarkerId)!;
|
|
175
|
-
p1 = p2;
|
|
176
|
-
p2 = [marker.longitude, marker.latitude];
|
|
177
|
-
r1 = r2;
|
|
178
|
-
r2 = [-p2[0], 20 - p2[1], projection.rotate()[2]];
|
|
179
|
-
const iv = util.interpolateAngles(r1, r2);
|
|
180
|
-
|
|
181
|
-
Object.assign(rotateRef.current, {
|
|
182
|
-
p1,
|
|
183
|
-
p2,
|
|
184
|
-
r1,
|
|
185
|
-
r2,
|
|
186
|
-
iv,
|
|
187
|
-
markerId: activeMarkerId,
|
|
188
|
-
});
|
|
189
|
-
const duration = state.animateDuration * 2;
|
|
190
|
-
|
|
191
|
-
dispatch({
|
|
192
|
-
type: 'rotate',
|
|
193
|
-
payload: {
|
|
194
|
-
animateDuration: duration > 1e3 ? 2 : duration,
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Enable auto rotation
|
|
200
|
-
} else if (enableRotation) {
|
|
201
|
-
const handler = window.requestAnimationFrame(() => {
|
|
202
|
-
const newRotation = [state.rotation[0] + 2 / rotationSpeed, state.rotation[1], state.rotation[2]];
|
|
203
|
-
dispatch({ type: 'rotate', payload: { rotation: newRotation } });
|
|
204
|
-
});
|
|
205
|
-
|
|
206
|
-
return function cleanup() {
|
|
207
|
-
window.cancelAnimationFrame(handler);
|
|
208
|
-
};
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
|
|
212
|
-
const getMousePosition = (event: MouseEvent) => {
|
|
213
|
-
const node = svgRef.current!;
|
|
214
|
-
const rect = node?.getBoundingClientRect();
|
|
215
|
-
const mousePosition = [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
|
216
|
-
|
|
217
|
-
return mousePosition;
|
|
218
|
-
};
|
|
219
|
-
|
|
220
|
-
const onDragStart = (event: React.MouseEvent<SVGSVGElement>) => {
|
|
221
|
-
const mousePosition = getMousePosition(event as unknown as MouseEvent);
|
|
222
|
-
|
|
223
|
-
if (!mousePosition[0]) {
|
|
224
|
-
return;
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
dragRef.current.v0 = versor.cartesian(projection.invert(mousePosition));
|
|
228
|
-
dragRef.current.r0 = projection.rotate();
|
|
229
|
-
dragRef.current.q0 = versor(dragRef.current.r0);
|
|
230
|
-
|
|
231
|
-
dispatch({ type: 'dragStart', payload: { mousePosition } });
|
|
232
|
-
};
|
|
233
|
-
|
|
234
|
-
const onDrag = (event: React.MouseEvent<SVGSVGElement>) => {
|
|
235
|
-
if (state.isDragging === false) {
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
const mousePosition = getMousePosition(event as unknown as MouseEvent);
|
|
240
|
-
const { r0, v0, q0 } = dragRef.current;
|
|
241
|
-
|
|
242
|
-
const v1 = versor.cartesian(projection.rotate(r0).invert(mousePosition));
|
|
243
|
-
const q1 = versor.multiply(q0, versor.delta(v0, v1));
|
|
244
|
-
const r1 = versor.rotation(q1);
|
|
245
|
-
|
|
246
|
-
dispatch({ type: 'rotate', payload: { rotation: r1, mousePosition } });
|
|
247
|
-
};
|
|
248
|
-
|
|
249
|
-
const onDragEnd = () => {
|
|
250
|
-
setTimeout(() => {
|
|
251
|
-
dispatch({ type: 'dragEnd', payload: {} });
|
|
252
|
-
}, 200);
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const onShowTooltip = (event: MouseEvent, i: number) =>
|
|
256
|
-
dispatch({
|
|
257
|
-
type: 'tooltip',
|
|
258
|
-
payload: { tooltipIndex: i, mousePosition: getMousePosition(event) },
|
|
259
|
-
});
|
|
260
|
-
|
|
261
|
-
const onHideTooltip = () => dispatch({ type: 'tooltip', payload: { tooltipIndex: -1, mousePosition: null } });
|
|
262
|
-
|
|
263
|
-
const renderMarkers = () =>
|
|
264
|
-
markers.map((x, i) => {
|
|
265
|
-
const areaCoords = [x.longitude, x.latitude];
|
|
266
|
-
const distance = d3.geoDistance(areaCoords, projection.invert([width / 2, height / 2]));
|
|
267
|
-
const sphereCoords = projection(areaCoords);
|
|
268
|
-
const isActive = activeMarkerId === x.id;
|
|
269
|
-
// eslint-disable-next-line no-nested-ternary
|
|
270
|
-
const fill = distance > 1.57 ? 'none' : isActive ? colors.activeMarker : colors.marker;
|
|
271
|
-
const radius = isActive ? 9 : 6;
|
|
272
|
-
return (
|
|
273
|
-
<g
|
|
274
|
-
key={x.id}
|
|
275
|
-
className={`marker ${isActive ? 'marker--active' : ''}`}
|
|
276
|
-
onFocus={(event) => onShowTooltip(event as unknown as MouseEvent, i)}
|
|
277
|
-
onBlur={onHideTooltip}
|
|
278
|
-
onMouseOver={(event) => onShowTooltip(event as unknown as MouseEvent, i)}
|
|
279
|
-
onMouseOut={onHideTooltip}>
|
|
280
|
-
<circle
|
|
281
|
-
key="marker-inner"
|
|
282
|
-
className="marker__inner"
|
|
283
|
-
r={radius}
|
|
284
|
-
cx={sphereCoords[0]}
|
|
285
|
-
cy={sphereCoords[1]}
|
|
286
|
-
fill={fill}
|
|
287
|
-
style={{ fillOpacity: isActive ? 1 : 0.5 }}
|
|
288
|
-
/>
|
|
289
|
-
<circle
|
|
290
|
-
key="marker-outer"
|
|
291
|
-
className="marker__outer"
|
|
292
|
-
r={radius * 2}
|
|
293
|
-
cx={sphereCoords[0]}
|
|
294
|
-
cy={sphereCoords[1]}
|
|
295
|
-
fill={fill}
|
|
296
|
-
style={{
|
|
297
|
-
animationDuration: isActive ? '800ms' : '1600ms',
|
|
298
|
-
animationDelay: `${i * 0.2}s`,
|
|
299
|
-
transformOrigin: `${sphereCoords[0]}px ${sphereCoords[1]}px`,
|
|
300
|
-
}}
|
|
301
|
-
/>
|
|
302
|
-
</g>
|
|
303
|
-
);
|
|
304
|
-
});
|
|
305
|
-
|
|
306
|
-
const renderTooltip = () => {
|
|
307
|
-
if (state.tooltipIndex >= 0) {
|
|
308
|
-
const marker = markers[state.tooltipIndex];
|
|
309
|
-
return (
|
|
310
|
-
<Tooltip style={{ left: state.mousePosition?.[0] ?? 0, top: state.mousePosition?.[1] ?? 0 }}>
|
|
311
|
-
<p className="title">{marker.title}</p>
|
|
312
|
-
<p className="description">{marker.description}</p>
|
|
313
|
-
<p className="description">ID: {marker.id}</p>
|
|
314
|
-
</Tooltip>
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
|
|
319
|
-
let activeCountry = null;
|
|
320
|
-
if (activeMarkerId && markers.some((x) => x.id === activeMarkerId)) {
|
|
321
|
-
const activeMarker = markers.find((x) => x.id === activeMarkerId);
|
|
322
|
-
activeCountry = geoJson.features.findIndex(
|
|
323
|
-
(x: any) => x.properties && x.properties.name && x.properties.name === activeMarker!.country
|
|
324
|
-
);
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return (
|
|
328
|
-
<Container width={width} height={height} $theme={theme} colors={colors} onMouseLeave={onDragEnd}>
|
|
329
|
-
{renderTooltip()}
|
|
330
|
-
<svg
|
|
331
|
-
className="earth"
|
|
332
|
-
width={width}
|
|
333
|
-
height={height}
|
|
334
|
-
onMouseDown={onDragStart}
|
|
335
|
-
onMouseMove={onDrag}
|
|
336
|
-
onMouseUp={onDragEnd}
|
|
337
|
-
ref={svgRef}>
|
|
338
|
-
<rect className="frame" width={width} height={height} />
|
|
339
|
-
<circle cx={width / 2} cy={height / 2} r={projection.scale()} className="globe" filter="url(#glow)" />
|
|
340
|
-
<path className="graticule" d={pathGenerator(d3.geoGraticule().step([10, 10])())} />
|
|
341
|
-
<g className="features">
|
|
342
|
-
{geoJson.features.map((x: any, i: number) => (
|
|
343
|
-
<path
|
|
344
|
-
key={x.properties.name}
|
|
345
|
-
className={`country ${activeCountry === i ? 'country--active' : ''}`}
|
|
346
|
-
d={pathGenerator(x)}
|
|
347
|
-
/>
|
|
348
|
-
))}
|
|
349
|
-
</g>
|
|
350
|
-
<g className="markers">{renderMarkers()}</g>
|
|
351
|
-
{state.isDragging && state.mousePosition && (
|
|
352
|
-
<path
|
|
353
|
-
className="point point-mouse"
|
|
354
|
-
d={pathGenerator({
|
|
355
|
-
type: 'Point',
|
|
356
|
-
coordinates: projection.invert(state.mousePosition),
|
|
357
|
-
})}
|
|
358
|
-
/>
|
|
359
|
-
)}
|
|
360
|
-
</svg>
|
|
361
|
-
<svg className="defs">
|
|
362
|
-
<defs>
|
|
363
|
-
<linearGradient id="gradBlue" x1="0%" y1="0%" x2="100%" y2="0%">
|
|
364
|
-
<stop offset="0%" style={{ stopColor: '#005C99', stopOpacity: 1 }} />
|
|
365
|
-
<stop offset="100%" style={{ stopColor: '#0099FF', stopOpacity: 1 }} />
|
|
366
|
-
</linearGradient>
|
|
367
|
-
<filter id="glow">
|
|
368
|
-
<feColorMatrix
|
|
369
|
-
type="matrix"
|
|
370
|
-
values="0 0 0 0 0
|
|
371
|
-
0 0 0 0.9 0
|
|
372
|
-
0 0 0 0.9 0
|
|
373
|
-
0 0 0 1 0"
|
|
374
|
-
/>
|
|
375
|
-
<feGaussianBlur stdDeviation="5.5" result="coloredBlur" />
|
|
376
|
-
<feMerge>
|
|
377
|
-
<feMergeNode in="coloredBlur" />
|
|
378
|
-
<feMergeNode in="SourceGraphic" />
|
|
379
|
-
</feMerge>
|
|
380
|
-
</filter>
|
|
381
|
-
</defs>
|
|
382
|
-
</svg>
|
|
383
|
-
</Container>
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
|
|
387
|
-
export default withDeprecated(Earth, { name: 'Earth' });
|
|
388
|
-
|
|
389
|
-
type ContainerProps = {
|
|
390
|
-
$theme: 'light' | 'dark';
|
|
391
|
-
width: number;
|
|
392
|
-
height: number;
|
|
393
|
-
colors: Colors;
|
|
394
|
-
};
|
|
395
|
-
|
|
396
|
-
const Container = styled('div')<ContainerProps>`
|
|
397
|
-
background-color: ${(props) => (props.$theme === 'light' ? '#f7f7f7' : '#222')};
|
|
398
|
-
width: ${(props) => props.width}px;
|
|
399
|
-
height: ${(props) => props.height}px;
|
|
400
|
-
position: relative;
|
|
401
|
-
animation-name: zoomIn;
|
|
402
|
-
animation-duration: 1s;
|
|
403
|
-
animation-iteration-count: 1;
|
|
404
|
-
animation-timing-function: ease;
|
|
405
|
-
user-select: none;
|
|
406
|
-
|
|
407
|
-
.defs {
|
|
408
|
-
height: 0;
|
|
409
|
-
width: 0;
|
|
410
|
-
}
|
|
411
|
-
|
|
412
|
-
.frame {
|
|
413
|
-
fill: none;
|
|
414
|
-
pointer-events: all;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
.country {
|
|
418
|
-
fill: ${(props) => props.colors.land};
|
|
419
|
-
stroke: ${(props) => props.colors.border};
|
|
420
|
-
stroke-width: 0.5px;
|
|
421
|
-
transition: fill 300ms ease;
|
|
422
|
-
|
|
423
|
-
&:hover {
|
|
424
|
-
fill: ${(props) => props.colors.activeLand};
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
.country--active {
|
|
429
|
-
fill: ${(props) => props.colors.activeLand};
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
.globe {
|
|
433
|
-
fill: ${(props) => props.colors.ocean};
|
|
434
|
-
stroke: rgba(255, 255, 255, 0.5);
|
|
435
|
-
stroke-width: 0.25px;
|
|
436
|
-
}
|
|
437
|
-
|
|
438
|
-
.graticule {
|
|
439
|
-
fill: none;
|
|
440
|
-
stroke: ${(props) => props.colors.graticule};
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
.star {
|
|
444
|
-
fill: #fff;
|
|
445
|
-
stroke: rgba(255, 255, 255, 0.5);
|
|
446
|
-
stroke-width: 0.25px;
|
|
447
|
-
}
|
|
448
|
-
|
|
449
|
-
.marker {
|
|
450
|
-
.marker__outer {
|
|
451
|
-
fill-opacity: 0;
|
|
452
|
-
animation: scaleIn 2s infinite ease-in-out;
|
|
453
|
-
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
@keyframes zoomIn {
|
|
457
|
-
from {
|
|
458
|
-
opacity: 0;
|
|
459
|
-
transform: scale3d(0.1, 0.1, 0.1);
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
50% {
|
|
463
|
-
opacity: 1;
|
|
464
|
-
}
|
|
465
|
-
}
|
|
466
|
-
|
|
467
|
-
@keyframes scaleIn {
|
|
468
|
-
from {
|
|
469
|
-
fill-opacity: 0.3;
|
|
470
|
-
transform: scale3d(0.5, 0.5, 0.5);
|
|
471
|
-
}
|
|
472
|
-
to {
|
|
473
|
-
fill-opacity: 0;
|
|
474
|
-
transform: scale3d(1.5, 1.5, 1.5);
|
|
475
|
-
}
|
|
476
|
-
}
|
|
477
|
-
`;
|
|
478
|
-
|
|
479
|
-
const Tooltip = styled('div')`
|
|
480
|
-
position: absolute;
|
|
481
|
-
width: auto;
|
|
482
|
-
min-width: 90px;
|
|
483
|
-
max-width: 320px;
|
|
484
|
-
padding: 8px 12px;
|
|
485
|
-
font-size: 14px;
|
|
486
|
-
background-color: #4a4a4a;
|
|
487
|
-
border-radius: 2px;
|
|
488
|
-
animation-name: fadeIn;
|
|
489
|
-
animation-duration: 250ms;
|
|
490
|
-
animation-iteration-count: 1;
|
|
491
|
-
animation-timing-function: ease;
|
|
492
|
-
|
|
493
|
-
.title,
|
|
494
|
-
.description {
|
|
495
|
-
margin: 0;
|
|
496
|
-
font-size: 16px;
|
|
497
|
-
color: #fff;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
.description {
|
|
501
|
-
margin-top: ${(props) => props.theme.spacing(1)}px;
|
|
502
|
-
color: #fff;
|
|
503
|
-
font-size: 12px;
|
|
504
|
-
}
|
|
505
|
-
|
|
506
|
-
@keyframes fadeIn {
|
|
507
|
-
from {
|
|
508
|
-
opacity: 0;
|
|
509
|
-
}
|
|
510
|
-
|
|
511
|
-
to {
|
|
512
|
-
opacity: 1;
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
`;
|
package/src/Earth/util.ts
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
/* eslint-disable */
|
|
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
|
-
|
|
9
|
-
export default class Util {
|
|
10
|
-
static fromAngles([l, p, g]: Angles) {
|
|
11
|
-
l *= Math.PI / 360;
|
|
12
|
-
p *= Math.PI / 360;
|
|
13
|
-
g *= Math.PI / 360;
|
|
14
|
-
const sl = Math.sin(l);
|
|
15
|
-
const cl = Math.cos(l);
|
|
16
|
-
const sp = Math.sin(p);
|
|
17
|
-
const cp = Math.cos(p);
|
|
18
|
-
const sg = Math.sin(g);
|
|
19
|
-
const cg = Math.cos(g);
|
|
20
|
-
return [
|
|
21
|
-
cl * cp * cg + sl * sp * sg,
|
|
22
|
-
sl * cp * cg - cl * sp * sg,
|
|
23
|
-
cl * sp * cg + sl * cp * sg,
|
|
24
|
-
cl * cp * sg - sl * sp * cg,
|
|
25
|
-
] as Quaternion;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
static toAngles([a, b, c, d]: Quaternion) {
|
|
29
|
-
return [
|
|
30
|
-
(Math.atan2(2 * (a * b + c * d), 1 - 2 * (b * b + c * c)) * 180) / Math.PI,
|
|
31
|
-
(Math.asin(Math.max(-1, Math.min(1, 2 * (a * c - d * b)))) * 180) / Math.PI,
|
|
32
|
-
(Math.atan2(2 * (a * d + b * c), 1 - 2 * (c * c + d * d)) * 180) / Math.PI,
|
|
33
|
-
];
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
static interpolateAngles(a: [number, number, number], b: [number, number, number]) {
|
|
37
|
-
const i = Util.interpolate(Util.fromAngles(a), Util.fromAngles(b));
|
|
38
|
-
return (t: number) => Util.toAngles(i(t));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
static interpolateLinear([a1, b1, c1, d1]: Quaternion, [a2, b2, c2, d2]: Quaternion) {
|
|
42
|
-
(a2 -= a1), (b2 -= b1), (c2 -= c1), (d2 -= d1);
|
|
43
|
-
const x = new Array(4);
|
|
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));
|
|
47
|
-
(x[0] /= l), (x[1] /= l), (x[2] /= l), (x[3] /= l);
|
|
48
|
-
|
|
49
|
-
return x as Quaternion;
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
static interpolate([a1, b1, c1, d1]: Quaternion, [a2, b2, c2, d2]: Quaternion) {
|
|
54
|
-
let dot = a1 * a2 + b1 * b2 + c1 * c2 + d1 * d2;
|
|
55
|
-
if (dot < 0) (a2 = -a2), (b2 = -b2), (c2 = -c2), (d2 = -d2), (dot = -dot);
|
|
56
|
-
if (dot > 0.9995) return Util.interpolateLinear([a1, b1, c1, d1], [a2, b2, c2, d2]);
|
|
57
|
-
const theta0 = Math.acos(Math.max(-1, Math.min(1, dot)));
|
|
58
|
-
const x = new Array(4);
|
|
59
|
-
const l = Math.hypot((a2 -= a1 * dot), (b2 -= b1 * dot), (c2 -= c1 * dot), (d2 -= d1 * dot));
|
|
60
|
-
(a2 /= l), (b2 /= l), (c2 /= l), (d2 /= l);
|
|
61
|
-
return (t: number) => {
|
|
62
|
-
const theta = theta0 * t;
|
|
63
|
-
const s = Math.sin(theta);
|
|
64
|
-
const c = Math.cos(theta);
|
|
65
|
-
x[0] = a1 * c + a2 * s;
|
|
66
|
-
x[1] = b1 * c + b2 * s;
|
|
67
|
-
x[2] = c1 * c + c2 * s;
|
|
68
|
-
x[3] = d1 * c + d2 * s;
|
|
69
|
-
return x as Quaternion;
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import Empty from './index';
|
|
2
|
-
|
|
3
|
-
import Basic from './demo/basic';
|
|
4
|
-
import CustomMessage from './demo/custom-message';
|
|
5
|
-
import ComplexMessage from './demo/complex-message';
|
|
6
|
-
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Data Display/Empty',
|
|
9
|
-
component: Empty,
|
|
10
|
-
parameters: {
|
|
11
|
-
docs: {
|
|
12
|
-
description: {
|
|
13
|
-
component: 'Empty provides a generic "Empty Content" placeholder.',
|
|
14
|
-
},
|
|
15
|
-
},
|
|
16
|
-
},
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
Basic.parameters = {
|
|
20
|
-
layout: 'fullscreen',
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
export { Basic, CustomMessage, ComplexMessage };
|
package/src/Empty/index.jsx
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import PropTypes from 'prop-types';
|
|
2
|
-
import { Box } from '@mui/material';
|
|
3
|
-
import EmptyIcon from '@arcblock/icons/lib/EmptyIcon';
|
|
4
|
-
import { styled } from '../Theme';
|
|
5
|
-
|
|
6
|
-
const Wrapper = styled(Box)`
|
|
7
|
-
display: flex;
|
|
8
|
-
justify-content: center;
|
|
9
|
-
align-items: center;
|
|
10
|
-
flex-direction: column;
|
|
11
|
-
height: 100%;
|
|
12
|
-
min-height: 100px;
|
|
13
|
-
color: #999;
|
|
14
|
-
.empty-icon {
|
|
15
|
-
margin: 10px 0;
|
|
16
|
-
}
|
|
17
|
-
`;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Empty component to display empty state
|
|
21
|
-
* @typedef {{
|
|
22
|
-
* color?: string;
|
|
23
|
-
* size?: number;
|
|
24
|
-
* children?: import('react').ReactNode;
|
|
25
|
-
* } & import('react').ComponentPropsWithoutRef<"div"> } EmptyProps
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* Empty state component
|
|
30
|
-
* @param {EmptyProps} props
|
|
31
|
-
* @returns {JSX.Element}
|
|
32
|
-
*/
|
|
33
|
-
function Empty({ color = 'inherit', size = 36, children = null, ...rest }) {
|
|
34
|
-
return (
|
|
35
|
-
<Wrapper {...rest}>
|
|
36
|
-
<EmptyIcon style={{ width: size, height: size, color }} className="empty-icon" />
|
|
37
|
-
<Box className="empty-content">{children}</Box>
|
|
38
|
-
</Wrapper>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
Empty.propTypes = {
|
|
43
|
-
color: PropTypes.string,
|
|
44
|
-
size: PropTypes.number,
|
|
45
|
-
children: PropTypes.any,
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export default Empty;
|