@blocklet/ui-react 3.1.27 → 3.1.30

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,25 +1,25 @@
1
- import { jsxs as c, jsx as r, Fragment as E } from "react/jsx-runtime";
2
- import { Box as l, Typography as S, Divider as B, IconButton as N, Collapse as T } from "@mui/material";
3
- import F from "@arcblock/ux/lib/Avatar";
4
- import K from "@arcblock/ux/lib/DID";
5
- import { useMemoizedFn as W } from "ahooks";
6
- import { translate as O } from "@arcblock/ux/lib/Locale/util";
7
- import { useLocaleContext as Q } from "@arcblock/ux/lib/Locale/context";
8
- import V from "lodash/noop";
1
+ import { jsxs as c, jsx as r, Fragment as B } from "react/jsx-runtime";
2
+ import { Box as l, Typography as S, Divider as N, IconButton as T, Collapse as F } from "@mui/material";
3
+ import K from "@arcblock/ux/lib/Avatar";
4
+ import W from "@arcblock/ux/lib/DID";
5
+ import { useMemoizedFn as O } from "ahooks";
6
+ import { translate as Q } from "@arcblock/ux/lib/Locale/util";
7
+ import { useLocaleContext as V } from "@arcblock/ux/lib/Locale/context";
8
+ import Y from "lodash/noop";
9
9
  import { useState as U, useEffect as y } from "react";
10
10
  import C from "@arcblock/ux/lib/Toast";
11
- import { parseURL as Y, joinURL as $ } from "ufo";
12
- import { KeyboardArrowUp as q, KeyboardArrowDown as G } from "@mui/icons-material";
13
- import { translations as H } from "../../libs/locales.js";
11
+ import { parseURL as $, joinURL as q } from "ufo";
12
+ import { KeyboardArrowUp as G, KeyboardArrowDown as H } from "@mui/icons-material";
13
+ import { translations as J } from "../../libs/locales.js";
14
14
  import { formatAxiosError as z } from "../../libs/utils.js";
15
- import { currentTimezone as J, getStatusDuration as X, isValidUrl as Z } from "./utils.js";
16
- import _ from "./switch-role.js";
17
- import P from "./metadata.js";
18
- import M from "./user-status.js";
19
- import tt from "./user-info.js";
15
+ import { currentTimezone as X, getStatusDuration as Z, isValidUrl as _ } from "./utils.js";
16
+ import P from "./switch-role.js";
17
+ import M from "./metadata.js";
18
+ import tt from "./user-status.js";
19
+ import rt from "./user-info.js";
20
20
  import { client as j } from "../../../libs/client.js";
