@blocklet/discuss-kit-ux 2.0.2 → 2.0.3
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.
|
@@ -4,7 +4,7 @@ import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangeP
|
|
|
4
4
|
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
5
|
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
6
6
|
import { lazy } from "react";
|
|
7
|
-
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-
|
|
7
|
+
import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-CEuSe9YY.mjs";
|
|
8
8
|
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -3935,6 +3935,15 @@ const useChatInWallet = () => {
|
|
|
3935
3935
|
return false;
|
|
3936
3936
|
}
|
|
3937
3937
|
}, [walletVersion, mobile]);
|
|
3938
|
+
const isWebNavbar = useMemo(() => {
|
|
3939
|
+
try {
|
|
3940
|
+
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
3941
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
3942
|
+
} catch (e) {
|
|
3943
|
+
console.error(e);
|
|
3944
|
+
return false;
|
|
3945
|
+
}
|
|
3946
|
+
}, [walletVersion, mobile]);
|
|
3938
3947
|
const navigateToChat = ({ id: id2, title }) => {
|
|
3939
3948
|
if (isChatInWalletV2) {
|
|
3940
3949
|
navigate(`/chat-in-wallet/${id2}`);
|
|
@@ -3948,7 +3957,7 @@ const useChatInWallet = () => {
|
|
|
3948
3957
|
const updateUnreadState = useCallback((unread) => {
|
|
3949
3958
|
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
3950
3959
|
}, []);
|
|
3951
|
-
return { navigateToChat, navigateToChatList, isChatInWalletV2, updateUnreadState };
|
|
3960
|
+
return { navigateToChat, navigateToChatList, isChatInWalletV2, isWebNavbar, updateUnreadState };
|
|
3952
3961
|
};
|
|
3953
3962
|
function ChatList({ inWallet, ...rest }) {
|
|
3954
3963
|
const { t } = useLocaleContext();
|
|
@@ -4670,7 +4679,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
|
4670
4679
|
}
|
|
4671
4680
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 14L21 3m0 0l-6.5 18a.55.55 0 0 1-1 0L10 14l-7-3.5a.55.55 0 0 1 0-1z" }) });
|
|
4672
4681
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", "data-iconify": "tabler", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M14 15.5a3.5 3.5 0 1 0 7 0a3.5 3.5 0 1 0-7 0M3 19V8.5a3.5 3.5 0 0 1 7 0V19m-7-6h7m11-1v7" }) });
|
|
4673
|
-
const Editor = lazy(() => import("./editor-
|
|
4682
|
+
const Editor = lazy(() => import("./editor-BkMaHMub.mjs"));
|
|
4674
4683
|
function LazyEditor(props) {
|
|
4675
4684
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4676
4685
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -5520,17 +5529,28 @@ function Empty({ sx }) {
|
|
|
5520
5529
|
] });
|
|
5521
5530
|
}
|
|
5522
5531
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5532
|
+
var _a2, _b2;
|
|
5523
5533
|
const { session } = useSessionContext();
|
|
5524
5534
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5525
5535
|
const { unread } = useUnreadNotification();
|
|
5526
|
-
const { navigateToChatList, updateUnreadState } = useChatInWallet();
|
|
5536
|
+
const { navigateToChatList, updateUnreadState, isWebNavbar } = useChatInWallet();
|
|
5527
5537
|
useEffect(() => {
|
|
5528
5538
|
updateUnreadState(unread);
|
|
5529
5539
|
}, [unread, updateUnreadState]);
|
|
5530
5540
|
if (!initialized) {
|
|
5531
5541
|
return /* @__PURE__ */ jsx(CircularProgress, {});
|
|
5532
5542
|
}
|
|
5533
|
-
const mergedSx = [
|
|
5543
|
+
const mergedSx = [
|
|
5544
|
+
{
|
|
5545
|
+
display: "flex",
|
|
5546
|
+
height: "100%",
|
|
5547
|
+
bgcolor: "#fff",
|
|
5548
|
+
...((_a2 = window.chatInWallet) == null ? void 0 : _a2.safeAreaInsetTop) && {
|
|
5549
|
+
pt: `${window.chatInWallet.safeAreaInsetTop}px`
|
|
5550
|
+
}
|
|
5551
|
+
},
|
|
5552
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
5553
|
+
];
|
|
5534
5554
|
return /* @__PURE__ */ jsx(Box$1, { ...rest, sx: mergedSx, children: /* @__PURE__ */ jsxs(
|
|
5535
5555
|
Box$1,
|
|
5536
5556
|
{
|
|
@@ -5542,24 +5562,35 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5542
5562
|
},
|
|
5543
5563
|
children: [
|
|
5544
5564
|
/* @__PURE__ */ jsxs(Box$1, { sx: { flex: "0 0 auto", py: 1, px: 2 }, children: [
|
|
5545
|
-
/* @__PURE__ */ jsxs(
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
{
|
|
5549
|
-
|
|
5550
|
-
|
|
5551
|
-
|
|
5552
|
-
|
|
5553
|
-
|
|
5554
|
-
|
|
5555
|
-
|
|
5556
|
-
|
|
5557
|
-
|
|
5558
|
-
|
|
5559
|
-
|
|
5560
|
-
|
|
5561
|
-
|
|
5562
|
-
|
|
5565
|
+
isWebNavbar && /* @__PURE__ */ jsxs(
|
|
5566
|
+
Box$1,
|
|
5567
|
+
{
|
|
5568
|
+
sx: {
|
|
5569
|
+
display: "flex",
|
|
5570
|
+
justifyContent: "space-between",
|
|
5571
|
+
mr: -1,
|
|
5572
|
+
mb: 1
|
|
5573
|
+
},
|
|
5574
|
+
children: [
|
|
5575
|
+
/* @__PURE__ */ jsxs(
|
|
5576
|
+
Box$1,
|
|
5577
|
+
{
|
|
5578
|
+
onClick: () => {
|
|
5579
|
+
bridge.call("switchApp");
|
|
5580
|
+
},
|
|
5581
|
+
sx: { display: "flex", alignItems: "center", gap: 1 },
|
|
5582
|
+
children: [
|
|
5583
|
+
/* @__PURE__ */ jsx(Box$1, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
|
|
5584
|
+
/* @__PURE__ */ jsx(Box$1, { component: "span", sx: { typography: "h5", fontWeight: "medium" }, children: window.blocklet.appName }),
|
|
5585
|
+
/* @__PURE__ */ jsx(Box$1, { component: tablerSwitchHorizontal, sx: { fontSize: 15, color: "grey.600" } })
|
|
5586
|
+
]
|
|
5587
|
+
}
|
|
5588
|
+
),
|
|
5589
|
+
/* @__PURE__ */ jsx(SessionManager, { style: { padding: 0 }, showText: true, showRole: true, session })
|
|
5590
|
+
]
|
|
5591
|
+
}
|
|
5592
|
+
),
|
|
5593
|
+
/* @__PURE__ */ jsx(UserSearch, {})
|
|
5563
5594
|
] }),
|
|
5564
5595
|
/* @__PURE__ */ jsx(Divider, {}),
|
|
5565
5596
|
!!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: true }),
|
|
@@ -5574,7 +5605,19 @@ function ChatListInWallet({ sx, ...rest }) {
|
|
|
5574
5605
|
onClose: () => navigateToChatList(),
|
|
5575
5606
|
onOpen: () => {
|
|
5576
5607
|
},
|
|
5577
|
-
children: /* @__PURE__ */ jsx(
|
|
5608
|
+
children: /* @__PURE__ */ jsx(
|
|
5609
|
+
Box$1,
|
|
5610
|
+
{
|
|
5611
|
+
sx: {
|
|
5612
|
+
width: 1,
|
|
5613
|
+
height: 1,
|
|
5614
|
+
...((_b2 = window.chatInWallet) == null ? void 0 : _b2.safeAreaInsetTop) && {
|
|
5615
|
+
pt: `${window.chatInWallet.safeAreaInsetTop}px`
|
|
5616
|
+
}
|
|
5617
|
+
},
|
|
5618
|
+
children: /* @__PURE__ */ jsx(Outlet, {})
|
|
5619
|
+
}
|
|
5620
|
+
)
|
|
5578
5621
|
}
|
|
5579
5622
|
)
|
|
5580
5623
|
]
|
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-
|
|
2
|
+
import { T, n, W, A, m, ad, B, F, K, J, L, ap, Y, X, $, Z, _, a1, w, C, x, y, E, a5, a6, ah, a8, O, Q, ac, D, ag, af, H, G, b, k, ae, M, P, ao, v, q, R, S, a9, aq, o, a2, a4, ai, al, ak, am, ar, N, as, l, f, p, r, j, t, h, aa, U, c, a0, z, a7, ab, u, an, d, at, a3, aj, e } from "./index-CEuSe9YY.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
package/dist/index.umd.js
CHANGED
|
@@ -3862,6 +3862,15 @@ var __publicField = (obj, key, value) => {
|
|
|
3862
3862
|
return false;
|
|
3863
3863
|
}
|
|
3864
3864
|
}, [walletVersion, mobile]);
|
|
3865
|
+
const isWebNavbar = react.useMemo(() => {
|
|
3866
|
+
try {
|
|
3867
|
+
const targetVersion = mobile.apple.device ? "5.4.6" : "5.4.4";
|
|
3868
|
+
return !!walletVersion && cmp(walletVersion, targetVersion) === 1;
|
|
3869
|
+
} catch (e) {
|
|
3870
|
+
console.error(e);
|
|
3871
|
+
return false;
|
|
3872
|
+
}
|
|
3873
|
+
}, [walletVersion, mobile]);
|
|
3865
3874
|
const navigateToChat = ({ id: id2, title }) => {
|
|
3866
3875
|
if (isChatInWalletV2) {
|
|
3867
3876
|
navigate(`/chat-in-wallet/${id2}`);
|
|
@@ -3875,7 +3884,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3875
3884
|
const updateUnreadState = react.useCallback((unread) => {
|
|
3876
3885
|
bridge.call("updateUnreadState", { unread, appId: window.blocklet.appPid, timestamp: /* @__PURE__ */ new Date() });
|
|
3877
3886
|
}, []);
|
|
3878
|
-
return { navigateToChat, navigateToChatList, isChatInWalletV2, updateUnreadState };
|
|
3887
|
+
return { navigateToChat, navigateToChatList, isChatInWalletV2, isWebNavbar, updateUnreadState };
|
|
3879
3888
|
};
|
|
3880
3889
|
function ChatList({ inWallet, ...rest }) {
|
|
3881
3890
|
const { t } = context.useLocaleContext();
|
|
@@ -5447,17 +5456,28 @@ var __publicField = (obj, key, value) => {
|
|
|
5447
5456
|
] });
|
|
5448
5457
|
}
|
|
5449
5458
|
function ChatListInWallet({ sx, ...rest }) {
|
|
5459
|
+
var _a2, _b2;
|
|
5450
5460
|
const { session } = useSessionContext();
|
|
5451
5461
|
const { initialized, chats, activeChatId } = useChatContext();
|
|
5452
5462
|
const { unread } = useUnreadNotification();
|
|
5453
|
-
const { navigateToChatList, updateUnreadState } = useChatInWallet();
|
|
5463
|
+
const { navigateToChatList, updateUnreadState, isWebNavbar } = useChatInWallet();
|
|
5454
5464
|
react.useEffect(() => {
|
|
5455
5465
|
updateUnreadState(unread);
|
|
5456
5466
|
}, [unread, updateUnreadState]);
|
|
5457
5467
|
if (!initialized) {
|
|
5458
5468
|
return /* @__PURE__ */ jsxRuntime.jsx(CircularProgress, {});
|
|
5459
5469
|
}
|
|
5460
|
-
const mergedSx = [
|
|
5470
|
+
const mergedSx = [
|
|
5471
|
+
{
|
|
5472
|
+
display: "flex",
|
|
5473
|
+
height: "100%",
|
|
5474
|
+
bgcolor: "#fff",
|
|
5475
|
+
...((_a2 = window.chatInWallet) == null ? void 0 : _a2.safeAreaInsetTop) && {
|
|
5476
|
+
pt: `${window.chatInWallet.safeAreaInsetTop}px`
|
|
5477
|
+
}
|
|
5478
|
+
},
|
|
5479
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
5480
|
+
];
|
|
5461
5481
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { ...rest, sx: mergedSx, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5462
5482
|
Box,
|
|
5463
5483
|
{
|
|
@@ -5469,24 +5489,35 @@ var __publicField = (obj, key, value) => {
|
|
|
5469
5489
|
},
|
|
5470
5490
|
children: [
|
|
5471
5491
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { flex: "0 0 auto", py: 1, px: 2 }, children: [
|
|
5472
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
{
|
|
5476
|
-
|
|
5477
|
-
|
|
5478
|
-
|
|
5479
|
-
|
|
5480
|
-
|
|
5481
|
-
|
|
5482
|
-
|
|
5483
|
-
|
|
5484
|
-
|
|
5485
|
-
|
|
5486
|
-
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
|
-
|
|
5492
|
+
isWebNavbar && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
5493
|
+
Box,
|
|
5494
|
+
{
|
|
5495
|
+
sx: {
|
|
5496
|
+
display: "flex",
|
|
5497
|
+
justifyContent: "space-between",
|
|
5498
|
+
mr: -1,
|
|
5499
|
+
mb: 1
|
|
5500
|
+
},
|
|
5501
|
+
children: [
|
|
5502
|
+
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
5503
|
+
Box,
|
|
5504
|
+
{
|
|
5505
|
+
onClick: () => {
|
|
5506
|
+
bridge.call("switchApp");
|
|
5507
|
+
},
|
|
5508
|
+
sx: { display: "flex", alignItems: "center", gap: 1 },
|
|
5509
|
+
children: [
|
|
5510
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "img", src: window.blocklet.appLogo, alt: "", sx: { width: 20, height: 20 } }),
|
|
5511
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { typography: "h5", fontWeight: "medium" }, children: window.blocklet.appName }),
|
|
5512
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerSwitchHorizontal, sx: { fontSize: 15, color: "grey.600" } })
|
|
5513
|
+
]
|
|
5514
|
+
}
|
|
5515
|
+
),
|
|
5516
|
+
/* @__PURE__ */ jsxRuntime.jsx(SessionManager, { style: { padding: 0 }, showText: true, showRole: true, session })
|
|
5517
|
+
]
|
|
5518
|
+
}
|
|
5519
|
+
),
|
|
5520
|
+
/* @__PURE__ */ jsxRuntime.jsx(UserSearch, {})
|
|
5490
5521
|
] }),
|
|
5491
5522
|
/* @__PURE__ */ jsxRuntime.jsx(material.Divider, {}),
|
|
5492
5523
|
!!(chats == null ? void 0 : chats.length) && /* @__PURE__ */ jsxRuntime.jsx(ChatList, { sx: { flex: 1, overflowY: "auto" }, inWallet: true }),
|
|
@@ -5501,7 +5532,19 @@ var __publicField = (obj, key, value) => {
|
|
|
5501
5532
|
onClose: () => navigateToChatList(),
|
|
5502
5533
|
onOpen: () => {
|
|
5503
5534
|
},
|
|
5504
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5535
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5536
|
+
Box,
|
|
5537
|
+
{
|
|
5538
|
+
sx: {
|
|
5539
|
+
width: 1,
|
|
5540
|
+
height: 1,
|
|
5541
|
+
...((_b2 = window.chatInWallet) == null ? void 0 : _b2.safeAreaInsetTop) && {
|
|
5542
|
+
pt: `${window.chatInWallet.safeAreaInsetTop}px`
|
|
5543
|
+
}
|
|
5544
|
+
},
|
|
5545
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Outlet, {})
|
|
5546
|
+
}
|
|
5547
|
+
)
|
|
5505
5548
|
}
|
|
5506
5549
|
)
|
|
5507
5550
|
]
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.3",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -31,8 +31,8 @@
|
|
|
31
31
|
"@arcblock/bridge": "^2.9.77",
|
|
32
32
|
"@arcblock/react-hooks": "^2.9.80",
|
|
33
33
|
"@arcblock/ws": "^1.18.116",
|
|
34
|
-
"@blocklet/editor": "2.0.
|
|
35
|
-
"@blocklet/labels": "2.0.
|
|
34
|
+
"@blocklet/editor": "2.0.3",
|
|
35
|
+
"@blocklet/labels": "2.0.3",
|
|
36
36
|
"@blocklet/uploader": "^0.1.2",
|
|
37
37
|
"@emotion/css": "^11.10.5",
|
|
38
38
|
"@emotion/react": "^11.10.5",
|
|
@@ -99,5 +99,5 @@
|
|
|
99
99
|
"resolutions": {
|
|
100
100
|
"react": "^18.2.0"
|
|
101
101
|
},
|
|
102
|
-
"gitHead": "
|
|
102
|
+
"gitHead": "f5202dfe329d8b5e093c74a5b9c984aa462a2ec8"
|
|
103
103
|
}
|