@arcblock/ux 2.8.26 → 2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- package/es/Address/did-address.js +33 -21
- package/es/AnimationWaiter/index.js +2 -1
- package/es/Avatar/index.js +1 -1
- package/es/BlockletContext/index.js +1 -1
- package/es/CardSelector/index.js +2 -1
- package/es/Colors/index.js +2 -1
- package/es/Colors/themes/temp.js +17 -0
- package/es/Datatable/TableSearch.js +2 -1
- package/es/Img/index.js +7 -6
- package/es/Locale/selector.js +15 -13
- package/es/NFTDisplay/index.js +2 -1
- package/es/QRCode/index.js +2 -1
- package/es/SessionBlocklet/index.js +169 -0
- package/es/SessionManager/index.js +2 -381
- package/es/SessionPermission/index.js +28 -0
- package/es/SessionUser/components/logged-in.js +224 -0
- package/es/SessionUser/components/session-user-item.js +148 -0
- package/es/SessionUser/components/session-user-switch.js +213 -0
- package/es/SessionUser/components/un-login.js +64 -0
- package/es/SessionUser/components/user-info.js +163 -0
- package/es/SessionUser/index.js +49 -0
- package/es/SessionUser/libs/translation.js +19 -0
- package/es/SessionUser/libs/utils.js +4 -0
- package/es/SplitButton/index.js +2 -1
- package/es/Toast/index.js +1 -1
- package/es/Util/constant.js +10 -0
- package/es/Util/index.js +11 -0
- package/lib/Address/did-address.js +36 -22
- package/lib/AnimationWaiter/index.js +2 -1
- package/lib/Avatar/index.js +1 -1
- package/lib/BlockletContext/index.js +1 -1
- package/lib/CardSelector/index.js +2 -1
- package/lib/Colors/index.js +7 -0
- package/lib/Colors/themes/temp.js +24 -0
- package/lib/Datatable/TableSearch.js +2 -1
- package/lib/Img/index.js +7 -6
- package/lib/Locale/selector.js +14 -13
- package/lib/NFTDisplay/index.js +2 -1
- package/lib/QRCode/index.js +2 -1
- package/lib/SessionBlocklet/index.js +187 -0
- package/lib/SessionManager/index.js +2 -390
- package/lib/SessionPermission/index.js +38 -0
- package/lib/SessionUser/components/logged-in.js +243 -0
- package/lib/SessionUser/components/session-user-item.js +163 -0
- package/lib/SessionUser/components/session-user-switch.js +232 -0
- package/lib/SessionUser/components/un-login.js +72 -0
- package/lib/SessionUser/components/user-info.js +175 -0
- package/lib/SessionUser/index.js +57 -0
- package/lib/SessionUser/libs/translation.js +26 -0
- package/lib/{SessionManager → SessionUser}/libs/utils.js +8 -1
- package/lib/SplitButton/index.js +2 -1
- package/lib/Toast/index.js +5 -5
- package/lib/Util/constant.js +26 -0
- package/lib/Util/index.js +16 -3
- package/package.json +19 -7
- package/src/Address/did-address.jsx +34 -20
- package/src/AnimationWaiter/index.js +2 -1
- package/src/Avatar/index.jsx +1 -1
- package/src/BlockletContext/index.jsx +1 -1
- package/src/CardSelector/index.jsx +2 -1
- package/src/Colors/index.js +1 -0
- package/src/Colors/themes/temp.js +18 -0
- package/src/Datatable/TableSearch.js +3 -1
- package/src/Img/{index.js → index.jsx} +8 -6
- package/src/Locale/selector.jsx +11 -8
- package/src/NFTDisplay/index.js +2 -1
- package/src/QRCode/index.js +2 -1
- package/src/SessionBlocklet/index.jsx +181 -0
- package/src/SessionManager/index.jsx +2 -369
- package/src/SessionPermission/index.jsx +28 -0
- package/src/SessionUser/components/logged-in.jsx +194 -0
- package/src/SessionUser/components/session-user-item.jsx +96 -0
- package/src/SessionUser/components/session-user-switch.jsx +222 -0
- package/src/SessionUser/components/un-login.jsx +55 -0
- package/src/SessionUser/components/user-info.jsx +165 -0
- package/src/SessionUser/index.jsx +38 -0
- package/src/SessionUser/libs/translation.js +19 -0
- package/src/{SessionManager → SessionUser}/libs/utils.js +4 -0
- package/src/SplitButton/index.js +2 -1
- package/src/Toast/index.js +1 -1
- package/src/Util/constant.js +12 -0
- package/src/Util/index.js +13 -0
- package/es/SessionManager/components/account-item.js +0 -212
- package/es/SessionManager/components/add-account-item.js +0 -57
- package/es/SessionManager/components/federated-login-detecter.js +0 -183
- package/es/SessionManager/components/manage-accounts.js +0 -219
- package/es/SessionManager/components/manage-blocklet.js +0 -70
- package/es/SessionManager/components/menu-accordion.js +0 -103
- package/es/SessionManager/components/responsive-popper.js +0 -24
- package/es/SessionManager/components/user-drawer.js +0 -68
- package/es/SessionManager/components/user-info.js +0 -143
- package/es/SessionManager/components/user-popper.js +0 -110
- package/es/SessionManager/hooks/use-config.js +0 -34
- package/es/SessionManager/libs/translation.js +0 -52
- package/es/SessionManager/libs/utils.js +0 -2
- package/lib/SessionManager/components/account-item.js +0 -219
- package/lib/SessionManager/components/add-account-item.js +0 -66
- package/lib/SessionManager/components/federated-login-detecter.js +0 -193
- package/lib/SessionManager/components/manage-accounts.js +0 -232
- package/lib/SessionManager/components/manage-blocklet.js +0 -86
- package/lib/SessionManager/components/menu-accordion.js +0 -111
- package/lib/SessionManager/components/responsive-popper.js +0 -34
- package/lib/SessionManager/components/user-drawer.js +0 -75
- package/lib/SessionManager/components/user-info.js +0 -160
- package/lib/SessionManager/components/user-popper.js +0 -104
- package/lib/SessionManager/hooks/use-config.js +0 -41
- package/lib/SessionManager/libs/translation.js +0 -59
- package/src/SessionManager/components/account-item.jsx +0 -156
- package/src/SessionManager/components/add-account-item.jsx +0 -49
- package/src/SessionManager/components/federated-login-detecter.jsx +0 -167
- package/src/SessionManager/components/manage-accounts.jsx +0 -228
- package/src/SessionManager/components/manage-blocklet.jsx +0 -70
- package/src/SessionManager/components/menu-accordion.jsx +0 -93
- package/src/SessionManager/components/responsive-popper.jsx +0 -26
- package/src/SessionManager/components/user-drawer.jsx +0 -57
- package/src/SessionManager/components/user-info.jsx +0 -117
- package/src/SessionManager/components/user-popper.jsx +0 -95
- package/src/SessionManager/hooks/use-config.js +0 -33
- package/src/SessionManager/libs/translation.js +0 -52
@@ -0,0 +1,10 @@
|
|
1
|
+
export const DEFAULT_TIMEOUT = 5 * 60;
|
2
|
+
export const DEFAULT_WINDOW_TIMEOUT = 30 * 60;
|
3
|
+
export const AUTH_SERVICE_PREFIX = '/.well-known/service';
|
4
|
+
export const SESSION_TOKEN_STORAGE_KEY = 'login_token';
|
5
|
+
export const REFRESH_TOKEN_STORAGE_KEY = 'refresh_token';
|
6
|
+
export const RELAY_SOCKET_PREFIX = '/.well-known/service';
|
7
|
+
export const API_DID_PREFIX = '/api/did';
|
8
|
+
export const DASHBOARD_URL = `${AUTH_SERVICE_PREFIX}/admin`;
|
9
|
+
export const PROFILE_URL = `${AUTH_SERVICE_PREFIX}/user`;
|
10
|
+
export const NAVIGATION_URL = `${AUTH_SERVICE_PREFIX}/admin/navigation`;
|
package/es/Util/index.js
CHANGED
@@ -305,4 +305,15 @@ export const sleep = (time = 0) => {
|
|
305
305
|
};
|
306
306
|
export const isUrl = str => {
|
307
307
|
return /^https?:\/\//.test(str);
|
308
|
+
};
|
309
|
+
const visitorIdKey = '__visitor_id';
|
310
|
+
export const getVisitorId = () => {
|
311
|
+
return localStorage.getItem(visitorIdKey);
|
312
|
+
};
|
313
|
+
export const setVisitorId = value => {
|
314
|
+
if (value === null) {
|
315
|
+
localStorage.removeItem(visitorIdKey);
|
316
|
+
} else {
|
317
|
+
localStorage.setItem(visitorIdKey, value);
|
318
|
+
}
|
308
319
|
};
|
@@ -7,11 +7,11 @@ exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
require("@fontsource/ubuntu-mono/400.css");
|
10
|
-
var _Tooltip = _interopRequireDefault(require("@mui/material/Tooltip"));
|
11
10
|
var _colors = require("@mui/material/colors");
|
11
|
+
var _material = require("@mui/material");
|
12
12
|
var _copyToClipboard = _interopRequireDefault(require("copy-to-clipboard"));
|
13
|
-
var
|
14
|
-
var
|
13
|
+
var _iconsMaterial = require("@mui/icons-material");
|
14
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
15
15
|
var _Theme = require("../Theme");
|
16
16
|
var _Util = require("../Util");
|
17
17
|
var _compactText = _interopRequireDefault(require("./compact-text"));
|
@@ -90,12 +90,12 @@ const DidAddress = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
90
90
|
copyElement = /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
91
91
|
className: "did-address-copy-wrapper",
|
92
92
|
title: copied ? '' : translations[locale].copy,
|
93
|
-
children: copied ? /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
93
|
+
children: copied ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Tooltip, {
|
94
94
|
title: translations[locale].copied,
|
95
95
|
placement: "bottom",
|
96
96
|
arrow: true,
|
97
97
|
open: copied,
|
98
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_iconsMaterial.Check, {
|
99
99
|
className: "did-address-copy",
|
100
100
|
style: {
|
101
101
|
color: _colors.green[500]
|
@@ -104,7 +104,7 @@ const DidAddress = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
104
104
|
}) :
|
105
105
|
/*#__PURE__*/
|
106
106
|
/* title prop 直接加在 icon 上不生效 */
|
107
|
-
(0, _jsxRuntime.jsx)(
|
107
|
+
(0, _jsxRuntime.jsx)(_iconsMaterial.ContentCopy, {
|
108
108
|
className: "did-address-copy",
|
109
109
|
onClick: onCopy
|
110
110
|
})
|
@@ -115,21 +115,35 @@ const DidAddress = /*#__PURE__*/(0, _react.forwardRef)((_ref, ref) => {
|
|
115
115
|
size: size
|
116
116
|
}, rest), {}, {
|
117
117
|
ref: ref,
|
118
|
-
children: [prepend, /*#__PURE__*/(0, _jsxRuntime.
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
118
|
+
children: [prepend, /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Tooltip, {
|
119
|
+
title: copyable ? '' : translations[locale].copied,
|
120
|
+
placement: "bottom",
|
121
|
+
arrow: true,
|
122
|
+
open: copied,
|
123
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
124
|
+
ref: textRef,
|
125
|
+
component: "span",
|
126
|
+
className: "did-address-text did-address-truncate",
|
127
|
+
sx: {
|
128
|
+
display: compact ? 'none' : 'inline',
|
129
|
+
cursor: copyable ? 'text' : 'pointer'
|
130
|
+
},
|
131
|
+
onDoubleClick: copyable ? _noop.default : onCopy,
|
131
132
|
children: children
|
132
|
-
})
|
133
|
+
}), compact && /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
134
|
+
component: "span",
|
135
|
+
className: "did-address-text",
|
136
|
+
sx: {
|
137
|
+
cursor: copyable ? 'text' : 'pointer'
|
138
|
+
},
|
139
|
+
onDoubleClick: copyable ? _noop.default : onCopy,
|
140
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_compactText.default, {
|
141
|
+
startChars: startChars,
|
142
|
+
endChars: endChars,
|
143
|
+
showCopyButtonInTooltip: showCopyButtonInTooltip,
|
144
|
+
children: children
|
145
|
+
})
|
146
|
+
})]
|
133
147
|
}), copyElement, append]
|
134
148
|
}));
|
135
149
|
});
|
@@ -167,9 +181,9 @@ DidAddress.defaultProps = {
|
|
167
181
|
endChars: 6,
|
168
182
|
locale: 'en'
|
169
183
|
};
|
170
|
-
const Root = (0, _Theme.styled)(
|
184
|
+
const Root = (0, _Theme.styled)(_material.Box, {
|
171
185
|
shouldForwardProp: prop => prop !== 'inline'
|
172
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: 'Ubuntu Mono', monospace;\n && {\n display: ", ";\n align-items: center;\n max-width: 100%;\n overflow: hidden;\n color: #ccc;\n font-size: ", ";\n font-weight: 400;\n\n svg {\n fill: currentColor;\n }\n }\n\n .did-address-text {\n color: #666;\n }\n /* truncate string with ellipsis */\n .did-address-truncate {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .did-address-copy
|
186
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n font-family: 'Ubuntu Mono', monospace;\n && {\n display: ", ";\n align-items: center;\n max-width: 100%;\n overflow: hidden;\n color: #ccc;\n font-size: ", ";\n font-weight: 400;\n\n svg {\n fill: currentColor;\n }\n }\n\n .did-address-text {\n color: #666;\n }\n /* truncate string with ellipsis */\n .did-address-truncate {\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n }\n\n .did-address-copy-wrapper {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 1em;\n height: 1em;\n margin-left: 8px;\n }\n .did-address-copy {\n flex: 0 0 auto;\n font-size: 1em;\n color: #999;\n cursor: pointer;\n }\n\n /* link */\n a {\n color: #666;\n }\n &:hover a {\n color: #222;\n text-decoration: underline;\n }\n"])), _ref2 => {
|
173
187
|
let {
|
174
188
|
inline
|
175
189
|
} = _ref2;
|
@@ -7,6 +7,7 @@ exports.default = AnimationWaiter;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
var _reactLottiePlayer = _interopRequireDefault(require("react-lottie-player"));
|
10
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
10
11
|
var _defaultAnimation = _interopRequireDefault(require("./default-animation.json"));
|
11
12
|
var _Theme = require("../Theme");
|
12
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -86,7 +87,7 @@ function AnimationWaiter(_ref) {
|
|
86
87
|
// tips
|
87
88
|
(0, _react.useEffect)(() => {
|
88
89
|
if (!tips.length) {
|
89
|
-
return
|
90
|
+
return _noop.default;
|
90
91
|
}
|
91
92
|
const timer = setTimeout(() => {
|
92
93
|
let nextId = tipsId + 1;
|
package/lib/Avatar/index.js
CHANGED
@@ -141,7 +141,7 @@ Avatar.defaultProps = {
|
|
141
141
|
shape: '',
|
142
142
|
responsive: false
|
143
143
|
};
|
144
|
-
const BlockyIconContainer = (0, _Theme.styled)(
|
144
|
+
const BlockyIconContainer = (0, _Theme.styled)(_Box.default)(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n width: ", "px;\n height: ", "px;\n .blocky-icon-inner {\n box-sizing: border-box;\n display: flex;\n justify-content: center;\n align-items: center;\n width: ", "px;\n height: ", "px;\n border-radius: ", "px;\n background: #ddd;\n }\n"])), props => props.$size, props => props.$size, props => props.$size, props => props.$size * 0.7, props => Math.min(10, Math.floor(0.1 * props.$size + 2)));
|
145
145
|
const StyledImg = (0, _Theme.styled)(_Img.default)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n &.avatar-img--rounded {\n border-radius: 4px;\n overflow: hidden;\n }\n &.avatar-img--circle {\n border-radius: 100%;\n overflow: hidden;\n }\n"])));
|
146
146
|
function AvatarWithErrorBoundary(props) {
|
147
147
|
const size = props.size || 36;
|
@@ -48,7 +48,7 @@ function BlockletProvider(_ref) {
|
|
48
48
|
setBlockletData(data);
|
49
49
|
} catch (_unused) {
|
50
50
|
// NOTICE: 如果获取指定 blockletData 失败,则使用 window.blocklet
|
51
|
-
const data =
|
51
|
+
const data = globalThis.blocklet || globalThis.env;
|
52
52
|
setBlockletData(data);
|
53
53
|
}
|
54
54
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
@@ -7,6 +7,7 @@ exports.default = CardSelector;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _styled = _interopRequireDefault(require("@emotion/styled"));
|
9
9
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
10
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
11
12
|
var _templateObject;
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -119,6 +120,6 @@ CardSelector.defaultProps = {
|
|
119
120
|
width: 300,
|
120
121
|
height: 400,
|
121
122
|
cardSpace: 40,
|
122
|
-
onSelect:
|
123
|
+
onSelect: _noop.default,
|
123
124
|
defaultIndex: 0
|
124
125
|
};
|
package/lib/Colors/index.js
CHANGED
@@ -9,5 +9,12 @@ Object.defineProperty(exports, "default", {
|
|
9
9
|
return _default.default;
|
10
10
|
}
|
11
11
|
});
|
12
|
+
Object.defineProperty(exports, "temp", {
|
13
|
+
enumerable: true,
|
14
|
+
get: function get() {
|
15
|
+
return _temp.default;
|
16
|
+
}
|
17
|
+
});
|
12
18
|
var _default = _interopRequireDefault(require("./themes/default"));
|
19
|
+
var _temp = _interopRequireDefault(require("./themes/temp"));
|
13
20
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -0,0 +1,24 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = void 0;
|
7
|
+
const colors = {
|
8
|
+
lineStep: 'rgba(18, 22, 24, 0.06)',
|
9
|
+
lineBorderStrong: 'rgba(18, 22, 24, 0.12)',
|
10
|
+
lineBorderBase: 'rgba(18, 22, 24, 0.06)',
|
11
|
+
borderBase: 'rgba(18, 22, 24, 0.06)',
|
12
|
+
textMuted: 'rgba(18, 22, 24, 0.36)',
|
13
|
+
textSubtitle: 'rgba(18, 22, 24, 0.6)',
|
14
|
+
textBase: 'rgba(18, 22, 24, 1)',
|
15
|
+
textPrimaryBase: 'rgba(18, 22, 24, 1)',
|
16
|
+
surfaceBgSubtitle: 'rgba(18, 22, 24, 0.03)',
|
17
|
+
surfacePrimarySubtitle: 'rgba(19, 125, 250, 0.06)',
|
18
|
+
surfaceSuccess: 'rgba(13, 202, 134, 1)',
|
19
|
+
primaryBase: 'rgba(19, 125, 250, 1)',
|
20
|
+
primary100: 'rgba(19, 125, 250, 1)',
|
21
|
+
gray6: 'rgba(17, 22, 24, 0.06)'
|
22
|
+
};
|
23
|
+
var _default = colors;
|
24
|
+
exports.default = _default;
|
@@ -12,6 +12,7 @@ var _Search = _interopRequireDefault(require("@mui/icons-material/Search"));
|
|
12
12
|
var _TextField = _interopRequireDefault(require("@mui/material/TextField"));
|
13
13
|
var _Clear = _interopRequireDefault(require("@mui/icons-material/Clear"));
|
14
14
|
var _clsx = _interopRequireDefault(require("clsx"));
|
15
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
15
16
|
var _DatatableContext = require("./DatatableContext");
|
16
17
|
var _Theme = require("../Theme");
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -119,6 +120,6 @@ TableSearch.propTypes = {
|
|
119
120
|
TableSearch.defaultProps = {
|
120
121
|
search: '',
|
121
122
|
searchText: '',
|
122
|
-
onSearchOpen:
|
123
|
+
onSearchOpen: _noop.default
|
123
124
|
};
|
124
125
|
const Container = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n align-items: center;\n .toolbar-search-area {\n width: 0;\n transition: all ease 0.3s;\n overflow: hidden;\n .MuiFormControl-root {\n width: inherit;\n margin: 0 12px;\n }\n &.toolbar-btn-show {\n width: 260px;\n padding-left: 8px;\n\n ", " {\n width: 200px;\n }\n\n ", " {\n width: 180px;\n }\n &.small-textfield {\n width: 200px;\n }\n }\n }\n .toolbar-search-close {\n width: 0;\n transition: all ease 0.3s;\n overflow: hidden;\n &.toolbar-btn-show {\n width: 40px;\n }\n }\n .toolbar-search-icon-placeholder {\n display: flex;\n justify-content: center;\n align-items: center;\n width: 40px;\n height: 40px;\n }\n &.search-always-open {\n .MuiFormControl-root {\n margin: 0 12px 0 0;\n }\n .toolbar-btn-show {\n padding-left: 0;\n }\n }\n"])), props => props.theme.breakpoints.down('md'), props => props.theme.breakpoints.down('sm'));
|
package/lib/Img/index.js
CHANGED
@@ -7,9 +7,10 @@ exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
var _reactIntersectionObserver = require("react-intersection-observer");
|
10
|
-
var
|
11
|
-
var
|
10
|
+
var _warningRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/warning-rounded"));
|
11
|
+
var _imageRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/image-rounded"));
|
12
12
|
var _react2 = require("@iconify/react");
|
13
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
13
14
|
var _Theme = require("../Theme");
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
15
16
|
const _excluded = ["lazy", "width", "height", "repeat", "ratio", "alt", "size", "position", "src", "placeholder", "fallback", "style", "className", "onError", "onSuccess"];
|
@@ -174,14 +175,14 @@ function Img(_ref) {
|
|
174
175
|
className: "image--state",
|
175
176
|
title: "loading image",
|
176
177
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
177
|
-
icon:
|
178
|
+
icon: _warningRounded.default,
|
178
179
|
className: "image--icon"
|
179
180
|
})
|
180
181
|
}), !placeholder && imgState === 'loading' && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
|
181
182
|
className: "image--state",
|
182
183
|
title: "Image load error",
|
183
184
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
184
|
-
icon:
|
185
|
+
icon: _imageRounded.default,
|
185
186
|
className: "image--icon"
|
186
187
|
})
|
187
188
|
}), imgState === 'loaded' && /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
@@ -223,8 +224,8 @@ Img.defaultProps = {
|
|
223
224
|
placeholder: null,
|
224
225
|
fallback: null,
|
225
226
|
className: '',
|
226
|
-
onError:
|
227
|
-
onSuccess:
|
227
|
+
onError: _noop.default,
|
228
|
+
onSuccess: _noop.default
|
228
229
|
};
|
229
230
|
var _default = Img;
|
230
231
|
exports.default = _default;
|
package/lib/Locale/selector.js
CHANGED
@@ -7,9 +7,12 @@ exports.default = LocaleSelector;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
var _material = require("@mui/material");
|
10
|
-
var
|
11
|
-
var
|
10
|
+
var _react2 = require("@iconify/react");
|
11
|
+
var _language = _interopRequireDefault(require("@iconify-icons/material-symbols/language"));
|
12
|
+
var _check = _interopRequireDefault(require("@iconify-icons/material-symbols/check"));
|
13
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
12
14
|
var _Util = require("../Util");
|
15
|
+
var _Colors = require("../Colors");
|
13
16
|
var _context = require("./context");
|
14
17
|
var _Theme = require("../Theme");
|
15
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
@@ -75,12 +78,10 @@ function LocaleSelector(props) {
|
|
75
78
|
if (Icon) {
|
76
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Icon, {});
|
77
80
|
}
|
78
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
color: theme.palette.text.secondary
|
83
|
-
}
|
81
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
82
|
+
icon: _language.default,
|
83
|
+
fontSize: size,
|
84
|
+
color: theme.palette.text.secondary
|
84
85
|
});
|
85
86
|
}, [Icon, theme === null || theme === void 0 ? void 0 : (_theme$palette2 = theme.palette) === null || _theme$palette2 === void 0 ? void 0 : (_theme$palette2$text = _theme$palette2.text) === null || _theme$palette2$text === void 0 ? void 0 : _theme$palette2$text.secondary, size]);
|
86
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Div, _objectSpread(_objectSpread(_objectSpread({
|
@@ -120,9 +121,9 @@ function LocaleSelector(props) {
|
|
120
121
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.MenuItem, {
|
121
122
|
className: "locale-item",
|
122
123
|
onClick: () => onSelect(code, name),
|
123
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(
|
124
|
-
|
125
|
-
|
124
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
125
|
+
icon: _check.default,
|
126
|
+
className: code === locale ? 'check-icon check-icon-visible' : 'check-icon'
|
126
127
|
}), name]
|
127
128
|
}, code);
|
128
129
|
})
|
@@ -144,13 +145,13 @@ LocaleSelector.defaultProps = {
|
|
144
145
|
showText: true,
|
145
146
|
size: 24,
|
146
147
|
popperProps: {},
|
147
|
-
onChange:
|
148
|
+
onChange: _noop.default,
|
148
149
|
popperType: 'click',
|
149
150
|
icon: null
|
150
151
|
};
|
151
152
|
const Div = (0, _Theme.styled)('div', {
|
152
153
|
shouldForwardProp: prop => prop !== 'dark'
|
153
|
-
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n\n .trigger {\n display: flex;\n flex-direction: column;\n justify-content: center;\n font-size: 14px;\n white-space: nowrap;\n\n .trigger-text {\n margin-left: 5px;\n font-size: 14px;\n color: ", ";\n }\n }\n\n .locales {\n background: ", ";\n box-shadow:
|
154
|
+
})(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: inline-block;\n\n .trigger {\n display: flex;\n flex-direction: column;\n justify-content: center;\n font-size: 14px;\n white-space: nowrap;\n\n .trigger-text {\n margin-left: 5px;\n font-size: 14px;\n color: ", ";\n }\n }\n\n .locales {\n background: ", ";\n box-shadow: 0px 8px 16px 0px ", ", 0px 0px 0px 1px ", ";\n border-radius: 8px;\n }\n\n .locale-item {\n font-size: 16px;\n font-style: normal;\n font-stretch: normal;\n line-height: normal;\n letter-spacing: 2px;\n text-align: center;\n color: ", ";\n cursor: pointer;\n display: flex;\n padding: 16px;\n align-items: center;\n .check-icon {\n visibility: hidden;\n margin-right: 4px;\n }\n .check-icon-visible {\n visibility: visible;\n }\n }\n"])), props => (0, _Util.getColor)(props), props => (0, _Util.getBackground)(props), _Colors.temp.gray6, _Colors.temp.gray6, props => (0, _Util.getColor)(props));
|
154
155
|
const StyledPopper = (0, _Theme.styled)(_material.Popper)(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n z-index: ", ";\n"])), _ref2 => {
|
155
156
|
let {
|
156
157
|
theme
|
package/lib/NFTDisplay/index.js
CHANGED
@@ -14,6 +14,7 @@ var _pako = _interopRequireDefault(require("pako"));
|
|
14
14
|
var _base64Url = _interopRequireDefault(require("base64-url"));
|
15
15
|
var _isSvg = _interopRequireDefault(require("is-svg"));
|
16
16
|
var _reactSvg = require("react-svg");
|
17
|
+
var _noop = _interopRequireDefault(require("lodash/noop"));
|
17
18
|
var _aspectRatioContainer = _interopRequireDefault(require("./aspect-ratio-container"));
|
18
19
|
var _img = _interopRequireDefault(require("./svg-embedder/img"));
|
19
20
|
var _inlineSvg = _interopRequireDefault(require("./svg-embedder/inline-svg"));
|
@@ -284,7 +285,7 @@ NFTDisplay.defaultProps = {
|
|
284
285
|
preferredSvgEmbedder: 'img',
|
285
286
|
checkSvg: false,
|
286
287
|
minimumLoadingTime: 0,
|
287
|
-
onCompleted:
|
288
|
+
onCompleted: _noop.default
|
288
289
|
};
|
289
290
|
const Root = (0, _Theme.styled)('div')(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n display: flex;\n justify-content: center;\n align-items: center;\n position: relative;\n /* \u9ED8\u8BA4\u5C3A\u5BF8 */\n width: 150px;\n height: 150px;\n overflow: hidden;\n\n &,\n img,\n object {\n max-width: 100%;\n max-height: 100%;\n }\n\n img,\n object {\n width: 100%;\n height: 100%;\n }\n\n &.nft-display--inset {\n width: 100%;\n height: 100%;\n }\n"])));
|
290
291
|
function withAspectRatio(Component) {
|
package/lib/QRCode/index.js
CHANGED
@@ -7,6 +7,7 @@ exports.default = void 0;
|
|
7
7
|
var _react = require("react");
|
8
8
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
9
|
var _qrCodeStyling = _interopRequireDefault(require("@solana/qr-code-styling"));
|
10
|
+
var _material = require("@mui/material");
|
10
11
|
var _jsxRuntime = require("react/jsx-runtime");
|
11
12
|
const _excluded = ["data", "size", "image", "config"];
|
12
13
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -65,7 +66,7 @@ function QRCode(_ref) {
|
|
65
66
|
qrCode.update(options);
|
66
67
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
67
68
|
}, [data, size, image, config]);
|
68
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
69
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, _objectSpread({
|
69
70
|
ref: ref
|
70
71
|
}, rest));
|
71
72
|
}
|
@@ -0,0 +1,187 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
4
|
+
value: true
|
5
|
+
});
|
6
|
+
exports.default = SessionBlocklet;
|
7
|
+
var _react = require("react");
|
8
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
9
|
+
var _material = require("@mui/material");
|
10
|
+
var _react2 = require("@iconify/react");
|
11
|
+
var _dashboardOutlineRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/dashboard-outline-rounded"));
|
12
|
+
var _widgetsOutlineRounded = _interopRequireDefault(require("@iconify-icons/material-symbols/widgets-outline-rounded"));
|
13
|
+
var _ahooks = require("ahooks");
|
14
|
+
var _Button = _interopRequireDefault(require("../Button"));
|
15
|
+
var _Colors = require("../Colors");
|
16
|
+
var _constant = require("../Util/constant");
|
17
|
+
var _SessionPermission = _interopRequireDefault(require("../SessionPermission"));
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
19
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
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
|
+
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; }
|
22
|
+
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; }
|
23
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
24
|
+
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); }
|
25
|
+
function SessionBlocklet(_ref) {
|
26
|
+
var _window;
|
27
|
+
let {
|
28
|
+
session,
|
29
|
+
locale,
|
30
|
+
size
|
31
|
+
} = _ref;
|
32
|
+
const blocklet = ((_window = window) === null || _window === void 0 ? void 0 : _window.blocklet) || {};
|
33
|
+
const sessionMenuList = (blocklet.navigation || []
|
34
|
+
// HACK 过滤掉默认插入的 /sessionManager 菜单
|
35
|
+
).filter(item => item.section === 'sessionManager' && !['/sessionManager'].includes(item.id)).filter(item => {
|
36
|
+
var _session$user;
|
37
|
+
if (((item === null || item === void 0 ? void 0 : item.role) || []).includes((session === null || session === void 0 ? void 0 : (_session$user = session.user) === null || _session$user === void 0 ? void 0 : _session$user.role) || 'guest')) {
|
38
|
+
return true;
|
39
|
+
}
|
40
|
+
return false;
|
41
|
+
}).map(item => {
|
42
|
+
const component = ((blocklet === null || blocklet === void 0 ? void 0 : blocklet.componentMountPoints) || []).find(x => item.component === x.name);
|
43
|
+
return _objectSpread(_objectSpread({}, item), {}, {
|
44
|
+
component
|
45
|
+
});
|
46
|
+
});
|
47
|
+
const popperAnchorRef = (0, _react.useRef)(null);
|
48
|
+
const currentState = (0, _ahooks.useReactive)({
|
49
|
+
open: false
|
50
|
+
});
|
51
|
+
const onTogglePopper = (0, _ahooks.useMemoizedFn)(function () {
|
52
|
+
let value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !currentState.open;
|
53
|
+
currentState.open = value;
|
54
|
+
});
|
55
|
+
if (sessionMenuList.length === 0) {
|
56
|
+
return null;
|
57
|
+
}
|
58
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
59
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.IconButton, {
|
60
|
+
size: "medium",
|
61
|
+
ref: popperAnchorRef,
|
62
|
+
onClick: () => onTogglePopper(),
|
63
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
64
|
+
icon: _dashboardOutlineRounded.default,
|
65
|
+
fontSize: size
|
66
|
+
})
|
67
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Popper, {
|
68
|
+
open: currentState.open,
|
69
|
+
onClose: () => onTogglePopper(false),
|
70
|
+
anchorEl: popperAnchorRef.current,
|
71
|
+
transition: true,
|
72
|
+
placement: "bottom-end",
|
73
|
+
sx: {
|
74
|
+
zIndex: 1600
|
75
|
+
},
|
76
|
+
children: _ref2 => {
|
77
|
+
let {
|
78
|
+
TransitionProps
|
79
|
+
} = _ref2;
|
80
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ClickAwayListener, {
|
81
|
+
onClickAway: e => {
|
82
|
+
e.preventDefault();
|
83
|
+
e.stopPropagation();
|
84
|
+
onTogglePopper(false);
|
85
|
+
},
|
86
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Fade, _objectSpread(_objectSpread({}, TransitionProps), {}, {
|
87
|
+
timeout: 350,
|
88
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.Paper, {
|
89
|
+
variant: "outlined",
|
90
|
+
sx: {
|
91
|
+
borderRadius: 3,
|
92
|
+
width: 350,
|
93
|
+
maxWidth: '90vw',
|
94
|
+
borderColor: _Colors.temp.lineStep,
|
95
|
+
p: 2,
|
96
|
+
border: '0 !important',
|
97
|
+
boxShadow: "0px 8px 16px 0px ".concat(_Colors.temp.gray6, ", 0px 0px 0px 1px ").concat(_Colors.temp.gray6)
|
98
|
+
},
|
99
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_material.List, {
|
100
|
+
sx: {
|
101
|
+
display: 'grid',
|
102
|
+
gridTemplateColumns: 'repeat(auto-fill, 100px)',
|
103
|
+
gridAutoRows: 'minmax(100px, max-content)',
|
104
|
+
justifyContent: 'space-between',
|
105
|
+
maxHeight: 350,
|
106
|
+
overflowY: 'auto',
|
107
|
+
p: 0
|
108
|
+
},
|
109
|
+
children: sessionMenuList.map(item => {
|
110
|
+
var _item$component, _item$title;
|
111
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.ListItem, {
|
112
|
+
disablePadding: true,
|
113
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_material.ListItemButton, {
|
114
|
+
href: item.link,
|
115
|
+
sx: {
|
116
|
+
p: 1,
|
117
|
+
display: 'flex',
|
118
|
+
flexDirection: 'column',
|
119
|
+
alignItems: 'center',
|
120
|
+
gap: 1,
|
121
|
+
width: '100%',
|
122
|
+
height: '100%',
|
123
|
+
borderRadius: 2,
|
124
|
+
'&:hover': {
|
125
|
+
backgroundColor: _Colors.temp.surfacePrimarySubtitle
|
126
|
+
}
|
127
|
+
},
|
128
|
+
children: [item !== null && item !== void 0 && (_item$component = item.component) !== null && _item$component !== void 0 && _item$component.did ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Box, {
|
129
|
+
component: "img",
|
130
|
+
src: "".concat(_constant.AUTH_SERVICE_PREFIX, "/blocklet/logo-bundle/").concat(item.component.did),
|
131
|
+
sx: {
|
132
|
+
borderRadius: 2,
|
133
|
+
width: 50,
|
134
|
+
height: 50,
|
135
|
+
objectFit: 'contain'
|
136
|
+
}
|
137
|
+
}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_react2.Icon, {
|
138
|
+
fontSize: 50,
|
139
|
+
icon: item.icon || _widgetsOutlineRounded.default,
|
140
|
+
color: _Colors.temp.textSubtitle
|
141
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_material.Typography, {
|
142
|
+
sx: {
|
143
|
+
fontSize: '12px',
|
144
|
+
color: _Colors.temp.textBase,
|
145
|
+
textAlign: 'center',
|
146
|
+
lineHeight: 'normal'
|
147
|
+
},
|
148
|
+
children: ((_item$title = item.title) === null || _item$title === void 0 ? void 0 : _item$title.zh) || item.title
|
149
|
+
})]
|
150
|
+
})
|
151
|
+
}, item.id);
|
152
|
+
})
|
153
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_SessionPermission.default, {
|
154
|
+
session: session,
|
155
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Button.default, {
|
156
|
+
variant: "outlined",
|
157
|
+
fullWidth: true,
|
158
|
+
href: _constant.NAVIGATION_URL,
|
159
|
+
sx: {
|
160
|
+
mt: 1,
|
161
|
+
borderRadius: 2,
|
162
|
+
color: _Colors.temp.textBase,
|
163
|
+
borderColor: _Colors.temp.lineBorderStrong,
|
164
|
+
'&:hover': {
|
165
|
+
color: _Colors.temp.primaryBase,
|
166
|
+
borderColor: _Colors.temp.primaryBase
|
167
|
+
}
|
168
|
+
},
|
169
|
+
children: locale === 'zh' ? '管理' : 'Manage'
|
170
|
+
})
|
171
|
+
})]
|
172
|
+
})
|
173
|
+
}))
|
174
|
+
});
|
175
|
+
}
|
176
|
+
})]
|
177
|
+
});
|
178
|
+
}
|
179
|
+
SessionBlocklet.propTypes = {
|
180
|
+
session: _propTypes.default.object.isRequired,
|
181
|
+
locale: _propTypes.default.string,
|
182
|
+
size: _propTypes.default.number
|
183
|
+
};
|
184
|
+
SessionBlocklet.defaultProps = {
|
185
|
+
locale: 'en',
|
186
|
+
size: 24
|
187
|
+
};
|