@blocklet/discuss-kit-ux 2.2.41 → 2.2.42
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/profile-card/index.d.ts +1 -1
- package/dist/components/profile-card/profile-card.d.ts +6 -3
- package/dist/components/shared/relative-time.d.ts +2 -1
- package/dist/{editor-0SygPq67.mjs → editor-D18Hv79L.mjs} +1 -1
- package/dist/{index-BQdMWyip.mjs → index-DHmJSOux.mjs} +26 -5
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +3 -1
- package/dist/index.umd.js +24 -3
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './profile-card';
|
|
@@ -4,8 +4,11 @@ interface ProfileCardProps {
|
|
|
4
4
|
click: () => void;
|
|
5
5
|
}
|
|
6
6
|
export declare function ProfileCard({ user, click, ...rest }: ProfileCardProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
|
|
7
|
+
interface ProfileCardTooltipProps {
|
|
8
8
|
user: User;
|
|
9
|
-
children: React.ReactElement
|
|
10
|
-
|
|
9
|
+
children: React.ReactElement | ((props: {
|
|
10
|
+
navigateToProfile: () => void;
|
|
11
|
+
}) => React.ReactElement);
|
|
12
|
+
}
|
|
13
|
+
export declare function ProfileCardTooltip({ user, children }: ProfileCardTooltipProps): import("react/jsx-runtime").JSX.Element;
|
|
11
14
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface Props {
|
|
2
2
|
value: string | number | Date;
|
|
3
3
|
[key: string]: any;
|
|
4
|
+
autoUpdate?: boolean;
|
|
4
5
|
}
|
|
5
|
-
export default function RelativeTime({ value, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default function RelativeTime({ value, autoUpdate, ...rest }: Props): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -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 { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
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-DHmJSOux.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -17,7 +17,7 @@ import { joinURL, withTrailingSlash, withQuery, parseQuery } from "ufo";
|
|
|
17
17
|
import { useLexicalComposerContext } from "@lexical/react/LexicalComposerContext";
|
|
18
18
|
import { ImageNode } from "@blocklet/editor/lib/main/nodes/ImageNode";
|
|
19
19
|
import { VideoNode } from "@blocklet/editor/lib/ext/VideoPlugin/VideoNode";
|
|
20
|
-
import { useSize, useInViewport, useSetState, useLocalStorageState, useRequest, useGetState, useReactive } from "ahooks";
|
|
20
|
+
import { useSize, useUpdate, useInViewport, useSetState, useLocalStorageState, useRequest, useGetState, useReactive } from "ahooks";
|
|
21
21
|
import { LocaleContext, useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
22
22
|
import { Send, Save, ChatBubbleOutlineOutlined, MoreVert, NavigateNext, DeleteOutlineOutlined, ContentCopy, ArrowUpward, ArrowDownward, ArrowBackIos, Add, BorderColorOutlined } from "@mui/icons-material";
|
|
23
23
|
import LoadingButton from "@mui/lab/LoadingButton";
|
|
@@ -863,8 +863,21 @@ function Avatars({ users, variant = "circle", size = 24, ...restProps }) {
|
|
|
863
863
|
return /* @__PURE__ */ jsx(Box$1, { className: "avatars-item", sx: { position: "relative", zIndex: index + 1 }, children: /* @__PURE__ */ jsx(Avatar, { did: user.did, src: user.avatar, size, shape: "circle", variant }) }, index);
|
|
864
864
|
}) });
|
|
865
865
|
}
|
|
866
|
-
function RelativeTime({ value, ...rest }) {
|
|
866
|
+
function RelativeTime({ value, autoUpdate, ...rest }) {
|
|
867
867
|
const v2 = value instanceof Date ? value.getTime() : value;
|
|
868
|
+
const update = useUpdate();
|
|
869
|
+
const timestamp = useMemo(() => new Date(v2).getTime(), [v2]);
|
|
870
|
+
useEffect(() => {
|
|
871
|
+
if (autoUpdate) {
|
|
872
|
+
const diff = Math.abs(Date.now() - timestamp);
|
|
873
|
+
const isLessThan45Minutes = diff < 45 * 6e4;
|
|
874
|
+
if (isLessThan45Minutes) {
|
|
875
|
+
const timer = setInterval(update, 6e4);
|
|
876
|
+
return () => clearInterval(timer);
|
|
877
|
+
}
|
|
878
|
+
}
|
|
879
|
+
return void 0;
|
|
880
|
+
}, [autoUpdate, timestamp, update]);
|
|
868
881
|
return /* @__PURE__ */ jsx(UxRelativeTime, { value: v2, ...rest });
|
|
869
882
|
}
|
|
870
883
|
function EmptyStatus({ sx }) {
|
|
@@ -1315,8 +1328,14 @@ function ProfileCardTooltip({ user, children }) {
|
|
|
1315
1328
|
}, 100);
|
|
1316
1329
|
}
|
|
1317
1330
|
};
|
|
1318
|
-
|
|
1331
|
+
const renderChildren = () => {
|
|
1332
|
+
if (typeof children === "function") {
|
|
1333
|
+
return children({ navigateToProfile: click });
|
|
1334
|
+
}
|
|
1319
1335
|
return children;
|
|
1336
|
+
};
|
|
1337
|
+
if (mobile.any) {
|
|
1338
|
+
return renderChildren();
|
|
1320
1339
|
}
|
|
1321
1340
|
return /* @__PURE__ */ jsx(
|
|
1322
1341
|
HtmlTooltip$2,
|
|
@@ -1326,7 +1345,7 @@ function ProfileCardTooltip({ user, children }) {
|
|
|
1326
1345
|
onOpen: () => setOpen(true),
|
|
1327
1346
|
PopperProps: { disablePortal: false },
|
|
1328
1347
|
title: /* @__PURE__ */ jsx(ProfileCard, { user, click }),
|
|
1329
|
-
children
|
|
1348
|
+
children: renderChildren()
|
|
1330
1349
|
}
|
|
1331
1350
|
);
|
|
1332
1351
|
}
|
|
@@ -4929,7 +4948,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
4929
4948
|
}
|
|
4930
4949
|
const tablerSend = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", 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" }) });
|
|
4931
4950
|
const tablerLetterCase = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", 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" }) });
|
|
4932
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
4951
|
+
const Editor = lazyRetry(() => import("./editor-D18Hv79L.mjs"));
|
|
4933
4952
|
function LazyEditor(props) {
|
|
4934
4953
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4935
4954
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -12584,6 +12603,8 @@ export {
|
|
|
12584
12603
|
useArcSphereDialog as aA,
|
|
12585
12604
|
Paywall as aB,
|
|
12586
12605
|
SubscriptionPaywall as aC,
|
|
12606
|
+
ProfileCard as aD,
|
|
12607
|
+
ProfileCardTooltip as aE,
|
|
12587
12608
|
SecureLabelPicker as aa,
|
|
12588
12609
|
useApiErrorHandler as ab,
|
|
12589
12610
|
useDefaultApiErrorHandler as ac,
|
package/dist/index.d.ts
CHANGED
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, aB, ap, w, v, R, S, aa, ar, aC, q, a3, a5, aj, am, al, az, as, O, an, at, aw, ax, l, ay, h, p, r, k, av, t, j, ab, aA, W, c, a1, E, a8, ac, e, u, ao, d, au, a4, ak, f } from "./index-
|
|
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, aB, ap, w, v, aD, aE, R, S, aa, ar, aC, q, a3, a5, aj, am, al, az, as, O, an, at, aw, ax, l, ay, h, p, r, k, av, t, j, ab, aA, W, c, a1, E, a8, ac, e, u, ao, d, au, a4, ak, f } from "./index-DHmJSOux.mjs";
|
|
3
3
|
import "react/jsx-runtime";
|
|
4
4
|
import "react";
|
|
5
5
|
import "@mui/material/Box";
|
|
@@ -53,6 +53,8 @@ export {
|
|
|
53
53
|
ap as PointUpProvider,
|
|
54
54
|
w as Post,
|
|
55
55
|
v as PostContent,
|
|
56
|
+
aD as ProfileCard,
|
|
57
|
+
aE as ProfileCardTooltip,
|
|
56
58
|
R as RelativeTime,
|
|
57
59
|
S as ScrollableEditorWrapper,
|
|
58
60
|
aa as SecureLabelPicker,
|
package/dist/index.umd.js
CHANGED
|
@@ -787,8 +787,21 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
787
787
|
return /* @__PURE__ */ jsxRuntime.jsx(Box, { className: "avatars-item", sx: { position: "relative", zIndex: index + 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(Avatar, { did: user.did, src: user.avatar, size, shape: "circle", variant }) }, index);
|
|
788
788
|
}) });
|
|
789
789
|
}
|
|
790
|
-
function RelativeTime({ value, ...rest }) {
|
|
790
|
+
function RelativeTime({ value, autoUpdate, ...rest }) {
|
|
791
791
|
const v2 = value instanceof Date ? value.getTime() : value;
|
|
792
|
+
const update = ahooks.useUpdate();
|
|
793
|
+
const timestamp = react.useMemo(() => new Date(v2).getTime(), [v2]);
|
|
794
|
+
react.useEffect(() => {
|
|
795
|
+
if (autoUpdate) {
|
|
796
|
+
const diff = Math.abs(Date.now() - timestamp);
|
|
797
|
+
const isLessThan45Minutes = diff < 45 * 6e4;
|
|
798
|
+
if (isLessThan45Minutes) {
|
|
799
|
+
const timer = setInterval(update, 6e4);
|
|
800
|
+
return () => clearInterval(timer);
|
|
801
|
+
}
|
|
802
|
+
}
|
|
803
|
+
return void 0;
|
|
804
|
+
}, [autoUpdate, timestamp, update]);
|
|
792
805
|
return /* @__PURE__ */ jsxRuntime.jsx(UxRelativeTime, { value: v2, ...rest });
|
|
793
806
|
}
|
|
794
807
|
function EmptyStatus({ sx }) {
|
|
@@ -1239,8 +1252,14 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1239
1252
|
}, 100);
|
|
1240
1253
|
}
|
|
1241
1254
|
};
|
|
1242
|
-
|
|
1255
|
+
const renderChildren = () => {
|
|
1256
|
+
if (typeof children === "function") {
|
|
1257
|
+
return children({ navigateToProfile: click });
|
|
1258
|
+
}
|
|
1243
1259
|
return children;
|
|
1260
|
+
};
|
|
1261
|
+
if (mobile.any) {
|
|
1262
|
+
return renderChildren();
|
|
1244
1263
|
}
|
|
1245
1264
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
1246
1265
|
HtmlTooltip$2,
|
|
@@ -1250,7 +1269,7 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
1250
1269
|
onOpen: () => setOpen(true),
|
|
1251
1270
|
PopperProps: { disablePortal: false },
|
|
1252
1271
|
title: /* @__PURE__ */ jsxRuntime.jsx(ProfileCard, { user, click }),
|
|
1253
|
-
children
|
|
1272
|
+
children: renderChildren()
|
|
1254
1273
|
}
|
|
1255
1274
|
);
|
|
1256
1275
|
}
|
|
@@ -12548,6 +12567,8 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
12548
12567
|
exports2.PointUpProvider = PointUpProvider;
|
|
12549
12568
|
exports2.Post = PostComponent;
|
|
12550
12569
|
exports2.PostContent = PostContent;
|
|
12570
|
+
exports2.ProfileCard = ProfileCard;
|
|
12571
|
+
exports2.ProfileCardTooltip = ProfileCardTooltip;
|
|
12551
12572
|
exports2.RelativeTime = RelativeTime;
|
|
12552
12573
|
exports2.ScrollableEditorWrapper = ScrollableEditorWrapper;
|
|
12553
12574
|
exports2.SecureLabelPicker = SecureLabelPicker;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blocklet/discuss-kit-ux",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.42",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"ufo": "^1.5.4",
|
|
46
46
|
"unstated-next": "^1.1.0",
|
|
47
47
|
"url-join": "^4.0.1",
|
|
48
|
-
"@blocklet/editor": "^2.2.
|
|
49
|
-
"@blocklet/labels": "^2.2.
|
|
48
|
+
"@blocklet/editor": "^2.2.42",
|
|
49
|
+
"@blocklet/labels": "^2.2.42"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"@arcblock/did-connect": "^2.10.36",
|