@arcblock/ux 2.5.58 → 2.5.60
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/ActionButton/index.js +20 -39
- package/lib/ActivityIndicator/index.js +20 -41
- package/lib/Address/compact-text.js +16 -38
- package/lib/Address/did-address.js +22 -51
- package/lib/Address/index.js +6 -19
- package/lib/Address/responsive-did-address.js +20 -36
- package/lib/Alert/index.js +12 -34
- package/lib/AnimationWaiter/index.js +35 -59
- package/lib/Async/index.js +5 -19
- package/lib/Avatar/did-motif.js +12 -26
- package/lib/Avatar/etherscan-blockies.js +2 -20
- package/lib/Avatar/index.js +28 -54
- package/lib/Badge/index.js +12 -33
- package/lib/Blocklet/blocklet.js +20 -47
- package/lib/Blocklet/index.js +0 -6
- package/lib/Blocklet/utils.js +0 -6
- package/lib/BlockletNFT/index.js +37 -67
- package/lib/Button/index.js +0 -4
- package/lib/Button/wrap.js +19 -38
- package/lib/ButtonGroup/index.js +0 -5
- package/lib/CardSelector/index.js +9 -22
- package/lib/Center/index.js +2 -12
- package/lib/ClickToCopy/copy-button.js +9 -26
- package/lib/ClickToCopy/hook.js +0 -10
- package/lib/ClickToCopy/index.js +13 -41
- package/lib/CodeBlock/LightBox.js +1 -6
- package/lib/CodeBlock/index.js +12 -80
- package/lib/Colors/index.js +0 -2
- package/lib/Colors/themes/default.js +2 -3
- package/lib/ContactForm/index.js +5 -35
- package/lib/CookieConsent/index.js +10 -32
- package/lib/CountDown/index.js +10 -35
- package/lib/DID/index.js +8 -32
- package/lib/Datatable/CustomToolbar.js +9 -56
- package/lib/Datatable/DatatableContext.js +2 -5
- package/lib/Datatable/TableSearch.js +0 -21
- package/lib/Datatable/index.js +76 -152
- package/lib/Datatable/utils.js +14 -27
- package/lib/Dialog/confirm.js +18 -31
- package/lib/Dialog/dialog.js +24 -50
- package/lib/Dialog/index.js +0 -3
- package/lib/DidLogo/index.js +0 -7
- package/lib/DriftBot/index.js +1 -12
- package/lib/Earth/index.js +17 -58
- package/lib/Earth/util.js +0 -7
- package/lib/Empty/index.js +9 -23
- package/lib/ErrorBoundary/fallback.js +0 -14
- package/lib/ErrorBoundary/index.js +0 -2
- package/lib/Footer/index.js +1 -14
- package/lib/Header/auto-hidden.js +9 -23
- package/lib/Header/header.js +19 -38
- package/lib/Header/index.js +0 -3
- package/lib/Header/responsive-header.js +16 -40
- package/lib/Icon/image.js +12 -26
- package/lib/Icon/index.js +15 -34
- package/lib/Img/index.js +32 -54
- package/lib/InfoRow/index.js +11 -27
- package/lib/Layout/dashboard/external-link.js +13 -30
- package/lib/Layout/dashboard/full-page.js +8 -24
- package/lib/Layout/dashboard/index.js +28 -72
- package/lib/Layout/dashboard/sidebar.js +11 -31
- package/lib/Layout/dashboard-legacy/header.js +14 -36
- package/lib/Layout/dashboard-legacy/index.js +19 -44
- package/lib/Layout/dashboard-legacy/sidebar.js +10 -32
- package/lib/Layout/index.js +18 -52
- package/lib/Locale/browser-lang.js +6 -19
- package/lib/Locale/context.js +15 -51
- package/lib/Locale/languages.js +3 -7
- package/lib/Locale/selector.js +11 -44
- package/lib/Locale/util.js +0 -10
- package/lib/Logo/index.js +10 -33
- package/lib/Metric/index.js +1 -9
- package/lib/NFTDisplay/aspect-ratio-container.js +7 -20
- package/lib/NFTDisplay/broken.js +0 -8
- package/lib/NFTDisplay/index.js +63 -110
- package/lib/NFTDisplay/loading.js +0 -6
- package/lib/NFTDisplay/svg-embedder/img.js +9 -22
- package/lib/NFTDisplay/svg-embedder/inline-svg.js +9 -23
- package/lib/NavMenu/index.js +0 -2
- package/lib/NavMenu/nav-menu.js +40 -69
- package/lib/NavMenu/style.js +1 -5
- package/lib/PageScroller/index.js +9 -39
- package/lib/PageScroller/story/FifthComponent.js +0 -2
- package/lib/PageScroller/story/FirstComponent.js +0 -2
- package/lib/PageScroller/story/FourthComponent.js +0 -2
- package/lib/PageScroller/story/FullPage.js +1 -14
- package/lib/PageScroller/story/PageContain.js +1 -14
- package/lib/PageScroller/story/SecondComponent.js +0 -2
- package/lib/PageScroller/story/ThirdComponent.js +0 -2
- package/lib/PageScroller/usePrevValue.js +1 -2
- package/lib/PricingTable/PricingPlan.js +0 -12
- package/lib/PricingTable/index.js +0 -14
- package/lib/QRCode/index.js +14 -24
- package/lib/RelativeTime/index.js +12 -45
- package/lib/Result/common.js +43 -63
- package/lib/Result/index.js +6 -23
- package/lib/Result/result.js +9 -23
- package/lib/Screenshot/BaseScreenshot/index.js +9 -26
- package/lib/Screenshot/BaseScreenshot/shells/Macbook.js +9 -10
- package/lib/Screenshot/BaseScreenshot/shells/Phone.js +3 -8
- package/lib/Screenshot/index.js +32 -65
- package/lib/SessionManager/federated-login-detecter.js +171 -0
- package/lib/SessionManager/index.js +189 -271
- package/lib/SessionManager/user-popper.js +83 -0
- package/lib/Sparkline/index.js +40 -42
- package/lib/Spinner/index.js +12 -23
- package/lib/SplitButton/index.js +20 -48
- package/lib/Switch/index.js +7 -22
- package/lib/Tabs/index.js +8 -22
- package/lib/Tag/index.js +13 -33
- package/lib/TextCollapse/index.js +14 -31
- package/lib/Theme/index.js +3 -13
- package/lib/Theme/theme-provider.js +1 -10
- package/lib/Theme/theme.js +15 -27
- package/lib/Toast/index.js +13 -40
- package/lib/Util/deprecate.js +3 -12
- package/lib/Util/index.js +13 -74
- package/lib/Util/wallet.js +3 -10
- package/lib/Video/index.js +3 -19
- package/lib/Wallet/Action.js +9 -28
- package/lib/Wallet/Download.js +11 -36
- package/lib/Wallet/Open.js +0 -12
- package/lib/WebWalletSWKeeper/index.js +30 -55
- package/lib/WechatPrompt/index.js +0 -16
- package/lib/index.js +0 -38
- package/lib/withTheme/index.js +3 -15
- package/lib/withTracker/error_boundary.js +3 -14
- package/lib/withTracker/index.js +3 -24
- package/package.json +5 -5
- package/src/Blocklet/blocklet.js +1 -1
- package/src/BlockletNFT/index.js +1 -1
- package/src/NFTDisplay/index.js +4 -4
- package/src/SessionManager/federated-login-detecter.jsx +138 -0
- package/src/SessionManager/index.jsx +140 -233
- package/src/SessionManager/user-popper.jsx +121 -0
package/lib/Dialog/confirm.js
CHANGED
@@ -4,29 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = Confirm;
|
7
|
-
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
|
10
8
|
var _Button = _interopRequireDefault(require("../Button"));
|
11
|
-
|
12
9
|
var _dialog = _interopRequireDefault(require("./dialog"));
|
13
|
-
|
14
10
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
|
-
|
16
11
|
const _excluded = ["title", "children", "onConfirm", "onCancel", "showCancelButton", "confirmButton", "cancelButton", "PaperProps"];
|
17
|
-
|
18
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
19
|
-
|
20
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
21
|
-
|
22
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
23
|
-
|
24
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
25
|
-
|
26
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
27
|
-
|
28
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
29
|
-
|
30
12
|
/**
|
31
13
|
@typedef {Object} ConfirmProps
|
32
14
|
@property {boolean} open
|
@@ -40,25 +22,31 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
40
22
|
@property {import('@mui/material').PaperProps} [PaperProps={}]
|
41
23
|
*/
|
42
24
|
// 注意排在 {...rest} 之后的 props 优先级更高
|
43
|
-
|
44
25
|
/**
|
45
26
|
*
|
46
27
|
* @param {ConfirmProps} props
|
47
28
|
* @returns {import('react').ReactComponentElement}
|
48
29
|
*/
|
30
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
33
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
34
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
35
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
36
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
37
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
49
38
|
function Confirm(_ref) {
|
50
39
|
let {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
40
|
+
title,
|
41
|
+
children,
|
42
|
+
onConfirm,
|
43
|
+
onCancel,
|
44
|
+
showCancelButton,
|
45
|
+
confirmButton,
|
46
|
+
cancelButton,
|
47
|
+
PaperProps
|
48
|
+
} = _ref,
|
49
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
62
50
|
// 去除 dialog 默认的 300 最小高度
|
63
51
|
PaperProps.style = Object.assign({
|
64
52
|
minHeight: 0
|
@@ -85,7 +73,6 @@ function Confirm(_ref) {
|
|
85
73
|
children: children
|
86
74
|
}));
|
87
75
|
}
|
88
|
-
|
89
76
|
Confirm.propTypes = {
|
90
77
|
title: _propTypes.default.node.isRequired,
|
91
78
|
children: _propTypes.default.node.isRequired,
|
package/lib/Dialog/dialog.js
CHANGED
@@ -4,50 +4,23 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
|
10
8
|
var _Dialog = _interopRequireDefault(require("@mui/material/Dialog"));
|
11
|
-
|
12
9
|
var _DialogContent = _interopRequireDefault(require("@mui/material/DialogContent"));
|
13
|
-
|
14
10
|
var _DialogActions = _interopRequireDefault(require("@mui/material/DialogActions"));
|
15
|
-
|
16
11
|
var _IconButton = _interopRequireDefault(require("@mui/material/IconButton"));
|
17
|
-
|
18
12
|
var _useMediaQuery = _interopRequireDefault(require("@mui/material/useMediaQuery"));
|
19
|
-
|
20
13
|
var _Close = _interopRequireDefault(require("@mui/icons-material/Close"));
|
21
|
-
|
22
14
|
var _Theme = require("../Theme");
|
23
|
-
|
24
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
25
|
-
|
26
16
|
var _templateObject, _templateObject2;
|
27
|
-
|
28
17
|
const _excluded = ["children", "title", "prepend", "toolbar", "actions", "showCloseButton", "actionsPosition", "PaperProps"];
|
29
|
-
|
30
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
31
|
-
|
32
|
-
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
33
|
-
|
34
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
35
|
-
|
36
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
37
|
-
|
38
|
-
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
39
|
-
|
40
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
41
|
-
|
42
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
43
|
-
|
44
18
|
/**
|
45
19
|
@typedef {import('@mui/material').PaperProps & {
|
46
20
|
minWidth: number | string,
|
47
21
|
minHeight: number | string,
|
48
22
|
}} PaperStyle
|
49
23
|
*/
|
50
|
-
|
51
24
|
/**
|
52
25
|
@typedef {Object} DialogProps
|
53
26
|
@property {React.ReactNode} children - The content of the dialog.
|
@@ -60,7 +33,6 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
60
33
|
@property {PaperStyle} [PaperProps] - Props to be passed down to the dialog paper.
|
61
34
|
@property {(event: React.SyntheticEvent, reason: string) => void} [onClose] - Callback function fired when the dialog is closed.
|
62
35
|
*/
|
63
|
-
|
64
36
|
/**
|
65
37
|
* Dialog
|
66
38
|
*
|
@@ -68,42 +40,46 @@ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) r
|
|
68
40
|
* 注意: 当设置明确的 width 时, 可能需要同时设置 maxWidth=false (mui dialog 默认 maxWidth=sm, 设置的 width 可能受限)
|
69
41
|
* - 添加默认最小尺寸 (300x300), 在需要 先展示 loading 再展示异步数据 的时候避免 loading 阶段窗口过小
|
70
42
|
*/
|
71
|
-
|
72
43
|
/**
|
73
44
|
* @description
|
74
45
|
* @param {DialogProps} props
|
75
46
|
* @return {React.ReactComponentElement<any, DialogProps>}
|
76
47
|
*/
|
48
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
49
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
50
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
51
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
52
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
53
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
54
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
55
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
56
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
77
57
|
function Dialog(_ref) {
|
78
58
|
let {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
59
|
+
children,
|
60
|
+
title,
|
61
|
+
prepend,
|
62
|
+
toolbar,
|
63
|
+
actions,
|
64
|
+
showCloseButton,
|
65
|
+
actionsPosition,
|
66
|
+
PaperProps
|
67
|
+
} = _ref,
|
68
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
69
|
+
const theme = (0, _Theme.useTheme)();
|
70
|
+
// 不管是否是 mobile 设备, 只要屏宽 < sm, dialog 就处于 mobile 模式
|
92
71
|
const isMobile = (0, _useMediaQuery.default)(theme.breakpoints.down('md'));
|
93
72
|
const showHeader = title || showCloseButton || toolbar;
|
94
|
-
|
95
73
|
const handleOnClose = (e, reason) => {
|
96
74
|
// escapeKeyDown/backdropClick
|
97
75
|
const {
|
98
76
|
onClose
|
99
77
|
} = rest;
|
100
|
-
|
101
78
|
if (onClose) {
|
102
79
|
onClose(e, reason);
|
103
80
|
}
|
104
|
-
};
|
105
|
-
|
106
|
-
|
81
|
+
};
|
82
|
+
// 添加默认最小尺寸 (300x300)
|
107
83
|
PaperProps.style = Object.assign({
|
108
84
|
minWidth: 300,
|
109
85
|
minHeight: 300
|
@@ -146,7 +122,6 @@ function Dialog(_ref) {
|
|
146
122
|
})]
|
147
123
|
}));
|
148
124
|
}
|
149
|
-
|
150
125
|
Dialog.propTypes = {
|
151
126
|
children: _propTypes.default.node.isRequired,
|
152
127
|
title: _propTypes.default.node,
|
@@ -171,10 +146,9 @@ Dialog.defaultProps = {
|
|
171
146
|
/**
|
172
147
|
* @type {import('@emotion/styled').StyledComponent<import('@mui/material').DialogProps, {}, { ref?: React.Ref<any> | undefined;}>}
|
173
148
|
*/
|
174
|
-
|
175
149
|
const StyledMuiDialog = (0, _Theme.styled)(_Dialog.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .MuiDialog-paper {\n ", ";\n }\n .MuiDialogContent-root {\n padding: 16px 24px;\n }\n .MuiDialogActions-root {\n padding: 8px 24px 16px 24px;\n }\n .MuiDialogActions-root.ux-dialog_actions--left {\n justify-content: flex-start;\n }\n .MuiDialogActions-root.ux-dialog_actions--right {\n justify-content: flex-end;\n }\n .MuiDialogActions-root.ux-dialog_actions--center {\n justify-content: center;\n }\n"])), props => props.fullScreen ? 'border-radius: 0;' : '');
|
176
|
-
/** @type {import('@emotion/styled').StyledComponent<import('react').ComponentPropsWithoutRef<"div">, {}, { ref?: React.Ref<any> | undefined;}>} */
|
177
150
|
|
151
|
+
/** @type {import('@emotion/styled').StyledComponent<import('react').ComponentPropsWithoutRef<"div">, {}, { ref?: React.Ref<any> | undefined;}>} */
|
178
152
|
const Header = (0, _Theme.styled)('div', {
|
179
153
|
shouldForwardProp: prop => prop !== 'isMobile'
|
180
154
|
})(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n display: flex;\n justify-content: space-between;\n align-items: center;\n padding: 16px 24px;\n .ux-dialog_left {\n display: flex;\n justify-content: flex-start;\n align-items: center;\n min-width: 0;\n }\n .ux-dialog_right {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n }\n .ux-dialog_toolbar {\n display: flex;\n align-items: center;\n }\n .ux-dialog_title {\n margin: 0;\n font-size: 18px;\n font-weight: 500;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n .ux-dialog_closeButton {\n /* \u4F7F closeButton \u4E0E content \u5DE6/\u53F3\u5BF9\u9F50 */\n ", "\n }\n"])), props => props.isMobile ? 'margin-left: -12px;' : 'margin-right: -12px;');
|
package/lib/Dialog/index.js
CHANGED
@@ -15,9 +15,6 @@ Object.defineProperty(exports, "default", {
|
|
15
15
|
return _dialog.default;
|
16
16
|
}
|
17
17
|
});
|
18
|
-
|
19
18
|
var _dialog = _interopRequireDefault(require("./dialog"));
|
20
|
-
|
21
19
|
var _confirm = _interopRequireDefault(require("./confirm"));
|
22
|
-
|
23
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
package/lib/DidLogo/index.js
CHANGED
@@ -4,21 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = DidLogo;
|
7
|
-
|
8
7
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
-
|
10
8
|
var _DidLogo = _interopRequireDefault(require("@arcblock/icons/lib/DidLogo"));
|
11
|
-
|
12
9
|
var _jsxRuntime = require("react/jsx-runtime");
|
13
|
-
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
11
|
const defaultStyle = {
|
17
12
|
width: 'auto',
|
18
13
|
height: '1em',
|
19
14
|
fill: 'currentColor'
|
20
15
|
};
|
21
|
-
|
22
16
|
function DidLogo(_ref) {
|
23
17
|
let {
|
24
18
|
style,
|
@@ -33,7 +27,6 @@ function DidLogo(_ref) {
|
|
33
27
|
} : {})
|
34
28
|
});
|
35
29
|
}
|
36
|
-
|
37
30
|
DidLogo.propTypes = {
|
38
31
|
style: _propTypes.default.object,
|
39
32
|
size: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
package/lib/DriftBot/index.js
CHANGED
@@ -4,16 +4,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _react = require("react");
|
9
|
-
|
10
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
11
|
-
|
12
9
|
var _Util = require("../Util");
|
13
|
-
|
14
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
-
|
16
11
|
/* eslint-disable max-len */
|
12
|
+
|
17
13
|
class DriftBot extends _react.Component {
|
18
14
|
constructor(props) {
|
19
15
|
super((0, _Util.mergeProps)(props, DriftBot, ['attributes']));
|
@@ -21,39 +17,32 @@ class DriftBot extends _react.Component {
|
|
21
17
|
this.addIdentityVariables = this.addIdentityVariables.bind(this);
|
22
18
|
this.insertScript = this.insertScript.bind(this);
|
23
19
|
}
|
24
|
-
|
25
20
|
insertScript(scriptText) {
|
26
21
|
const script = document.createElement('script');
|
27
22
|
script.innerText = scriptText;
|
28
23
|
script.async = true;
|
29
24
|
document.body.appendChild(script);
|
30
25
|
}
|
31
|
-
|
32
26
|
addMainScript() {
|
33
27
|
const scriptText = "!function() {\n var t = window.driftt = window.drift = window.driftt || [];\n if (!t.init) {\n if (t.invoked) return void (window.console && console.error && console.error(\"Drift snippet included twice.\"));\n t.invoked = !0, t.methods = [ \"identify\", \"config\", \"track\", \"reset\", \"debug\", \"show\", \"ping\", \"page\", \"hide\", \"off\", \"on\" ],\n t.factory = function(e) {\n return function() {\n var n = Array.prototype.slice.call(arguments);\n return n.unshift(e), t.push(n), t;\n };\n }, t.methods.forEach(function(e) {\n t[e] = t.factory(e);\n }), t.load = function(t) {\n var e = 3e5, n = Math.ceil(new Date() / e) * e, o = document.createElement(\"script\");\n o.type = \"text/javascript\", o.async = !0, o.crossorigin = \"anonymous\", o.src = \"https://js.driftt.com/include/\" + n + \"/\" + t + \".js\";\n var i = document.getElementsByTagName(\"script\")[0];\n i.parentNode.insertBefore(o, i);\n };\n }\n }();\n drift.SNIPPET_VERSION = '0.3.1';\n drift.load('".concat(this.props.appId, "');");
|
34
28
|
this.insertScript(scriptText);
|
35
29
|
}
|
36
|
-
|
37
30
|
addIdentityVariables() {
|
38
31
|
if (typeof this.props.userId !== 'undefined') {
|
39
32
|
const scriptText = "\n var t = window.driftt = window.drift = window.driftt || [];\n drift.identify('".concat(this.props.userId, "', ").concat(JSON.stringify(this.props.attributes), ")\n ");
|
40
33
|
this.insertScript(scriptText);
|
41
34
|
}
|
42
35
|
}
|
43
|
-
|
44
36
|
componentDidMount() {
|
45
37
|
if (typeof window !== 'undefined') {
|
46
38
|
this.addMainScript();
|
47
39
|
this.addIdentityVariables();
|
48
40
|
}
|
49
41
|
}
|
50
|
-
|
51
42
|
render() {
|
52
43
|
return '';
|
53
44
|
}
|
54
|
-
|
55
45
|
}
|
56
|
-
|
57
46
|
exports.default = DriftBot;
|
58
47
|
DriftBot.propTypes = {
|
59
48
|
appId: _propTypes.default.string.isRequired,
|
package/lib/Earth/index.js
CHANGED
@@ -4,45 +4,27 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
var _react = require("react");
|
9
|
-
|
10
8
|
var _useSpring = _interopRequireDefault(require("react-use/lib/useSpring"));
|
11
|
-
|
12
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
13
|
-
|
14
10
|
var d3 = _interopRequireWildcard(require("d3-geo"));
|
15
|
-
|
16
11
|
var topojson = _interopRequireWildcard(require("topojson-client"));
|
17
|
-
|
18
12
|
var _versor = _interopRequireDefault(require("versor"));
|
19
|
-
|
20
13
|
var _countries = _interopRequireDefault(require("./countries.json"));
|
21
|
-
|
22
14
|
var _util = _interopRequireDefault(require("./util"));
|
23
|
-
|
24
15
|
var _deprecate = require("../Util/deprecate");
|
25
|
-
|
26
16
|
var _Theme = require("../Theme");
|
27
|
-
|
28
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
29
|
-
|
30
18
|
var _templateObject, _templateObject2;
|
31
|
-
|
32
19
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
33
|
-
|
34
20
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
35
|
-
|
36
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
37
|
-
|
38
22
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
39
|
-
|
40
23
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
41
|
-
|
42
24
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
43
|
-
|
44
|
-
function
|
45
|
-
|
25
|
+
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
26
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
27
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } /* eslint-disable consistent-return */
|
46
28
|
const geoJson = topojson.feature(_countries.default, _countries.default.objects.ne_110m_admin_0_countries);
|
47
29
|
const themes = {
|
48
30
|
light: {
|
@@ -64,30 +46,25 @@ const themes = {
|
|
64
46
|
activeMarker: '#FFD159'
|
65
47
|
}
|
66
48
|
};
|
67
|
-
|
68
49
|
function stateReducer(state, action) {
|
69
50
|
switch (action.type) {
|
70
51
|
case 'dragEnd':
|
71
52
|
return _objectSpread(_objectSpread({}, state), {}, {
|
72
53
|
isDragging: false
|
73
54
|
});
|
74
|
-
|
75
55
|
case 'dragStart':
|
76
56
|
return _objectSpread(_objectSpread({}, state), {}, {
|
77
57
|
isDragging: true,
|
78
58
|
animationDuration: 1,
|
79
59
|
mousePosition: action.payload.mousePosition
|
80
60
|
});
|
81
|
-
|
82
61
|
case 'tooltip':
|
83
62
|
case 'rotate':
|
84
63
|
return Object.assign({}, state, action.payload);
|
85
|
-
|
86
64
|
default:
|
87
65
|
return state;
|
88
66
|
}
|
89
67
|
}
|
90
|
-
|
91
68
|
function Earth(_ref) {
|
92
69
|
let {
|
93
70
|
theme,
|
@@ -107,14 +84,16 @@ function Earth(_ref) {
|
|
107
84
|
mousePosition: null,
|
108
85
|
tooltipIndex: -1
|
109
86
|
});
|
110
|
-
const svgRef = (0, _react.useRef)(null);
|
87
|
+
const svgRef = (0, _react.useRef)(null);
|
111
88
|
|
89
|
+
// variables used to track drag and rotate
|
112
90
|
const dragRef = (0, _react.useRef)({
|
113
91
|
v0: undefined,
|
114
92
|
r0: undefined,
|
115
93
|
q0: undefined
|
116
|
-
});
|
94
|
+
});
|
117
95
|
|
96
|
+
// variables used to track start and end position when there is active marker
|
118
97
|
const rotateRef = (0, _react.useRef)({
|
119
98
|
p1: null,
|
120
99
|
p2: [0, 0],
|
@@ -123,11 +102,13 @@ function Earth(_ref) {
|
|
123
102
|
step: 0,
|
124
103
|
markerId: null,
|
125
104
|
iv: null
|
126
|
-
});
|
105
|
+
});
|
127
106
|
|
107
|
+
// console.log('renderGlobe', state, dragRef.current, rotateRef.current, geoJson);
|
128
108
|
const t = (0, _useSpring.default)(state.animateDuration, 170, 26);
|
129
|
-
const isValid = activeMarkerId && rotateRef.current.markerId !== activeMarkerId && markers.some(x => x.id === activeMarkerId);
|
109
|
+
const isValid = activeMarkerId && rotateRef.current.markerId !== activeMarkerId && markers.some(x => x.id === activeMarkerId);
|
130
110
|
|
111
|
+
// Setup path for globe
|
131
112
|
const projection = d3.geoOrthographic().fitExtent([[30, 30], [width - 30, height - 30]], geoJson).rotate(t <= 1 || state.isDragging || !activeMarkerId ? state.rotation : rotateRef.current.iv(t / state.animateDuration));
|
132
113
|
const pathGenerator = d3.geoPath().projection(projection).pointRadius(2);
|
133
114
|
(0, _react.useEffect)(() => {
|
@@ -140,17 +121,15 @@ function Earth(_ref) {
|
|
140
121
|
r1,
|
141
122
|
r2,
|
142
123
|
markerId
|
143
|
-
} = rotateRef.current;
|
144
|
-
|
124
|
+
} = rotateRef.current;
|
125
|
+
// We should only start new animation if the marker has changed
|
145
126
|
if (markerId !== activeMarkerId && !state.isDragging) {
|
146
127
|
const marker = markers.find(x => x.id === activeMarkerId);
|
147
128
|
p1 = p2;
|
148
129
|
p2 = [marker.longitude, marker.latitude];
|
149
130
|
r1 = r2;
|
150
131
|
r2 = [-p2[0], 20 - p2[1], projection.rotate()[2]];
|
151
|
-
|
152
132
|
const iv = _util.default.interpolateAngles(r1, r2);
|
153
|
-
|
154
133
|
Object.assign(rotateRef.current, {
|
155
134
|
p1,
|
156
135
|
p2,
|
@@ -166,8 +145,9 @@ function Earth(_ref) {
|
|
166
145
|
animateDuration: duration > 1e3 ? 2 : duration
|
167
146
|
}
|
168
147
|
});
|
169
|
-
}
|
148
|
+
}
|
170
149
|
|
150
|
+
// Enable auto rotation
|
171
151
|
} else if (enableRotation) {
|
172
152
|
const handler = window.requestAnimationFrame(() => {
|
173
153
|
const newRotation = [state.rotation[0] + 2 / rotationSpeed, state.rotation[1], state.rotation[2]];
|
@@ -183,21 +163,17 @@ function Earth(_ref) {
|
|
183
163
|
};
|
184
164
|
}
|
185
165
|
});
|
186
|
-
|
187
166
|
const getMousePosition = event => {
|
188
167
|
const node = svgRef.current;
|
189
168
|
const rect = node.getBoundingClientRect();
|
190
169
|
const mousePosition = [event.clientX - rect.left - node.clientLeft, event.clientY - rect.top - node.clientTop];
|
191
170
|
return mousePosition;
|
192
171
|
};
|
193
|
-
|
194
172
|
const onDragStart = event => {
|
195
173
|
const mousePosition = getMousePosition(event);
|
196
|
-
|
197
174
|
if (!mousePosition[0]) {
|
198
175
|
return;
|
199
176
|
}
|
200
|
-
|
201
177
|
dragRef.current.v0 = _versor.default.cartesian(projection.invert(mousePosition));
|
202
178
|
dragRef.current.r0 = projection.rotate();
|
203
179
|
dragRef.current.q0 = (0, _versor.default)(dragRef.current.r0);
|
@@ -208,25 +184,19 @@ function Earth(_ref) {
|
|
208
184
|
}
|
209
185
|
});
|
210
186
|
};
|
211
|
-
|
212
187
|
const onDrag = event => {
|
213
188
|
if (state.isDragging === false) {
|
214
189
|
return;
|
215
190
|
}
|
216
|
-
|
217
191
|
const mousePosition = getMousePosition(event);
|
218
192
|
const {
|
219
193
|
r0,
|
220
194
|
v0,
|
221
195
|
q0
|
222
196
|
} = dragRef.current;
|
223
|
-
|
224
197
|
const v1 = _versor.default.cartesian(projection.rotate(r0).invert(mousePosition));
|
225
|
-
|
226
198
|
const q1 = _versor.default.multiply(q0, _versor.default.delta(v0, v1));
|
227
|
-
|
228
199
|
const r1 = _versor.default.rotation(q1);
|
229
|
-
|
230
200
|
dispatch({
|
231
201
|
type: 'rotate',
|
232
202
|
payload: {
|
@@ -235,7 +205,6 @@ function Earth(_ref) {
|
|
235
205
|
}
|
236
206
|
});
|
237
207
|
};
|
238
|
-
|
239
208
|
const onDragEnd = () => {
|
240
209
|
setTimeout(() => {
|
241
210
|
dispatch({
|
@@ -244,7 +213,6 @@ function Earth(_ref) {
|
|
244
213
|
});
|
245
214
|
}, 200);
|
246
215
|
};
|
247
|
-
|
248
216
|
const onShowTooltip = (event, i) => dispatch({
|
249
217
|
type: 'tooltip',
|
250
218
|
payload: {
|
@@ -252,7 +220,6 @@ function Earth(_ref) {
|
|
252
220
|
mousePosition: getMousePosition(event)
|
253
221
|
}
|
254
222
|
});
|
255
|
-
|
256
223
|
const onHideTooltip = () => dispatch({
|
257
224
|
type: 'tooltip',
|
258
225
|
payload: {
|
@@ -260,13 +227,12 @@ function Earth(_ref) {
|
|
260
227
|
mousePosition: null
|
261
228
|
}
|
262
229
|
});
|
263
|
-
|
264
230
|
const renderMarkers = () => markers.map((x, i) => {
|
265
231
|
const areaCoords = [x.longitude, x.latitude];
|
266
232
|
const distance = d3.geoDistance(areaCoords, projection.invert([width / 2, height / 2]));
|
267
233
|
const sphereCoords = projection(areaCoords);
|
268
|
-
const isActive = activeMarkerId === x.id;
|
269
|
-
|
234
|
+
const isActive = activeMarkerId === x.id;
|
235
|
+
// eslint-disable-next-line no-nested-ternary
|
270
236
|
const fill = distance > 1.57 ? 'none' : isActive ? colors.activeMarker : colors.marker;
|
271
237
|
const radius = isActive ? 9 : 6;
|
272
238
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
@@ -298,7 +264,6 @@ function Earth(_ref) {
|
|
298
264
|
}, "marker-outer")]
|
299
265
|
}, x.id);
|
300
266
|
});
|
301
|
-
|
302
267
|
const renderTooltip = () => {
|
303
268
|
if (state.tooltipIndex >= 0) {
|
304
269
|
const marker = markers[state.tooltipIndex];
|
@@ -320,14 +285,11 @@ function Earth(_ref) {
|
|
320
285
|
});
|
321
286
|
}
|
322
287
|
};
|
323
|
-
|
324
288
|
let activeCountry = null;
|
325
|
-
|
326
289
|
if (activeMarkerId && markers.some(x => x.id === activeMarkerId)) {
|
327
290
|
const activeMarker = markers.find(x => x.id === activeMarkerId);
|
328
291
|
activeCountry = geoJson.features.findIndex(x => x.properties && x.properties.name && x.properties.name === activeMarker.country);
|
329
292
|
}
|
330
|
-
|
331
293
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Container, {
|
332
294
|
width: width,
|
333
295
|
height: height,
|
@@ -413,7 +375,6 @@ function Earth(_ref) {
|
|
413
375
|
})]
|
414
376
|
});
|
415
377
|
}
|
416
|
-
|
417
378
|
Earth.propTypes = {
|
418
379
|
theme: _propTypes.default.oneOf(['light', 'dark']),
|
419
380
|
width: _propTypes.default.number,
|
@@ -449,11 +410,9 @@ Earth.defaultProps = {
|
|
449
410
|
activeMarkerId: undefined,
|
450
411
|
colors: {}
|
451
412
|
};
|
452
|
-
|
453
413
|
var _default = (0, _deprecate.withDeprecated)(Earth, {
|
454
414
|
name: 'Earth'
|
455
415
|
});
|
456
|
-
|
457
416
|
exports.default = _default;
|
458
417
|
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n background-color: ", ";\n width: ", "px;\n height: ", "px;\n position: relative;\n animation-name: zoomIn;\n animation-duration: 1s;\n animation-iteration-count: 1;\n animation-timing-function: ease;\n user-select: none;\n\n .defs {\n height: 0;\n width: 0;\n }\n\n .frame {\n fill: none;\n pointer-events: all;\n }\n\n .country {\n fill: ", ";\n stroke: ", ";\n stroke-width: 0.5px;\n transition: fill 300ms ease;\n\n &:hover {\n fill: ", ";\n }\n }\n\n .country--active {\n fill: ", ";\n }\n\n .globe {\n fill: ", ";\n stroke: rgba(255, 255, 255, 0.5);\n stroke-width: 0.25px;\n }\n\n .graticule {\n fill: none;\n stroke: ", ";\n }\n\n .star {\n fill: #fff;\n stroke: rgba(255, 255, 255, 0.5);\n stroke-width: 0.25px;\n }\n\n .marker {\n .marker__outer {\n fill-opacity: 0;\n animation: scaleIn 2s infinite ease-in-out;\n }\n }\n\n @keyframes zoomIn {\n from {\n opacity: 0;\n transform: scale3d(0.1, 0.1, 0.1);\n }\n\n 50% {\n opacity: 1;\n }\n }\n\n @keyframes scaleIn {\n from {\n fill-opacity: 0.3;\n transform: scale3d(0.5, 0.5, 0.5);\n }\n to {\n fill-opacity: 0;\n transform: scale3d(1.5, 1.5, 1.5);\n }\n }\n"])), props => props.theme === 'light' ? '#f7f7f7' : '#222', props => props.width, props => props.height, props => props.colors.land, props => props.colors.border, props => props.colors.activeLand, props => props.colors.activeLand, props => props.colors.ocean, props => props.colors.graticule);
|
459
418
|
const Tooltip = (0, _Theme.styled)('div')(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n width: auto;\n min-width: 90px;\n max-width: 320px;\n padding: 8px 12px;\n font-size: 14px;\n background-color: #4a4a4a;\n border-radius: 2px;\n animation-name: fadeIn;\n animation-duration: 250ms;\n animation-iteration-count: 1;\n animation-timing-function: ease;\n\n .title,\n .description {\n margin: 0;\n font-size: 16px;\n color: #fff;\n }\n\n .description {\n margin-top: ", "px;\n color: #fff;\n font-size: 12px;\n }\n\n @keyframes fadeIn {\n from {\n opacity: 0;\n }\n\n to {\n opacity: 1;\n }\n }\n"])), props => props.theme.spacing(1));
|
package/lib/Earth/util.js
CHANGED
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
5
5
|
});
|
6
6
|
exports.default = void 0;
|
7
|
-
|
8
7
|
/* eslint-disable */
|
9
8
|
// Code from: https://observablehq.com/@d3/world-tour
|
10
9
|
class Util {
|
@@ -21,17 +20,14 @@ class Util {
|
|
21
20
|
const cg = Math.cos(g);
|
22
21
|
return [cl * cp * cg + sl * sp * sg, sl * cp * cg - cl * sp * sg, cl * sp * cg + sl * cp * sg, cl * cp * sg - sl * sp * cg];
|
23
22
|
}
|
24
|
-
|
25
23
|
static toAngles(_ref2) {
|
26
24
|
let [a, b, c, d] = _ref2;
|
27
25
|
return [Math.atan2(2 * (a * b + c * d), 1 - 2 * (b * b + c * c)) * 180 / Math.PI, Math.asin(Math.max(-1, Math.min(1, 2 * (a * c - d * b)))) * 180 / Math.PI, Math.atan2(2 * (a * d + b * c), 1 - 2 * (c * c + d * d)) * 180 / Math.PI];
|
28
26
|
}
|
29
|
-
|
30
27
|
static interpolateAngles(a, b) {
|
31
28
|
const i = Util.interpolate(Util.fromAngles(a), Util.fromAngles(b));
|
32
29
|
return t => Util.toAngles(i(t));
|
33
30
|
}
|
34
|
-
|
35
31
|
static interpolateLinear(_ref3, _ref4) {
|
36
32
|
let [a1, b1, c1, d1] = _ref3;
|
37
33
|
let [a2, b2, c2, d2] = _ref4;
|
@@ -43,7 +39,6 @@ class Util {
|
|
43
39
|
return x;
|
44
40
|
};
|
45
41
|
}
|
46
|
-
|
47
42
|
static interpolate(_ref5, _ref6) {
|
48
43
|
let [a1, b1, c1, d1] = _ref5;
|
49
44
|
let [a2, b2, c2, d2] = _ref6;
|
@@ -65,7 +60,5 @@ class Util {
|
|
65
60
|
return x;
|
66
61
|
};
|
67
62
|
}
|
68
|
-
|
69
63
|
}
|
70
|
-
|
71
64
|
exports.default = Util;
|