@arcblock/ux 3.1.20 → 3.1.22

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,27 +1,26 @@
1
- import { styled as m } from "@mui/material";
2
- import { useTheme as h } from "@mui/material";
3
- import { collectFontFamilies as f, create as i, createDefaultThemeOptions as n, createTheme as c, isTheme as p, isUxTheme as T, lazyCreateDefaultTheme as x, loadFonts as F } from "./theme.js";
4
- import { ColorSchemeContext as y, default as C, useColorScheme as g } from "./theme-provider.js";
5
- import { mergeThemeOptions as D } from "@blocklet/theme";
6
- import { deepmergeAll as S } from "../Util/index.js";
7
- const t = (e) => e.startsWith("$"), a = (e, r) => m(e, {
1
+ import { styled as s } from "@mui/material";
2
+ import { useTheme as d } from "@mui/material";
3
+ import { collectFontFamilies as n, create as u, createDefaultThemeOptions as T, createTheme as c, isTheme as f, isUxTheme as p, lazyCreateDefaultTheme as x, loadFonts as F } from "./theme.js";
4
+ import { ColorSchemeContext as g, default as y, useColorScheme as C } from "./theme-provider.js";
5
+ import { mergeThemeOptions as O, mergeAllThemeOptions as A } from "@blocklet/theme";
6
+ const o = (e) => e.startsWith("$"), l = (e, r) => s(e, {
8
7
  ...r,
9
- shouldForwardProp: (o) => r?.shouldForwardProp ? r.shouldForwardProp(o) && !t(o) : !t(o)
8
+ shouldForwardProp: (t) => r?.shouldForwardProp ? r.shouldForwardProp(t) && !o(t) : !o(t)
10
9
  });
11
10
  export {
12
- y as ColorSchemeContext,
13
- C as ThemeProvider,
14
- f as collectFontFamilies,
15
- i as create,
16
- n as createDefaultThemeOptions,
11
+ g as ColorSchemeContext,
12
+ y as ThemeProvider,
13
+ n as collectFontFamilies,
14
+ u as create,
15
+ T as createDefaultThemeOptions,
17
16
  c as createTheme,
18
- D as deepmerge,
19
- S as deepmergeAll,
20
- p as isTheme,
21
- T as isUxTheme,
17
+ O as deepmerge,
18
+ A as deepmergeAll,
19
+ f as isTheme,
20
+ p as isUxTheme,
22
21
  x as lazyCreateDefaultTheme,
23
22
  F as loadFonts,
24
- a as styled,
25
- g as useColorScheme,
26
- h as useTheme
23
+ l as styled,
24
+ C as useColorScheme,
25
+ d as useTheme
27
26
  };
@@ -1,8 +1,8 @@
1
1
  import { createTheme as p, responsiveFontSizes as O } from "@mui/material";
2
- import _ from "webfontloader";
3
- import { DEFAULT_FONTS as b, getDefaultThemePrefer as C, mergeThemeOptions as f, getBlockletThemeOptions as d, BLOCKLET_THEME_DARK as k, BLOCKLET_THEME_LIGHT as x } from "@blocklet/theme";
4
- import { mergeThemeOptions as Q } from "@blocklet/theme";
5
- import { deepmergeAll as A, cleanedObj as l } from "../Util/index.js";
2
+ import A from "webfontloader";
3
+ import { DEFAULT_FONTS as _, getDefaultThemePrefer as b, mergeThemeOptions as f, getBlockletThemeOptions as d, mergeAllThemeOptions as C, BLOCKLET_THEME_DARK as k, BLOCKLET_THEME_LIGHT as x } from "@blocklet/theme";
4
+ import { mergeThemeOptions as Q, mergeAllThemeOptions as V } from "@blocklet/theme";
5
+ import { cleanedObj as c } from "../Util/index.js";
6
6
  import "@fontsource/roboto/latin-400.css";
7
7
  import "@fontsource/roboto/latin-500.css";
8
8
  import "@fontsource/roboto/latin-700.css";
@@ -20,22 +20,22 @@ function h(e, t = /* @__PURE__ */ new Set()) {
20
20
  typeof o == "object" && h(o, t);
21
21
  })), t;
22
22
  }
