@arcblock/ux 3.1.5 → 3.1.7

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,27 @@
1
- import { styled as s } from "@mui/material";
1
+ import { styled as m } from "@mui/material";
2
2
  import { useTheme as h } from "@mui/material";
3
- import { collectFontFamilies as c, create as f, createDefaultThemeOptions as i, createTheme as n, isTheme as T, isUxTheme as x, lazyCreateDefaultTheme as p, loadFonts as F } from "./theme.js";
4
- import { ColorSchemeContext as y, default as C, useColorScheme as w } from "./theme-provider.js";
5
- import { deepmerge as S } from "@mui/utils";
6
- const o = (e) => e.startsWith("$"), m = (e, r) => s(e, {
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, {
7
8
  ...r,
8
- shouldForwardProp: (t) => r?.shouldForwardProp ? r.shouldForwardProp(t) && !o(t) : !o(t)
9
+ shouldForwardProp: (o) => r?.shouldForwardProp ? r.shouldForwardProp(o) && !t(o) : !t(o)
9
10
  });
10
11
  export {
11
12
  y as ColorSchemeContext,
12
13
  C as ThemeProvider,
13
- c as collectFontFamilies,
14
- f as create,
15
- i as createDefaultThemeOptions,
16
- n as createTheme,
17
- S as deepmerge,
18
- T as isTheme,
19
- x as isUxTheme,
20
- p as lazyCreateDefaultTheme,
14
+ f as collectFontFamilies,
15
+ i as create,
16
+ n as createDefaultThemeOptions,
17
+ c as createTheme,
18
+ D as deepmerge,
19
+ S as deepmergeAll,
20
+ p as isTheme,
21
+ T as isUxTheme,
22
+ x as lazyCreateDefaultTheme,
21
23
  F as loadFonts,
22
- m as styled,
23
- w as useColorScheme,
24
+ a as styled,
25
+ g as useColorScheme,
24
26
  h as useTheme
25
27
  };
@@ -1,6 +1,6 @@
1
1
  import { PaletteMode } from '@mui/material';
2
- import { deepmerge } from '@mui/utils';
3
- import { ThemeOptions, Theme } from '@blocklet/theme';
2
+ import { mergeThemeOptions as deepmerge, ThemeOptions, Theme } from '@blocklet/theme';
3
+ import { deepmergeAll } from '../Util';
4
4
  /** 是否是 MUI Theme 对象 */
5
5
  export declare function isTheme(obj: any): obj is Theme;
6
6
  /** 是否是 UX Theme 对象 */
@@ -16,4 +16,4 @@ export interface UxThemeOptions extends ThemeOptions {
16
16
  export declare function lazyCreateDefaultTheme(mode: PaletteMode): () => Theme;
17
17
  export declare const create: (...args: Array<UxThemeOptions | ((baseTheme: Theme) => UxThemeOptions)>) => Theme;
18
18
  export declare const createTheme: (...args: Array<UxThemeOptions | ((baseTheme: Theme) => UxThemeOptions)>) => Theme;
19
- export { deepmerge };
19
+ export { deepmerge, deepmergeAll };
@@ -1,8 +1,7 @@
1
1
  import { createTheme as p, responsiveFontSizes as O } from "@mui/material";
2
- import { deepmerge as f } from "@mui/utils";
3
- import { deepmerge as V } from "@mui/utils";
4
2
  import _ from "webfontloader";
5
- import { DEFAULT_FONTS as b, getDefaultThemePrefer as C, getBlockletThemeOptions as d, BLOCKLET_THEME_DARK as k, BLOCKLET_THEME_LIGHT as x } from "@blocklet/theme";
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";
6
5
  import { deepmergeAll as A, cleanedObj as l } from "../Util/index.js";
7
6
  import "@fontsource/roboto/latin-400.css";
8
7
  import "@fontsource/roboto/latin-500.css";
@@ -13,7 +12,7 @@ import "@fontsource/roboto/latin-ext-700.css";
13
12
  function E(e) {
14
13
  return e && typeof e == "object" && e.palette && typeof e.palette.getContrastText == "function";
15
14
  }
16
- function W(e) {
15
+ function R(e) {
17
16
  return E(e) && e.__isUxTheme__ === !0;
18
17
  }
19
18
  function h(e, t = /* @__PURE__ */ new Set()) {
@@ -21,22 +20,22 @@ function h(e, t = /* @__PURE__ */ new Set()) {
21
20
  typeof o == "object" && h(o, t);
22
21
  })), t;
23
22
  }
24
- const s = new Set(b.concat("inherit"));
23
+ const c = new Set(b.concat("inherit"));
25
24
  function D(e) {
26
- const t = e.filter((r) => !s.has(r));
25
+ const t = e.filter((n) => !c.has(n));
27
26
  if (t.length === 0)
28
27
  return Promise.resolve(!0);
29
- t.forEach((r) => s.add(r));
28
+ t.forEach((n) => c.add(n));
30
29
  const o = t.length - 1;
31
- return t[o] = `${t[o]}&display=swap`, new Promise((r) => {
30
+ return t[o] = `${t[o]}&display=swap`, new Promise((n) => {
32
31
  _.load({
33
32
  google: {
34
33
  families: t
35
34
  },
36
- active: () => r(!0),
37
- inactive: () => r(!0),
38
- fontinactive: (n, i) => {
39
- s.delete(n), console.warn(`font ${n} ${i} download failed`);
35
+ active: () => n(!0),
36
+ inactive: () => n(!0),
37
+ fontinactive: (r, i) => {
38
+ c.delete(r), console.warn(`font ${r} ${i} download failed`);
40
39
  }
41
40
  });
42
41
  });
@@ -52,13 +51,13 @@ function w(e) {
52
51
  return t = p(o), t;
53
52
  };
54
53
  }
55
- const m = ({ palette: e, components: t, overrides: o, ...r }) => ({
54
+ const m = ({ palette: e, components: t, overrides: o, ...n }) => ({
56
55
  palette: e,
57
56
  components: {
58
57
  ...o,
59
58
  ...t
60
59
  },
61
- ...r
60
+ ...n
62
61
  }), v = {
63
62
  themeName: "ArcBlock",
64
63
  pageWidth: "md",
@@ -85,21 +84,21 @@ const m = ({ palette: e, components: t, overrides: o, ...r }) => ({
85
84
  lightGrey: "#BCBCBC"
86
85
  }
87
86
  }, L = (...e) => {
88
- const t = C(), o = w(t), r = e.reduce(
89
- (B, c) => f(B, m(typeof c == "function" ? c(o()) : c)),
87
+ const t = C(), o = w(t), n = e.reduce(
88
+ (B, s) => f(B, m(typeof s == "function" ? s(o()) : s)),
90
89
  m(v)
91
- ), n = r.mode || r.palette?.mode || t, i = d(n), T = u(n), { disableBlockletTheme: F } = r, g = A(
90
+ ), r = n.mode || n.palette?.mode || t, i = d(r), T = u(r), { disableBlockletTheme: g } = n, F = A(
92
91
  [
93
92
  T,
94
- !F && l(i),
95
- l(r),
93
+ !g && l(i),
94
+ l(n),
96
95
  // 确保 mode 跟 prefer 一致
97
96
  {
98
- mode: n,
99
- palette: { mode: n }
97
+ mode: r,
98
+ palette: { mode: r }
100
99
  }
101
100
  ].filter(Boolean)
102
- ), a = p(g);
101
+ ), a = p(F);
103
102
  a.__isUxTheme__ = !0;
104
103
  const y = h(a.typography);
105
104
  return D(Array.from(y)), O(a, {
@@ -122,15 +121,16 @@ const m = ({ palette: e, components: t, overrides: o, ...r }) => ({
122
121
  "overline"
123
122
  ]
124
123
  });
125
- }, q = L;
124
+ }, W = L;
126
125
  export {
127
126
  h as collectFontFamilies,
128
127
  L as create,
129
128
  u as createDefaultThemeOptions,
130
- q as createTheme,
131
- V as deepmerge,
129
+ W as createTheme,
130
+ Q as deepmerge,
131
+ A as deepmergeAll,
132
132
  E as isTheme,
133
- W as isUxTheme,
133
+ R as isUxTheme,
134
134
  w as lazyCreateDefaultTheme,
135
135
  D as loadFonts
136
136
  };
@@ -1,5 +1,5 @@
1
+ import { ThemeOptions } from '@blocklet/theme';
1
2
  import { default as Cookies } from 'js-cookie';
2
- import { DeepmergeOptions } from '@mui/utils/deepmerge';
3
3
  import { $TSFixMe, Locale } from '../type';
4
4
  declare let dateTool: $TSFixMe | null;
5
5
  /** 是否常见二段式顶级域名 */
@@ -106,9 +106,8 @@ export declare const cleanedObj: (obj: object) => import('lodash').Dictionary<an
106
106
  export declare function hexToRgba(hex: string, alpha?: number): string;
107
107
  /**
108
108
  * 依次对数组中的对象进行深度合并
109
- * @param objects - 需要合并的对象数组
110
- * @param options - deepmerge 的配置选项
109
+ * @param objects - 需要合并的主题配置对象数组
111
110
  * @returns 合并后的对象
112
111
  */
113
- export declare function deepmergeAll<T>(objects: T[], options?: DeepmergeOptions): T;
112
+ export declare function deepmergeAll(objects: ThemeOptions[]): ThemeOptions;
114
113
  export {};
package/lib/Util/index.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import { lazy as E } from "react";
2
2
  import u from "lodash/padStart";
3
3
  import { colors as g, getDIDMotifInfo as x } from "@arcblock/did-motif";
4
+ import { mergeThemeOptions as k } from "@blocklet/theme";
4
5
  import y from "lodash/isNil";
5
- import k from "lodash/omitBy";
6
- import A from "p-retry";
6
+ import A from "lodash/omitBy";
7
+ import F from "p-retry";
7
8
  import l from "js-cookie";
8
- import F from "color-convert";
9
- import U from "@mui/utils/deepmerge";
9
+ import O from "color-convert";
10
10
  import a from "dayjs";
11
11
  import "dayjs/locale/zh-cn";
12
- import j from "dayjs/plugin/utc";
13
- import O from "dayjs/plugin/timezone";
12
+ import U from "dayjs/plugin/utc";
13
+ import j from "dayjs/plugin/timezone";
14
14
  import R from "dayjs/plugin/relativeTime";
15
15
  import W from "dayjs/plugin/updateLocale";
16
16
  import L from "dayjs/plugin/localizedFormat";
@@ -23,27 +23,27 @@ function z(t) {
23
23
  return !1;
24
24
  const e = t.split(".");
25
25
  if (e.length < 2) return !1;
26
- const r = e[e.length - 2], n = e[e.length - 1];
27
- return V.has(r) && _.has(n);
26
+ const n = e[e.length - 2], r = e[e.length - 1];
27
+ return V.has(n) && _.has(r);
28
28
  }
29
29
  function mt() {
30
30
  const { host: t } = window.location;
31
31
  if (!t || M.test(t))
32
32
  return "";
33
- const r = t.split(":")[0].split(".");
34
- if (r.length === 1)
33
+ const n = t.split(":")[0].split(".");
34
+ if (n.length === 1)
35
35
  return "";
36
- if (r.length > 2) {
37
- const n = r.slice(-2).join(".");
38
- if (z(n))
39
- return `.${r.slice(-3).join(".")}`;
36
+ if (n.length > 2) {
37
+ const r = n.slice(-2).join(".");
38
+ if (z(r))
39
+ return `.${n.slice(-3).join(".")}`;
40
40
  }
41
- return `.${r.slice(-2).join(".")}`;
41
+ return `.${n.slice(-2).join(".")}`;
42
42
  }
43
43
  function dt(t) {
44
- return t.replace(/^\?/, "").split("&").map((e) => e.split("=")).filter(([e]) => !!e).reduce((e, r) => {
45
- const n = r[0], i = decodeURIComponent(r[1]) || !0;
46
- return e[n] = i, e;
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;
47
47
  }, {});
48
48
  }
49
49
  function pt(t = {}) {
@@ -52,7 +52,7 @@ function pt(t = {}) {
52
52
  function ht(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 r = {
55
+ const n = {
56
56
  expires: e.expireInDays,
57
57
  path: e.path,
58
58
  domain: e.domain || "",
@@ -60,22 +60,22 @@ 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 r.domain, r;
63
+ return (typeof window > "u" || e.domain || e.returnDomain === !1) && e.returnDomain === !1 && delete n.domain, n;
64
64
  }
65
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, r = []) {
67
- const n = Object.assign({}, t), i = e.defaultProps || {};
66
+ function yt(t, e, n = []) {
67
+ const r = Object.assign({}, t), i = e.defaultProps || {};
68
68
  return Object.keys(i).forEach((o) => {
69
- typeof n[o] == "string" && n[o].indexOf("::prop::") === 0 && (n[o] = i[o]);
70
- }), Array.isArray(r) && r.forEach((o) => {
71
- if (typeof n[o] == "string")
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")
72
72
  try {
73
- n[o] = JSON.parse(n[o]);
73
+ r[o] = JSON.parse(r[o]);
74
74
  } catch {
75
75
  }
76
- }), Object.keys(n).forEach((o) => {
77
- typeof n[o] == "string" && n[o].indexOf("::prop::") === 0 && (n[o] = "");
78
- }), n;
76
+ }), Object.keys(r).forEach((o) => {
77
+ typeof r[o] == "string" && r[o].indexOf("::prop::") === 0 && (r[o] = "");
78
+ }), r;
79
79
  }
80
80
  function It(t = 2017) {
81
81
  const e = (/* @__PURE__ */ new Date()).getFullYear();
@@ -83,17 +83,17 @@ function It(t = 2017) {
83
83
  }
84
84
  const Dt = () => typeof Intl == "object" && typeof Intl.DateTimeFormat == "function" && typeof Intl.DateTimeFormat().resolvedOptions == "function" ? Intl.DateTimeFormat().resolvedOptions().timeZone : "", bt = (t) => {
85
85
  let e = 0;
86
- for (let n = 0; n < t.length; n++)
87
- e = t.charCodeAt(n) + ((e << 5) - e);
88
- let r = "#";
89
- for (let n = 0; n < 3; n++) {
90
- const i = e >> n * 8 & 255;
91
- r += `00${i.toString(16)}`.substr(-2);
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);
92
92
  }
93
- return r;
93
+ return n;
94
94
  }, $t = (t) => {
95
- const e = Math.round(t / 1e3), r = Math.floor(e / 3600), n = Math.floor((e - r * 3600) / 60), i = e % 60;
96
- return `${u(r, 2, "0")}:${u(n, 2, "0")}:${u(i, 2, "0")}`;
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")}`;
97
97
  };
98
98
  function B(t) {
99
99
  f = t;
@@ -101,8 +101,8 @@ function B(t) {
101
101
  function Tt() {
102
102
  return f;
103
103
  }
104
- const I = (t) => (e, { locale: r, tz: n, isUtc: i } = {}) => {
105
- if (f === null && (a.extend(L), a.extend(j), a.extend(O), a.extend(W), a.extend(R), a.updateLocale("zh-cn", {
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", {
106
106
  // copy with https://github.com/iamkun/dayjs/blob/dev/src/locale/zh-cn.js
107
107
  relativeTime: {
108
108
  future: "%s后",
@@ -122,18 +122,18 @@ const I = (t) => (e, { locale: r, tz: n, isUtc: i } = {}) => {
122
122
  }), B(a)), y(e) || e === "")
123
123
  return "-";
124
124
  let o = f(e);
125
- return n && (o = o.tz(n)), i && (o = o.utc()), typeof r < "u" && (o = o.locale(r)), o.format(t);
125
+ return r && (o = o.tz(r)), i && (o = o.utc()), typeof n < "u" && (o = o.locale(n)), o.format(t);
126
126
  };
127
- function St(t, { locale: e = "en", tz: r } = {}) {
128
- return I("ll")(t, { locale: e, tz: r });
127
+ function St(t, { locale: e = "en", tz: n } = {}) {
128
+ return I("ll")(t, { locale: e, tz: n });
129
129
  }
130
130
  function Et(t, {
131
131
  locale: e = "en",
132
- tz: r,
133
- isUtc: n = !1,
132
+ tz: n,
133
+ isUtc: r = !1,
134
134
  format: i = "lll"
135
135
  } = {}) {
136
- return I(i)(t, { locale: e, tz: r, isUtc: n });
136
+ return I(i)(t, { locale: e, tz: n, isUtc: r });
137
137
  }
138
138
  function N() {
139
139
  const t = window?.ABT_DEV || window.ABT;
@@ -142,8 +142,8 @@ function N() {
142
142
  function xt({
143
143
  webWalletUrl: t,
144
144
  action: e = "login",
145
- locale: r = "en",
146
- url: n,
145
+ locale: n = "en",
146
+ url: r,
147
147
  windowFeatures: i,
148
148
  appInfo: o,
149
149
  memberAppInfo: p
@@ -152,8 +152,8 @@ function xt({
152
152
  if (h)
153
153
  return h.open({
154
154
  action: e,
155
- locale: r,
156
- url: encodeURIComponent(n),
155
+ locale: n,
156
+ url: encodeURIComponent(r),
157
157
  appInfo: {
158
158
  ...o
159
159
  },
@@ -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=${r}&url=${encodeURIComponent(n)}`, c = Object.assign({}, D, i), $ = (s) => s.innerWidth || s.document.documentElement.clientWidth || s.document.body.clientWidth;
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;
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;
@@ -190,10 +190,10 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
190
190
  if (!e)
191
191
  return t;
192
192
  try {
193
- const r = new URL(t, window.location.origin);
194
- return Object.keys(e).forEach((n) => {
195
- r.searchParams.set(n, String(e[n]));
196
- }), r.origin === window.location.origin ? r.pathname + r.search : r.href;
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;
197
197
  } catch {
198
198
  return t;
199
199
  }
@@ -205,7 +205,7 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
205
205
  setTimeout(() => {
206
206
  e();
207
207
  }, t);
208
- }), Ut = (t) => /^https?:\/\//.test(t), m = "vid", d = "__visitor_id", Q = () => l.get(m) || localStorage.getItem(d), w = (t) => {
208
+ }), Ot = (t) => /^https?:\/\//.test(t), m = "vid", d = "__visitor_id", Q = () => l.get(m) || localStorage.getItem(d), w = (t) => {
209
209
  t === null ? l.remove(m, {
210
210
  sameSite: "None",
211
211
  secure: !0
@@ -214,7 +214,7 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
214
214
  secure: !0,
215
215
  expires: 365
216
216
  });
217
- }, jt = () => {
217
+ }, Ut = () => {
218
218
  let t = localStorage.getItem(d);
219
219
  if (t && (localStorage.removeItem(d), w(t)), !Q()) {
220
220
  if (!C())
@@ -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 n = 0; n < 16; n++)
230
- e[n] = Math.floor(Math.random() * 256);
231
- const r = Array.from(e).map((n) => n.toString(16).padStart(2, "0"));
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"));
232
232
  t = [
233
- r.slice(0, 4).join(""),
234
- r.slice(4, 6).join(""),
235
- r.slice(6, 8).join(""),
236
- r.slice(8, 10).join(""),
237
- r.slice(10, 16).join("")
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("")
238
238
  ].join("-");
239
239
  }
240
240
  } catch {
@@ -242,11 +242,11 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
242
242
  }
243
243
  t && w(t);
244
244
  }
245
- }, Ot = (t) => {
245
+ }, jt = (t) => {
246
246
  if (X(t)) {
247
247
  const e = Uint8Array.from(
248
- t.slice(2).match(/.{1,2}/g).map((r) => parseInt(r, 16))
249
- ).slice(0, 8).reduce((r, n) => r + n, 0) % g.length;
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;
250
250
  return g[e];
251
251
  }
252
252
  try {
@@ -254,14 +254,14 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
254
254
  } catch {
255
255
  return null;
256
256
  }
257
- }, Rt = (t, e, r = {}) => {
258
- const { fallbackLocale: n = "en", defaultValue: i = "unknown" } = r;
257
+ }, Rt = (t, e, n = {}) => {
258
+ const { fallbackLocale: r = "en", defaultValue: i = "unknown" } = n;
259
259
  if (typeof t == "string")
260
260
  return t;
261
261
  let o;
262
- return e && (o = t[e]), (!o || typeof o != "string") && (o = t[n]), (!o || typeof o != "string") && (o = i), o;
262
+ return e && (o = t[e]), (!o || typeof o != "string") && (o = t[r]), (!o || typeof o != "string") && (o = i), o;
263
263
  }, Wt = (t) => E(
264
- () => A(
264
+ () => F(
265
265
  async () => {
266
266
  try {
267
267
  return await t();
@@ -272,22 +272,22 @@ const kt = (t) => t && Number(t) >= 12 ? `${Number(t)}px` : "inherit", X = (t) =
272
272
  // 只需要重试两次,加上原本的一次,总共三次
273
273
  { retries: 2 }
274
274
  )
275
- ), Lt = (t) => k(t, y);
275
+ ), Lt = (t) => A(t, y);
276
276
  function Pt(t, e = 1) {
277
- const [r, n, i] = F.hex.rgb(t);
278
- return `rgba(${r}, ${n}, ${i}, ${e})`;
277
+ const [n, r, i] = O.hex.rgb(t);
278
+ return `rgba(${n}, ${r}, ${i}, ${e})`;
279
279
  }
280
- function vt(t, e) {
280
+ function vt(t) {
281
281
  if (!Array.isArray(t))
282
282
  throw new Error("First argument should be an array");
283
- return t.length === 0 ? {} : t.length === 1 ? t[0] : t.reduce((r, n) => U(r, n, e));
283
+ return t.length === 0 ? {} : t.length === 1 ? t[0] : t.reduce((e, n) => k(e, n));
284
284
  }
285
285
  export {
286
286
  K as appendParams,
287
287
  Lt as cleanedObj,
288
288
  vt as deepmergeAll,
289
289
  N as detectWalletExtension,
290
- jt as ensureVisitorId,
290
+ Ut as ensureVisitorId,
291
291
  St as formatToDate,
292
292
  Et as formatToDatetime,
293
293
  $t as formatUptime,
@@ -295,7 +295,7 @@ export {
295
295
  gt as getColor,
296
296
  ht as getCookieOptions,
297
297
  It as getCopyright,
298
- Ot as getDIDColor,
298
+ jt as getDIDColor,
299
299
  Tt as getDateTool,
300
300
  kt as getFontSize,
301
301
  Dt as getTimezone,
@@ -305,7 +305,7 @@ export {
305
305
  Pt as hexToRgba,
306
306
  X as isEthereumDid,
307
307
  z as isTwoSegmentTLD,
308
- Ut as isUrl,
308
+ Ot as isUrl,
309
309
  Wt as lazyRetry,
310
310
  yt as mergeProps,
311
311
  xt as openWebWallet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arcblock/ux",
3
- "version": "3.1.5",
3
+ "version": "3.1.7",
4
4
  "description": "Common used react components for arcblock products",
5
5
  "keywords": [
6
6
  "react",
@@ -35,12 +35,18 @@
35
35
  },
36
36
  "devDependencies": {
37
37
  "@arcblock/ux": "workspace:*",
38
+ "@babel/plugin-proposal-class-properties": "^7.18.6",
39
+ "@babel/plugin-syntax-dynamic-import": "^7.8.3",
40
+ "@babel/preset-env": "^7.28.0",
41
+ "@babel/preset-react": "^7.27.1",
42
+ "@babel/preset-typescript": "^7.27.1",
38
43
  "@types/base64-url": "^2.2.2",
39
44
  "@types/pako": "^2.0.3",
40
45
  "@types/react": "^19.1.8",
41
46
  "@types/react-helmet": "^6.1.11",
42
47
  "@types/webfontloader": "^1.6.38",
43
48
  "babel-jest": "29",
49
+ "babel-plugin-inline-react-svg": "^2.0.2",
44
50
  "eslint-plugin-react-hooks": "^4.6.2",
45
51
  "jest": "^29.7.0",
46
52
  "jest-environment-jsdom": "^29.7.0",
@@ -60,16 +66,16 @@
60
66
  "react": "^19.0.0",
61
67
  "react-router-dom": "^6.22.3"
62
68
  },
63
- "gitHead": "1ed5a2051033d58cbdbfea5a439f49c7508b97f6",
69
+ "gitHead": "8f0b8300d7c73a1d82f7b76d3e7c293f921b260c",
64
70
  "dependencies": {
65
- "@arcblock/bridge": "3.1.5",
71
+ "@arcblock/bridge": "3.1.7",
66
72
  "@arcblock/did": "^1.21.2",
67
73
  "@arcblock/did-motif": "^1.1.14",
68
- "@arcblock/icons": "3.1.5",
69
- "@arcblock/nft-display": "3.1.5",
70
- "@arcblock/react-hooks": "3.1.5",
74
+ "@arcblock/icons": "3.1.7",
75
+ "@arcblock/nft-display": "3.1.7",
76
+ "@arcblock/react-hooks": "3.1.7",
71
77
  "@blocklet/js-sdk": "^1.16.47",
72
- "@blocklet/theme": "3.1.5",
78
+ "@blocklet/theme": "3.1.7",
73
79
  "@fontsource/roboto": "~5.1.1",
74
80
  "@fontsource/ubuntu-mono": "^5.2.6",
75
81
  "@iconify-icons/logos": "^1.2.36",
@@ -1,12 +1,12 @@
1
1
  /* eslint-disable no-shadow */
2
2
  // https://app.zeplin.io/styleguide/5d1436f1e97c2156f49c0725/colors
3
3
  import { createTheme as _createTheme, responsiveFontSizes, type PaletteMode } from '@mui/material';
4
- import { deepmerge } from '@mui/utils';
5
4
  import webfontloader from 'webfontloader';
6
5
  import {
7
6
  BLOCKLET_THEME_LIGHT,
8
7
  BLOCKLET_THEME_DARK,
9
8
  DEFAULT_FONTS,
9
+ mergeThemeOptions as deepmerge,
10
10
  getDefaultThemePrefer,
11
11
  getBlockletThemeOptions,
12
12
  type ThemeOptions,
@@ -226,4 +226,4 @@ export const create = (...args: Array<UxThemeOptions | ((baseTheme: Theme) => Ux
226
226
  };
227
227
 
228
228
  export const createTheme = create;
229
- export { deepmerge };
229
+ export { deepmerge, deepmergeAll };
package/src/Util/index.ts CHANGED
@@ -2,12 +2,12 @@
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
6
  import isNil from 'lodash/isNil';
6
7
  import omitBy from 'lodash/omitBy';
7
8
  import pRetry from 'p-retry';
8
9
  import Cookies from 'js-cookie';
9
10
  import colorConvert from 'color-convert';
10
- import deepmerge, { type DeepmergeOptions } from '@mui/utils/deepmerge';
11
11
  import dayjs from 'dayjs';
12
12
  import 'dayjs/locale/zh-cn';
13
13
  import utc from 'dayjs/plugin/utc';
@@ -658,17 +658,16 @@ export function hexToRgba(hex: string, alpha = 1) {
658
658
 
659
659
  /**
660
660
  * 依次对数组中的对象进行深度合并
661
- * @param objects - 需要合并的对象数组
662
- * @param options - deepmerge 的配置选项
661
+ * @param objects - 需要合并的主题配置对象数组
663
662
  * @returns 合并后的对象
664
663
  */
665
- export function deepmergeAll<T>(objects: T[], options?: DeepmergeOptions): T {
664
+ export function deepmergeAll(objects: ThemeOptions[]): ThemeOptions {
666
665
  if (!Array.isArray(objects)) {
667
666
  throw new Error('First argument should be an array');
668
667
  }
669
668
 
670
669
  if (objects.length === 0) {
671
- return {} as T;
670
+ return {};
672
671
  }
673
672
 
674
673
  if (objects.length === 1) {
@@ -676,6 +675,6 @@ export function deepmergeAll<T>(objects: T[], options?: DeepmergeOptions): T {
676
675
  }
677
676
 
678
677
  return objects.reduce((acc, obj) => {
679
- return deepmerge(acc, obj, options);
678
+ return mergeThemeOptions(acc, obj);
680
679
  });
681
680
  }