@blocklet/ui-react 3.0.9 → 3.0.10
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/BlockletStudio/index.js +70 -71
- package/lib/ComponentInstaller/index.js +85 -88
- package/lib/ComponentInstaller/installer-item.js +47 -53
- package/lib/ComponentInstaller/use-component-installed.js +32 -38
- package/lib/ComponentManager/components/add-component.js +47 -50
- package/lib/ComponentManager/components/publish-component.js +30 -31
- package/lib/ComponentManager/components/resource-dialog.js +28 -30
- package/lib/Dashboard/index.d.ts +1 -1
- package/lib/Dashboard/index.js +59 -61
- package/lib/Footer/index.js +51 -52
- package/lib/Footer/internal-footer.js +43 -47
- package/lib/Footer/layout/standard.js +11 -12
- package/lib/Footer/links.js +25 -28
- package/lib/Footer/social-media.js +17 -17
- package/lib/Header/index.js +81 -83
- package/lib/Notifications/Snackbar.js +76 -77
- package/lib/Notifications/hooks/use-title.js +34 -34
- package/lib/Notifications/utils.js +56 -60
- package/lib/UserCenter/components/config-inviter.js +17 -18
- package/lib/UserCenter/components/danger-zone.js +49 -52
- package/lib/UserCenter/components/nft.js +44 -45
- package/lib/UserCenter/components/notification.js +92 -99
- package/lib/UserCenter/components/passport.js +22 -22
- package/lib/UserCenter/components/privacy.js +6 -6
- package/lib/UserCenter/components/settings.js +40 -43
- package/lib/UserCenter/components/status-dialog/date-picker.js +7 -8
- package/lib/UserCenter/components/status-dialog/index.js +112 -114
- package/lib/UserCenter/components/status-selector/duration-menu.js +35 -36
- package/lib/UserCenter/components/status-selector/index.js +13 -13
- package/lib/UserCenter/components/storage/action.js +21 -22
- package/lib/UserCenter/components/storage/delete.js +24 -24
- package/lib/UserCenter/components/third-party-login/index.js +53 -53
- package/lib/UserCenter/components/third-party-login/third-party-item.js +87 -89
- package/lib/UserCenter/components/user-center.js +198 -207
- package/lib/UserCenter/components/user-info/metadata.js +343 -353
- package/lib/UserCenter/components/user-info/switch-role.js +17 -20
- package/lib/UserCenter/components/user-info/user-basic-info.js +79 -82
- package/lib/UserCenter/components/user-info/user-info.js +40 -40
- package/lib/UserCenter/components/user-info/user-status.js +97 -99
- package/lib/UserCenter/components/user-info/utils.js +34 -35
- package/lib/UserSessions/components/user-session-info.js +25 -28
- package/lib/UserSessions/components/user-sessions.js +169 -181
- package/lib/blocklets.js +62 -72
- package/lib/common/domain-warning.js +31 -31
- package/lib/common/header-addons.d.ts +1 -1
- package/lib/common/header-addons.js +49 -53
- package/lib/common/notification-addon.js +29 -32
- package/lib/common/ws.js +17 -18
- package/lib/contexts/config-user-space.js +16 -19
- package/lib/utils.js +44 -48
- package/package.json +6 -6
package/lib/utils.js
CHANGED
|
@@ -1,65 +1,61 @@
|
|
|
1
|
-
import
|
|
2
|
-
const d = (n,
|
|
1
|
+
import H from "semver";
|
|
2
|
+
const d = (n, r, e = "children") => n.map((t) => Array.isArray(t[e]) ? r({
|
|
3
3
|
...t,
|
|
4
|
-
[
|
|
5
|
-
}) :
|
|
6
|
-
const
|
|
7
|
-
return d(n, (t) =>
|
|
8
|
-
},
|
|
9
|
-
let
|
|
10
|
-
return d(n, () =>
|
|
11
|
-
},
|
|
12
|
-
const s = t[
|
|
4
|
+
[e]: d(t[e], r, e)
|
|
5
|
+
}) : r(t)), C = (n, r = "children") => {
|
|
6
|
+
const e = [];
|
|
7
|
+
return d(n, (t) => e.push(t), r), e;
|
|
8
|
+
}, S = (n, r = "children") => {
|
|
9
|
+
let e = 0;
|
|
10
|
+
return d(n, () => e++, r), e;
|
|
11
|
+
}, R = (n, r, e = "children") => n.map((t) => ({ ...t })).filter((t) => {
|
|
12
|
+
const s = t[e];
|
|
13
13
|
if (Array.isArray(s)) {
|
|
14
|
-
const o =
|
|
15
|
-
t[
|
|
14
|
+
const o = R(s, r, e);
|
|
15
|
+
t[e] = o?.length ? o : void 0;
|
|
16
16
|
}
|
|
17
|
-
const c = { filteredChildren: t[
|
|
18
|
-
return
|
|
19
|
-
}),
|
|
20
|
-
if (!n || !
|
|
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) => {
|
|
20
|
+
if (!n || !n?.startsWith("/"))
|
|
21
21
|
return !1;
|
|
22
|
-
const
|
|
23
|
-
return
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
return
|
|
27
|
-
},
|
|
28
|
-
const { columns:
|
|
29
|
-
var h;
|
|
30
|
-
return u + s + (((h = m[o]) == null ? void 0 : h.length) || 0) * c;
|
|
31
|
-
}, 0), f = Math.ceil(w / r), l = [[]];
|
|
22
|
+
const r = (s) => s.endsWith("/") ? s : `${s}/`, e = r(window.location.pathname), t = r(new URL(n, window.location.origin).pathname);
|
|
23
|
+
return e.startsWith(t);
|
|
24
|
+
}, W = (n = []) => {
|
|
25
|
+
const r = n.map((t, s) => ({ path: t, index: s })).filter((t) => V(t.path));
|
|
26
|
+
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 = [[]];
|
|
32
29
|
let i = 0, a = 0;
|
|
33
|
-
const
|
|
30
|
+
const m = l * 0.2, f = (u) => a > l - m && i < e - 1 && a + u > l + m;
|
|
34
31
|
return n.forEach((u) => {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
t && g(s) && (i++, a = 0, l[i] = []), !t && a > 0 && g(m) && (i++, a = 0, l[i] = []), l[i].push({
|
|
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({
|
|
38
34
|
...u,
|
|
39
35
|
group: !0
|
|
40
|
-
}), a += s, u[o] && u[o].forEach((
|
|
41
|
-
t &&
|
|
42
|
-
...
|
|
36
|
+
}), a += s, u[o] && u[o].forEach((w) => {
|
|
37
|
+
t && f(c) && (i++, a = 0, h[i] = []), h[i].push({
|
|
38
|
+
...w,
|
|
43
39
|
group: !1
|
|
44
40
|
}), a += c;
|
|
45
41
|
});
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
48
|
-
const
|
|
42
|
+
}), h;
|
|
43
|
+
}, v = (n, r) => {
|
|
44
|
+
const e = (c) => {
|
|
49
45
|
const o = c.match(/^(\d+\.\d+\.\d+(?:-[^-]+?-\d{8}))/);
|
|
50
46
|
return o ? o[1] : c;
|
|
51
|
-
}, t =
|
|
52
|
-
return t === s && n !==
|
|
47
|
+
}, t = e(n), s = e(r);
|
|
48
|
+
return t === s && n !== r ? !1 : H.gte(t, s);
|
|
53
49
|
};
|
|
54
50
|
export {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
51
|
+
v as compareVersions,
|
|
52
|
+
S as countRecursive,
|
|
53
|
+
R as filterRecursive,
|
|
54
|
+
C as flatRecursive,
|
|
55
|
+
P as isIconifyString,
|
|
56
|
+
x as isUrl,
|
|
61
57
|
d as mapRecursive,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
58
|
+
V as matchPath,
|
|
59
|
+
W as matchPaths,
|
|
60
|
+
k as splitNavColumns
|
|
65
61
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/ui-react",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "Some useful front-end web components that can be used in Blocklets.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -35,12 +35,12 @@
|
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@abtnode/constant": "^1.16.44",
|
|
37
37
|
"@abtnode/util": "^1.16.44",
|
|
38
|
-
"@arcblock/bridge": "3.0.
|
|
39
|
-
"@arcblock/icons": "3.0.
|
|
40
|
-
"@arcblock/react-hooks": "3.0.
|
|
38
|
+
"@arcblock/bridge": "3.0.10",
|
|
39
|
+
"@arcblock/icons": "3.0.10",
|
|
40
|
+
"@arcblock/react-hooks": "3.0.10",
|
|
41
41
|
"@arcblock/ws": "^1.20.15",
|
|
42
42
|
"@blocklet/constant": "^1.16.44",
|
|
43
|
-
"@blocklet/did-space-react": "^1.0
|
|
43
|
+
"@blocklet/did-space-react": "^1.1.0",
|
|
44
44
|
"@iconify-icons/logos": "^1.2.36",
|
|
45
45
|
"@iconify-icons/material-symbols": "^1.2.58",
|
|
46
46
|
"@iconify-icons/tabler": "^1.2.95",
|
|
@@ -90,5 +90,5 @@
|
|
|
90
90
|
"jest": "^29.7.0",
|
|
91
91
|
"unbuild": "^2.0.0"
|
|
92
92
|
},
|
|
93
|
-
"gitHead": "
|
|
93
|
+
"gitHead": "8e4b3b4f9cc52c8f1f1d270ab03a3c566073617a"
|
|
94
94
|
}
|