21
- import rt from "./social-actions/index.js";
22
- function Ct({
21
+ import ot from "./social-actions/index.js";
22
+ function zt({
23
23
  user: t,
24
24
  isMyself: e = !0,
25
25
  showFullDid: f = !0,
@@ -28,19 +28,20 @@ function Ct({
28
28
  isMobile: a = !1,
29
29
  onlyProfile: s = !1,
30
30
  refreshProfile: u,
31
+ isShowSocialActions: A = !1,
31
32
  ...m
32
33
  }) {
33
- const { locale: x } = Q(), [h, g] = U(void 0), w = W((n, o = {}) => O(H, n, x, "en", o)), [d, v] = U(!a || s);
34
+ const { locale: x } = V(), [h, g] = U(void 0), w = O((n, o = {}) => Q(J, n, x, "en", o)), [d, v] = U(!a || s);
34
35
  y(() => {
35
36
  g(t?.metadata?.status);
36
37
  }, [t]), y(() => {
37
38
  v(!a || s);
38
39
  }, [a, s]);
39
- const A = async (n) => {
40
+ const b = async (n) => {
40
41
  if (e)
41
42
  try {
42
43
  if (n) {
43
- const o = X(n);
44
+ const o = Z(n);
44
45
  n.dateRange = o.length > 0 ? o : h?.dateRange ?? [];
45
46
  }
46
47
  g(n), await j.user.saveProfile({
@@ -53,25 +54,25 @@ function Ct({
53
54
  } catch (o) {
54
55
  console.error(o), C.error(z(o));
55
56
  }
56
- }, b = () => {
57
+ }, D = () => {
57
58
  v(!d);
58
59
  };
59
60
  if (!t)
60
61
  return null;
61
- const D = async (n) => {
62
+ const L = async (n) => {
62
63
  if (!e)
63
64
  return;
64
- const { metadata: o, address: L } = n;
65
+ const { metadata: o, address: k } = n;
65
66
  try {
66
67
  const p = o?.links?.map((i) => {
67
- if (!i.url || !Z(i.url)) return null;
68
+ if (!i.url || !_(i.url)) return null;
68
69
  try {
69
- return Y(i.url).protocol || (i.url = $("https://", i.url)), i;
70
+ return $(i.url).protocol || (i.url = q("https://", i.url)), i;
70
71
  } catch {
71
72
  return console.error("Invalid URL:", i.url), null;
72
73
  }
73
74
  }).filter((i) => !!i) || [];
74
- o.links = p, await j.user.saveProfile({ metadata: o, address: L }), u();
75
+ o.links = p, await j.user.saveProfile({ metadata: o, address: k }), u();
75
76
  } catch (p) {
76
77
  console.error(p), C.error(z(p));
77
78
  }
@@ -107,7 +108,7 @@ function Ct({
107
108
  },
108
109
  children: [
109
110
  /* @__PURE__ */ r(
110
- F,
111
+ K,
111
112
  {
112
113
  src: t?.avatar,
113
114
  did: t?.did,
@@ -138,18 +139,18 @@ function Ct({
138
139
  }
139
140
  } : {}
140
141
  },
141
- onClick: e ? R : V
142
+ onClick: e ? R : Y
142
143
  }
143
144
  ),
144
145
  /* @__PURE__ */ r(
145
- M,
146
+ tt,
146
147
  {
147
148
  isMobile: a,
148
149
  size: m.size || (a ? 64 : 100),
149
150
  isMyself: e,
150
- timezone: t?.metadata?.timezone || J,
151
+ timezone: t?.metadata?.timezone || X,
151
152
  status: h,
152
- onChange: A
153
+ onChange: b
153
154
  }
154
155
  )
155
156
  ]
@@ -189,21 +190,21 @@ function Ct({
189
190
  children: t?.fullName
190
191
  }
191
192
  ),
192
- e ? /* @__PURE__ */ r(_, { user: t, switchPassport: I }) : null
193
+ e ? /* @__PURE__ */ r(P, { user: t, switchPassport: I }) : null
193
194
  ]
194
195
  }
195
196
  ),
196
- /* @__PURE__ */ r(K, { did: t.did, showQrcode: !0, copyable: !0, compact: !f, responsive: !f, locale: x })
197
+ /* @__PURE__ */ r(W, { did: t.did, showQrcode: !0, copyable: !0, compact: !f, responsive: !f, locale: x })
197
198
  ]
198
199
  }
199
200
  )
200
201
  ]
201
202
  }
202
203
  ),
203
- e ? null : /* @__PURE__ */ r(l, { sx: { mt: 2 }, children: /* @__PURE__ */ r(rt, { user: t }) }),
204
- /* @__PURE__ */ r(P, { isMobile: a, isMyself: e, user: t, onSave: D }),
205
- e ? /* @__PURE__ */ c(E, { children: [
206
- /* @__PURE__ */ r(B, { sx: { my: a ? 1 : 3 } }),
204
+ !e && A ? /* @__PURE__ */ r(l, { sx: { mt: 2 }, children: /* @__PURE__ */ r(ot, { user: t }) }) : null,
205
+ /* @__PURE__ */ r(M, { isMobile: a, isMyself: e, user: t, onSave: L }),
206
+ e ? /* @__PURE__ */ c(B, { children: [
207
+ /* @__PURE__ */ r(N, { sx: { my: a ? 1 : 3 } }),
207
208
  a && !s ? /* @__PURE__ */ r(
208
209
  l,
209
210
  {
@@ -213,10 +214,10 @@ function Ct({
213
214
  mb: 0
214
215
  },
215
216
  children: /* @__PURE__ */ r(
216
- N,
217
+ T,
217
218
  {
218
219
  size: "small",
219
- onClick: b,
220
+ onClick: D,
220
221
  sx: {
221
222
  backgroundColor: "grey.50",
222
223
  "&:hover": {
@@ -224,12 +225,12 @@ function Ct({
224
225
  opacity: 0.8
225
226
  }
226
227
  },
227
- children: d ? /* @__PURE__ */ r(q, {}) : /* @__PURE__ */ r(G, {})
228
+ children: d ? /* @__PURE__ */ r(G, {}) : /* @__PURE__ */ r(H, {})
228
229
  }
229
230
  )
230
231
  }
231
232
  ) : null,
232
- /* @__PURE__ */ c(T, { in: d, timeout: "auto", children: [
233
+ /* @__PURE__ */ c(F, { in: d, timeout: "auto", children: [
233
234
  /* @__PURE__ */ r(
234
235
  S,
235
236
  {
@@ -242,7 +243,7 @@ function Ct({
242
243
  children: w("profile.justForYou")
243
244
  }
244
245
  ),
245
- /* @__PURE__ */ r(tt, { user: t, isMySelf: e })
246
+ /* @__PURE__ */ r(rt, { user: t, isMySelf: e })
246
247
  ] })
247
248
  ] }) : null
248
249
  ]
@@ -250,5 +251,5 @@ function Ct({
250
251
  );
251
252
  }
252
253
  export {
253
- Ct as default
254
+ zt as default
254
255
  };
package/lib/blocklets.js CHANGED
@@ -1,48 +1,50 @@
1
- import { mapRecursive as s, filterRecursive as a, isUrl as f } from "./utils.js";
2
- const g = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", i = (o) => {
3
- const r = { ...o }, e = o?.background;
4
- return typeof e == "string" ? r.background = { header: e, footer: e, default: e } : e && typeof e == "object" && (r.background = {
5
- header: e.header || e.default,
6
- footer: e.footer || e.default,
7
- default: e.default
1
+ import { mapRecursive as s, filterRecursive as a, isUrl as f, isMailProtocol as i } from "./utils.js";
2
+ const p = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", c = (e) => {
3
+ const r = { ...e }, t = e?.background;
4
+ return typeof t == "string" ? r.background = { header: t, footer: t, default: t } : t && typeof t == "object" && (r.background = {
5
+ header: t.header || t.default,
6
+ footer: t.footer || t.default,
7
+ default: t.default
8
8
  }), r;
9
- }, c = (o, r = "en") => {
10
- if (typeof o == "string") {
11
- if (f(o)) {
12
- const t = new URL(o);
13
- return t.searchParams.set("locale", r), t.href;
9
+ }, u = (e, r = "en") => {
10
+ if (typeof e == "string") {
11
+ if (f(e)) {
12
+ const o = new URL(e);
13
+ return o.searchParams.set("locale", r), o.href;
14
14
  }
15
- const e = new URL(o, window.location.origin);
16
- return e.searchParams.set("locale", r), e.pathname + e.search;
15
+ if (i(e))
16
+ return e;
17
+ const t = new URL(e, window.location.origin);
18
+ return t.searchParams.set("locale", r), t.pathname + t.search;
17
19
  }
18
- return typeof o == "object" ? o[r] || o?.en || o?.zh : o;
19
- }, p = (o, r = "en") => {
20
- if (!o?.length)
21
- return o;
22
- const e = (t, n) => t && typeof t == "object" ? t[n] || t?.en || t?.zh : t;
20
+ return typeof e == "object" ? e[r] || e?.en || e?.zh : e;
21
+ }, b = (e, r = "en") => {
22
+ if (!e?.length)
23
+ return e;
24
+ const t = (o, n) => o && typeof o == "object" ? o[n] || o?.en || o?.zh : o;
23
25
  return s(
24
- o,
25
- (t) => ({
26
- ...t,
27
- title: e(t.title, r),
28
- description: e(t.description, r),
26
+ e,
27
+ (o) => ({
28
+ ...o,
29
+ title: t(o.title, r),
30
+ description: t(o.description, r),
29
31
  // 仅对叶结点进行处理
30
- link: t.items?.length ? t.link : c(t.link, r),
31
- _rawLink: t.link
32
+ link: o.items?.length ? o.link : u(o.link, r),
33
+ _rawLink: o.link
32
34
  }),
33
35
  "items"
34
36
  );
35
- }, u = (o) => s(
36
- o,
37
+ }, l = (e) => s(
38
+ e,
37
39
  (r) => r.role ? {
38
40
  ...r,
39
41
  role: Array.isArray(r.role) ? r.role : [r.role]
40
42
  } : r,
41
43
  "items"
42
- ), l = (o) => {
43
- if (!o?.length)
44
+ ), d = (e) => {
45
+ if (!e?.length)
44
46
  return null;
45
- const r = u(o), e = {
47
+ const r = l(e), t = {
46
48
  header: [],
47
49
  footer: [],
48
50
  // 对应 footer social media
@@ -55,32 +57,32 @@ const g = window?.blocklet?.groupPrefix || window?.blocklet?.prefix || "/", i =
55
57
  sessionManager: [],
56
58
  userCenter: []
57
59
  };
58
- return r.forEach((t) => {
59
- t.section ? Array.isArray(t.section) ? t.section.forEach((n) => {
60
- e[n]?.push(t);
61
- }) : typeof t.section == "string" && e[t.section]?.push(t) : e.header.push(t);
62
- }), e;
63
- }, b = (o) => {
64
- if (!o)
60
+ return r.forEach((o) => {
61
+ o.section ? Array.isArray(o.section) ? o.section.forEach((n) => {
62
+ t[n]?.push(o);
63
+ }) : typeof o.section == "string" && t[o.section]?.push(o) : t.header.push(o);
64
+ }), t;
65
+ }, y = (e) => {
66
+ if (!e)
65
67
  return null;
66
- const r = { ...o };
67
- return r.theme = i(r.theme), r.navigation = l(d(r.navigation)), r;
68
- }, d = (o = []) => a(o, (r, e) => !!r.link || e.filteredChildren?.length, "items"), y = (o, r) => a(
69
- o,
70
- (e, t) => {
71
- const n = !e.role || r && (e.role.includes(r) || e.role.includes("guest"));
72
- return t.isLeaf ? n : n && t.filteredChildren?.length;
68
+ const r = { ...e };
69
+ return r.theme = c(r.theme), r.navigation = d(h(r.navigation)), r;
70
+ }, h = (e = []) => a(e, (r, t) => !!r.link || t.filteredChildren?.length, "items"), w = (e, r) => a(
71
+ e,
72
+ (t, o) => {
73
+ const n = !t.role || r && (t.role.includes(r) || t.role.includes("guest"));
74
+ return o.isLeaf ? n : n && o.filteredChildren?.length;
73
75
  },
74
76
  "items"
75
77
  );
76
78
  export {
77
- y as filterNavByRole,
78
- d as filterValidNavItems,
79
- b as formatBlockletInfo,
80
- u as formatNavigation,
81
- i as formatTheme,
82
- c as getLink,
83
- p as getLocalizedNavigation,
84
- l as parseNavigation,
85
- g as publicPath
79
+ w as filterNavByRole,
80
+ h as filterValidNavItems,
81
+ y as formatBlockletInfo,
82
+ l as formatNavigation,
83
+ c as formatTheme,
84
+ u as getLink,
85
+ b as getLocalizedNavigation,
86
+ d as parseNavigation,
87
+ p as publicPath
86
88
  };
@@ -7,17 +7,17 @@ import S from "@arcblock/icons/lib/Notification";
7
7
  import { useCreation as s } from "ahooks";
8
8
  import { WELLKNOWN_SERVICE_PATH_PREFIX as V, EVENTS as y } from "@abtnode/constant";
9
9
  import x from "@arcblock/react-hooks/lib/useBrowser";
10
- import { joinURL as U, withQuery as I } from "ufo";
11
- import { useListenWsClient as j } from "./ws.js";
12
- import F from "../Notifications/Snackbar.js";
13
- import { compareVersions as H } from "../utils.js";
14
- const b = U(V, "user", "notifications"), K = (r) => I(b, {
10
+ import { compareVersions as U } from "@arcblock/ux/lib/Util";
11
+ import { joinURL as j, withQuery as I } from "ufo";
12
+ import { useListenWsClient as F } from "./ws.js";
13
+ import H from "../Notifications/Snackbar.js";
14
+ const b = j(V, "user", "notifications"), K = (r) => I(b, {
15
15
  id: r.id,
16
16
  severity: r.severity || "all",
17
17
  componentDid: r.source === "system" ? "system" : r.componentDid || "all"
18
18
  });
19
19
  function P({ session: r = {} }) {
20
- const { unReadCount: c, user: w, setUnReadCount: n } = r, e = s(() => w?.did, [w]), { enqueueSnackbar: E } = D(), l = x(), k = _(() => l.arcSphere || l.wallet, [l]), N = s(() => window.blocklet?.serverVersion, []), t = j("user"), d = s(
20
+ const { unReadCount: c, user: w, setUnReadCount: n } = r, e = s(() => w?.did, [w]), { enqueueSnackbar: E } = D(), l = x(), k = _(() => l.arcSphere || l.wallet, [l]), N = s(() => window.blocklet?.serverVersion, []), t = F("user"), d = s(
21
21
  () => `${window.blocklet.did}/${e}/${y.NOTIFICATION_BLOCKLET_CREATE}`,
22
22
  [e]
23
23
  ), u = s(
@@ -28,14 +28,14 @@ function P({ session: r = {} }) {
28
28
  const { receivers: f } = o ?? {}, { receiver: p } = f[0] ?? {};
29
29
  if (p === e) {
30
30
  n((v) => v + 1);
31
- const C = H(N, "1.16.42-beta-20250407");
31
+ const C = U(N, "1.16.42-beta-20250407");
32
32
  if (!k && o.source === "component" && C) {
33
33
  const v = K(o), { severity: T, description: L } = o || {}, A = ["error", "warning"].includes(T) || o.sticky;
34
34
  E(L, {
35
35
  variant: T,
36
36
  autoHideDuration: A ? null : 5e3,
37
37
  // eslint-disable-next-line react/no-unstable-nested-components
38
- content: (R) => /* @__PURE__ */ i(F, { viewAllUrl: v, keyId: R, notification: o })
38
+ content: (R) => /* @__PURE__ */ i(H, { viewAllUrl: v, keyId: R, notification: o })
39
39
  });
40
40
  }
41
41
  }
package/lib/utils.d.ts CHANGED
@@ -3,8 +3,8 @@ export function flatRecursive(array: any, childrenKey?: string): any[];
3
3
  export function countRecursive(array: any, childrenKey?: string): number;
4
4
  export function filterRecursive(array: any, predicate: any, childrenKey?: string): any;
5
5
  export function isUrl(str: any): boolean;
6
+ export function isMailProtocol(str: any): boolean;
6
7
  export function isIconifyString(str: any): boolean;
7
8
  export function matchPath(path: any): any;
8
9
  export function matchPaths(paths?: any[]): number;
9
10
  export function splitNavColumns(items: any, options?: {}): never[][];
10
- export function compareVersions(version1: any, version2: any): any;
package/lib/utils.js CHANGED
@@ -1,61 +1,54 @@
1
- import H from "semver";
2
- const d = (n, r, e = "children") => n.map((t) => Array.isArray(t[e]) ? r({
1
+ const p = (n, r, e = "children") => n.map((t) => Array.isArray(t[e]) ? r({
3
2
  ...t,
4
- [e]: d(t[e], r, e)
5
- }) : r(t)), C = (n, r = "children") => {
3
+ [e]: p(t[e], r, e)
4
+ }) : r(t)), v = (n, r = "children") => {
6
5
  const e = [];
7
- return d(n, (t) => e.push(t), r), e;
8
- }, S = (n, r = "children") => {
6
+ return p(n, (t) => e.push(t), r), e;
7
+ }, A = (n, r = "children") => {
9
8
  let e = 0;
10
- return d(n, () => e++, r), e;
11
- }, R = (n, r, e = "children") => n.map((t) => ({ ...t })).filter((t) => {
9
+ return p(n, () => e++, r), e;
10
+ }, H = (n, r, e = "children") => n.map((t) => ({ ...t })).filter((t) => {
12
11
  const s = t[e];
13
12
  if (Array.isArray(s)) {
14
- const o = R(s, r, e);
15
- t[e] = o?.length ? o : void 0;
13
+ const a = H(s, r, e);
14
+ t[e] = a?.length ? a : void 0;
16
15
  }
17
- const c = { filteredChildren: t[e], isLeaf: !s?.length };
18
- return r(t, c);
19
- }), x = (n) => /^https?:\/\//.test(n), P = (n) => /^[\w-]+:[\w-]+$/.test(n), V = (n) => {
16
+ const l = { filteredChildren: t[e], isLeaf: !s?.length };
17
+ return r(t, l);
18
+ }), C = (n) => /^https?:\/\//.test(n), P = (n) => /^mailto:/i.test(n.trim()), S = (n) => /^[\w-]+:[\w-]+$/.test(n), R = (n) => {
20
19
  if (!n || !n?.startsWith("/"))
21
20
  return !1;
22
21
  const r = (s) => s.endsWith("/") ? s : `${s}/`, e = r(window.location.pathname), t = r(new URL(n, window.location.origin).pathname);
23
22
  return e.startsWith(t);
24
- }, W = (n = []) => {
25
- const r = n.map((t, s) => ({ path: t, index: s })).filter((t) => V(t.path));
23
+ }, x = (n = []) => {
24
+ const r = n.map((t, s) => ({ path: t, index: s })).filter((t) => R(t.path));
26
25
  return r?.length ? r.slice(1).reduce((t, s) => t.path.length >= s.path.length ? t : s, r[0]).index : -1;
27
- }, k = (n, r = {}) => {
28
- const { columns: e = 1, breakInside: t = !1, groupHeight: s = 48, itemHeight: c = 24, childrenKey: o = "items" } = r, p = n.reduce((u, g) => u + s + (g[o]?.length || 0) * c, 0), l = Math.ceil(p / e), h = [[]];
29
- let i = 0, a = 0;
30
- const m = l * 0.2, f = (u) => a > l - m && i < e - 1 && a + u > l + m;
31
- return n.forEach((u) => {
32
- const g = s + (u[o]?.length || 0) * c;
33
- t && f(s) && (i++, a = 0, h[i] = []), !t && a > 0 && f(g) && (i++, a = 0, h[i] = []), h[i].push({
34
- ...u,
26
+ }, W = (n, r = {}) => {
27
+ const { columns: e = 1, breakInside: t = !1, groupHeight: s = 48, itemHeight: l = 24, childrenKey: a = "items" } = r, m = n.reduce((c, g) => c + s + (g[a]?.length || 0) * l, 0), h = Math.ceil(m / e), u = [[]];
28
+ let o = 0, i = 0;
29
+ const d = h * 0.2, f = (c) => i > h - d && o < e - 1 && i + c > h + d;
30
+ return n.forEach((c) => {
31
+ const g = s + (c[a]?.length || 0) * l;
32
+ t && f(s) && (o++, i = 0, u[o] = []), !t && i > 0 && f(g) && (o++, i = 0, u[o] = []), u[o].push({
33
+ ...c,
35
34
  group: !0
36
- }), a += s, u[o] && u[o].forEach((w) => {
37
- t && f(c) && (i++, a = 0, h[i] = []), h[i].push({
35
+ }), i += s, c[a] && c[a].forEach((w) => {
36
+ t && f(l) && (o++, i = 0, u[o] = []), u[o].push({
38
37
  ...w,
39
38
  group: !1
40
- }), a += c;
39
+ }), i += l;
41
40
  });
42
- }), h;
43
- }, v = (n, r) => {
44
- const e = (c) => {
45
- const o = c.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
46
- return o ? o[1] : c;
47
- }, t = e(n), s = e(r);
48
- return t === s && n !== r ? !1 : H.gte(t, s);
41
+ }), u;
49
42
  };
50
43
  export {
51
- v as compareVersions,
52
- S as countRecursive,
53
- R as filterRecursive,
54
- C as flatRecursive,
55
- P as isIconifyString,
56
- x as isUrl,
57
- d as mapRecursive,
58
- V as matchPath,
59
- W as matchPaths,
60
- k as splitNavColumns
44
+ A as countRecursive,
45
+ H as filterRecursive,
46
+ v as flatRecursive,
47
+ S as isIconifyString,
48
+ P as isMailProtocol,
49
+ C as isUrl,
50
+ p as mapRecursive,
51
+ R as matchPath,
52
+ x as matchPaths,
53
+ W as splitNavColumns
61
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/ui-react",
3
- "version": "3.1.27",
3
+ "version": "3.1.30",
4
4
  "description": "Some useful front-end web components that can be used in Blocklets.",
5
5
  "keywords": [
6
6
  "react",
@@ -33,13 +33,13 @@
33
33
  "url": "https://github.com/ArcBlock/ux/issues"
34
34
  },
35
35
  "dependencies": {
36
- "@abtnode/constant": "^1.16.48",
37
- "@abtnode/util": "^1.16.48",
38
- "@arcblock/bridge": "3.1.27",
39
- "@arcblock/icons": "3.1.27",
40
- "@arcblock/react-hooks": "3.1.27",
36
+ "@abtnode/constant": "^1.16.49-beta-20250823-082650-626c1473",
37
+ "@abtnode/util": "^1.16.49-beta-20250823-082650-626c1473",
38
+ "@arcblock/bridge": "3.1.30",
39
+ "@arcblock/icons": "3.1.30",
40
+ "@arcblock/react-hooks": "3.1.30",
41
41
  "@arcblock/ws": "^1.21.3",
42
- "@blocklet/constant": "^1.16.48",
42
+ "@blocklet/constant": "^1.16.49-beta-20250823-082650-626c1473",
43
43
  "@blocklet/did-space-react": "^1.1.16",
44
44
  "@iconify-icons/logos": "^1.2.36",
45
45
  "@iconify-icons/material-symbols": "^1.2.58",
@@ -63,7 +63,6 @@
63
63
  "react-error-boundary": "^3.1.4",
64
64
  "react-helmet": "^6.1.0",
65
65
  "react-placeholder": "^4.1.0",
66
- "semver": "^7.7.2",
67
66
  "type-fest": "^4.41.0",
68
67
  "ua-parser-js": "^1.0.40",
69
68
  "ufo": "^1.6.1",
@@ -84,7 +83,7 @@
84
83
  "access": "public"
85
84
  },
86
85
  "devDependencies": {
87
- "@arcblock/did-connect-react": "3.1.27",
86
+ "@arcblock/did-connect-react": "3.1.30",
88
87
  "@types/dompurify": "^3.2.0",
89
88
  "@types/ua-parser-js": "^0.7.39",
90
89
  "@types/validator": "^13.15.2",
@@ -92,5 +91,5 @@
92
91
  "jest": "^29.7.0",
93
92
  "unbuild": "^2.0.0"
94
93
  },
95
- "gitHead": "9cbf9135aa96ce8d13481db7b21f755d009d2f9f"
94
+ "gitHead": "a51fede74e5eca679ff40a8c62d96bae09210f04"
96
95
  }
@@ -9,7 +9,7 @@ import clsx from 'clsx';
9
9
  import { ExpandMore as ExpandMoreIcon } from '@mui/icons-material';
10
10
  import Icon from '../Icon';
11
11
  import useMobile from '../hooks/use-mobile';
12
- import { splitNavColumns } from '../utils';
12
+ import { splitNavColumns, isMailProtocol } from '../utils';
13
13
 
14
14
  /**
15
15
  * footer 中的 links (支持分组, 最多支持 2 级)
@@ -28,14 +28,17 @@ export default function Links({ links = [], flowLayout = false, columns, ...rest
28
28
  result = render({ label, link, props });
29
29
  } else if (link && isString(link)) {
30
30
  const isExternal = link.startsWith('http') || link.startsWith('//');
31
+ const isMail = isMailProtocol(link);
32
+
33
+ const otherProps = isMail
34
+ ? {}
35
+ : {
36
+ target: isExternal ? '_blank' : '_self',
37
+ rel: isExternal ? 'noreferrer noopener' : undefined,
38
+ };
31
39
 
32
40
  result = (
33
- <a
34
- href={link}
35
- aria-label={`Footer link for ${label}`}
36
- target={isExternal ? '_blank' : '_self'}
37
- rel={isExternal ? 'noreferrer noopener' : undefined}
38
- {...props}>
41
+ <a href={link} aria-label={`Footer link for ${label}`} {...otherProps} {...props}>
39
42
  {label}
40
43
  </a>
41
44
  );
@@ -15,10 +15,12 @@ import { useUserFollowersContext } from '../../contexts/user-followers';
15
15
  function Fallback({
16
16
  currentActiveTab,
17
17
  isMyself,
18
+ isSupportFollow = false,
18
19
  children,
19
20
  }: {
20
21
  currentActiveTab: UserCenterTab;
21
22
  isMyself: boolean;
23
+ isSupportFollow?: boolean;
22
24
  children: React.ReactNode;
23
25
  }) {
24
26
  const { locale } = useLocaleContext();
@@ -34,6 +36,10 @@ function Fallback({
34
36
 
35
37
  const { protected: protection } = currentActiveTab;
36
38
 
39
+ // 如果还没有支持 follow 关系,但是已经设置了仅粉丝可见,则直接显示内容
40
+ if (!isSupportFollow && protection === 'follower-only') {
41
+ return children;
42
+ }
37
43
  // 私密内容(仅自己可见)
38
44
  if (protection === true || protection === 'private') {
39
45
  return <Empty>{t('underProtected')}</Empty>;