@arcblock/ux 3.1.20 → 3.1.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Theme/index.js +19 -20
- package/lib/Theme/theme.js +19 -19
- package/lib/Util/index.d.ts +3 -8
- package/lib/Util/index.js +151 -156
- package/package.json +8 -7
- package/src/Util/index.ts +4 -24
package/lib/Theme/index.js
CHANGED
@@ -1,27 +1,26 @@
|
|
1
|
-
import { styled as
|
2
|
-
import { useTheme as
|
3
|
-
import { collectFontFamilies as
|
4
|
-
import { ColorSchemeContext as
|
5
|
-
import { mergeThemeOptions as
|
6
|
-
|
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: (
|
8
|
+
shouldForwardProp: (t) => r?.shouldForwardProp ? r.shouldForwardProp(t) && !o(t) : !o(t)
|
10
9
|
});
|
11
10
|
export {
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
25
|
-
|
26
|
-
|
23
|
+
l as styled,
|
24
|
+
C as useColorScheme,
|
25
|
+
d as useTheme
|
27
26
|
};
|
package/lib/Theme/theme.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
import { createTheme as p, responsiveFontSizes as O } from "@mui/material";
|
2
|
-
import
|
3
|
-
import { DEFAULT_FONTS as
|
4
|
-
import { mergeThemeOptions as Q } from "@blocklet/theme";
|
5
|
-
import {
|
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
|
23
|
+
const l = new Set(_.concat("inherit"));
|
24
24
|
function D(e) {
|
25
|
-
const t = e.filter((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) =>
|
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
|
-
|
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
|
-
|
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 =
|
88
|
-
(B,
|
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 =
|
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 &&
|
94
|
-
|
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
|
-
),
|
102
|
-
|
103
|
-
const y = h(
|
104
|
-
return D(Array.from(y)), O(
|
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
|
-
|
131
|
+
V as deepmergeAll,
|
132
132
|
E as isTheme,
|
133
133
|
R as isUxTheme,
|
134
134
|
w as lazyCreateDefaultTheme,
|
package/lib/Util/index.d.ts
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
import {
|
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
|
2
|
-
import
|
3
|
-
import { colors as g, getDIDMotifInfo as
|
4
|
-
import {
|
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
|
7
|
-
import
|
8
|
-
import
|
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
|
14
|
-
import
|
15
|
-
import
|
16
|
-
import
|
17
|
-
import { DID_PREFIX as
|
18
|
-
import { getFederatedEnabled as
|
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
|
21
|
-
function
|
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
|
27
|
-
return
|
26
|
+
const o = e[e.length - 2], n = e[e.length - 1];
|
27
|
+
return M.has(o) && V.has(n);
|
28
28
|
}
|
29
|
-
function
|
29
|
+
function lt() {
|
30
30
|
const { host: t } = window.location;
|
31
|
-
if (!t ||
|
31
|
+
if (!t || C.test(t))
|
32
32
|
return "";
|
33
|
-
const
|
34
|
-
if (
|
33
|
+
const o = t.split(":")[0].split(".");
|
34
|
+
if (o.length === 1)
|
35
35
|
return "";
|
36
|
-
if (
|
37
|
-
const
|
38
|
-
if (
|
39
|
-
return `.${
|
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 `.${
|
41
|
+
return `.${o.slice(-2).join(".")}`;
|
42
42
|
}
|
43
|
-
function
|
44
|
-
return t.replace(/^\?/, "").split("&").map((e) => e.split("=")).filter(([e]) => !!e).reduce((e,
|
45
|
-
const
|
46
|
-
return 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
|
49
|
+
function mt(t = {}) {
|
50
50
|
return new URLSearchParams(t).toString();
|
51
51
|
}
|
52
|
-
function
|
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
|
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
|
63
|
+
return (typeof window > "u" || e.domain || e.returnDomain === !1) && e.returnDomain === !1 && delete o.domain, o;
|
64
64
|
}
|
65
|
-
const
|
66
|
-
function
|
67
|
-
const
|
68
|
-
return Object.keys(i).forEach((
|
69
|
-
typeof r
|
70
|
-
}), Array.isArray(
|
71
|
-
if (typeof r
|
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
|
73
|
+
n[r] = JSON.parse(n[r]);
|
74
74
|
} catch {
|
75
75
|
}
|
76
|
-
}), Object.keys(
|
77
|
-
typeof r
|
78
|
-
}),
|
76
|
+
}), Object.keys(n).forEach((r) => {
|
77
|
+
typeof n[r] == "string" && n[r].indexOf("::prop::") === 0 && (n[r] = "");
|
78
|
+
}), n;
|
79
79
|
}
|
80
|
-
function
|
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
|
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
|
87
|
-
e = t.charCodeAt(
|
88
|
-
let
|
89
|
-
for (let
|
90
|
-
const i = e >>
|
91
|
-
|
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
|
94
|
-
},
|
95
|
-
const e = Math.round(t / 1e3),
|
96
|
-
return `${
|
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
|
98
|
+
function z(t) {
|
99
99
|
f = t;
|
100
100
|
}
|
101
|
-
function
|
101
|
+
function Dt() {
|
102
102
|
return f;
|
103
103
|
}
|
104
|
-
const I = (t) => (e, { locale:
|
105
|
-
if (f === null && (a.extend(
|
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
|
-
}),
|
122
|
+
}), z(a)), y(e) || e === "")
|
123
123
|
return "-";
|
124
|
-
let
|
125
|
-
return
|
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
|
128
|
-
return I("ll")(t, { locale: e, tz:
|
127
|
+
function $t(t, { locale: e = "en", tz: o } = {}) {
|
128
|
+
return I("ll")(t, { locale: e, tz: o });
|
129
129
|
}
|
130
|
-
function
|
130
|
+
function Tt(t, {
|
131
131
|
locale: e = "en",
|
132
|
-
tz:
|
133
|
-
isUtc:
|
132
|
+
tz: o,
|
133
|
+
isUtc: n = !1,
|
134
134
|
format: i = "lll"
|
135
135
|
} = {}) {
|
136
|
-
return I(i)(t, { locale: e, tz:
|
136
|
+
return I(i)(t, { locale: e, tz: o, isUtc: n });
|
137
137
|
}
|
138
|
-
function
|
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
|
142
|
+
function St({
|
143
143
|
webWalletUrl: t,
|
144
144
|
action: e = "login",
|
145
|
-
locale:
|
146
|
-
url:
|
145
|
+
locale: o = "en",
|
146
|
+
url: n,
|
147
147
|
windowFeatures: i,
|
148
|
-
appInfo:
|
148
|
+
appInfo: r,
|
149
149
|
memberAppInfo: p
|
150
150
|
}) {
|
151
|
-
const h =
|
151
|
+
const h = B();
|
152
152
|
if (h)
|
153
153
|
return h.open({
|
154
154
|
action: e,
|
155
|
-
locale:
|
156
|
-
url: encodeURIComponent(
|
155
|
+
locale: o,
|
156
|
+
url: encodeURIComponent(n),
|
157
157
|
appInfo: {
|
158
|
-
...
|
158
|
+
...r
|
159
159
|
},
|
160
160
|
memberAppInfo: {
|
161
161
|
...p
|
162
162
|
}
|
163
163
|
}), { type: "extension" };
|
164
|
-
const
|
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
|
-
},
|
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(
|
184
|
+
return window.open(D, "targetWindow", T), { type: "web" };
|
185
185
|
}
|
186
|
-
const
|
187
|
-
const e = t.replace(
|
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
|
-
},
|
189
|
+
}, X = (t, e) => {
|
190
190
|
if (!e)
|
191
191
|
return t;
|
192
192
|
try {
|
193
|
-
const
|
194
|
-
return Object.keys(e).forEach((
|
195
|
-
|
196
|
-
}),
|
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
|
-
},
|
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),
|
204
|
+
}) : t), jt = (t = 0) => new Promise((e) => {
|
205
205
|
setTimeout(() => {
|
206
206
|
e();
|
207
207
|
}, t);
|
208
|
-
}),
|
209
|
-
t === null ?
|
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
|
-
}) :
|
212
|
+
}) : u.set(m, t, {
|
213
213
|
sameSite: "None",
|
214
214
|
secure: !0,
|
215
215
|
expires: 365
|
216
216
|
});
|
217
|
-
},
|
217
|
+
}, Ot = () => {
|
218
218
|
let t = localStorage.getItem(d);
|
219
|
-
if (t && (localStorage.removeItem(d), w(t)), !
|
220
|
-
if (!
|
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
|
230
|
-
e[
|
231
|
-
const
|
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
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
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
|
-
},
|
246
|
-
if (
|
245
|
+
}, Ut = (t) => {
|
246
|
+
if (N(t)) {
|
247
247
|
const e = Uint8Array.from(
|
248
|
-
t.slice(2).match(/.{1,2}/g).map((
|
249
|
-
).slice(0, 8).reduce((
|
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
|
253
|
+
return E(t)?.color;
|
254
254
|
} catch {
|
255
255
|
return null;
|
256
256
|
}
|
257
|
-
},
|
258
|
-
const { fallbackLocale:
|
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
|
262
|
-
return e && (
|
263
|
-
},
|
264
|
-
() =>
|
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
|
-
),
|
276
|
-
function
|
277
|
-
const [
|
278
|
-
return `rgba(${
|
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
|
-
|
287
|
-
|
281
|
+
X as appendParams,
|
282
|
+
Rt as cleanedObj,
|
288
283
|
vt as deepmergeAll,
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
313
|
-
|
314
|
-
|
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
|
-
|
317
|
-
|
318
|
-
|
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.
|
3
|
+
"version": "3.1.21",
|
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": "
|
70
|
+
"gitHead": "dedb6d83f569480ca7840679ef32fb863d4042e1",
|
70
71
|
"dependencies": {
|
71
|
-
"@arcblock/bridge": "3.1.
|
72
|
+
"@arcblock/bridge": "3.1.21",
|
72
73
|
"@arcblock/did": "^1.21.3",
|
73
74
|
"@arcblock/did-motif": "^1.1.14",
|
74
|
-
"@arcblock/icons": "3.1.
|
75
|
-
"@arcblock/nft-display": "3.1.
|
76
|
-
"@arcblock/react-hooks": "3.1.
|
75
|
+
"@arcblock/icons": "3.1.21",
|
76
|
+
"@arcblock/nft-display": "3.1.21",
|
77
|
+
"@arcblock/react-hooks": "3.1.21",
|
77
78
|
"@blocklet/js-sdk": "^1.16.48",
|
78
|
-
"@blocklet/theme": "3.1.
|
79
|
+
"@blocklet/theme": "3.1.21",
|
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 {
|
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
|
-
}
|