@arcblock/ux 3.0.9 → 3.0.11
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/Address/did-address.js +47 -49
- package/lib/Address/responsive-did-address.js +53 -57
- package/lib/Avatar/index.js +16 -16
- package/lib/BlockletV2/blocklet.js +64 -64
- package/lib/BlockletV2/components/tooltip-icon.js +26 -27
- package/lib/CardSelector/index.js +1 -2
- package/lib/ClickToCopy/hook.js +10 -11
- package/lib/ClickToCopy/index.js +16 -16
- package/lib/Config/theme-mode-toggle.js +7 -8
- package/lib/DID/index.js +131 -133
- package/lib/DIDConnect/app-info-item.js +18 -18
- package/lib/DIDConnect/auth-apps/index.js +83 -84
- package/lib/DIDConnect/did-connect-container.js +89 -90
- package/lib/DIDConnect/did-connect-footer.js +25 -25
- package/lib/DIDConnect/landing-page.js +17 -17
- package/lib/DIDConnect/powered-by.js +11 -11
- package/lib/DIDConnect/request-storage-access-api-dialog.js +36 -37
- package/lib/DIDConnect/with-container.js +66 -68
- package/lib/Dialog/use-confirm.js +40 -43
- package/lib/Earth/index.js +21 -22
- package/lib/Footer/index.js +15 -16
- package/lib/Header/responsive-header.js +23 -24
- package/lib/Layout/dashboard/index.js +63 -72
- package/lib/Layout/dashboard/sidebar.js +20 -21
- package/lib/Layout/dashboard-legacy/index.js +52 -52
- package/lib/Locale/context.js +36 -37
- package/lib/Locale/selector.js +40 -42
- package/lib/NFTDisplay/index.js +114 -118
- package/lib/NFTDisplay/render-svg.js +12 -12
- package/lib/NavMenu/nav-menu.js +159 -161
- package/lib/NavMenu/sub-container.js +25 -26
- package/lib/PageScroller/index.js +28 -32
- package/lib/Passport/passport.js +11 -11
- package/lib/PhoneInput/country-select.js +38 -38
- package/lib/PhoneInput/index.js +65 -66
- package/lib/Screenshot/index.js +26 -27
- package/lib/SessionBlocklet/index.js +87 -93
- package/lib/SessionPermission/index.js +5 -9
- package/lib/SessionUser/components/did-space.js +24 -25
- package/lib/SessionUser/components/logged-in.js +122 -127
- package/lib/SessionUser/components/quick-login-item.js +41 -42
- package/lib/SessionUser/components/session-user-item.js +35 -36
- package/lib/SessionUser/components/session-user-switch.js +81 -85
- package/lib/SessionUser/components/un-login.js +41 -41
- package/lib/SessionUser/components/user-info.js +43 -47
- package/lib/SessionUser/index.js +1 -1
- package/lib/SessionUser/libs/utils.js +24 -30
- package/lib/SharedBridge/index.js +35 -35
- package/lib/Theme/index.js +16 -16
- package/lib/Theme/theme.js +42 -43
- package/lib/Toast/index.js +24 -25
- package/lib/Typography/index.js +42 -42
- package/lib/UserCard/Content/basic.js +91 -93
- package/lib/UserCard/Content/shorten-label.js +9 -9
- package/lib/UserCard/components.js +15 -15
- package/lib/Util/deprecate.js +1 -1
- package/lib/Util/federated.js +28 -32
- package/lib/Util/iframe.js +9 -10
- package/lib/Util/index.js +134 -135
- package/lib/Util/security.js +9 -10
- package/lib/Util/wallet.js +6 -9
- package/lib/VerificationCode/index.js +26 -28
- package/lib/hooks/use-blocklet-logo.js +11 -14
- package/lib/ux.css +1 -1
- package/lib/withTracker/index.js +13 -14
- package/package.json +10 -11
@@ -1,59 +1,56 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { useRef as
|
3
|
-
import { useTheme as
|
4
|
-
import { Icon as
|
1
|
+
import { jsxs as s, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { useRef as y } from "react";
|
3
|
+
import { useTheme as R, Box as p, IconButton as k, Popper as w, ClickAwayListener as C, Fade as P, Paper as L, List as z, ListItem as A, ListItemButton as M, Typography as S } from "@mui/material";
|
4
|
+
import { Icon as u } from "@iconify/react";
|
5
5
|
import T from "iconify-icons-material-symbols-400/dashboard-outline-rounded";
|
6
6
|
import B from "@iconify-icons/material-symbols/widgets-outline-rounded";
|
7
7
|
import { useReactive as E, useMemoizedFn as j } from "ahooks";
|
8
8
|
import F from "../Button/index.js";
|
9
9
|
import { BLOCKLET_SERVICE_PATH_PREFIX as O, NAVIGATION_URL as _ } from "../Util/constant.js";
|
10
10
|
import D from "../SessionPermission/index.js";
|
11
|
-
import { getTranslation as
|
11
|
+
import { getTranslation as m } from "../Util/index.js";
|
12
12
|
function J({
|
13
|
-
session:
|
14
|
-
locale:
|
15
|
-
size:
|
16
|
-
popperType:
|
17
|
-
sx:
|
18
|
-
...
|
13
|
+
session: r,
|
14
|
+
locale: i = "zh",
|
15
|
+
size: f = 24,
|
16
|
+
popperType: h = "click",
|
17
|
+
sx: g,
|
18
|
+
...x
|
19
19
|
}) {
|
20
|
-
const
|
21
|
-
|
22
|
-
return !!((n == null ? void 0 : n.role) || []).includes(((e = t == null ? void 0 : t.user) == null ? void 0 : e.role) || "guest");
|
23
|
-
}).map((n) => {
|
24
|
-
const e = ((r == null ? void 0 : r.componentMountPoints) || []).find((l) => n.component === l.name);
|
20
|
+
const c = window?.blocklet || {}, a = (c.navigation || []).filter((n) => n.section === "sessionManager" && !["/sessionManager"].includes(n.id)).filter((n) => !!(n?.role || []).includes(r?.user?.role || "guest")).map((n) => {
|
21
|
+
const o = (c?.componentMountPoints || []).find((v) => n.component === v.name);
|
25
22
|
return {
|
26
23
|
...n,
|
27
|
-
component:
|
24
|
+
component: o
|
28
25
|
};
|
29
|
-
}),
|
26
|
+
}), b = R(), d = y(null), l = E({
|
30
27
|
open: !1
|
31
|
-
}),
|
32
|
-
|
33
|
-
}),
|
34
|
-
return
|
35
|
-
|
28
|
+
}), t = j((n = !l.open) => {
|
29
|
+
l.open = n;
|
30
|
+
}), I = h === "hover" ? { onMouseEnter: () => t(!0), onMouseLeave: () => t(!1) } : { onClick: () => t() };
|
31
|
+
return a.length === 0 || !r?.user ? null : /* @__PURE__ */ s(
|
32
|
+
p,
|
36
33
|
{
|
37
|
-
sx: { display: "inline-flex", alignItems: "center", justifyContent: "center", ...
|
34
|
+
sx: { display: "inline-flex", alignItems: "center", justifyContent: "center", ...g },
|
35
|
+
...x,
|
38
36
|
...I,
|
39
|
-
...y,
|
40
37
|
children: [
|
41
|
-
/* @__PURE__ */
|
42
|
-
/* @__PURE__ */
|
43
|
-
|
38
|
+
/* @__PURE__ */ e(k, { size: "medium", ref: d, children: /* @__PURE__ */ e(u, { icon: T, fontSize: f, style: { transform: "scale(1.08)" } }) }),
|
39
|
+
/* @__PURE__ */ e(
|
40
|
+
w,
|
44
41
|
{
|
45
|
-
open:
|
46
|
-
anchorEl:
|
42
|
+
open: l.open,
|
43
|
+
anchorEl: d.current,
|
47
44
|
transition: !0,
|
48
45
|
placement: "bottom-end",
|
49
46
|
sx: { zIndex: 1600 },
|
50
|
-
children: ({ TransitionProps: n }) => /* @__PURE__ */
|
51
|
-
|
47
|
+
children: ({ TransitionProps: n }) => /* @__PURE__ */ e(
|
48
|
+
C,
|
52
49
|
{
|
53
|
-
onClickAway: (
|
54
|
-
|
50
|
+
onClickAway: (o) => {
|
51
|
+
o.preventDefault(), o.stopPropagation(), t(!1);
|
55
52
|
},
|
56
|
-
children: /* @__PURE__ */
|
53
|
+
children: /* @__PURE__ */ e(P, { ...n, timeout: 350, children: /* @__PURE__ */ s(
|
57
54
|
L,
|
58
55
|
{
|
59
56
|
variant: "outlined",
|
@@ -64,7 +61,7 @@ function J({
|
|
64
61
|
p: 2
|
65
62
|
},
|
66
63
|
children: [
|
67
|
-
/* @__PURE__ */
|
64
|
+
/* @__PURE__ */ e(
|
68
65
|
z,
|
69
66
|
{
|
70
67
|
sx: {
|
@@ -76,66 +73,63 @@ function J({
|
|
76
73
|
overflowY: "auto",
|
77
74
|
p: 0
|
78
75
|
},
|
79
|
-
children:
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
{
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
76
|
+
children: a.map((o) => /* @__PURE__ */ e(A, { disablePadding: !0, children: /* @__PURE__ */ s(
|
77
|
+
M,
|
78
|
+
{
|
79
|
+
href: m(o.link, i),
|
80
|
+
sx: {
|
81
|
+
p: 1,
|
82
|
+
display: "flex",
|
83
|
+
flexDirection: "column",
|
84
|
+
alignItems: "center",
|
85
|
+
gap: 1,
|
86
|
+
width: "100%",
|
87
|
+
height: "100%",
|
88
|
+
borderRadius: 1,
|
89
|
+
"&:hover": {
|
90
|
+
backgroundColor: "action.hover"
|
91
|
+
}
|
92
|
+
},
|
93
|
+
children: [
|
94
|
+
o?.component?.did ? /* @__PURE__ */ e(
|
95
|
+
p,
|
96
|
+
{
|
97
|
+
component: "img",
|
98
|
+
src: `${O}/blocklet/logo-bundle/${o.component.did}`,
|
99
|
+
sx: {
|
100
|
+
borderRadius: 1,
|
101
|
+
width: 50,
|
102
|
+
height: 50,
|
103
|
+
objectFit: "contain"
|
104
|
+
},
|
105
|
+
alt: "SessionBlocklet component icon"
|
96
106
|
}
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
/* @__PURE__ */ o(
|
121
|
-
S,
|
122
|
-
{
|
123
|
-
sx: {
|
124
|
-
fontSize: "12px",
|
125
|
-
color: "text.primary",
|
126
|
-
textAlign: "center",
|
127
|
-
lineHeight: "normal"
|
128
|
-
},
|
129
|
-
children: f(e.title, a)
|
130
|
-
}
|
131
|
-
)
|
132
|
-
]
|
133
|
-
}
|
134
|
-
) }, e.id);
|
135
|
-
})
|
107
|
+
) : /* @__PURE__ */ e(
|
108
|
+
u,
|
109
|
+
{
|
110
|
+
fontSize: 50,
|
111
|
+
icon: o.icon || B,
|
112
|
+
color: b.palette.text.secondary
|
113
|
+
}
|
114
|
+
),
|
115
|
+
/* @__PURE__ */ e(
|
116
|
+
S,
|
117
|
+
{
|
118
|
+
sx: {
|
119
|
+
fontSize: "12px",
|
120
|
+
color: "text.primary",
|
121
|
+
textAlign: "center",
|
122
|
+
lineHeight: "normal"
|
123
|
+
},
|
124
|
+
children: m(o.title, i)
|
125
|
+
}
|
126
|
+
)
|
127
|
+
]
|
128
|
+
}
|
129
|
+
) }, o.id))
|
136
130
|
}
|
137
131
|
),
|
138
|
-
/* @__PURE__ */
|
132
|
+
/* @__PURE__ */ e(D, { session: r, children: /* @__PURE__ */ e(F, { variant: "outlined", fullWidth: !0, href: _, sx: { mt: 1 }, children: i === "zh" ? "管理" : "Manage" }) })
|
139
133
|
]
|
140
134
|
}
|
141
135
|
) })
|
@@ -1,12 +1,8 @@
|
|
1
|
-
import { useCreation as
|
2
|
-
function
|
3
|
-
|
4
|
-
|
5
|
-
var n;
|
6
|
-
return u.includes(((n = r == null ? void 0 : r.user) == null ? void 0 : n.role) || "guest");
|
7
|
-
}, [(f = r == null ? void 0 : r.user) == null ? void 0 : f.role, u]);
|
8
|
-
return typeof t == "function" ? t({ hasPermission: e }) : e ? t : null;
|
1
|
+
import { useCreation as u } from "ahooks";
|
2
|
+
function i({ session: e, roles: n = ["owner", "admin"], children: r }) {
|
3
|
+
const t = u(() => n.includes(e?.user?.role || "guest"), [e?.user?.role, n]);
|
4
|
+
return typeof r == "function" ? r({ hasPermission: t }) : t ? r : null;
|
9
5
|
}
|
10
6
|
export {
|
11
|
-
|
7
|
+
i as default
|
12
8
|
};
|
@@ -1,23 +1,22 @@
|
|
1
|
-
import { jsxs as
|
2
|
-
import { useState as
|
3
|
-
import { useMemoizedFn as
|
4
|
-
import { useTheme as
|
5
|
-
import { Icon as
|
6
|
-
import
|
7
|
-
import { translate as
|
8
|
-
import { translations as
|
9
|
-
import
|
10
|
-
import { DID_SPACE_URL as
|
11
|
-
import { TBox as
|
12
|
-
import
|
13
|
-
function
|
14
|
-
|
15
|
-
|
16
|
-
f(Math.ceil((i - r) / 4));
|
1
|
+
import { jsxs as p, Fragment as x, jsx as e } from "react/jsx-runtime";
|
2
|
+
import { useState as h } from "react";
|
3
|
+
import { useMemoizedFn as a } from "ahooks";
|
4
|
+
import { useTheme as y, MenuItem as g, Divider as S } from "@mui/material";
|
5
|
+
import { Icon as u } from "@iconify/react";
|
6
|
+
import D from "@iconify-icons/material-symbols/lens";
|
7
|
+
import { translate as I } from "../../Locale/util.js";
|
8
|
+
import { translations as v } from "../libs/translation.js";
|
9
|
+
import T from "../images/did-spaces.svg.js";
|
10
|
+
import { DID_SPACE_URL as w } from "../../Util/constant.js";
|
11
|
+
import { TBox as z } from "../../MuiWrap/index.js";
|
12
|
+
import k from "../../Typography/index.js";
|
13
|
+
function G({ session: s, locale: m = "en", ...l }) {
|
14
|
+
const c = a((r, i = {}) => I(v, r, m, "en", i)), t = y(), o = s.user?.didSpace ?? {}, [n, d] = h(0), f = a(({ fontSize: r, initialSize: i }) => {
|
15
|
+
d(Math.ceil((i - r) / 4));
|
17
16
|
});
|
18
|
-
return /* @__PURE__ */
|
19
|
-
/* @__PURE__ */ e(
|
20
|
-
|
17
|
+
return /* @__PURE__ */ p(x, { children: [
|
18
|
+
/* @__PURE__ */ e(z, { component: "a", href: w, sx: { p: 0.5, display: "block", textDecoration: "none" }, ...l, children: /* @__PURE__ */ p(
|
19
|
+
g,
|
21
20
|
{
|
22
21
|
sx: {
|
23
22
|
display: "flex",
|
@@ -27,7 +26,7 @@ function O({ session: m, locale: l = "en", ...c }) {
|
|
27
26
|
},
|
28
27
|
children: [
|
29
28
|
/* @__PURE__ */ e("div", { style: { display: "flex", alignItems: "center" }, children: /* @__PURE__ */ e(
|
30
|
-
|
29
|
+
T,
|
31
30
|
{
|
32
31
|
style: {
|
33
32
|
height: "24px",
|
@@ -48,14 +47,14 @@ function O({ session: m, locale: l = "en", ...c }) {
|
|
48
47
|
overflow: "hidden",
|
49
48
|
whiteSpace: "nowrap"
|
50
49
|
},
|
51
|
-
children: /* @__PURE__ */ e(
|
50
|
+
children: /* @__PURE__ */ e(k, { fontSize: "auto", minFontSize: 1, sx: { marginTop: `${n}px` }, onShrink: f, children: o.did ? o.name : c("disconnected") })
|
52
51
|
}
|
53
52
|
),
|
54
53
|
/* @__PURE__ */ e(
|
55
|
-
|
54
|
+
u,
|
56
55
|
{
|
57
56
|
style: { marginTop: `${n}px`, flexShrink: 0 },
|
58
|
-
icon:
|
57
|
+
icon: D,
|
59
58
|
fontSize: 8,
|
60
59
|
color: o.did ? t.palette.success.main : t.palette.grey[200]
|
61
60
|
}
|
@@ -63,9 +62,9 @@ function O({ session: m, locale: l = "en", ...c }) {
|
|
63
62
|
]
|
64
63
|
}
|
65
64
|
) }),
|
66
|
-
/* @__PURE__ */ e(
|
65
|
+
/* @__PURE__ */ e(S, {})
|
67
66
|
] });
|
68
67
|
}
|
69
68
|
export {
|
70
|
-
|
69
|
+
G as default
|
71
70
|
};
|