23
- const c = new Set(b.concat("inherit"));
23
+ const l = new Set(_.concat("inherit"));
24
24
  function D(e) {
25
- const t = e.filter((n) => !c.has(n));
25
+ const t = e.filter((n) => !l.has(n));
26
26
  if (t.length === 0)
27
27
  return Promise.resolve(!0);
28
- t.forEach((n) => c.add(n));
28
+ t.forEach((n) => l.add(n));
29
29
  const o = t.length - 1;
30
30
  return t[o] = `${t[o]}&display=swap`, new Promise((n) => {
31
- _.load({
31
+ A.load({
32
32
  google: {
33
33
  families: t
34
34
  },
35
35
  active: () => n(!0),
36
36
  inactive: () => n(!0),
37
37
  fontinactive: (r, i) => {
38
- c.delete(r), console.warn(`font ${r} ${i} download failed`);
38
+ l.delete(r), console.warn(`font ${r} ${i} download failed`);
39
39
  }
40
40
  });
41
41
  });
@@ -84,24 +84,24 @@ const m = ({ palette: e, components: t, overrides: o, ...n }) => ({
84
84
  lightGrey: "#BCBCBC"
85
85
  }
86
86
  }, L = (...e) => {
87
- const t = C(), o = w(t), n = e.reduce(
88
- (B, s) => f(B, m(typeof s == "function" ? s(o()) : s)),
87
+ const t = b(), o = w(t), n = e.reduce(
88
+ (B, a) => f(B, m(typeof a == "function" ? a(o()) : a)),
89
89
  m(v)
90
- ), r = n.mode || n.palette?.mode || t, i = d(r), T = u(r), { disableBlockletTheme: g } = n, F = A(
90
+ ), r = n.mode || n.palette?.mode || t, i = d(r), T = u(r), { disableBlockletTheme: g } = n, F = C(
91
91
  [
92
92
  T,
93
- !g && l(i),
94
- l(n),
93
+ !g && c(i),
94
+ c(n),
95
95
  // 确保 mode 跟 prefer 一致
96
96
  {
97
97
  mode: r,
98
98
  palette: { mode: r }
99
99
  }
100
100
  ].filter(Boolean)
101
- ), a = p(F);
102
- a.__isUxTheme__ = !0;
103
- const y = h(a.typography);
104
- return D(Array.from(y)), O(a, {
101
+ ), s = p(F);
102
+ s.__isUxTheme__ = !0;
103
+ const y = h(s.typography);
104
+ return D(Array.from(y)), O(s, {
105
105
  breakpoints: ["xs", "sm", "md", "lg"],
106
106
  disableAlign: !1,
107
107
  factor: 3,
@@ -128,7 +128,7 @@ export {
128
128
  u as createDefaultThemeOptions,
129
129
  W as createTheme,
130
130
  Q as deepmerge,
131
- A as deepmergeAll,
131
+ V as deepmergeAll,
132
132
  E as isTheme,
133
133
  R as isUxTheme,
134
134
  w as lazyCreateDefaultTheme,
@@ -1,7 +1,9 @@
1
- import { ThemeOptions } from '@blocklet/theme';
1
+ import { mergeAllThemeOptions } from '@blocklet/theme';
2
2
  import { default as Cookies } from 'js-cookie';
3
3
  import { $TSFixMe, Locale } from '../type';
4
4
  declare let dateTool: $TSFixMe | null;
5
+ /** @deprecated for compatibility, please use `import { mergeAllThemeOptions } from '@blocklet/theme'` instead */
6
+ export { mergeAllThemeOptions as deepmergeAll };
5
7
  /** 是否常见二段式顶级域名 */
6
8
  export declare function isTwoSegmentTLD(domain: string): boolean;
7
9
  /** 获取根域名 */
@@ -104,10 +106,3 @@ export declare const cleanedObj: (obj: object) => import('lodash').Dictionary<an
104
106
  * @returns RGBA 颜色字符串 (例如: "rgba(255, 0, 0, 1)")
105
107
  */
106
108
  export declare function hexToRgba(hex: string, alpha?: number): string;
107
- /**
108
- * 依次对数组中的对象进行深度合并
109
- * @param objects - 需要合并的主题配置对象数组
110
- * @returns 合并后的对象
111
- */
112
- export declare function deepmergeAll(objects: ThemeOptions[]): ThemeOptions;
113
- export {};
package/lib/Util/index.js CHANGED
@@ -1,58 +1,58 @@
1
- import { lazy as E } from "react";
2
- import u from "lodash/padStart";
3
- import { colors as g, getDIDMotifInfo as x } from "@arcblock/did-motif";
4
- import { mergeThemeOptions as k } from "@blocklet/theme";
1
+ import { lazy as x } from "react";
2
+ import l from "lodash/padStart";
3
+ import { colors as g, getDIDMotifInfo as E } from "@arcblock/did-motif";
4
+ import { mergeAllThemeOptions as vt } from "@blocklet/theme";
5
5
  import y from "lodash/isNil";
6
- import A from "lodash/omitBy";
7
- import F from "p-retry";
8
- import l from "js-cookie";
6
+ import j from "lodash/omitBy";
7
+ import k from "p-retry";
8
+ import u from "js-cookie";
9
9
  import O from "color-convert";
10
10
  import a from "dayjs";
11
11
  import "dayjs/locale/zh-cn";
12
12
  import U from "dayjs/plugin/utc";
13
- import j from "dayjs/plugin/timezone";
14
- import R from "dayjs/plugin/relativeTime";
15
- import W from "dayjs/plugin/updateLocale";
16
- import L from "dayjs/plugin/localizedFormat";
17
- import { DID_PREFIX as P, BLOCKLET_SERVICE_PATH_PREFIX as v } from "./constant.js";
18
- import { getFederatedEnabled as C } from "./federated.js";
13
+ import A from "dayjs/plugin/timezone";
14
+ import F from "dayjs/plugin/relativeTime";
15
+ import R from "dayjs/plugin/updateLocale";
16
+ import W from "dayjs/plugin/localizedFormat";
17
+ import { DID_PREFIX as L, BLOCKLET_SERVICE_PATH_PREFIX as P } from "./constant.js";
18
+ import { getFederatedEnabled as v } from "./federated.js";
19
19
  let f = null;
20
- const M = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, V = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), _ = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
21
- function z(t) {
20
+ const C = /^(\d{1,3}\.){3}\d{1,3}(:\d+)?$/, M = /* @__PURE__ */ new Set(["co", "com", "net", "org", "gov", "edu", "ac"]), V = /* @__PURE__ */ new Set(["uk", "au", "cn", "nz", "za", "in", "br", "mx", "fr", "it", "ca"]);
21
+ function _(t) {
22
22
  if (!t)
23
23
  return !1;
24
24
  const e = t.split(".");
25
25
  if (e.length < 2) return !1;
26
- const n = e[e.length - 2], r = e[e.length - 1];
27
- return V.has(n) && _.has(r);
26
+ const o = e[e.length - 2], n = e[e.length - 1];
27
+ return M.has(o) && V.has(n);
28
28
  }
29
- function mt() {
29
+ function lt() {
30
30
  const { host: t } = window.location;
31
- if (!t || M.test(t))
31
+ if (!t || C.test(t))
32
32
  return "";
33
- const n = t.split(":")[0].split(".");
34
- if (n.length === 1)
33
+ const o = t.split(":")[0].split(".");
34
+ if (o.length === 1)
35
35
  return "";
36
- if (n.length > 2) {
37
- const r = n.slice(-2).join(".");
38
- if (z(r))
39
- return `.${n.slice(-3).join(".")}`;
36
+ if (o.length > 2) {
37
+ const n = o.slice(-2).join(".");
38
+ if (_(n))
39
+ return `.${o.slice(-3).join(".")}`;
40
40
  }
41
- return `.${n.slice(-2).join(".")}`;
41
+ return `.${o.slice(-2).join(".")}`;
42
42
  }
43
- function dt(t) {
44
- return t.replace(/^\?/, "").split("&").map((e) => e.split("=")).filter(([e]) => !!e).reduce((e, n) => {
45
- const r = n[0], i = decodeURIComponent(n[1]) || !0;
46
- return e[r] = i, e;
43
+ function ut(t) {
44
+ return t.replace(/^\?/, "").split("&").map((e) => e.split("=")).filter(([e]) => !!e).reduce((e, o) => {
45
+ const n = o[0], i = decodeURIComponent(o[1]) || !0;
46
+ return e[n] = i, e;
47
47
  }, {});
48
48
  }
49
- function pt(t = {}) {
49
+ function mt(t = {}) {
50
50
  return new URLSearchParams(t).toString();
51
51
  }
52
- function ht(t = 1) {
52
+ function dt(t = 1) {
53
53
  let e = t;
54
54
  typeof e == "number" && (e = { expireInDays: e }), e.path === void 0 && (e.path = "/"), e.expireInDays || (e.expireInDays = 1);
55
- const n = {
55
+ const o = {
56
56
  expires: e.expireInDays,
57
57
  path: e.path,
58
58
  domain: e.domain || "",
@@ -60,49 +60,49 @@ function ht(t = 1) {
60
60
  // 允许自定义设置为 false,默认是 true
61
61
  secure: e.secure !== !1
62
62
  };
63
- return (typeof window > "u" || e.domain || e.returnDomain === !1) && e.returnDomain === !1 && delete n.domain, n;
63
+ return (typeof window > "u" || e.domain || e.returnDomain === !1) && e.returnDomain === !1 && delete o.domain, o;
64
64
  }
65
- const gt = (t) => t.color ? t.color : t.dark ? t.theme.palette.common.white : t.theme.palette.text.primary, wt = (t) => t.background ? t.background : t.dark ? t.theme.palette.common.black : t.theme.palette.common.white;
66
- function yt(t, e, n = []) {
67
- const r = Object.assign({}, t), i = e.defaultProps || {};
68
- return Object.keys(i).forEach((o) => {
69
- typeof r[o] == "string" && r[o].indexOf("::prop::") === 0 && (r[o] = i[o]);
70
- }), Array.isArray(n) && n.forEach((o) => {
71
- if (typeof r[o] == "string")
65
+ const pt = (t) => t.color ? t.color : t.dark ? t.theme.palette.common.white : t.theme.palette.text.primary, ht = (t) => t.background ? t.background : t.dark ? t.theme.palette.common.black : t.theme.palette.common.white;
66
+ function gt(t, e, o = []) {
67
+ const n = Object.assign({}, t), i = e.defaultProps || {};
68
+ return Object.keys(i).forEach((r) => {
69
+ typeof n[r] == "string" && n[r].indexOf("::prop::") === 0 && (n[r] = i[r]);
70
+ }), Array.isArray(o) && o.forEach((r) => {
71
+ if (typeof n[r] == "string")
72
72
  try {
73
- r[o] = JSON.parse(r[o]);
73
+ n[r] = JSON.parse(n[r]);
74
74
  } catch {
75
75
  }
76
- }), Object.keys(r).forEach((o) => {
77
- typeof r[o] == "string" && r[o].indexOf("::prop::") === 0 && (r[o] = "");
78
- }), r;
76
+ }), Object.keys(n).forEach((r) => {
77
+ typeof n[r] == "string" && n[r].indexOf("::prop::") === 0 && (n[r] = "");
78
+ }), n;
79
79
  }
80
- function It(t = 2017) {
80
+ function wt(t = 2017) {
81
81
  const e = (/* @__PURE__ */ new Date()).getFullYear();
82
82
  return `${e}` == `${t}` ? `© ArcBlock ${e}` : `© ArcBlock ${t} - ${e}`;
83
83
  }
84
- const Dt = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", bt = (t) => {
84
+ const yt = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", It = (t) => {
85
85
  let e = 0;
86
- for (let r = 0; r < t.length; r++)
87
- e = t.charCodeAt(r) + ((e << 5) - e);
88
- let n = "#";
89
- for (let r = 0; r < 3; r++) {
90
- const i = e >> r * 8 & 255;
91
- n += `00${i.toString(16)}`.substr(-2);
86
+ for (let n = 0; n < t.length; n++)
87
+ e = t.charCodeAt(n) + ((e << 5) - e);
88
+ let o = "#";
89
+ for (let n = 0; n < 3; n++) {
90
+ const i = e >> n * 8 & 255;
91
+ o += `00${i.toString(16)}`.substr(-2);
92
92
  }
93
- return n;
94
- }, $t = (t) => {
95
- const e = Math.round(t / 1e3), n = Math.floor(e / 3600), r = Math.floor((e - n * 3600) / 60), i = e % 60;
96
- return `${u(n, 2, "0")}:${u(r, 2, "0")}:${u(i, 2, "0")}`;
93
+ return o;
94
+ }, bt = (t) => {
95
+ const e = Math.round(t / 1e3), o = Math.floor(e / 3600), n = Math.floor((e - o * 3600) / 60), i = e % 60;
96
+ return `${l(o, 2, "0")}:${l(n, 2, "0")}:${l(i, 2, "0")}`;
97
97
  };
98
- function B(t) {
98
+ function z(t) {
99
99
  f = t;
100
100
  }
101
- function Tt() {
101
+ function Dt() {
102
102
  return f;
103
103
  }
104
- const I = (t) => (e, { locale: n, tz: r, isUtc: i } = {}) => {
105
- if (f === null && (a.extend(L), a.extend(U), a.extend(j), a.extend(W), a.extend(R), a.updateLocale("zh-cn", {
104
+ const I = (t) => (e, { locale: o, tz: n, isUtc: i } = {}) => {
105
+ if (f === null && (a.extend(W), a.extend(U), a.extend(A), a.extend(R), a.extend(F), a.updateLocale("zh-cn", {
106
106
  // copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
107
107
  relativeTime: {
108
108
  future: "%s后",
@@ -119,49 +119,49 @@ const I = (t) => (e, { locale: n, tz: r, isUtc: i } = {}) => {
119
119
  y: "1 年",
120
120
  yy: "%d 年"
121
121
  }
122
- }), B(a)), y(e) || e === "")
122
+ }), z(a)), y(e) || e === "")
123
123
  return "-";
124
- let o = f(e);
125
- return r && (o = o.tz(r)), i && (o = o.utc()), typeof n < "u" && (o = o.locale(n)), o.format(t);
124
+ let r = f(e);
125
+ return n && (r = r.tz(n)), i && (r = r.utc()), typeof o < "u" && (r = r.locale(o)), r.format(t);
126
126
  };
127
- function St(t, { locale: e = "en", tz: n } = {}) {
128
- return I("ll")(t, { locale: e, tz: n });
127
+ function $t(t, { locale: e = "en", tz: o } = {}) {
128
+ return I("ll")(t, { locale: e, tz: o });
129
129
  }
130
- function Et(t, {
130
+ function Tt(t, {
131
131
  locale: e = "en",
132
- tz: n,
133
- isUtc: r = !1,
132
+ tz: o,
133
+ isUtc: n = !1,
134
134
  format: i = "lll"
135
135
  } = {}) {
136
- return I(i)(t, { locale: e, tz: n, isUtc: r });
136
+ return I(i)(t, { locale: e, tz: o, isUtc: n });
137
137
  }
138
- function N() {
138
+ function B() {
139
139
  const t = window?.ABT_DEV || window.ABT;
140
140
  return t && typeof t.open == "function" ? t : null;
141
141
  }
142
- function xt({
142
+ function St({
143
143
  webWalletUrl: t,
144
144
  action: e = "login",
145
- locale: n = "en",
146
- url: r,
145
+ locale: o = "en",
146
+ url: n,
147
147
  windowFeatures: i,
148
- appInfo: o,
148
+ appInfo: r,
149
149
  memberAppInfo: p
150
150
  }) {
151
- const h = N();
151
+ const h = B();
152
152
  if (h)
153
153
  return h.open({
154
154
  action: e,
155
- locale: n,
156
- url: encodeURIComponent(r),
155
+ locale: o,
156
+ url: encodeURIComponent(n),
157
157
  appInfo: {
158
- ...o
158
+ ...r
159
159
  },
160
160
  memberAppInfo: {
161
161
  ...p
162
162
  }
163
163
  }), { type: "extension" };
164
- const D = {
164
+ const b = {
165
165
  toolbar: "no",
166
166
  location: "no",
167
167
  status: "no",
@@ -171,7 +171,7 @@ function xt({
171
171
  // iphone 8plus size
172
172
  width: 414,
173
173
  height: 736
174
- }, b = `${t}?action=${e}&locale=${n}&url=${encodeURIComponent(r)}`, c = Object.assign({}, D, i), $ = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
174
+ }, D = `${t}?action=${e}&locale=${o}&url=${encodeURIComponent(n)}`, c = Object.assign({}, b, i), $ = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
175
175
  if (!("left" in c)) {
176
176
  const s = $(window.top || window), S = window.screenLeft || window.screenX;
177
177
  c.left = s + S - c.width;
@@ -181,43 +181,43 @@ function xt({
181
181
  c.top = s;
182
182
  }
183
183
  const T = Object.keys(c).map((s) => `${s}=${c[s]}`).join(",");
184
- return window.open(b, "targetWindow", T), { type: "web" };
184
+ return window.open(D, "targetWindow", T), { type: "web" };
185
185
  }
186
- const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) => {
187
- const e = t.replace(P, "");
186
+ const xt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", N = (t) => {
187
+ const e = t.replace(L, "");
188
188
  return !!/^(0x)?[0-9a-f]{40}$/i.test(e);
189
- }, K = (t, e) => {
189
+ }, X = (t, e) => {
190
190
  if (!e)
191
191
  return t;
192
192
  try {
193
- const n = new URL(t, window.location.origin);
194
- return Object.keys(e).forEach((r) => {
195
- n.searchParams.set(r, String(e[r]));
196
- }), n.origin === window.location.origin ? n.pathname + n.search : n.href;
193
+ const o = new URL(t, window.location.origin);
194
+ return Object.keys(e).forEach((n) => {
195
+ o.searchParams.set(n, String(e[n]));
196
+ }), o.origin === window.location.origin ? o.pathname + o.search : o.href;
197
197
  } catch {
198
198
  return t;
199
199
  }
200
- }, At = (t, e = 48) => t && (t.indexOf(v) >= 0 ? K(t, {
200
+ }, Et = (t, e = 48) => t && (t.indexOf(P) >= 0 ? X(t, {
201
201
  imageFilter: "resize",
202
202
  w: e,
203
203
  h: e
204
- }) : t), Ft = (t = 0) => new Promise((e) => {
204
+ }) : t), jt = (t = 0) => new Promise((e) => {
205
205
  setTimeout(() => {
206
206
  e();
207
207
  }, t);
208
- }), Ot = (t) => /^https?:\/\//.test(t), m = "vid", d = "__visitor_id", Q = () => l.get(m) || localStorage.getItem(d), w = (t) => {
209
- t === null ? l.remove(m, {
208
+ }), kt = (t) => /^https?:\/\//.test(t), m = "vid", d = "__visitor_id", K = () => u.get(m) || localStorage.getItem(d), w = (t) => {
209
+ t === null ? u.remove(m, {
210
210
  sameSite: "None",
211
211
  secure: !0
212
- }) : l.set(m, t, {
212
+ }) : u.set(m, t, {
213
213
  sameSite: "None",
214
214
  secure: !0,
215
215
  expires: 365
216
216
  });
217
- }, Ut = () => {
217
+ }, Ot = () => {
218
218
  let t = localStorage.getItem(d);
219
- if (t && (localStorage.removeItem(d), w(t)), !Q()) {
220
- if (!C())
219
+ if (t && (localStorage.removeItem(d), w(t)), !K()) {
220
+ if (!v())
221
221
  try {
222
222
  if (window.crypto && typeof window.crypto.randomUUID == "function")
223
223
  t = window.crypto.randomUUID();
@@ -226,15 +226,15 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
226
226
  if (window.crypto && typeof window.crypto.getRandomValues == "function")
227
227
  window.crypto.getRandomValues(e);
228
228
  else
229
- for (let r = 0; r < 16; r++)
230
- e[r] = Math.floor(Math.random() * 256);
231
- const n = Array.from(e).map((r) => r.toString(16).padStart(2, "0"));
229
+ for (let n = 0; n < 16; n++)
230
+ e[n] = Math.floor(Math.random() * 256);
231
+ const o = Array.from(e).map((n) => n.toString(16).padStart(2, "0"));
232
232
  t = [
233
- n.slice(0, 4).join(""),
234
- n.slice(4, 6).join(""),
235
- n.slice(6, 8).join(""),
236
- n.slice(8, 10).join(""),
237
- n.slice(10, 16).join("")
233
+ o.slice(0, 4).join(""),
234
+ o.slice(4, 6).join(""),
235
+ o.slice(6, 8).join(""),
236
+ o.slice(8, 10).join(""),
237
+ o.slice(10, 16).join("")
238
238
  ].join("-");
239
239
  }
240
240
  } catch {
@@ -242,26 +242,26 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
242
242
  }
243
243
  t && w(t);
244
244
  }
245
- }, jt = (t) => {
246
- if (X(t)) {
245
+ }, Ut = (t) => {
246
+ if (N(t)) {
247
247
  const e = Uint8Array.from(
248
- t.slice(2).match(/.{1,2}/g).map((n) => parseInt(n, 16))
249
- ).slice(0, 8).reduce((n, r) => n + r, 0) % g.length;
248
+ t.slice(2).match(/.{1,2}/g).map((o) => parseInt(o, 16))
249
+ ).slice(0, 8).reduce((o, n) => o + n, 0) % g.length;
250
250
  return g[e];
251
251
  }
252
252
  try {
253
- return x(t)?.color;
253
+ return E(t)?.color;
254
254
  } catch {
255
255
  return null;
256
256
  }
257
- }, Rt = (t, e, n = {}) => {
258
- const { fallbackLocale: r = "en", defaultValue: i = "unknown" } = n;
257
+ }, At = (t, e, o = {}) => {
258
+ const { fallbackLocale: n = "en", defaultValue: i = "unknown" } = o;
259
259
  if (typeof t == "string")
260
260
  return t;
261
- let o;
262
- return e && (o = t[e]), (!o || typeof o != "string") && (o = t[r]), (!o || typeof o != "string") && (o = i), o;
263
- }, Wt = (t) => E(
264
- () => F(
261
+ let r;
262
+ return e && (r = t[e]), (!r || typeof r != "string") && (r = t[n]), (!r || typeof r != "string") && (r = i), r;
263
+ }, Ft = (t) => x(
264
+ () => k(
265
265
  async () => {
266
266
  try {
267
267
  return await t();
@@ -272,48 +272,43 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
272
272
  // 只需要重试两次,加上原本的一次,总共三次
273
273
  { retries: 2 }
274
274
  )
275
- ), Lt = (t) => A(t, y);
276
- function Pt(t, e = 1) {
277
- const [n, r, i] = O.hex.rgb(t);
278
- return `rgba(${n}, ${r}, ${i}, ${e})`;
279
- }
280
- function vt(t) {
281
- if (!Array.isArray(t))
282
- throw new Error("First argument should be an array");
283
- return t.length === 0 ? {} : t.length === 1 ? t[0] : t.reduce((e, n) => k(e, n));
275
+ ), Rt = (t) => j(t, y);
276
+ function Wt(t, e = 1) {
277
+ const [o, n, i] = O.hex.rgb(t);
278
+ return `rgba(${o}, ${n}, ${i}, ${e})`;
284
279
  }
285
280
  export {
286
- K as appendParams,
287
- Lt as cleanedObj,
281
+ X as appendParams,
282
+ Rt as cleanedObj,
288
283
  vt as deepmergeAll,
289
- N as detectWalletExtension,
290
- Ut as ensureVisitorId,
291
- St as formatToDate,
292
- Et as formatToDatetime,
293
- $t as formatUptime,
294
- wt as getBackground,
295
- gt as getColor,
296
- ht as getCookieOptions,
297
- It as getCopyright,
298
- jt as getDIDColor,
299
- Tt as getDateTool,
300
- kt as getFontSize,
301
- Dt as getTimezone,
302
- Rt as getTranslation,
303
- At as getUserAvatar,
304
- Q as getVisitorId,
305
- Pt as hexToRgba,
306
- X as isEthereumDid,
307
- z as isTwoSegmentTLD,
308
- Ot as isUrl,
309
- Wt as lazyRetry,
310
- yt as mergeProps,
311
- xt as openWebWallet,
312
- dt as parseQuery,
313
- mt as resolveRootDomain,
314
- B as setDateTool,
284
+ B as detectWalletExtension,
285
+ Ot as ensureVisitorId,
286
+ $t as formatToDate,
287
+ Tt as formatToDatetime,
288
+ bt as formatUptime,
289
+ ht as getBackground,
290
+ pt as getColor,
291
+ dt as getCookieOptions,
292
+ wt as getCopyright,
293
+ Ut as getDIDColor,
294
+ Dt as getDateTool,
295
+ xt as getFontSize,
296
+ yt as getTimezone,
297
+ At as getTranslation,
298
+ Et as getUserAvatar,
299
+ K as getVisitorId,
300
+ Wt as hexToRgba,
301
+ N as isEthereumDid,
302
+ _ as isTwoSegmentTLD,
303
+ kt as isUrl,
304
+ Ft as lazyRetry,
305
+ gt as mergeProps,
306
+ St as openWebWallet,
307
+ ut as parseQuery,
308
+ lt as resolveRootDomain,
309
+ z as setDateTool,
315
310
  w as setVisitorId,
316
- Ft as sleep,
317
- bt as str2color,
318
- pt as stringifyQuery
311
+ jt as sleep,
312
+ It as str2color,
313
+ mt as stringifyQuery
319
314
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.1.20",
3
+ "version": "3.1.22",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -40,6 +40,7 @@
40
40
  "@babel/preset-env": "^7.28.0",
41
41
  "@babel/preset-react": "^7.27.1",
42
42
  "@babel/preset-typescript": "^7.27.1",
43
+ "@testing-library/react": "^16.3.0",
43
44
  "@types/base64-url": "^2.2.2",
44
45
  "@types/pako": "^2.0.3",
45
46
  "@types/react": "^19.1.8",
@@ -66,16 +67,16 @@
66
67
  "react": "^19.0.0",
67
68
  "react-router-dom": "^6.22.3"
68
69
  },
69
- "gitHead": "acb1c932b5f600dc38e44aa2b4491a943562b81e",
70
+ "gitHead": "11d0b4fb6ae868d94d232e4e120ee6b25497ee21",
70
71
  "dependencies": {
71
- "@arcblock/bridge": "3.1.20",
72
+ "@arcblock/bridge": "3.1.22",
72
73
  "@arcblock/did": "^1.21.3",
73
74
  "@arcblock/did-motif": "^1.1.14",
74
- "@arcblock/icons": "3.1.20",
75
- "@arcblock/nft-display": "3.1.20",
76
- "@arcblock/react-hooks": "3.1.20",
75
+ "@arcblock/icons": "3.1.22",
76
+ "@arcblock/nft-display": "3.1.22",
77
+ "@arcblock/react-hooks": "3.1.22",
77
78
  "@blocklet/js-sdk": "^1.16.48",
78
- "@blocklet/theme": "3.1.20",
79
+ "@blocklet/theme": "3.1.22",
79
80
  "@fontsource/roboto": "~5.1.1",
80
81
  "@fontsource/ubuntu-mono": "^5.2.6",
81
82
  "@iconify-icons/logos": "^1.2.36",
package/src/Util/index.ts CHANGED
@@ -2,7 +2,7 @@
2
2
  import { lazy } from 'react';
3
3
  import padStart from 'lodash/padStart';
4
4
  import { getDIDMotifInfo, colors } from '@arcblock/did-motif';
5
- import { mergeThemeOptions, ThemeOptions } from '@blocklet/theme';
5
+ import { mergeAllThemeOptions } from '@blocklet/theme';
6
6
  import isNil from 'lodash/isNil';
7
7
  import omitBy from 'lodash/omitBy';
8
8
  import pRetry from 'p-retry';
@@ -27,6 +27,9 @@ const commonSLDs = new Set(['co', 'com', 'net', 'org', 'gov', 'edu', 'ac']);
27
27
  // 常见国家域名
28
28
  const commonCcTLDs = new Set(['uk', 'au', 'cn', 'nz', 'za', 'in', 'br', 'mx', 'fr', 'it', 'ca']);
29
29
 
30
+ /** @deprecated for compatibility, please use `import { mergeAllThemeOptions } from '@blocklet/theme'` instead */
31
+ export { mergeAllThemeOptions as deepmergeAll };
32
+
30
33
  /** 是否常见二段式顶级域名 */
31
34
  export function isTwoSegmentTLD(domain: string) {
32
35
  if (!domain) {
@@ -655,26 +658,3 @@ export function hexToRgba(hex: string, alpha = 1) {
655
658
  // 返回 RGBA 格式
656
659
  return `rgba(${r}, ${g}, ${b}, ${alpha})`;
657
660
  }
658
-
659
- /**
660
- * 依次对数组中的对象进行深度合并
661
- * @param objects - 需要合并的主题配置对象数组
662
- * @returns 合并后的对象
663
- */
664
- export function deepmergeAll(objects: ThemeOptions[]): ThemeOptions {
665
- if (!Array.isArray(objects)) {
666
- throw new Error('First argument should be an array');
667
- }
668
-
669
- if (objects.length === 0) {
670
- return {};
671
- }
672
-
673
- if (objects.length === 1) {
674
- return objects[0];
675
- }
676
-
677
- return objects.reduce((acc, obj) => {
678
- return mergeThemeOptions(acc, obj);
679
- });
680
- }