@arcblock/react-hooks 3.0.8 → 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/useBrowser.js +13 -16
- package/lib/useLineClamp.js +4 -5
- package/package.json +2 -2
package/lib/useBrowser.js
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
import
|
|
3
|
-
const
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
const o = new RegExp(`${s}/(?<version>[0-9.]+)`, "g").exec(e);
|
|
7
|
-
return (l = o == null ? void 0 : o.groups) == null ? void 0 : l.version;
|
|
1
|
+
import { useState as l } from "react";
|
|
2
|
+
import t from "ismobilejs";
|
|
3
|
+
const r = "ABTWallet", a = "ArcSphere";
|
|
4
|
+
function o(e, s) {
|
|
5
|
+
return new RegExp(`${s}/(?<version>[0-9.]+)`, "g").exec(e)?.groups?.version;
|
|
8
6
|
}
|
|
9
|
-
function
|
|
10
|
-
|
|
11
|
-
const e = (a = window == null ? void 0 : window.navigator) == null ? void 0 : a.userAgent, [s] = f({
|
|
7
|
+
function d() {
|
|
8
|
+
const e = window?.navigator?.userAgent, [s] = l({
|
|
12
9
|
// FIXME: @zhanghan 待应用中相关代码兼容 arcSphere 的判断后,才能移除 arcSphere 的判断
|
|
13
10
|
// https://github.com/search?q=org%3AArcBlock%20browser.wallet&type=code
|
|
14
11
|
// https://github.com/search?q=org%3Ablocklet+browser.wallet&type=code
|
|
15
|
-
wallet: e.indexOf(
|
|
16
|
-
walletVersion:
|
|
17
|
-
arcSphere: e.indexOf(
|
|
18
|
-
arcSphereVersion:
|
|
12
|
+
wallet: e.indexOf(r) > -1 || e.indexOf(a) > -1,
|
|
13
|
+
walletVersion: o(e, r),
|
|
14
|
+
arcSphere: e.indexOf(a) > -1,
|
|
15
|
+
arcSphereVersion: o(e, a),
|
|
19
16
|
wechat: /MicroMessenger/i.test(e),
|
|
20
17
|
mobile: {
|
|
21
18
|
apple: {
|
|
@@ -50,11 +47,11 @@ function b() {
|
|
|
50
47
|
phone: !1,
|
|
51
48
|
tablet: !1,
|
|
52
49
|
any: !1,
|
|
53
|
-
...
|
|
50
|
+
...t(e)
|
|
54
51
|
}
|
|
55
52
|
});
|
|
56
53
|
return s;
|
|
57
54
|
}
|
|
58
55
|
export {
|
|
59
|
-
|
|
56
|
+
d as default
|
|
60
57
|
};
|
package/lib/useLineClamp.js
CHANGED
|
@@ -30,7 +30,7 @@ function $({
|
|
|
30
30
|
if (!n.clientHeight)
|
|
31
31
|
return;
|
|
32
32
|
function b() {
|
|
33
|
-
(
|
|
33
|
+
(n?.getBoundingClientRect().height ?? 1) <= M ? h = r + 1 : y = r - 1;
|
|
34
34
|
}
|
|
35
35
|
for (; h <= y; ) {
|
|
36
36
|
if (r = Math.floor((h + y) / 2), n.innerText = t.slice(0, r) + g, d && n.appendChild(d.cloneNode(!0)), r === t.length) {
|
|
@@ -54,12 +54,11 @@ function $({
|
|
|
54
54
|
});
|
|
55
55
|
});
|
|
56
56
|
return N(() => {
|
|
57
|
-
var s;
|
|
58
57
|
if (o && !m.current) {
|
|
59
|
-
const
|
|
60
|
-
m.current =
|
|
58
|
+
const s = (a.current?.clientHeight ?? 1) + 1;
|
|
59
|
+
m.current = s, setTimeout(() => {
|
|
61
60
|
p({
|
|
62
|
-
lineHeight:
|
|
61
|
+
lineHeight: s,
|
|
63
62
|
originalText: o,
|
|
64
63
|
expanded: l,
|
|
65
64
|
ellipsis: c,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcblock/react-hooks",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.10",
|
|
4
4
|
"description": "React hooks used by arcblock products",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
41
41
|
"jest": "^29.7.0"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "8e4b3b4f9cc52c8f1f1d270ab03a3c566073617a"
|
|
44
44
|
}
|