@blocklet/discuss-kit-ux 2.0.70 → 2.0.72

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.
@@ -3,4 +3,3 @@ export { useChanged } from './changed';
3
3
  export { useNow } from './now';
4
4
  export { useInterval } from './interval';
5
5
  export { useDownBreakpoint, useUpBreakpoint } from './responsive';
6
- export { useNotification } from './notification';
@@ -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-DR4mMFMg.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, V as VideoPathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-DRyXxhLw.mjs";
8
8
  const BlockletEditor = lazy(() => import("@blocklet/editor"));
9
9
  const Root = styled(Box)`
10
10
  .be-editable,
@@ -1126,23 +1126,6 @@ const useResponsiveValue = (values2) => {
1126
1126
  const r = useResponsive();
1127
1127
  return r(values2);
1128
1128
  };
1129
- const useNotification = () => {
1130
- const show = async ({ title, options, onclick }) => {
1131
- if (!("Notification" in window))
1132
- return;
1133
- if (Notification.permission === "granted") {
1134
- const notification = new Notification(title, options);
1135
- notification.onclick = onclick ?? null;
1136
- return;
1137
- }
1138
- if (Notification.permission !== "denied") {
1139
- const permission = await Notification.requestPermission();
1140
- if (permission === "granted")
1141
- show({ title, options, onclick });
1142
- }
1143
- };
1144
- return { show };
1145
- };
1146
1129
  function ProfileCard({ user, click, ...rest }) {
1147
1130
  var _a2, _b2, _c2;
1148
1131
  const { session } = useSessionContext();
@@ -2158,10 +2141,10 @@ function GithubReaction({
2158
2141
  gap: 0.75,
2159
2142
  ml: -0.25,
2160
2143
  cursor: "pointer",
2161
- ".github-reaction-text": {
2144
+ ".github-reaction-text, .github-reaction-icon": {
2162
2145
  color: "text.secondary"
2163
2146
  },
2164
- "&:hover .github-reaction-text": {
2147
+ "&:hover .github-reaction-text, &:hover .github-reaction-icon": {
2165
2148
  color: "secondary.main"
2166
2149
  }
2167
2150
  },
@@ -2170,7 +2153,7 @@ function GithubReaction({
2170
2153
  /* @__PURE__ */ jsx(
2171
2154
  Box,
2172
2155
  {
2173
- className: "github-reaction-text",
2156
+ className: "github-reaction-icon",
2174
2157
  component: tablerMoodPlus,
2175
2158
  sx: { width: "1em", height: "1em", fontSize: 18 }
2176
2159
  }
@@ -2369,6 +2352,7 @@ function Comment({
2369
2352
  onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
2370
2353
  onUnrate: () => onUnrate(post),
2371
2354
  interactive,
2355
+ sx: { ".github-reaction-text": { display: { xs: "none", md: "inline-block" } } },
2372
2356
  append: /* @__PURE__ */ jsxs(Fragment, { children: [
2373
2357
  (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxs(
2374
2358
  Box$1,
@@ -2391,7 +2375,7 @@ function Comment({
2391
2375
  sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
2392
2376
  }
2393
2377
  ),
2394
- /* @__PURE__ */ jsx(Box$1, { component: "span", children: "Reply" })
2378
+ /* @__PURE__ */ jsx(Box$1, { component: "span", sx: { display: { xs: "none", md: "inline-block" } }, children: "Reply" })
2395
2379
  ]
2396
2380
  }
2397
2381
  ),
@@ -3745,9 +3729,6 @@ function ChatProvider({ client: client2, activeChatId, children, isInWallet }) {
3745
3729
  activeChatId: void 0,
3746
3730
  error: void 0
3747
3731
  });
3748
- const chatById = useMemo(() => {
3749
- return state.chats.reduce((acc, cur) => ({ ...acc, [cur.id]: cur }), {});
3750
- }, [state.chats]);
3751
3732
  const { markAsUnread } = useUnreadNotification();
3752
3733
  const navigate = useNavigate();
3753
3734
  const { session } = useSessionContext();
@@ -3959,42 +3940,9 @@ function ChatProvider({ client: client2, activeChatId, children, isInWallet }) {
3959
3940
  setState((prev) => ({ ...prev, activeChatId: void 0 }));
3960
3941
  }
3961
3942
  }, [state, activeChatId]);
3962
- const { t } = useLocaleContext();
3963
- const { show } = useNotification();
3964
- const resolveChatNotification = (chatId, { id: id2, content, sender, type, link, sourceUser, comment, reply, post }) => {
3965
- if (isInWallet || sender.did === currentUser.did)
3966
- return;
3967
- const chat = chatById[chatId];
3968
- if (!chat)
3969
- return;
3970
- const isSystem = chat.type === "notification";
3971
- const isChannel = chat.type === "channel";
3972
- const getNotificationMeta = () => {
3973
- const getOpener = (url) => () => window.open(url, "_blank");
3974
- const getTitle = (i18nKey) => `${sourceUser == null ? void 0 : sourceUser.fullName} ${t(`chat.${i18nKey}`)}`;
3975
- const onclick2 = getOpener(link);
3976
- const map = {
3977
- message: {
3978
- title: `${t("chat.newMsg")} ${isChannel ? chat.name : sender.fullName}`,
3979
- body: getExcerptFromLexicalContent(content),
3980
- onclick: getOpener(joinURL(discussKitMountPoint ?? "", "/chat", chatId))
3981
- },
3982
- comment: { title: getTitle("commentedYourPost"), body: comment == null ? void 0 : comment.excerpt, onclick: onclick2 },
3983
- reply: { title: getTitle("replyYourComment"), body: reply == null ? void 0 : reply.excerpt, onclick: onclick2 },
3984
- mentionInComment: { title: getTitle("mentionInComment"), body: comment == null ? void 0 : comment.excerpt, onclick: onclick2 },
3985
- mentionInPost: { title: getTitle("mentionInPost"), body: post == null ? void 0 : post.excerpt, onclick: onclick2 }
3986
- };
3987
- return map[type];
3988
- };
3989
- const icon = isSystem ? sourceUser == null ? void 0 : sourceUser.avatar : sender.avatar;
3990
- const { title, body, onclick } = getNotificationMeta();
3991
- if (title)
3992
- show({ title, onclick, options: { tag: id2, icon, body } });
3993
- };
3994
3943
  useEffect(() => {
3995
3944
  const cancels = [
3996
3945
  client2.onMessage(({ chatId, message }) => {
3997
- resolveChatNotification(chatId, message);
3998
3946
  addMessage(chatId, message);
3999
3947
  if (message.sender.did === (currentUser == null ? void 0 : currentUser.did)) {
4000
3948
  updateLastAckTime(chatId, true);
@@ -4802,7 +4750,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, ...rest }) {
4802
4750
  }
4803
4751
  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" }) });
4804
4752
  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" }) });
4805
- const Editor = lazy(() => import("./editor-D5fQYtn3.mjs"));
4753
+ const Editor = lazy(() => import("./editor-ywsvT-rA.mjs"));
4806
4754
  function LazyEditor(props) {
4807
4755
  const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
4808
4756
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -12271,89 +12219,88 @@ function SegmentedControl({ value, options, onChange, sx, ...rest }) {
12271
12219
  ) });
12272
12220
  }
12273
12221
  export {
12274
- ChatListInWallet as $,
12222
+ ChatHeaderAddon as $,
12275
12223
  Avatar as A,
12276
12224
  Badge as B,
12277
12225
  CommentInput as C,
12278
12226
  DefaultEditorConfigProvider as D,
12279
- useCommentsContext as E,
12280
- CommentsProvider as F,
12281
- BinaryThumb as G,
12282
- GithubReaction as H,
12227
+ CommentsProvider as E,
12228
+ BinaryThumb as F,
12229
+ GithubReaction as G,
12230
+ EmptyStatus as H,
12283
12231
  ImagePathFixerPlugin as I,
12284
- EmptyStatus as J,
12285
- BlogListWrapper as K,
12286
- BlogCard as L,
12232
+ BlogListWrapper as J,
12233
+ BlogCard as K,
12234
+ BlogPermaLink as L,
12287
12235
  Menu as M,
12288
- BlogPermaLink as N,
12289
- getBlogLink as O,
12236
+ getBlogLink as N,
12237
+ CoverImage as O,
12290
12238
  Pagination as P,
12291
- CoverImage as Q,
12239
+ CoverImageUpload as Q,
12292
12240
  RelativeTime as R,
12293
12241
  ScrollableEditorWrapper as S,
12294
- CoverImageUpload as T,
12295
- AccessControl as U,
12242
+ AccessControl as T,
12243
+ useAuthzContext as U,
12296
12244
  VideoPathFixerPlugin as V,
12297
- useAuthzContext as W,
12298
- AuthzProvider as X,
12299
- ChatClient as Y,
12300
- Chat as Z,
12301
- ChatInWallet as _,
12245
+ AuthzProvider as W,
12246
+ ChatClient as X,
12247
+ Chat as Y,
12248
+ ChatInWallet as Z,
12249
+ ChatListInWallet as _,
12302
12250
  isEmptyContent as a,
12303
- ChatHeaderAddon as a0,
12304
- useChatContext as a1,
12305
- ChatProvider as a2,
12306
- UnreadNotificationContext as a3,
12307
- useUnreadNotification as a4,
12308
- UnreadNotificationProvider as a5,
12309
- Confirm as a6,
12310
- ConfirmContext as a7,
12311
- useConfirm as a8,
12312
- ConfirmProvider as a9,
12313
- SecureLabelPicker as aa,
12314
- useApiErrorHandler as ab,
12315
- useDefaultApiErrorHandler as ac,
12316
- DefaultApiErrorHandler as ad,
12317
- Back as ae,
12318
- LazyEditor as af,
12319
- EditorPreview as ag,
12320
- DirtyPromptContainer as ah,
12321
- ConfirmNavigation as ai,
12322
- UploaderContext as aj,
12323
- useUploader as ak,
12324
- UploaderTrigger as al,
12325
- UploaderProvider as am,
12326
- composeImageUrl as an,
12327
- usePointUpContext as ao,
12328
- PointUpProvider as ap,
12329
- ButtonGroup as aq,
12330
- SegmentedControl as ar,
12331
- create as as,
12332
- getWsClient as at,
12333
- useSubscription as au,
12251
+ useChatContext as a0,
12252
+ ChatProvider as a1,
12253
+ UnreadNotificationContext as a2,
12254
+ useUnreadNotification as a3,
12255
+ UnreadNotificationProvider as a4,
12256
+ Confirm as a5,
12257
+ ConfirmContext as a6,
12258
+ useConfirm as a7,
12259
+ ConfirmProvider as a8,
12260
+ SecureLabelPicker as a9,
12261
+ useApiErrorHandler as aa,
12262
+ useDefaultApiErrorHandler as ab,
12263
+ DefaultApiErrorHandler as ac,
12264
+ Back as ad,
12265
+ LazyEditor as ae,
12266
+ EditorPreview as af,
12267
+ DirtyPromptContainer as ag,
12268
+ ConfirmNavigation as ah,
12269
+ UploaderContext as ai,
12270
+ useUploader as aj,
12271
+ UploaderTrigger as ak,
12272
+ UploaderProvider as al,
12273
+ composeImageUrl as am,
12274
+ usePointUpContext as an,
12275
+ PointUpProvider as ao,
12276
+ ButtonGroup as ap,
12277
+ SegmentedControl as aq,
12278
+ create as ar,
12279
+ getWsClient as as,
12280
+ useSubscription as at,
12334
12281
  Input as b,
12335
12282
  useChanged as c,
12336
12283
  useSessionContext as d,
12337
- useNotification as e,
12338
- utils as f,
12284
+ utils as e,
12285
+ preferences as f,
12339
12286
  getExcerptSync as g,
12340
- preferences as h,
12287
+ typography as h,
12341
12288
  inferInitialEditorState as i,
12342
- typography as j,
12343
- themeOverrides as k,
12289
+ themeOverrides as j,
12290
+ InternalThemeProvider as k,
12344
12291
  lexical as l,
12345
- InternalThemeProvider as m,
12346
- Avatars as n,
12347
- AuthorInfo as o,
12292
+ Avatars as m,
12293
+ AuthorInfo as n,
12294
+ SystemUser as o,
12348
12295
  preloadInput as p,
12349
- SystemUser as q,
12296
+ PostContent as q,
12350
12297
  routes as r,
12351
12298
  stringify as s,
12352
12299
  translations as t,
12353
12300
  useNow as u,
12354
- PostContent as v,
12355
- PostComponent as w,
12356
- Comment as x,
12357
- CommentList as y,
12358
- CommentsContext as z
12301
+ PostComponent as v,
12302
+ Comment as w,
12303
+ CommentList as x,
12304
+ CommentsContext as y,
12305
+ useCommentsContext as z
12359
12306
  };
package/dist/index.d.ts CHANGED
@@ -18,7 +18,7 @@ export * from './components/editor';
18
18
  export * as lexicalUtils from './components/lexical';
19
19
  export * from './components/dirty-prompt';
20
20
  export { translations } from './components/locale';
21
- export { useNow, useChanged, useSessionContext, useNotification } from './components/hooks';
21
+ export { useNow, useChanged, useSessionContext } from './components/hooks';
22
22
  export * as utils from './components/utils';
23
23
  export * as routes from './components/routes';
24
24
  export { default as preferences } from './preferences';
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { U, o, X, A, n, ae, B, G, L, K, N, aq, Z, Y, a0, _, $, a2, x, C, y, z, F, a6, a7, ai, a9, Q, T, ad, D, ah, ag, J, H, b, m, af, M, P, ap, w, v, R, S, aa, ar, q, a3, a5, aj, am, al, an, as, O, at, l, h, p, r, k, t, j, ab, W, c, a1, E, a8, ac, e, u, ao, d, au, a4, ak, f } from "./index-DR4mMFMg.mjs";
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-DRyXxhLw.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
@@ -9,83 +9,82 @@ import "@mui/icons-material";
9
9
  import "@arcblock/ux/lib/Locale/context";
10
10
  import "@mui/material";
11
11
  export {
12
- U as AccessControl,
13
- o as AuthorInfo,
14
- X as AuthzProvider,
12
+ T as AccessControl,
13
+ n as AuthorInfo,
14
+ W as AuthzProvider,
15
15
  A as Avatar,
16
- n as Avatars,
17
- ae as Back,
16
+ m as Avatars,
17
+ ad as Back,
18
18
  B as Badge,
19
- G as BinaryThumb,
20
- L as BlogCard,
21
- K as BlogList,
22
- N as BlogPermaLink,
23
- aq as ButtonGroup,
24
- Z as Chat,
25
- Y as ChatClient,
26
- a0 as ChatHeaderAddon,
27
- _ as ChatInWallet,
28
- $ as ChatListInWallet,
29
- a2 as ChatProvider,
30
- x as Comment,
19
+ F as BinaryThumb,
20
+ K as BlogCard,
21
+ J as BlogList,
22
+ L as BlogPermaLink,
23
+ ap as ButtonGroup,
24
+ Y as Chat,
25
+ X as ChatClient,
26
+ $ as ChatHeaderAddon,
27
+ Z as ChatInWallet,
28
+ _ as ChatListInWallet,
29
+ a1 as ChatProvider,
30
+ w as Comment,
31
31
  C as CommentInput,
32
- y as CommentList,
33
- z as CommentsContext,
34
- F as CommentsProvider,
35
- a6 as Confirm,
36
- a7 as ConfirmContext,
37
- ai as ConfirmNavigation,
38
- a9 as ConfirmProvider,
39
- Q as CoverImage,
40
- T as CoverImageUpload,
41
- ad as DefaultApiErrorHandler,
32
+ x as CommentList,
33
+ y as CommentsContext,
34
+ E as CommentsProvider,
35
+ a5 as Confirm,
36
+ a6 as ConfirmContext,
37
+ ah as ConfirmNavigation,
38
+ a8 as ConfirmProvider,
39
+ O as CoverImage,
40
+ Q as CoverImageUpload,
41
+ ac as DefaultApiErrorHandler,
42
42
  D as DefaultEditorConfigProvider,
43
- ah as DirtyPromptContainer,
44
- ag as EditorPreview,
45
- J as EmptyStatus,
46
- H as GithubReaction,
43
+ ag as DirtyPromptContainer,
44
+ af as EditorPreview,
45
+ H as EmptyStatus,
46
+ G as GithubReaction,
47
47
  b as Input,
48
- m as InternalThemeProvider,
49
- af as LazyEditor,
48
+ k as InternalThemeProvider,
49
+ ae as LazyEditor,
50
50
  M as Menu,
51
51
  P as Pagination,
52
- ap as PointUpProvider,
53
- w as Post,
54
- v as PostContent,
52
+ ao as PointUpProvider,
53
+ v as Post,
54
+ q as PostContent,
55
55
  R as RelativeTime,
56
56
  S as ScrollableEditorWrapper,
57
- aa as SecureLabelPicker,
58
- ar as SegmentedControl,
59
- q as SystemUser,
60
- a3 as UnreadNotificationContext,
61
- a5 as UnreadNotificationProvider,
62
- aj as UploaderContext,
63
- am as UploaderProvider,
64
- al as UploaderTrigger,
65
- an as composeImageUrl,
66
- as as create,
67
- O as getBlogLink,
68
- at as getWsClient,
57
+ a9 as SecureLabelPicker,
58
+ aq as SegmentedControl,
59
+ o as SystemUser,
60
+ a2 as UnreadNotificationContext,
61
+ a4 as UnreadNotificationProvider,
62
+ ai as UploaderContext,
63
+ al as UploaderProvider,
64
+ ak as UploaderTrigger,
65
+ am as composeImageUrl,
66
+ ar as create,
67
+ N as getBlogLink,
68
+ as as getWsClient,
69
69
  l as lexicalUtils,
70
- h as preferences,
70
+ f as preferences,
71
71
  p as preloadInput,
72
72
  r as routes,
73
- k as themeOverrides,
73
+ j as themeOverrides,
74
74
  t as translations,
75
- j as typography,
76
- ab as useApiErrorHandler,
77
- W as useAuthzContext,
75
+ h as typography,
76
+ aa as useApiErrorHandler,
77
+ U as useAuthzContext,
78
78
  c as useChanged,
79
- a1 as useChatContext,
80
- E as useCommentsContext,
81
- a8 as useConfirm,
82
- ac as useDefaultApiErrorHandler,
83
- e as useNotification,
79
+ a0 as useChatContext,
80
+ z as useCommentsContext,
81
+ a7 as useConfirm,
82
+ ab as useDefaultApiErrorHandler,
84
83
  u as useNow,
85
- ao as usePointUpContext,
84
+ an as usePointUpContext,
86
85
  d as useSessionContext,
87
- au as useSubscription,
88
- a4 as useUnreadNotification,
89
- ak as useUploader,
90
- f as utils
86
+ at as useSubscription,
87
+ a3 as useUnreadNotification,
88
+ aj as useUploader,
89
+ e as utils
91
90
  };
package/dist/index.umd.js CHANGED
@@ -1,6 +1,6 @@
1
1
  (function(global, factory) {
2
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("ufo"), require("@blocklet/editor"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/react-hooks", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "semver-compare", "@arcblock/bridge", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "ufo", "@blocklet/editor", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.reactHooks, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.cmp, global.bridge, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.ReactDOM, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.ufo, global.editor$1, global.Fab, global.debounce, global.useIsFocused, global.TextField, global.AddIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ImageNode, global.VideoNode));
3
- })(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, ReactDOM, joinUrl, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, ufo, editor$1, Fab, debounce, useIsFocused, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ImageNode, VideoNode) {
2
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("@arcblock/ux/lib/Theme"), require("react"), require("@mui/material"), require("lodash/isNil"), require("@blocklet/editor/lib/config"), require("react-lazy-with-preload"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/material/Box"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("lodash/isBoolean"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/AvatarGroup"), require("@mui/material/colors"), require("@mui/material/useMediaQuery"), require("@arcblock/ux/lib/DID"), require("@mui/material/Tooltip"), require("react-router-dom"), require("@arcblock/react-hooks"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("@arcblock/ux/lib/Empty"), require("@arcblock/did-connect/lib/Session"), require("semver-compare"), require("@arcblock/bridge"), require("@mui/icons-material/NotificationsActiveOutlined"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("react-dom"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("react-helmet"), require("react-flip-toolkit"), require("@mui/material/colors/grey"), require("@blocklet/editor"), require("@mui/material/Fab"), require("lodash/debounce"), require("@blocklet/editor/lib/main/hooks/useIsFocused"), require("@mui/material/TextField"), require("@mui/icons-material/Add"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("js-cookie"), require("@arcblock/ws"), require("@emotion/css"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("ufo"), require("@blocklet/editor/lib/main/nodes/ImageNode"), require("@blocklet/editor/lib/ext/VideoPlugin/VideoNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "@arcblock/ux/lib/Theme", "react", "@mui/material", "lodash/isNil", "@blocklet/editor/lib/config", "react-lazy-with-preload", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/material/Box", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "lodash/isBoolean", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/AvatarGroup", "@mui/material/colors", "@mui/material/useMediaQuery", "@arcblock/ux/lib/DID", "@mui/material/Tooltip", "react-router-dom", "@arcblock/react-hooks", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "@arcblock/ux/lib/Empty", "@arcblock/did-connect/lib/Session", "semver-compare", "@arcblock/bridge", "@mui/icons-material/NotificationsActiveOutlined", "@blocklet/editor/lib/ext/CheckboxPlugin", "@arcblock/did-connect/lib/Address", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "react-dom", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "react-helmet", "react-flip-toolkit", "@mui/material/colors/grey", "@blocklet/editor", "@mui/material/Fab", "lodash/debounce", "@blocklet/editor/lib/main/hooks/useIsFocused", "@mui/material/TextField", "@mui/icons-material/Add", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "js-cookie", "@arcblock/ws", "@emotion/css", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "ufo", "@blocklet/editor/lib/main/nodes/ImageNode", "@blocklet/editor/lib/ext/VideoPlugin/VideoNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.Theme, global.react, global.material, global.isNil, global.config, global.reactLazyWithPreload, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.Box, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.isBoolean, global.Button, global.DidAvatar, global.AvatarGroup, global.colors, global.useMediaQuery, global.DID, global.Tooltip, global.reactRouterDom, global.reactHooks, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.Empty$3, global.Session, global.cmp, global.bridge, global.NotificationsActiveOutlinedIcon, global.CheckboxPlugin, global.DIDAddress, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.ReactDOM, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.reactHelmet, global.reactFlipToolkit, global.grey, global.editor$1, global.Fab, global.debounce, global.useIsFocused, global.TextField, global.AddIcon, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.Cookie, global.ws, global.css, global.OnContentChangePlugin, global.ShortcutPlugin$1, global.SafeAreaPlugin, global.text, global.ufo, global.ImageNode, global.VideoNode));
3
+ })(this, function(exports2, labels, jsxRuntime, styles, Theme, react, material, isNil, config, reactLazyWithPreload, LexicalComposerContext, lexical$1, ahooks, Box, LoadingButton, iconsMaterial, context, Alert, isBoolean, Button, DidAvatar, AvatarGroup, colors, useMediaQuery, DID, Tooltip, reactRouterDom, reactHooks, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, Empty$3, Session, cmp, bridge, NotificationsActiveOutlinedIcon, CheckboxPlugin, DIDAddress, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, ReactDOM, joinUrl, dayjs, relativeTime, mitt, CircularProgress, reactHelmet, reactFlipToolkit, grey, editor$1, Fab, debounce, useIsFocused, TextField, AddIcon, axios, Toast, MuiPagination, unstatedNext, Cookie, ws, css, OnContentChangePlugin, ShortcutPlugin$1, SafeAreaPlugin, text, ufo, ImageNode, VideoNode) {
4
4
  "use strict";var __defProp = Object.defineProperty;
5
5
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
6
6
  var __publicField = (obj, key, value) => {
@@ -1052,23 +1052,6 @@ var __publicField = (obj, key, value) => {
1052
1052
  const r = useResponsive();
1053
1053
  return r(values2);
1054
1054
  };
1055
- const useNotification = () => {
1056
- const show = async ({ title, options, onclick }) => {
1057
- if (!("Notification" in window))
1058
- return;
1059
- if (Notification.permission === "granted") {
1060
- const notification = new Notification(title, options);
1061
- notification.onclick = onclick ?? null;
1062
- return;
1063
- }
1064
- if (Notification.permission !== "denied") {
1065
- const permission = await Notification.requestPermission();
1066
- if (permission === "granted")
1067
- show({ title, options, onclick });
1068
- }
1069
- };
1070
- return { show };
1071
- };
1072
1055
  function ProfileCard({ user, click, ...rest }) {
1073
1056
  var _a2, _b2, _c2;
1074
1057
  const { session } = useSessionContext();
@@ -2084,10 +2067,10 @@ var __publicField = (obj, key, value) => {
2084
2067
  gap: 0.75,
2085
2068
  ml: -0.25,
2086
2069
  cursor: "pointer",
2087
- ".github-reaction-text": {
2070
+ ".github-reaction-text, .github-reaction-icon": {
2088
2071
  color: "text.secondary"
2089
2072
  },
2090
- "&:hover .github-reaction-text": {
2073
+ "&:hover .github-reaction-text, &:hover .github-reaction-icon": {
2091
2074
  color: "secondary.main"
2092
2075
  }
2093
2076
  },
@@ -2096,7 +2079,7 @@ var __publicField = (obj, key, value) => {
2096
2079
  /* @__PURE__ */ jsxRuntime.jsx(
2097
2080
  material.Box,
2098
2081
  {
2099
- className: "github-reaction-text",
2082
+ className: "github-reaction-icon",
2100
2083
  component: tablerMoodPlus,
2101
2084
  sx: { width: "1em", height: "1em", fontSize: 18 }
2102
2085
  }
@@ -2295,6 +2278,7 @@ var __publicField = (obj, key, value) => {
2295
2278
  onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
2296
2279
  onUnrate: () => onUnrate(post),
2297
2280
  interactive,
2281
+ sx: { ".github-reaction-text": { display: { xs: "none", md: "inline-block" } } },
2298
2282
  append: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
2299
2283
  (!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsxRuntime.jsxs(
2300
2284
  Box,
@@ -2317,7 +2301,7 @@ var __publicField = (obj, key, value) => {
2317
2301
  sx: { width: "1em", height: "1em", fontSize: 18, color: "text.secondary" }
2318
2302
  }
2319
2303
  ),
2320
- /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", children: "Reply" })
2304
+ /* @__PURE__ */ jsxRuntime.jsx(Box, { component: "span", sx: { display: { xs: "none", md: "inline-block" } }, children: "Reply" })
2321
2305
  ]
2322
2306
  }
2323
2307
  ),
@@ -3671,9 +3655,6 @@ var __publicField = (obj, key, value) => {
3671
3655
  activeChatId: void 0,
3672
3656
  error: void 0
3673
3657
  });
3674
- const chatById = react.useMemo(() => {
3675
- return state.chats.reduce((acc, cur) => ({ ...acc, [cur.id]: cur }), {});
3676
- }, [state.chats]);
3677
3658
  const { markAsUnread } = useUnreadNotification();
3678
3659
  const navigate = reactRouterDom.useNavigate();
3679
3660
  const { session } = useSessionContext();
@@ -3885,42 +3866,9 @@ var __publicField = (obj, key, value) => {
3885
3866
  setState((prev) => ({ ...prev, activeChatId: void 0 }));
3886
3867
  }
3887
3868
  }, [state, activeChatId]);
3888
- const { t } = context.useLocaleContext();
3889
- const { show } = useNotification();
3890
- const resolveChatNotification = (chatId, { id: id2, content, sender, type, link, sourceUser, comment, reply, post }) => {
3891
- if (isInWallet || sender.did === currentUser.did)
3892
- return;
3893
- const chat = chatById[chatId];
3894
- if (!chat)
3895
- return;
3896
- const isSystem = chat.type === "notification";
3897
- const isChannel = chat.type === "channel";
3898
- const getNotificationMeta = () => {
3899
- const getOpener = (url) => () => window.open(url, "_blank");
3900
- const getTitle = (i18nKey) => `${sourceUser == null ? void 0 : sourceUser.fullName} ${t(`chat.${i18nKey}`)}`;
3901
- const onclick2 = getOpener(link);
3902
- const map = {
3903
- message: {
3904
- title: `${t("chat.newMsg")} ${isChannel ? chat.name : sender.fullName}`,
3905
- body: getExcerptFromLexicalContent(content),
3906
- onclick: getOpener(ufo.joinURL(discussKitMountPoint ?? "", "/chat", chatId))
3907
- },
3908
- comment: { title: getTitle("commentedYourPost"), body: comment == null ? void 0 : comment.excerpt, onclick: onclick2 },
3909
- reply: { title: getTitle("replyYourComment"), body: reply == null ? void 0 : reply.excerpt, onclick: onclick2 },
3910
- mentionInComment: { title: getTitle("mentionInComment"), body: comment == null ? void 0 : comment.excerpt, onclick: onclick2 },
3911
- mentionInPost: { title: getTitle("mentionInPost"), body: post == null ? void 0 : post.excerpt, onclick: onclick2 }
3912
- };
3913
- return map[type];
3914
- };
3915
- const icon = isSystem ? sourceUser == null ? void 0 : sourceUser.avatar : sender.avatar;
3916
- const { title, body, onclick } = getNotificationMeta();
3917
- if (title)
3918
- show({ title, onclick, options: { tag: id2, icon, body } });
3919
- };
3920
3869
  react.useEffect(() => {
3921
3870
  const cancels = [
3922
3871
  client2.onMessage(({ chatId, message }) => {
3923
- resolveChatNotification(chatId, message);
3924
3872
  addMessage(chatId, message);
3925
3873
  if (message.sender.did === (currentUser == null ? void 0 : currentUser.did)) {
3926
3874
  updateLastAckTime(chatId, true);
@@ -12306,7 +12254,6 @@ var __publicField = (obj, key, value) => {
12306
12254
  exports2.useCommentsContext = useCommentsContext;
12307
12255
  exports2.useConfirm = useConfirm;
12308
12256
  exports2.useDefaultApiErrorHandler = useDefaultApiErrorHandler;
12309
- exports2.useNotification = useNotification;
12310
12257
  exports2.useNow = useNow;
12311
12258
  exports2.usePointUpContext = usePointUpContext;
12312
12259
  exports2.useSessionContext = useSessionContext;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "2.0.70",
3
+ "version": "2.0.72",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -31,8 +31,8 @@
31
31
  "@arcblock/bridge": "^2.10.6",
32
32
  "@arcblock/react-hooks": "^2.10.6",
33
33
  "@arcblock/ws": "^1.18.126",
34
- "@blocklet/editor": "2.0.70",
35
- "@blocklet/labels": "2.0.70",
34
+ "@blocklet/editor": "2.0.72",
35
+ "@blocklet/labels": "2.0.72",
36
36
  "@blocklet/uploader": "^0.1.19",
37
37
  "@emotion/css": "^11.10.5",
38
38
  "@emotion/react": "^11.10.5",
@@ -100,5 +100,5 @@
100
100
  "resolutions": {
101
101
  "react": "^18.2.0"
102
102
  },
103
- "gitHead": "33b4b65368af257ac54c965ae8658093bb801531"
103
+ "gitHead": "3a55e1cdbe23ed4a905c8859dacbefe53daf337f"
104
104
  }
@@ -1,9 +0,0 @@
1
- interface UseNotificationProps {
2
- title: string;
3
- options?: NotificationOptions;
4
- onclick?: () => void;
5
- }
6
- export declare const useNotification: () => {
7
- show: ({ title, options, onclick }: UseNotificationProps) => Promise<void>;
8
- };
9
- export {};