@arcblock/ux 3.1.11 → 3.1.12

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.
@@ -1,10 +1,10 @@
1
1
  import { jsx as e } from "react/jsx-runtime";
2
2
  import { useTheme as t } from "@mui/material";
3
3
  import r from "../DIDLogo/index.js";
4
- function i() {
4
+ function a() {
5
5
  const o = t();
6
- return /* @__PURE__ */ e(r, { size: 16, name: "connect", dark: o.palette.mode === "dark" });
6
+ return /* @__PURE__ */ e(r, { size: 16, fontSize: 36, name: "connect", dark: o.palette.mode === "dark" });
7
7
  }
8
8
  export {
9
- i as default
9
+ a as default
10
10
  };
@@ -1,6 +1,6 @@
1
1
  import { jsxs as l, jsx as C, Fragment as f } from "react/jsx-runtime";
2
- import { useRef as w, useState as d, useEffect as P } from "react";
3
- const m = {
2
+ import { useRef as m, useState as d, useEffect as P } from "react";
3
+ const w = {
4
4
  default: {
5
5
  color: "#4598FA",
6
6
  text: void 0
@@ -26,24 +26,24 @@ function H({
26
26
  style: B = {},
27
27
  className: p = "",
28
28
  size: v = "1em",
29
- color: W = void 0,
29
+ color: T = void 0,
30
30
  text: h = void 0,
31
- textColor: S = void 0,
31
+ textColor: W = void 0,
32
32
  fontSize: x = void 0,
33
33
  gap: M = 10,
34
- variant: T = "default",
34
+ variant: S = "default",
35
35
  name: y = void 0,
36
36
  dark: A = !1
37
37
  }) {
38
- const c = T === "contained", Z = m[y] || m.default, o = h === void 0 ? Z?.text : h, F = W || Z?.color, R = S || (A ? "white" : "#121212");
38
+ const c = S === "contained", Z = w[y] || w.default, o = h === void 0 ? Z?.text : h, F = T || Z?.color, R = W || (A ? "white" : "#121212");
39
39
  let e = 1, t = 80, n = x, i = M + 5;
40
40
  !c && o && (t = 64, e = 1.25, i = M, x || (n = 32)), n = n || 40;
41
- const u = w(null), L = w(null), [z, D] = d(), [j, $] = d(t), [b, I] = d(t), N = c ? t / 2 + 5 : t / 2 + 3, r = t / 5;
41
+ const u = m(null), L = m(null), [z, D] = d(), [j, $] = d(t), [b, I] = d(t), N = c ? t / 2 + 5 : t / 2 + 3, r = t / 5;
42
42
  P(() => {
43
- if (L.current) {
43
+ L.current && setTimeout(() => {
44
44
  const E = u.current?.getBBox(), G = L.current.getBoundingClientRect(), a = E?.width || 0, O = G.height / t, g = t * e + a + (a ? i : 0);
45
45
  I(g), $(t * e + (a ? i : 0)), D(g * O);
46
- }
46
+ }, 300);
47
47
  }, [o, i, e, t]);
48
48
  const V = /* @__PURE__ */ l(f, { children: [
49
49
  /* @__PURE__ */ C("rect", { ref: L, width: t, height: t, rx: r, fill: "currentColor", opacity: 0.1 }),
@@ -2,7 +2,7 @@ import { jsxs as i, jsx as e } from "react/jsx-runtime";
2
2
  import { useTheme as y, Menu as I, MenuItem as c, Box as n } from "@mui/material";
3
3
  import { useMemoizedFn as S } from "ahooks";
4
4
  import { Icon as B } from "@iconify/react";
5
- import { TwitterShareButton as L, XIcon as w, TelegramShareButton as T, TelegramIcon as C, RedditShareButton as F, RedditIcon as R, WeiboShareButton as j, WeiboIcon as z, FacebookShareButton as M, FacebookIcon as W, LinkedinShareButton as v, LinkedinIcon as O } from "react-share";
5
+ import { TwitterShareButton as w, XIcon as T, TelegramShareButton as L, TelegramIcon as C, RedditShareButton as F, RedditIcon as R, WeiboShareButton as j, WeiboIcon as z, FacebookShareButton as M, FacebookIcon as W, LinkedinShareButton as v, LinkedinIcon as O } from "react-share";
6
6
  import P from "../Toast/index.js";
7
7
  import { translate as X } from "../Locale/util.js";
8
8
  const a = {
@@ -18,7 +18,7 @@ const a = {
18
18
  }, H = {
19
19
  en: {
20
20
  copyLink: "Copy Link",
21
- x: "X",
21
+ x: "X (Twitter)",
22
22
  telegram: "Telegram",
23
23
  reddit: "Reddit",
24
24
  facebook: "Facebook",
@@ -28,7 +28,7 @@ const a = {
28
28
  },
29
29
  zh: {
30
30
  copyLink: "复制链接",
31
- x: "X",
31
+ x: "X (Twitter)",
32
32
  telegram: "Telegram",
33
33
  reddit: "Reddit",
34
34
  facebook: "Facebook",
@@ -54,16 +54,16 @@ const a = {
54
54
  });
55
55
  function Q({
56
56
  anchorEl: h,
57
- onClose: o,
57
+ onClose: t,
58
58
  sharedProps: u,
59
59
  locale: x = "en"
60
60
  }) {
61
- const m = y(), k = !!h, t = S((f, g = {}) => X(H, f, x, "en", g)), d = {
61
+ const m = y(), k = !!h, o = S((f, g = {}) => X(H, f, x, "en", g)), d = {
62
62
  bgStyle: { fill: m.palette.background.paper },
63
63
  iconFillColor: m.palette.text.secondary
64
64
  }, { title: p, url: r } = u, b = () => {
65
65
  r && navigator.clipboard.writeText(r).then(() => {
66
- P.success(t("copySuccess"));
66
+ P.success(o("copySuccess"));
67
67
  });
68
68
  };
69
69
  return /* @__PURE__ */ i(
@@ -72,7 +72,7 @@ function Q({
72
72
  id: "basic-menu",
73
73
  anchorEl: h,
74
74
  open: k,
75
- onClose: o,
75
+ onClose: t,
76
76
  anchorOrigin: {
77
77
  vertical: "top",
78
78
  horizontal: "right"
@@ -97,39 +97,39 @@ function Q({
97
97
  c,
98
98
  {
99
99
  onClick: () => {
100
- b(), o();
100
+ b(), t();
101
101
  },
102
102
  sx: a,
103
103
  children: /* @__PURE__ */ i(n, { sx: l, children: [
104
104
  /* @__PURE__ */ e(n, { sx: s, children: /* @__PURE__ */ e(B, { icon: "tabler:link" }) }),
105
- /* @__PURE__ */ e("span", { children: t("copyLink") })
105
+ /* @__PURE__ */ e("span", { children: o("copyLink") })
106
106
  ] })
107
107
  },
108
108
  "copy-to-clipboard"
109
109
  ),
110
- /* @__PURE__ */ e(c, { onClick: o, sx: a, children: /* @__PURE__ */ i(n, { component: L, url: r, title: p, sx: l, children: [
111
- /* @__PURE__ */ e(n, { component: w, sx: s, round: !0, ...d }),
112
- /* @__PURE__ */ e("span", { children: t("x") })
110
+ /* @__PURE__ */ e(c, { onClick: t, sx: a, children: /* @__PURE__ */ i(n, { component: w, url: r, title: p, sx: l, children: [
111
+ /* @__PURE__ */ e(n, { component: T, sx: s, round: !0, ...d }),
112
+ /* @__PURE__ */ e("span", { children: o("x") })
113
113
  ] }) }, "share-to-x"),
114
- /* @__PURE__ */ e(c, { onClick: o, sx: a, children: /* @__PURE__ */ i(n, { component: T, url: r, title: p, sx: l, children: [
114
+ /* @__PURE__ */ e(c, { onClick: t, sx: a, children: /* @__PURE__ */ i(n, { component: L, url: r, title: p, sx: l, children: [
115
115
  /* @__PURE__ */ e(n, { component: C, sx: s, round: !0, ...d }),
116
- /* @__PURE__ */ e("span", { children: t("telegram") })
116
+ /* @__PURE__ */ e("span", { children: o("telegram") })
117
117
  ] }) }, "share-to-telegram"),
118
- /* @__PURE__ */ e(c, { onClick: o, sx: a, children: /* @__PURE__ */ i(n, { component: F, url: r, title: p, sx: l, children: [
118
+ /* @__PURE__ */ e(c, { onClick: t, sx: a, children: /* @__PURE__ */ i(n, { component: F, url: r, title: p, sx: l, children: [
119
119
  /* @__PURE__ */ e(n, { component: R, sx: s, round: !0, ...d }),
120
- /* @__PURE__ */ e("span", { children: t("reddit") })
120
+ /* @__PURE__ */ e("span", { children: o("reddit") })
121
121
  ] }) }, "share-to-reddit"),
122
- /* @__PURE__ */ e(c, { onClick: o, sx: a, children: /* @__PURE__ */ i(n, { component: j, url: r, title: p, sx: l, children: [
122
+ /* @__PURE__ */ e(c, { onClick: t, sx: a, children: /* @__PURE__ */ i(n, { component: j, url: r, title: p, sx: l, children: [
123
123
  /* @__PURE__ */ e(n, { component: z, sx: s, round: !0, ...d }),
124
- /* @__PURE__ */ e("span", { children: t("weiBo") })
124
+ /* @__PURE__ */ e("span", { children: o("weiBo") })
125
125
  ] }) }, "share-to-weibo"),
126
- /* @__PURE__ */ e(c, { onClick: o, sx: a, children: /* @__PURE__ */ i(n, { component: M, url: r, title: p, sx: l, children: [
126
+ /* @__PURE__ */ e(c, { onClick: t, sx: a, children: /* @__PURE__ */ i(n, { component: M, url: r, title: p, sx: l, children: [
127
127
  /* @__PURE__ */ e(n, { component: W, sx: s, round: !0, ...d }),
128
- /* @__PURE__ */ e("span", { children: t("facebook") })
128
+ /* @__PURE__ */ e("span", { children: o("facebook") })
129
129
  ] }) }, "share-to-facebook"),
130
- /* @__PURE__ */ e(c, { onClick: o, sx: a, children: /* @__PURE__ */ i(n, { component: v, url: r, title: p, sx: l, children: [
130
+ /* @__PURE__ */ e(c, { onClick: t, sx: a, children: /* @__PURE__ */ i(n, { component: v, url: r, title: p, sx: l, children: [
131
131
  /* @__PURE__ */ e(n, { component: O, sx: s, round: !0, ...d }),
132
- /* @__PURE__ */ e("span", { children: t("linkedin") })
132
+ /* @__PURE__ */ e("span", { children: o("linkedin") })
133
133
  ] }) }, "share-to-linkedin")
134
134
  ]
135
135
  }
@@ -1,4 +1,4 @@
1
- const T = 300, _ = 1800, t = "/.well-known/service", o = "login_token", I = "refresh_token", e = "/.well-known/service", A = "/api/did", n = `${t}/admin`, s = `${t}/user`, O = `${t}/user/did-spaces`, R = `${t}/admin/navigation`, D = "did:abt:", L = {
1
+ const T = 300, _ = 1800, t = "/.well-known/service", e = "login_token", o = "refresh_token", I = "/.well-known/service", A = "/api/did", n = `${t}/admin`, s = `${t}/user`, O = `${t}/user/did-spaces`, R = `${t}/admin/navigation`, D = "did:abt:", L = {
2
2
  VALID: "valid",
3
3
  REVOKED: "revoked"
4
4
  }, E = {
@@ -20,14 +20,14 @@ const T = 300, _ = 1800, t = "/.well-known/service", o = "login_token", I = "ref
20
20
  [E.WALLET]: "DID Wallet",
21
21
  [E.NFT]: "NFT",
22
22
  [E.PASSKEY]: "Passkey",
23
- [E.TWITTER]: "X"
23
+ [E.TWITTER]: "X (Twitter)"
24
24
  }, l = {
25
25
  email: "Email",
26
26
  auth0: "Auth0",
27
27
  apple: "Apple",
28
28
  github: "Github",
29
29
  google: "Google",
30
- twitter: "X"
30
+ twitter: "X (Twitter)"
31
31
  }, c = 360, a = 576;
32
32
  export {
33
33
  A as API_DID_PREFIX,
@@ -45,7 +45,7 @@ export {
45
45
  l as OAUTH_PROVIDER,
46
46
  L as PASSPORT_STATUS,
47
47
  s as PROFILE_URL,
48
- I as REFRESH_TOKEN_STORAGE_KEY,
49
- e as RELAY_SOCKET_PREFIX,
50
- o as SESSION_TOKEN_STORAGE_KEY
48
+ o as REFRESH_TOKEN_STORAGE_KEY,
49
+ I as RELAY_SOCKET_PREFIX,
50
+ e as SESSION_TOKEN_STORAGE_KEY
51
51
  };
@@ -1,20 +1,20 @@
1
- import i from "lodash/isEmpty";
1
+ import o from "lodash/isEmpty";
2
2
  const a = {};
3
- function o(e = window.blocklet) {
3
+ function i(e = window.blocklet) {
4
4
  return (e?.settings?.federated || {}).master;
5
5
  }
6
- function d(e = window.blocklet) {
6
+ function s(e = window.blocklet) {
7
7
  return (e?.settings?.federated || {}).config;
8
8
  }
9
- function s(e = window.blocklet) {
10
- return d(e)?.status === "approved";
9
+ function d(e = window.blocklet) {
10
+ return i(e).appPid === e.appPid ? !1 : s(e)?.status === "approved";
11
11
  }
12
12
  function w(e = window.blocklet) {
13
- return o(e)?.appPid;
13
+ return i(e)?.appPid;
14
14
  }
15
15
  function c(e = window.blocklet) {
16
- const p = o(e);
17
- return !i(p) ? {
16
+ const p = i(e);
17
+ return !o(p) ? {
18
18
  appId: p.appId,
19
19
  appName: p.appName,
20
20
  appDescription: p.appDescription,
@@ -56,7 +56,7 @@ function u(e = window.blocklet) {
56
56
  }) : null;
57
57
  }
58
58
  function g(e) {
59
- const p = [], r = c(e), t = u(e), n = s(e);
59
+ const p = [], r = c(e), t = u(e), n = d(e);
60
60
  return t && p.push(t), r && r?.appId !== t?.appId && n && p.push(r), p.reverse();
61
61
  }
62
62
  async function l(e, p = !1) {
@@ -74,10 +74,10 @@ async function l(e, p = !1) {
74
74
  export {
75
75
  g as getApps,
76
76
  l as getBlockletData,
77
- d as getConfig,
77
+ s as getConfig,
78
78
  u as getCurrentApp,
79
79
  c as getFederatedApp,
80
- s as getFederatedEnabled,
81
- o as getMaster,
80
+ d as getFederatedEnabled,
81
+ i as getMaster,
82
82
  w as getSourceAppPid
83
83
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.1.11",
3
+ "version": "3.1.12",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -66,16 +66,16 @@
66
66
  "react": "^19.0.0",
67
67
  "react-router-dom": "^6.22.3"
68
68
  },
69
- "gitHead": "d050c2db5014a01199a48f0e99b71509f6ef1a7e",
69
+ "gitHead": "0cb1a641693d3f3c1ac105d8117365f289d9e5c2",
70
70
  "dependencies": {
71
- "@arcblock/bridge": "3.1.11",
72
- "@arcblock/did": "^1.21.2",
71
+ "@arcblock/bridge": "3.1.12",
72
+ "@arcblock/did": "^1.21.3",
73
73
  "@arcblock/did-motif": "^1.1.14",
74
- "@arcblock/icons": "3.1.11",
75
- "@arcblock/nft-display": "3.1.11",
76
- "@arcblock/react-hooks": "3.1.11",
77
- "@blocklet/js-sdk": "^1.16.47",
78
- "@blocklet/theme": "3.1.11",
74
+ "@arcblock/icons": "3.1.12",
75
+ "@arcblock/nft-display": "3.1.12",
76
+ "@arcblock/react-hooks": "3.1.12",
77
+ "@blocklet/js-sdk": "^1.16.48",
78
+ "@blocklet/theme": "3.1.12",
79
79
  "@fontsource/roboto": "~5.1.1",
80
80
  "@fontsource/ubuntu-mono": "^5.2.6",
81
81
  "@iconify-icons/logos": "^1.2.36",
@@ -83,7 +83,7 @@
83
83
  "@iconify-icons/mdi": "^1.2.48",
84
84
  "@iconify-icons/tabler": "^1.2.95",
85
85
  "@iconify/react": "^5.2.1",
86
- "@ocap/mcrypto": "^1.21.2",
86
+ "@ocap/mcrypto": "^1.21.3",
87
87
  "@solana/qr-code-styling": "^1.6.0",
88
88
  "@types/dompurify": "^3.2.0",
89
89
  "@types/mui-datatables": "^4.3.12",
@@ -4,5 +4,5 @@ import DIDLogo from '../DIDLogo';
4
4
  export default function DidConnectLogo() {
5
5
  const theme = useTheme();
6
6
 
7
- return <DIDLogo size={16} name="connect" dark={theme.palette.mode === 'dark'} />;
7
+ return <DIDLogo size={16} fontSize={36} name="connect" dark={theme.palette.mode === 'dark'} />;
8
8
  }
@@ -80,18 +80,22 @@ export default function DIDLogo({
80
80
 
81
81
  useEffect(() => {
82
82
  if (iconRef.current) {
83
- // @ts-ignore
84
- const textBbox = textRef.current?.getBBox();
85
- // @ts-ignore
86
- const iconRect = iconRef.current.getBoundingClientRect();
83
+ setTimeout(() => {
84
+ // @ts-ignore
85
+ const textBbox = textRef.current?.getBBox();
86
+ // @ts-ignore
87
+ const iconRect = iconRef.current.getBoundingClientRect();
87
88
 
88
- const textWidth = textBbox?.width || 0;
89
- const scaleSize = iconRect.height / initSize;
89
+ const textWidth = textBbox?.width || 0;
90
+ const scaleSize = iconRect.height / initSize;
90
91
 
91
- const newViewBoxWidth = initSize * scaleIcon + textWidth + (textWidth ? finalGap : 0);
92
- setViewBoxWidth(newViewBoxWidth);
93
- setTextX(initSize * scaleIcon + (textWidth ? finalGap : 0));
94
- setSvgWidth(newViewBoxWidth * scaleSize);
92
+ const newViewBoxWidth = initSize * scaleIcon + textWidth + (textWidth ? finalGap : 0);
93
+ setViewBoxWidth(newViewBoxWidth);
94
+ setTextX(initSize * scaleIcon + (textWidth ? finalGap : 0));
95
+ setSvgWidth(newViewBoxWidth * scaleSize);
96
+ // HACK: 留给字体渲染一些时间,否则首次出现时,计算的 svg 宽度是不对的
97
+ // 这个时间小于 dialog 动画出现的时间,所以不会引起视觉上的抖动
98
+ }, 300);
95
99
  }
96
100
  }, [finalText, finalGap, scaleIcon, initSize]);
97
101
 
@@ -42,7 +42,7 @@ export interface SharedProps {
42
42
  const translations = {
43
43
  en: {
44
44
  copyLink: 'Copy Link',
45
- x: 'X',
45
+ x: 'X (Twitter)',
46
46
  telegram: 'Telegram',
47
47
  reddit: 'Reddit',
48
48
  facebook: 'Facebook',
@@ -52,7 +52,7 @@ const translations = {
52
52
  },
53
53
  zh: {
54
54
  copyLink: '复制链接',
55
- x: 'X',
55
+ x: 'X (Twitter)',
56
56
  telegram: 'Telegram',
57
57
  reddit: 'Reddit',
58
58
  facebook: 'Facebook',
@@ -40,7 +40,7 @@ export const LOGIN_PROVIDER_NAME = {
40
40
  [LOGIN_PROVIDER.WALLET]: 'DID Wallet',
41
41
  [LOGIN_PROVIDER.NFT]: 'NFT',
42
42
  [LOGIN_PROVIDER.PASSKEY]: 'Passkey',
43
- [LOGIN_PROVIDER.TWITTER]: 'X',
43
+ [LOGIN_PROVIDER.TWITTER]: 'X (Twitter)',
44
44
  };
45
45
 
46
46
  // HACK: 目前这里的键值不能使用 [LOGIN_PROVIDER.AUTH0] 形式,否则会影响 ts 的 keyof typeof OAUTH_PROVIDER 来获取键值作为类型的判断
@@ -50,7 +50,7 @@ export const OAUTH_PROVIDER = {
50
50
  apple: 'Apple',
51
51
  github: 'Github',
52
52
  google: 'Google',
53
- twitter: 'X',
53
+ twitter: 'X (Twitter)',
54
54
  };
55
55
 
56
56
  export const DID_CONNECT_SMALL_WIDTH = 360;
@@ -13,6 +13,12 @@ export function getConfig(blocklet = window.blocklet) {
13
13
  }
14
14
 
15
15
  export function getFederatedEnabled(blocklet = window.blocklet) {
16
+ const master = getMaster(blocklet);
17
+ // 如果当前应用是 master,则代表未开启统一登录
18
+ if (master.appPid === blocklet.appPid) {
19
+ return false;
20
+ }
21
+
16
22
  const config = getConfig(blocklet);
17
23
  return config?.status === 'approved';
18
24
  }