@blocklet/discuss-kit-ux 1.6.188 → 1.6.191
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/dist/components/hooks/session.d.ts +8 -3
- package/dist/components/posts/post-content.d.ts +1 -2
- package/dist/{editor-1S0suIcX.mjs → editor-E23ceKmd.mjs} +1 -1
- package/dist/{index-q1fCyaqz.mjs → index-OmtAwPz3.mjs} +214 -130
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +59 -58
- package/dist/index.umd.js +154 -70
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export * from "@blocklet/labels";
|
|
2
|
-
import {
|
|
2
|
+
import { O, k, T, A, j, a9, B, z, H, F, J, al, W, U, X, Z, q, C, v, w, y, a1, a2, ad, a4, L, N, D, ac, ab, E, G, b, h, aa, M, P, ak, o, n, a8, R, S, a5, am, m, _, a0, ae, ah, ag, ai, an, K, ao, l, p, r, f, t, a6, Q, c, Y, x, a3, a7, u, aj, d, ap, $, af, e } from "./index-OmtAwPz3.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
|
@@ -7,7 +7,6 @@ import "@mui/material/Button";
|
|
|
7
7
|
import "@mui/lab/LoadingButton";
|
|
8
8
|
import "@mui/icons-material";
|
|
9
9
|
import "@arcblock/ux/lib/Locale/context";
|
|
10
|
-
import "@arcblock/did-connect/lib/Session";
|
|
11
10
|
import "@mui/material";
|
|
12
11
|
import "@mui/material/styles";
|
|
13
12
|
import "lodash/isNil";
|
|
@@ -40,6 +39,7 @@ import "@mui/material/Avatar";
|
|
|
40
39
|
import "@mui/icons-material/BrokenImage";
|
|
41
40
|
import "@iconify/react";
|
|
42
41
|
import "@arcblock/ux/lib/Empty";
|
|
42
|
+
import "@arcblock/did-connect/lib/Session";
|
|
43
43
|
import "@mui/icons-material/NotificationsActiveOutlined";
|
|
44
44
|
import "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
45
45
|
import "@arcblock/did-connect/lib/Address";
|
|
@@ -71,77 +71,78 @@ import "js-cookie";
|
|
|
71
71
|
import "@arcblock/ws";
|
|
72
72
|
import "@emotion/css";
|
|
73
73
|
export {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
O as AccessControl,
|
|
75
|
+
k as AuthorInfo,
|
|
76
|
+
T as AuthzProvider,
|
|
77
77
|
A as Avatar,
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
j as Avatars,
|
|
79
|
+
a9 as Back,
|
|
80
80
|
B as Badge,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
81
|
+
z as BinaryThumb,
|
|
82
|
+
H as BlogCard,
|
|
83
|
+
F as BlogList,
|
|
84
|
+
J as BlogPermaLink,
|
|
85
|
+
al as ButtonGroup,
|
|
86
|
+
W as Chat,
|
|
87
|
+
U as ChatClient,
|
|
88
|
+
X as ChatHeaderAddon,
|
|
89
|
+
Z as ChatProvider,
|
|
90
|
+
q as Comment,
|
|
91
91
|
C as CommentInput,
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
92
|
+
v as CommentList,
|
|
93
|
+
w as CommentsContext,
|
|
94
|
+
y as CommentsProvider,
|
|
95
|
+
a1 as Confirm,
|
|
96
|
+
a2 as ConfirmContext,
|
|
97
|
+
ad as ConfirmNavigation,
|
|
98
|
+
a4 as ConfirmProvider,
|
|
99
|
+
L as CoverImage,
|
|
100
|
+
N as CoverImageUpload,
|
|
101
101
|
D as DefaultEditorConfigProvider,
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
ac as DirtyPromptContainer,
|
|
103
|
+
ab as EditorPreview,
|
|
104
104
|
E as EmptyStatus,
|
|
105
105
|
G as GithubReaction,
|
|
106
106
|
b as Input,
|
|
107
|
-
|
|
108
|
-
|
|
107
|
+
h as InternalThemeProvider,
|
|
108
|
+
aa as LazyEditor,
|
|
109
109
|
M as Menu,
|
|
110
110
|
P as Pagination,
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
111
|
+
ak as PointUpProvider,
|
|
112
|
+
o as Post,
|
|
113
|
+
n as PostContent,
|
|
114
|
+
a8 as PreviousLocationRecorder,
|
|
115
115
|
R as RelativeTime,
|
|
116
116
|
S as ScrollableEditorWrapper,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
a5 as SecureLabelPicker,
|
|
118
|
+
am as SegmentedControl,
|
|
119
|
+
m as SystemUser,
|
|
120
|
+
_ as UnreadNotificationContext,
|
|
121
|
+
a0 as UnreadNotificationProvider,
|
|
122
|
+
ae as UploaderContext,
|
|
123
|
+
ah as UploaderProvider,
|
|
124
|
+
ag as UploaderTrigger,
|
|
125
|
+
ai as composeImageUrl,
|
|
126
|
+
an as create,
|
|
127
|
+
K as getBlogLink,
|
|
128
|
+
ao as getWsClient,
|
|
129
129
|
l as lexicalUtils,
|
|
130
130
|
p as preferences,
|
|
131
131
|
r as routes,
|
|
132
|
-
|
|
132
|
+
f as themeOverrides,
|
|
133
133
|
t as translations,
|
|
134
|
-
|
|
135
|
-
|
|
134
|
+
a6 as useApiErrorHandler,
|
|
135
|
+
Q as useAuthzContext,
|
|
136
136
|
c as useChanged,
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
137
|
+
Y as useChatContext,
|
|
138
|
+
x as useCommentsContext,
|
|
139
|
+
a3 as useConfirm,
|
|
140
|
+
a7 as useDefaultApiErrorHandler,
|
|
141
141
|
u as useNow,
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
142
|
+
aj as usePointUpContext,
|
|
143
|
+
d as useSessionContext,
|
|
144
|
+
ap as useSubscription,
|
|
145
|
+
$ as useUnreadNotification,
|
|
146
|
+
af as useUploader,
|
|
147
|
+
e as utils
|
|
147
148
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -451,7 +451,7 @@ var __publicField = (obj, key, value) => {
|
|
|
451
451
|
...editorConfig,
|
|
452
452
|
...inSmallView && {
|
|
453
453
|
toolbar: {
|
|
454
|
-
items: ["block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
|
|
454
|
+
items: ["component", "block", "italic", "bold", "underline", "media", ...((_a2 = editorConfig == null ? void 0 : editorConfig.toolbar) == null ? void 0 : _a2.items) || []]
|
|
455
455
|
}
|
|
456
456
|
}
|
|
457
457
|
};
|
|
@@ -849,9 +849,13 @@ var __publicField = (obj, key, value) => {
|
|
|
849
849
|
] }) : null;
|
|
850
850
|
}
|
|
851
851
|
const useSessionContext = () => {
|
|
852
|
-
var _a2, _b2;
|
|
852
|
+
var _a2, _b2, _c, _d;
|
|
853
853
|
const ctx = react.useContext(Session.SessionContext) || {};
|
|
854
854
|
const loginRole = (_b2 = (_a2 = ctx == null ? void 0 : ctx.session) == null ? void 0 : _a2.user) == null ? void 0 : _b2.role;
|
|
855
|
+
const permissionSet = react.useMemo(() => {
|
|
856
|
+
var _a3, _b3;
|
|
857
|
+
return new Set(((_b3 = (_a3 = ctx.session) == null ? void 0 : _a3.user) == null ? void 0 : _b3.permissions) || []);
|
|
858
|
+
}, [(_d = (_c = ctx.session) == null ? void 0 : _c.user) == null ? void 0 : _d.permissions]);
|
|
855
859
|
return {
|
|
856
860
|
...ctx,
|
|
857
861
|
isAdmin: ["admin", "owner"].includes(loginRole),
|
|
@@ -861,6 +865,13 @@ var __publicField = (obj, key, value) => {
|
|
|
861
865
|
}
|
|
862
866
|
const passportsArr = Array.isArray(passports) ? passports : [passports];
|
|
863
867
|
return passportsArr.includes(loginRole);
|
|
868
|
+
},
|
|
869
|
+
hasAnyPermission: (perms) => {
|
|
870
|
+
if (!perms || perms.length === 0) {
|
|
871
|
+
return true;
|
|
872
|
+
}
|
|
873
|
+
const permsArr = Array.isArray(perms) ? perms : [perms];
|
|
874
|
+
return permsArr.some((item) => permissionSet.has(item));
|
|
864
875
|
}
|
|
865
876
|
};
|
|
866
877
|
};
|
|
@@ -1011,7 +1022,16 @@ var __publicField = (obj, key, value) => {
|
|
|
1011
1022
|
}
|
|
1012
1023
|
);
|
|
1013
1024
|
}
|
|
1014
|
-
const HtmlTooltip$1 = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1025
|
+
const HtmlTooltip$1 = styles.styled(({ className, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1026
|
+
Tooltip,
|
|
1027
|
+
{
|
|
1028
|
+
PopperProps: {
|
|
1029
|
+
disablePortal: true
|
|
1030
|
+
},
|
|
1031
|
+
...props,
|
|
1032
|
+
classes: { popper: className }
|
|
1033
|
+
}
|
|
1034
|
+
))(() => ({
|
|
1015
1035
|
[`& .${Tooltip.tooltipClasses.tooltip}`]: {
|
|
1016
1036
|
backgroundColor: "transparent",
|
|
1017
1037
|
maxWidth: "initial"
|
|
@@ -1113,10 +1133,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1113
1133
|
);
|
|
1114
1134
|
return /* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 1, fontSize }, ...rest, children: [
|
|
1115
1135
|
renderAvatar(),
|
|
1116
|
-
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column" }, children: [
|
|
1136
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", flexDirection: "column", flex: 1 }, children: [
|
|
1117
1137
|
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
1118
1138
|
Box,
|
|
1119
1139
|
{
|
|
1140
|
+
className: "author-info-title",
|
|
1120
1141
|
sx: { display: "flex", alignItems: "center", minHeight: 20, flexWrap: "wrap", lineHeight: 1.5 },
|
|
1121
1142
|
lineHeight: 1,
|
|
1122
1143
|
children: [
|
|
@@ -1236,7 +1257,6 @@ var __publicField = (obj, key, value) => {
|
|
|
1236
1257
|
content,
|
|
1237
1258
|
editing = false,
|
|
1238
1259
|
onExitEditing,
|
|
1239
|
-
onCancel,
|
|
1240
1260
|
onSubmit,
|
|
1241
1261
|
autoCollapse,
|
|
1242
1262
|
enableHeadingsIdPlugin,
|
|
@@ -1250,7 +1270,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1250
1270
|
sx: {
|
|
1251
1271
|
".be-editable": { maxHeight: 768, overflow: "auto", minHeight: `${Math.max(innerHeight, 200)}px !important` }
|
|
1252
1272
|
},
|
|
1253
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(PostEdit, { content, onCancel, send: onSubmit, onSuccess: onExitEditing })
|
|
1273
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(PostEdit, { content, onCancel: onExitEditing, send: onSubmit, onSuccess: onExitEditing })
|
|
1254
1274
|
}
|
|
1255
1275
|
);
|
|
1256
1276
|
}
|
|
@@ -1432,7 +1452,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1432
1452
|
return /* @__PURE__ */ jsxRuntime.jsxs(Root$2, { sx: { position: "relative", mt: 2, py: 1 }, ...rest, children: [
|
|
1433
1453
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { id: post.id, flex: "1", className: clsx({ "post-highlighted": isTargetPost && hasEnteredViewport }), children: [
|
|
1434
1454
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { display: "flex", justifyContent: "space-between", alignItems: "start", children: [
|
|
1435
|
-
/* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { user: post.author, createdAt: renderTime(), showProfileCard }),
|
|
1455
|
+
/* @__PURE__ */ jsxRuntime.jsx(AuthorInfo, { size: "sm", user: post.author, createdAt: renderTime(), showProfileCard }),
|
|
1436
1456
|
/* @__PURE__ */ jsxRuntime.jsx(Menu, { items: menuItems, style: { position: "absolute", right: 0, top: 0 } })
|
|
1437
1457
|
] }),
|
|
1438
1458
|
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { ml: 5.5 }, children: [
|
|
@@ -1484,6 +1504,7 @@ var __publicField = (obj, key, value) => {
|
|
|
1484
1504
|
renderExtraContent && renderExtraContent(postContext)
|
|
1485
1505
|
] });
|
|
1486
1506
|
}
|
|
1507
|
+
const tablerMessageCircle = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsx("path", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "m3 20l1.3-3.9C1.976 12.663 2.874 8.228 6.4 5.726c3.526-2.501 8.59-2.296 11.845.48c3.255 2.777 3.695 7.266 1.029 10.501C16.608 19.942 11.659 20.922 7.7 19z" }) });
|
|
1487
1508
|
const iconoirThumbsUp = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeWidth: 1.5, children: [
|
|
1488
1509
|
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M16.472 20H4.1a.6.6 0 0 1-.6-.6V9.6a.6.6 0 0 1 .6-.6h2.768a2 2 0 0 0 1.715-.971l2.71-4.517a1.631 1.631 0 0 1 2.961 1.308l-1.022 3.408a.6.6 0 0 0 .574.772h4.575a2 2 0 0 1 1.93 2.526l-1.91 7A2 2 0 0 1 16.473 20Z" }),
|
|
1489
1510
|
/* @__PURE__ */ jsxRuntime.jsx("path", { strokeLinejoin: "round", d: "M7 20V9" })
|
|
@@ -1716,6 +1737,10 @@ var __publicField = (obj, key, value) => {
|
|
|
1716
1737
|
}
|
|
1717
1738
|
}
|
|
1718
1739
|
`;
|
|
1740
|
+
const tablerMoodPlus = (props) => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsxRuntime.jsxs("g", { fill: "none", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, children: [
|
|
1741
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M20.985 12.528a9 9 0 1 0-8.45 8.456M16 19h6m-3-3v6M9 10h.01M15 10h.01" }),
|
|
1742
|
+
/* @__PURE__ */ jsxRuntime.jsx("path", { d: "M9.5 15c.658.64 1.56 1 2.5 1s1.842-.36 2.5-1" })
|
|
1743
|
+
] }) });
|
|
1719
1744
|
const emojiFont = {
|
|
1720
1745
|
fontFamily: '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color"'
|
|
1721
1746
|
};
|
|
@@ -1823,10 +1848,11 @@ var __publicField = (obj, key, value) => {
|
|
|
1823
1848
|
sx: {
|
|
1824
1849
|
lineHeight: "24px",
|
|
1825
1850
|
fontSize: 13,
|
|
1851
|
+
border: 1,
|
|
1852
|
+
borderColor: "divider",
|
|
1826
1853
|
borderRadius: 1,
|
|
1827
1854
|
cursor: "pointer",
|
|
1828
1855
|
...selected && {
|
|
1829
|
-
border: 1,
|
|
1830
1856
|
borderColor: "primary.light",
|
|
1831
1857
|
bgcolor: (theme) => material.alpha(theme.palette.primary.light, 0.2)
|
|
1832
1858
|
}
|
|
@@ -1846,14 +1872,21 @@ var __publicField = (obj, key, value) => {
|
|
|
1846
1872
|
display: "flex",
|
|
1847
1873
|
justifyContent: "center",
|
|
1848
1874
|
alignItems: "center",
|
|
1849
|
-
|
|
1850
|
-
|
|
1851
|
-
|
|
1852
|
-
|
|
1853
|
-
|
|
1875
|
+
gap: 0.75,
|
|
1876
|
+
ml: -0.25,
|
|
1877
|
+
cursor: "pointer",
|
|
1878
|
+
fontWeight: "medium",
|
|
1879
|
+
".github-reaction-text": {
|
|
1880
|
+
color: "text.secondary"
|
|
1881
|
+
},
|
|
1882
|
+
"&:hover .github-reaction-text": {
|
|
1883
|
+
color: "secondary.main"
|
|
1884
|
+
}
|
|
1854
1885
|
},
|
|
1886
|
+
onClick: handleOpen,
|
|
1855
1887
|
children: [
|
|
1856
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1888
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "github-reaction-text", component: tablerMoodPlus, sx: { fontSize: 18 } }),
|
|
1889
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Box, { className: "github-reaction-text", component: "span", sx: { fontSize: 13 }, children: "Sticker" }),
|
|
1857
1890
|
open && /* @__PURE__ */ jsxRuntime.jsx(material.ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
1858
1891
|
material.Box,
|
|
1859
1892
|
{
|
|
@@ -2037,23 +2070,36 @@ var __publicField = (obj, key, value) => {
|
|
|
2037
2070
|
};
|
|
2038
2071
|
const render = ({ post, interactive }) => {
|
|
2039
2072
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
2040
|
-
/* @__PURE__ */ jsxRuntime.
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2073
|
+
/* @__PURE__ */ jsxRuntime.jsxs(Box, { sx: { display: "flex", alignItems: "center", gap: 3, mt: 1 }, children: [
|
|
2074
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2075
|
+
GithubReaction,
|
|
2076
|
+
{
|
|
2077
|
+
data: (post == null ? void 0 : post.rating) || [],
|
|
2078
|
+
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2079
|
+
onUnrate: () => onUnrate(post),
|
|
2080
|
+
interactive
|
|
2081
|
+
}
|
|
2082
|
+
),
|
|
2083
|
+
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
|
|
2084
|
+
Box,
|
|
2085
|
+
{
|
|
2086
|
+
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)),
|
|
2087
|
+
sx: {
|
|
2088
|
+
display: "flex",
|
|
2089
|
+
alignItems: "center",
|
|
2090
|
+
gap: 0.75,
|
|
2091
|
+
fontSize: 13,
|
|
2092
|
+
color: "text.secondary",
|
|
2093
|
+
lineHeight: 1,
|
|
2094
|
+
"&:hover": { cursor: "pointer" }
|
|
2095
|
+
},
|
|
2096
|
+
children: [
|
|
2097
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: tablerMessageCircle, sx: { fontSize: 18, color: "text.secondary" } }),
|
|
2098
|
+
/* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
|
|
2099
|
+
]
|
|
2100
|
+
}
|
|
2101
|
+
)
|
|
2102
|
+
] }),
|
|
2057
2103
|
inputVisible && /* @__PURE__ */ jsxRuntime.jsx(Box, { my: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2058
2104
|
CommentInput,
|
|
2059
2105
|
{
|
|
@@ -2061,7 +2107,8 @@ var __publicField = (obj, key, value) => {
|
|
|
2061
2107
|
onSuccess: () => setInputVisible(false),
|
|
2062
2108
|
draftKey: `post-${post.id}`
|
|
2063
2109
|
}
|
|
2064
|
-
) })
|
|
2110
|
+
) }),
|
|
2111
|
+
/* @__PURE__ */ jsxRuntime.jsx(material.Divider, { sx: { mt: 3 } })
|
|
2065
2112
|
] });
|
|
2066
2113
|
};
|
|
2067
2114
|
const renderExtraContent = ({ post }) => {
|
|
@@ -2641,7 +2688,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2641
2688
|
pt: `${100 / aspectRatio}%`,
|
|
2642
2689
|
overflow: "hidden",
|
|
2643
2690
|
position: "relative",
|
|
2644
|
-
borderRadius:
|
|
2691
|
+
borderRadius: 1,
|
|
2645
2692
|
...shadow && { boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px" },
|
|
2646
2693
|
// https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari
|
|
2647
2694
|
transform: "translateZ(0)"
|
|
@@ -2722,7 +2769,7 @@ var __publicField = (obj, key, value) => {
|
|
|
2722
2769
|
height: 0,
|
|
2723
2770
|
pt: "56%",
|
|
2724
2771
|
overflow: "hidden",
|
|
2725
|
-
borderRadius:
|
|
2772
|
+
borderRadius: 1,
|
|
2726
2773
|
bgcolor: "grey.300",
|
|
2727
2774
|
cursor: "pointer"
|
|
2728
2775
|
},
|
|
@@ -3209,7 +3256,7 @@ var __publicField = (obj, key, value) => {
|
|
|
3209
3256
|
alignItems: "center",
|
|
3210
3257
|
border: "1px solid #bbb",
|
|
3211
3258
|
borderRadius: 1,
|
|
3212
|
-
|
|
3259
|
+
overflow: "hidden"
|
|
3213
3260
|
},
|
|
3214
3261
|
children: [
|
|
3215
3262
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3218,10 +3265,10 @@ var __publicField = (obj, key, value) => {
|
|
|
3218
3265
|
sx: {
|
|
3219
3266
|
display: "flex",
|
|
3220
3267
|
alignItems: "center",
|
|
3221
|
-
width:
|
|
3268
|
+
width: 180,
|
|
3222
3269
|
alignSelf: "stretch",
|
|
3223
|
-
px:
|
|
3224
|
-
bgcolor: "grey.
|
|
3270
|
+
px: 1.25,
|
|
3271
|
+
bgcolor: "grey.200"
|
|
3225
3272
|
},
|
|
3226
3273
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3227
3274
|
material.Box,
|
|
@@ -3233,10 +3280,11 @@ var __publicField = (obj, key, value) => {
|
|
|
3233
3280
|
width: 1,
|
|
3234
3281
|
overflow: "hidden",
|
|
3235
3282
|
whiteSpace: "nowrap",
|
|
3236
|
-
fontSize: 14,
|
|
3237
3283
|
border: 0,
|
|
3238
3284
|
bgcolor: "inherit",
|
|
3239
|
-
outline: "none"
|
|
3285
|
+
outline: "none",
|
|
3286
|
+
fontSize: 14,
|
|
3287
|
+
color: "text.secondary"
|
|
3240
3288
|
}
|
|
3241
3289
|
}
|
|
3242
3290
|
)
|
|
@@ -3245,20 +3293,19 @@ var __publicField = (obj, key, value) => {
|
|
|
3245
3293
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3246
3294
|
material.InputBase,
|
|
3247
3295
|
{
|
|
3248
|
-
className: "blog-link",
|
|
3249
3296
|
value: slug,
|
|
3250
3297
|
onChange: (e) => onChange(e.target.value),
|
|
3251
|
-
sx: { ml:
|
|
3298
|
+
sx: { ml: 0.5, flex: 1, bgcolor: "transparent", input: { py: 1, fontSize: 14 } }
|
|
3252
3299
|
}
|
|
3253
3300
|
),
|
|
3254
3301
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3255
3302
|
material.IconButton,
|
|
3256
3303
|
{
|
|
3257
|
-
sx: {
|
|
3304
|
+
sx: { px: 1 },
|
|
3258
3305
|
onClick: () => {
|
|
3259
3306
|
copy(joinUrl(prefix, slug));
|
|
3260
3307
|
},
|
|
3261
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopy, { sx: { fontSize:
|
|
3308
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ContentCopy, { sx: { fontSize: 18 } })
|
|
3262
3309
|
}
|
|
3263
3310
|
)
|
|
3264
3311
|
]
|
|
@@ -3769,6 +3816,9 @@ var __publicField = (obj, key, value) => {
|
|
|
3769
3816
|
}
|
|
3770
3817
|
}
|
|
3771
3818
|
};
|
|
3819
|
+
const renderPostContent = () => {
|
|
3820
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "author-chat-item", children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) });
|
|
3821
|
+
};
|
|
3772
3822
|
const menuItems = [];
|
|
3773
3823
|
const isSender = message.sender.did === ((_a2 = session == null ? void 0 : session.user) == null ? void 0 : _a2.did);
|
|
3774
3824
|
const messageDate = new Date(message.createdAt);
|
|
@@ -3796,10 +3846,18 @@ var __publicField = (obj, key, value) => {
|
|
|
3796
3846
|
display: "flex !important"
|
|
3797
3847
|
}
|
|
3798
3848
|
},
|
|
3849
|
+
".author-info-title": {
|
|
3850
|
+
fontSize: 14,
|
|
3851
|
+
fontWeight: 500
|
|
3852
|
+
},
|
|
3853
|
+
".author-chat-item": {
|
|
3854
|
+
ml: compactMessage ? 6 : 0,
|
|
3855
|
+
width: "90%"
|
|
3856
|
+
},
|
|
3799
3857
|
...{
|
|
3800
3858
|
".be-editable": {
|
|
3801
3859
|
"& > *:last-child": {
|
|
3802
|
-
|
|
3860
|
+
mb: "0 !important"
|
|
3803
3861
|
}
|
|
3804
3862
|
}
|
|
3805
3863
|
}
|
|
@@ -3820,17 +3878,21 @@ var __publicField = (obj, key, value) => {
|
|
|
3820
3878
|
}
|
|
3821
3879
|
}
|
|
3822
3880
|
),
|
|
3823
|
-
!compactMessage
|
|
3881
|
+
!compactMessage ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
3824
3882
|
AuthorInfo,
|
|
3825
3883
|
{
|
|
3826
3884
|
showBadge: false,
|
|
3827
3885
|
showProfileCard: true,
|
|
3886
|
+
showDID: false,
|
|
3828
3887
|
user: message.sender,
|
|
3829
3888
|
createdAt: showTime ? message.createdAt : void 0,
|
|
3830
|
-
size: "sm"
|
|
3889
|
+
size: "sm",
|
|
3890
|
+
style: {
|
|
3891
|
+
alignItems: "flex-start"
|
|
3892
|
+
},
|
|
3893
|
+
children: renderPostContent()
|
|
3831
3894
|
}
|
|
3832
|
-
)
|
|
3833
|
-
/* @__PURE__ */ jsxRuntime.jsx(Box, { sx: { ml: 6, width: "90%" }, children: /* @__PURE__ */ jsxRuntime.jsx(PostContent, { content: message.content }) })
|
|
3895
|
+
) : renderPostContent()
|
|
3834
3896
|
]
|
|
3835
3897
|
}
|
|
3836
3898
|
);
|
|
@@ -4122,6 +4184,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4122
4184
|
const isActive = isActiveChat(chat.id);
|
|
4123
4185
|
const containerRef = react.useRef(null);
|
|
4124
4186
|
const [isAtBottom, setIsAtBottom] = react.useState(true);
|
|
4187
|
+
const [isLoadingMore, setIsLoadingMore] = react.useState(false);
|
|
4125
4188
|
const scrollToBottom = () => {
|
|
4126
4189
|
var _a3, _b3;
|
|
4127
4190
|
(_b3 = containerRef.current) == null ? void 0 : _b3.scrollTo({ top: ((_a3 = containerRef.current) == null ? void 0 : _a3.scrollHeight) || 0, behavior: "smooth" });
|
|
@@ -4159,7 +4222,23 @@ var __publicField = (obj, key, value) => {
|
|
|
4159
4222
|
py: 2.5,
|
|
4160
4223
|
px: 1.25,
|
|
4161
4224
|
gap: 1,
|
|
4162
|
-
background: "rgba(249, 250, 251, 1)"
|
|
4225
|
+
background: "rgba(249, 250, 251, 1)",
|
|
4226
|
+
// 闪烁
|
|
4227
|
+
"@keyframes blinking": {
|
|
4228
|
+
"0%": { opacity: 0 },
|
|
4229
|
+
"50%": { opacity: 1 },
|
|
4230
|
+
"100%": { opacity: 0 }
|
|
4231
|
+
},
|
|
4232
|
+
// 渐变显示
|
|
4233
|
+
"@keyframes fade-in": {
|
|
4234
|
+
"0%": { opacity: 0 },
|
|
4235
|
+
"100%": { opacity: 1 }
|
|
4236
|
+
},
|
|
4237
|
+
// 用于弱化消息渲染闪烁
|
|
4238
|
+
".message-item": {
|
|
4239
|
+
animation: "fade-in 0.2s linear",
|
|
4240
|
+
animationIterationCount: 1
|
|
4241
|
+
}
|
|
4163
4242
|
},
|
|
4164
4243
|
ref: containerRef,
|
|
4165
4244
|
children: [
|
|
@@ -4171,32 +4250,37 @@ var __publicField = (obj, key, value) => {
|
|
|
4171
4250
|
display: "flex",
|
|
4172
4251
|
justifyContent: "center",
|
|
4173
4252
|
py: 0.5,
|
|
4174
|
-
|
|
4175
|
-
"@keyframes fade-in": {
|
|
4176
|
-
"0%": { opacity: 0 },
|
|
4177
|
-
"50%": { opacity: 1 },
|
|
4178
|
-
"100%": { opacity: 0 }
|
|
4179
|
-
}
|
|
4253
|
+
height: 40
|
|
4180
4254
|
},
|
|
4181
4255
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4182
|
-
|
|
4256
|
+
LoadingButton,
|
|
4183
4257
|
{
|
|
4184
4258
|
variant: "text",
|
|
4185
4259
|
color: "inherit",
|
|
4260
|
+
loadingPosition: "start",
|
|
4261
|
+
loading: isLoadingMore,
|
|
4186
4262
|
onClick: async () => {
|
|
4187
|
-
|
|
4188
|
-
|
|
4189
|
-
|
|
4263
|
+
var _a3, _b3;
|
|
4264
|
+
try {
|
|
4265
|
+
setIsLoadingMore(true);
|
|
4266
|
+
const firstChatId = (_b3 = (_a3 = chat.messages) == null ? void 0 : _a3[0]) == null ? void 0 : _b3.id;
|
|
4267
|
+
const firstChatMessage = document.getElementById(firstChatId);
|
|
4190
4268
|
const divider = document.createElement("div");
|
|
4191
|
-
divider.style.animation = "
|
|
4269
|
+
divider.style.animation = "blinking 1s linear";
|
|
4192
4270
|
divider.style.animationIterationCount = "5";
|
|
4193
4271
|
divider.style.borderTop = "1px solid #e5e5e5";
|
|
4194
4272
|
divider.style.opacity = "0";
|
|
4195
4273
|
divider.style.height = "0";
|
|
4196
|
-
|
|
4197
|
-
(
|
|
4198
|
-
|
|
4199
|
-
|
|
4274
|
+
await loadMessages(chat.id, chat.nextCursor);
|
|
4275
|
+
setTimeout(() => {
|
|
4276
|
+
var _a4, _b4;
|
|
4277
|
+
(_a4 = containerRef.current) == null ? void 0 : _a4.insertBefore(divider, firstChatMessage);
|
|
4278
|
+
(_b4 = containerRef.current) == null ? void 0 : _b4.scrollTo({ top: divider.offsetTop - 40 - 16 - 1 });
|
|
4279
|
+
}, 20);
|
|
4280
|
+
} catch (error) {
|
|
4281
|
+
} finally {
|
|
4282
|
+
setIsLoadingMore(false);
|
|
4283
|
+
}
|
|
4200
4284
|
},
|
|
4201
4285
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowUpward, {}),
|
|
4202
4286
|
children: t("chat.loadMore")
|
|
@@ -4207,12 +4291,12 @@ var __publicField = (obj, key, value) => {
|
|
|
4207
4291
|
chat.type !== "notification" && ((_a2 = chat.messages) == null ? void 0 : _a2.map((message, index) => {
|
|
4208
4292
|
var _a3;
|
|
4209
4293
|
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4210
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4294
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "message-item", id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(Message, { message, prevMessage: prev }) }, message.id);
|
|
4211
4295
|
})),
|
|
4212
4296
|
chat.type === "notification" && ((_b2 = chat.messages) == null ? void 0 : _b2.map((message, index) => {
|
|
4213
4297
|
var _a3;
|
|
4214
4298
|
const prev = (_a3 = chat.messages) == null ? void 0 : _a3[index - 1];
|
|
4215
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Box, { id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4299
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "message-item", id: message.id, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
4216
4300
|
NotificationMessage,
|
|
4217
4301
|
{
|
|
4218
4302
|
chat,
|
|
@@ -4299,7 +4383,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4299
4383
|
};
|
|
4300
4384
|
function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
|
|
4301
4385
|
const navigate = reactRouterDom.useNavigate();
|
|
4302
|
-
const mergedSx = [{
|
|
4386
|
+
const mergedSx = [{}, ...Array.isArray(sx) ? sx : [sx]];
|
|
4303
4387
|
const handleClick = () => {
|
|
4304
4388
|
if (url) {
|
|
4305
4389
|
navigate(url, { replace: true });
|
|
@@ -4318,8 +4402,7 @@ var __publicField = (obj, key, value) => {
|
|
|
4318
4402
|
{
|
|
4319
4403
|
onClick: handleClick,
|
|
4320
4404
|
variant: "outlined",
|
|
4321
|
-
color: "
|
|
4322
|
-
size: "small",
|
|
4405
|
+
color: "primary",
|
|
4323
4406
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(iconsMaterial.ArrowBackIos, { style: { fontSize: 13 } }),
|
|
4324
4407
|
sx: mergedSx,
|
|
4325
4408
|
...rest,
|
|
@@ -11291,6 +11374,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11291
11374
|
exports2.useDefaultApiErrorHandler = useDefaultApiErrorHandler;
|
|
11292
11375
|
exports2.useNow = useNow;
|
|
11293
11376
|
exports2.usePointUpContext = usePointUpContext;
|
|
11377
|
+
exports2.useSessionContext = useSessionContext;
|
|
11294
11378
|
exports2.useSubscription = useSubscription;
|
|
11295
11379
|
exports2.useUnreadNotification = useUnreadNotification;
|
|
11296
11380
|
exports2.useUploader = useUploader;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.191",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -29,8 +29,8 @@
|
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@arcblock/ws": "^1.18.113",
|
|
32
|
-
"@blocklet/editor": "1.6.
|
|
33
|
-
"@blocklet/labels": "1.6.
|
|
32
|
+
"@blocklet/editor": "1.6.191",
|
|
33
|
+
"@blocklet/labels": "1.6.191",
|
|
34
34
|
"@blocklet/uploader": "^0.0.75",
|
|
35
35
|
"@emotion/css": "^11.10.5",
|
|
36
36
|
"@emotion/react": "^11.10.5",
|
|
@@ -94,5 +94,5 @@
|
|
|
94
94
|
"resolutions": {
|
|
95
95
|
"react": "^18.2.0"
|
|
96
96
|
},
|
|
97
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "e0bfe0bdc7ce8d39f4f3684f7170075025bbcb0a"
|
|
98
98
|
}
|