@blocklet/discuss-kit-ux 2.4.35 → 2.4.37
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/axios.d.ts +8 -0
- package/dist/blocklets.d.ts +1 -1
- package/dist/blocklets.mjs +17 -0
- package/dist/components/api-error-handler/api-error-handler.d.ts +1 -1
- package/dist/components/api-error-handler/api-error-handler.mjs +25 -0
- package/dist/components/api-error-handler/default-handler.mjs +69 -0
- package/dist/components/api-error-handler/index.mjs +2 -0
- package/dist/components/api-error-handler/json-validation-interceptor.d.ts +1 -1
- package/dist/components/api-error-handler/json-validation-interceptor.mjs +9 -0
- package/dist/components/arcsphere/index.mjs +51 -0
- package/dist/components/authz/access-control.d.ts +15 -1
- package/dist/components/authz/access-control.mjs +15 -0
- package/dist/components/authz/context.d.ts +2 -1
- package/dist/components/authz/context.mjs +30 -0
- package/dist/components/authz/index.d.ts +1 -1
- package/dist/components/authz/index.mjs +2 -0
- package/dist/components/auto-translate/api.d.ts +1 -1
- package/dist/components/auto-translate/api.mjs +23 -0
- package/dist/components/auto-translate/auto-translate-button.d.ts +2 -1
- package/dist/components/auto-translate/auto-translate-button.mjs +47 -0
- package/dist/components/auto-translate/editor-store-adaptor.mjs +14 -0
- package/dist/components/auto-translate/index.mjs +6 -0
- package/dist/components/auto-translate/languages.mjs +61 -0
- package/dist/components/auto-translate/post-auto-translate-plugin.d.ts +4 -3
- package/dist/components/auto-translate/post-auto-translate-plugin.mjs +32 -0
- package/dist/components/auto-translate/store.d.ts +3 -3
- package/dist/components/auto-translate/store.mjs +23 -0
- package/dist/components/auto-translate/translate.d.ts +3 -2
- package/dist/components/auto-translate/translate.mjs +103 -0
- package/dist/components/auto-translate/utils.d.ts +1 -1
- package/dist/components/auto-translate/utils.mjs +14 -0
- package/dist/components/auto-translate/with-availibility-check.d.ts +1 -1
- package/dist/components/auto-translate/with-availibility-check.mjs +10 -0
- package/dist/components/avatars/author-info.d.ts +3 -2
- package/dist/components/avatars/author-info.mjs +184 -0
- package/dist/components/avatars/avatar.d.ts +2 -1
- package/dist/components/avatars/avatar.mjs +9 -0
- package/dist/components/avatars/avatars.d.ts +4 -3
- package/dist/components/avatars/avatars.mjs +49 -0
- package/dist/components/avatars/badge.d.ts +2 -1
- package/dist/components/avatars/badge.mjs +178 -0
- package/dist/components/avatars/index.mjs +5 -0
- package/dist/components/avatars/system-user.d.ts +1 -1
- package/dist/components/avatars/system-user.mjs +58 -0
- package/dist/components/back.d.ts +2 -1
- package/dist/components/back.mjs +28 -0
- package/dist/components/blog/blog-link.mjs +16 -0
- package/dist/components/blog/blog-list.d.ts +4 -3
- package/dist/components/blog/blog-list.mjs +441 -0
- package/dist/components/blog/cover-image.d.ts +4 -3
- package/dist/components/blog/cover-image.mjs +160 -0
- package/dist/components/blog/index.mjs +4 -0
- package/dist/components/blog/permalink.d.ts +3 -2
- package/dist/components/blog/permalink.mjs +78 -0
- package/dist/components/blog/types.d.ts +1 -1
- package/dist/components/blog/types.mjs +0 -0
- package/dist/components/button-group/button-group.d.ts +2 -1
- package/dist/components/button-group/button-group.mjs +195 -0
- package/dist/components/button-group/index.mjs +1 -0
- package/dist/components/chat/channel-group.d.ts +3 -2
- package/dist/components/chat/channel-group.mjs +41 -0
- package/dist/components/chat/chat-client.d.ts +2 -2
- package/dist/components/chat/chat-client.mjs +33 -0
- package/dist/components/chat/chat-header-addon.d.ts +2 -1
- package/dist/components/chat/chat-header-addon.mjs +26 -0
- package/dist/components/chat/chat-in-wallet.d.ts +2 -1
- package/dist/components/chat/chat-in-wallet.mjs +67 -0
- package/dist/components/chat/chat-input.d.ts +3 -2
- package/dist/components/chat/chat-input.mjs +295 -0
- package/dist/components/chat/chat-list-in-wallet.d.ts +2 -1
- package/dist/components/chat/chat-list-in-wallet.mjs +113 -0
- package/dist/components/chat/chat-list.d.ts +2 -1
- package/dist/components/chat/chat-list.mjs +109 -0
- package/dist/components/chat/chat-room.d.ts +3 -2
- package/dist/components/chat/chat-room.mjs +225 -0
- package/dist/components/chat/chat.d.ts +2 -1
- package/dist/components/chat/chat.mjs +163 -0
- package/dist/components/chat/context.d.ts +4 -3
- package/dist/components/chat/context.mjs +303 -0
- package/dist/components/chat/hooks.d.ts +1 -1
- package/dist/components/chat/hooks.mjs +59 -0
- package/dist/components/chat/index.mjs +7 -0
- package/dist/components/chat/message-list.d.ts +3 -2
- package/dist/components/chat/message-list.mjs +151 -0
- package/dist/components/chat/message.d.ts +4 -3
- package/dist/components/chat/message.mjs +312 -0
- package/dist/components/chat/participants.d.ts +3 -2
- package/dist/components/chat/participants.mjs +60 -0
- package/dist/components/chat/time.d.ts +1 -1
- package/dist/components/chat/time.mjs +16 -0
- package/dist/components/chat/types.d.ts +1 -1
- package/dist/components/chat/types.mjs +0 -0
- package/dist/components/chat/unread-notification.d.ts +2 -2
- package/dist/components/chat/unread-notification.mjs +43 -0
- package/dist/components/chat/user-search.d.ts +2 -1
- package/dist/components/chat/user-search.mjs +143 -0
- package/dist/components/check-mark.d.ts +2 -1
- package/dist/components/check-mark.mjs +98 -0
- package/dist/components/confirm.d.ts +4 -4
- package/dist/components/confirm.mjs +103 -0
- package/dist/components/dayjs.d.ts +1 -1
- package/dist/components/dayjs.mjs +4 -0
- package/dist/components/default-editor-config-provider.d.ts +3 -2
- package/dist/components/default-editor-config-provider.mjs +107 -0
- package/dist/components/dirty-prompt.d.ts +3 -2
- package/dist/components/dirty-prompt.mjs +117 -0
- package/dist/components/editor/editor.d.ts +4 -3
- package/dist/{editor-B3z0rXVh.mjs → components/editor/editor.mjs} +7 -8
- package/dist/components/editor/index.mjs +2 -0
- package/dist/components/editor/lazy-editor.d.ts +3 -2
- package/dist/components/editor/lazy-editor.mjs +14 -0
- package/dist/components/editor/plugins/video-path-fixer-plugin.mjs +29 -0
- package/dist/components/editor/preview.d.ts +4 -3
- package/dist/components/editor/preview.mjs +32 -0
- package/dist/components/emoji-icon.d.ts +2 -1
- package/dist/components/emoji-icon.mjs +62 -0
- package/dist/components/empty-status/empty-status.d.ts +2 -1
- package/dist/components/empty-status/empty-status.mjs +24 -0
- package/dist/components/empty-status/index.mjs +1 -0
- package/dist/components/hooks/changed.mjs +34 -0
- package/dist/components/hooks/index.mjs +6 -0
- package/dist/components/hooks/interval.mjs +16 -0
- package/dist/components/hooks/locale-context.mjs +12 -0
- package/dist/components/hooks/measure.mjs +8 -0
- package/dist/components/hooks/now.mjs +10 -0
- package/dist/components/hooks/responsive.d.ts +1 -1
- package/dist/components/hooks/responsive.mjs +25 -0
- package/dist/components/hooks/session.d.ts +1 -0
- package/dist/components/hooks/session.mjs +41 -0
- package/dist/components/hooks/use-event-callback.mjs +14 -0
- package/dist/components/icon-button.d.ts +4 -3
- package/dist/components/icon-button.mjs +37 -0
- package/dist/components/input/auto-clear-plugin.mjs +26 -0
- package/dist/components/input/comment-input.d.ts +2 -1
- package/dist/components/input/comment-input.mjs +107 -0
- package/dist/components/input/image-path-fixer-plugin.mjs +29 -0
- package/dist/components/input/index.mjs +4 -0
- package/dist/components/input/input.d.ts +4 -4
- package/dist/components/input/input.mjs +152 -0
- package/dist/components/input/post-edit.d.ts +2 -1
- package/dist/components/input/post-edit.mjs +49 -0
- package/dist/components/input/scrollable-editor-wrapper.d.ts +2 -1
- package/dist/components/input/scrollable-editor-wrapper.mjs +18 -0
- package/dist/components/input/shortcut-plugin.mjs +28 -0
- package/dist/components/label-picker.d.ts +2 -1
- package/dist/components/label-picker.mjs +41 -0
- package/dist/components/lexical.mjs +69 -0
- package/dist/components/locale/en.mjs +92 -0
- package/dist/components/locale/index.mjs +3 -0
- package/dist/components/locale/zh.mjs +94 -0
- package/dist/components/pagination.d.ts +3 -2
- package/dist/components/pagination.mjs +44 -0
- package/dist/components/paywall.d.ts +2 -2
- package/dist/components/paywall.mjs +110 -0
- package/dist/components/point-up/{box-animation.json.d.ts → box-animation.json} +1 -4
- package/dist/components/point-up/index.d.ts +3 -2
- package/dist/components/point-up/index.mjs +153 -0
- package/dist/components/point-up/lottie-component.d.ts +2 -1
- package/dist/components/point-up/lottie-component.mjs +7 -0
- package/dist/components/posts/comment-list/comment-list.d.ts +2 -1
- package/dist/components/posts/comment-list/comment-list.mjs +163 -0
- package/dist/components/posts/comment-list/context.d.ts +4 -4
- package/dist/components/posts/comment-list/context.mjs +318 -0
- package/dist/components/posts/comment.d.ts +3 -2
- package/dist/components/posts/comment.mjs +184 -0
- package/dist/components/posts/index.mjs +6 -0
- package/dist/components/posts/menu.d.ts +3 -2
- package/dist/components/posts/menu.mjs +83 -0
- package/dist/components/posts/post-content.d.ts +2 -1
- package/dist/components/posts/post-content.mjs +86 -0
- package/dist/components/posts/post.d.ts +4 -4
- package/dist/components/posts/post.mjs +198 -0
- package/dist/components/profile-card/index.mjs +1 -0
- package/dist/components/profile-card/profile-card.d.ts +4 -3
- package/dist/components/profile-card/profile-card.mjs +162 -0
- package/dist/components/rating/binary-thumb.d.ts +4 -3
- package/dist/components/rating/binary-thumb.mjs +157 -0
- package/dist/components/rating/github-reaction-container.d.ts +2 -1
- package/dist/components/rating/github-reaction-container.mjs +46 -0
- package/dist/components/rating/github-reaction.d.ts +3 -2
- package/dist/components/rating/github-reaction.mjs +173 -0
- package/dist/components/rating/index.mjs +3 -0
- package/dist/components/rating/rater-list.d.ts +3 -2
- package/dist/components/rating/rater-list.mjs +33 -0
- package/dist/components/rating/rating.d.ts +1 -1
- package/dist/components/rating/rating.mjs +50 -0
- package/dist/components/routes.d.ts +1 -1
- package/dist/components/routes.mjs +27 -0
- package/dist/components/segmented-control.d.ts +3 -2
- package/dist/components/segmented-control.mjs +55 -0
- package/dist/components/shared/relative-time.d.ts +2 -1
- package/dist/components/shared/relative-time.mjs +21 -0
- package/dist/components/toast.d.ts +1 -1
- package/dist/components/toast.mjs +44 -0
- package/dist/components/uploader/index.d.ts +3 -3
- package/dist/components/uploader/index.mjs +70 -0
- package/dist/components/uploader/utils.mjs +16 -0
- package/dist/components/utils.d.ts +4 -4
- package/dist/components/utils.mjs +139 -0
- package/dist/components/view-more.d.ts +1 -1
- package/dist/components/view-more.mjs +50 -0
- package/dist/constants.mjs +14 -0
- package/dist/global.d.ts +1 -0
- package/dist/index.mjs +37 -0
- package/dist/preferences.mjs +9 -0
- package/dist/theme/index.d.ts +3 -3
- package/dist/theme/index.mjs +96 -0
- package/dist/theme/typography.d.ts +1 -1
- package/dist/theme/typography.mjs +66 -0
- package/dist/type-override.d.ts +7 -0
- package/dist/types.mjs +0 -0
- package/dist/vite-env.d.ts +1 -0
- package/dist/ws.d.ts +2 -2
- package/dist/ws.mjs +39 -0
- package/package.json +18 -25
- package/dist/components/avatars/Avatars.stories.d.ts +0 -5
- package/dist/components/posts/Post.stories.d.ts +0 -7
- package/dist/index-BlqRGWgQ.mjs +0 -7631
- package/dist/index.es.js +0 -118
- package/dist/index.umd.js +0 -7589
- package/dist/test/fixtures/index.d.ts +0 -4
- package/dist/test/fixtures/mock-session.d.ts +0 -3
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import { useCreation, useRequest } from "ahooks";
|
|
4
|
+
import GithubReaction from "./github-reaction.mjs";
|
|
5
|
+
import { discussKitApiBaseUrl } from "../utils.mjs";
|
|
6
|
+
import { useSessionContext } from "../hooks/session.mjs";
|
|
7
|
+
const baseConfig = { baseURL: discussKitApiBaseUrl };
|
|
8
|
+
const createApi = (request) => {
|
|
9
|
+
return {
|
|
10
|
+
fetchRatings: async (id) => {
|
|
11
|
+
const { data } = await request.get(`/ratings/${id}`, baseConfig);
|
|
12
|
+
return data;
|
|
13
|
+
},
|
|
14
|
+
rate: async ({ id, ratingType, value }) => {
|
|
15
|
+
await request.post(`/topics/${id}/ratings`, { ratingType, value }, baseConfig);
|
|
16
|
+
},
|
|
17
|
+
unrate: async ({ id }) => {
|
|
18
|
+
await request.delete(`/topics/${id}/ratings`, baseConfig);
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export function GithubReactionContainer({ id, request, ...rest }) {
|
|
23
|
+
const { session } = useSessionContext();
|
|
24
|
+
const api = useCreation(() => createApi(request || axios.create({})), [request]);
|
|
25
|
+
const { data, loading, error } = useRequest(() => api.fetchRatings(id), {
|
|
26
|
+
refreshDeps: [id]
|
|
27
|
+
});
|
|
28
|
+
const handleRate = async ({ ratingType, value }) => {
|
|
29
|
+
if (!session.user) {
|
|
30
|
+
session.login();
|
|
31
|
+
throw new Error("Unauthenticated.");
|
|
32
|
+
}
|
|
33
|
+
await api.rate({ id, ratingType, value });
|
|
34
|
+
};
|
|
35
|
+
const handleUnrate = async () => {
|
|
36
|
+
if (!session.user) {
|
|
37
|
+
session.login();
|
|
38
|
+
throw new Error("Unauthenticated.");
|
|
39
|
+
}
|
|
40
|
+
await api.unrate({ id });
|
|
41
|
+
};
|
|
42
|
+
if (loading || error) {
|
|
43
|
+
return null;
|
|
44
|
+
}
|
|
45
|
+
return /* @__PURE__ */ jsx(GithubReaction, { data, onRate: handleRate, onUnrate: handleUnrate, ...rest });
|
|
46
|
+
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { IconButtonProps } from '@mui/material';
|
|
2
|
-
import { Rating as RatingType } from '../../types';
|
|
3
|
+
import type { Rating as RatingType } from '../../types';
|
|
3
4
|
export type GithubReactionProps = {
|
|
4
5
|
data: RatingType[];
|
|
5
6
|
onRate: ({ ratingType, value }: {
|
|
@@ -14,4 +15,4 @@ export type GithubReactionProps = {
|
|
|
14
15
|
* GithubReaction 与 Rating 组件不兼容, 后者是 n 选 1, GithubReaction 是 n 选 m,
|
|
15
16
|
* 所以 GithubReaction 相当于重写, 与 Rating 组件和 BinaryThumb 组件没有关系
|
|
16
17
|
*/
|
|
17
|
-
export default function GithubReaction({ data, onRate, onUnrate, interactive, sx, ...rest }: GithubReactionProps): import("react
|
|
18
|
+
export default function GithubReaction({ data, onRate, onUnrate, interactive, sx, ...rest }: GithubReactionProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo, useState } from "react";
|
|
3
|
+
import { Box, Chip, ClickAwayListener, Tooltip, alpha } from "@mui/material";
|
|
4
|
+
import MoodPlusIcon from "virtual:icons/tabler/mood-plus";
|
|
5
|
+
import { useSessionContext } from "../hooks/index.mjs";
|
|
6
|
+
import { IconButton } from "../icon-button.mjs";
|
|
7
|
+
const emojiFont = {
|
|
8
|
+
fontFamily: '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color"'
|
|
9
|
+
};
|
|
10
|
+
export default function GithubReaction({
|
|
11
|
+
data,
|
|
12
|
+
onRate,
|
|
13
|
+
onUnrate,
|
|
14
|
+
interactive = true,
|
|
15
|
+
sx,
|
|
16
|
+
...rest
|
|
17
|
+
}) {
|
|
18
|
+
const { session } = useSessionContext();
|
|
19
|
+
const [open, setOpen] = useState(false);
|
|
20
|
+
const [raters, setRaters] = useState(null);
|
|
21
|
+
const [myReaction, setMyReaction] = useState(null);
|
|
22
|
+
const options = [
|
|
23
|
+
{ value: "thumbs_up", label: "\u{1F44D}" },
|
|
24
|
+
{ value: "thumbs_down", label: "\u{1F44E}" },
|
|
25
|
+
{ value: "white_check_mark", label: "\u2705" },
|
|
26
|
+
{ value: "laugh", label: "\u{1F604}" },
|
|
27
|
+
{ value: "joy", label: "\u{1F602}" },
|
|
28
|
+
{ value: "hooray", label: "\u{1F389}" },
|
|
29
|
+
{ value: "heart", label: "\u2764\uFE0F" },
|
|
30
|
+
{ value: "rocket", label: "\u{1F680}" },
|
|
31
|
+
{ value: "eyes", label: "\u{1F440}" }
|
|
32
|
+
];
|
|
33
|
+
const ratings = useMemo(() => {
|
|
34
|
+
const mapped = data.map((x) => {
|
|
35
|
+
if (x.value == "1" || x.value == "-1") {
|
|
36
|
+
return { ...x, value: x.value == "1" ? ["thumbs_up"] : ["thumbs_down"] };
|
|
37
|
+
}
|
|
38
|
+
return { ...x, value: x.value?.split(",") || [] };
|
|
39
|
+
});
|
|
40
|
+
if (session?.user?.did && myReaction) {
|
|
41
|
+
return [...mapped.filter((x) => x.rater?.did !== session.user.did), { rater: session.user, value: myReaction }];
|
|
42
|
+
}
|
|
43
|
+
return mapped;
|
|
44
|
+
}, [data, myReaction, session.user]);
|
|
45
|
+
const countPerValue = useMemo(() => {
|
|
46
|
+
return ratings.reduce((acc, cur) => {
|
|
47
|
+
cur.value.forEach((item) => {
|
|
48
|
+
acc[item] = (acc[item] || 0) + 1;
|
|
49
|
+
});
|
|
50
|
+
return acc;
|
|
51
|
+
}, {});
|
|
52
|
+
}, [ratings]);
|
|
53
|
+
const selectedValues = useMemo(() => {
|
|
54
|
+
return ratings.find((x) => x.rater?.did === session?.user?.did)?.value || [];
|
|
55
|
+
}, [ratings, session.user]);
|
|
56
|
+
const selectedValuesMap = useMemo(() => {
|
|
57
|
+
return selectedValues.reduce((acc, cur) => ({ ...acc, [cur]: true }), {});
|
|
58
|
+
}, [selectedValues]);
|
|
59
|
+
const hasReaction = Object.keys(countPerValue).length > 0;
|
|
60
|
+
const toggleRate = (value) => {
|
|
61
|
+
if (!interactive) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
const valuesMap = { ...selectedValuesMap };
|
|
65
|
+
valuesMap[value] = !valuesMap[value];
|
|
66
|
+
const values = Object.keys(valuesMap).filter((x) => valuesMap[x]);
|
|
67
|
+
if (values.length) {
|
|
68
|
+
onRate({
|
|
69
|
+
ratingType: "github-reaction",
|
|
70
|
+
value: values.join(",")
|
|
71
|
+
});
|
|
72
|
+
} else {
|
|
73
|
+
onUnrate();
|
|
74
|
+
}
|
|
75
|
+
setMyReaction(values);
|
|
76
|
+
setOpen(false);
|
|
77
|
+
};
|
|
78
|
+
const getRatersNames = (value) => {
|
|
79
|
+
return ratings.filter((x) => x.rater && x.value.includes(value)).map((x) => x.rater.fullName);
|
|
80
|
+
};
|
|
81
|
+
const handleOpen = () => {
|
|
82
|
+
if (interactive) {
|
|
83
|
+
setOpen(!open);
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
const mergedSx = [{ position: "relative", ...hasReaction && { mt: 2.5 } }, ...Array.isArray(sx) ? sx : [sx]];
|
|
87
|
+
return /* @__PURE__ */ jsxs(IconButton, { onClick: handleOpen, sx: mergedSx, ...rest, children: [
|
|
88
|
+
/* @__PURE__ */ jsx(Box, { component: MoodPlusIcon }),
|
|
89
|
+
hasReaction && /* @__PURE__ */ jsx(Box, { sx: { position: "absolute", top: -24, left: 5, display: "flex", gap: 1 }, children: options.map((option) => {
|
|
90
|
+
if (!countPerValue[option.value]) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const selected = selectedValuesMap[option.value];
|
|
94
|
+
return /* @__PURE__ */ jsx(Tooltip, { title: raters?.join(", "), children: /* @__PURE__ */ jsx(
|
|
95
|
+
Chip,
|
|
96
|
+
{
|
|
97
|
+
label: /* @__PURE__ */ jsxs(Box, { component: "span", sx: { display: "inline-flex", alignItems: "center", gap: 1 }, children: [
|
|
98
|
+
/* @__PURE__ */ jsx(Box, { component: "span", sx: emojiFont, children: option.label }),
|
|
99
|
+
/* @__PURE__ */ jsx("span", { children: countPerValue[option.value] })
|
|
100
|
+
] }),
|
|
101
|
+
color: "default",
|
|
102
|
+
size: "small",
|
|
103
|
+
variant: selected ? "outlined" : "filled",
|
|
104
|
+
sx: {
|
|
105
|
+
lineHeight: "24px",
|
|
106
|
+
fontSize: 13,
|
|
107
|
+
border: 1,
|
|
108
|
+
borderColor: "divider",
|
|
109
|
+
borderRadius: 1,
|
|
110
|
+
cursor: "pointer",
|
|
111
|
+
bgcolor: "transparent",
|
|
112
|
+
"&:hover": {
|
|
113
|
+
bgcolor: "grey.100"
|
|
114
|
+
},
|
|
115
|
+
...selected && {
|
|
116
|
+
borderColor: "warning.light",
|
|
117
|
+
bgcolor: (theme) => alpha(theme.palette.warning.light, 0.2)
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
onClick: (e) => {
|
|
121
|
+
e.stopPropagation();
|
|
122
|
+
toggleRate(option.value);
|
|
123
|
+
},
|
|
124
|
+
onMouseEnter: () => setRaters(getRatersNames(option.value)),
|
|
125
|
+
onMouseLeave: () => setRaters(null)
|
|
126
|
+
}
|
|
127
|
+
) }, option.value);
|
|
128
|
+
}) }),
|
|
129
|
+
open && /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsx(
|
|
130
|
+
Box,
|
|
131
|
+
{
|
|
132
|
+
sx: {
|
|
133
|
+
display: "flex",
|
|
134
|
+
gap: 0.5,
|
|
135
|
+
position: "absolute",
|
|
136
|
+
left: 0,
|
|
137
|
+
bottom: 36,
|
|
138
|
+
px: 1,
|
|
139
|
+
py: 0.5,
|
|
140
|
+
border: 1,
|
|
141
|
+
borderColor: "grey.300",
|
|
142
|
+
bgcolor: "background.paper",
|
|
143
|
+
borderRadius: 1
|
|
144
|
+
},
|
|
145
|
+
children: options.map((option) => {
|
|
146
|
+
const selected = selectedValuesMap[option.value];
|
|
147
|
+
return /* @__PURE__ */ jsx(
|
|
148
|
+
Box,
|
|
149
|
+
{
|
|
150
|
+
onClick: () => toggleRate(option.value),
|
|
151
|
+
sx: {
|
|
152
|
+
display: "flex",
|
|
153
|
+
justifyContent: "center",
|
|
154
|
+
alignItems: "center",
|
|
155
|
+
width: 28,
|
|
156
|
+
height: 28,
|
|
157
|
+
fontSize: 14,
|
|
158
|
+
borderRadius: 1,
|
|
159
|
+
cursor: "pointer",
|
|
160
|
+
":hover": { bgcolor: "grey.100" },
|
|
161
|
+
...selected && {
|
|
162
|
+
bgcolor: (theme) => alpha(theme.palette.primary.light, 0.2)
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
children: /* @__PURE__ */ jsx(Box, { sx: emojiFont, children: option.label })
|
|
166
|
+
},
|
|
167
|
+
option.value
|
|
168
|
+
);
|
|
169
|
+
})
|
|
170
|
+
}
|
|
171
|
+
) })
|
|
172
|
+
] });
|
|
173
|
+
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { Rating } from '../../types';
|
|
2
3
|
interface Props {
|
|
3
4
|
open: boolean;
|
|
4
5
|
onClose: () => void;
|
|
5
6
|
value: string;
|
|
6
7
|
ratings: Rating[];
|
|
7
8
|
}
|
|
8
|
-
export default function RaterList({ open, onClose, value, ratings }: Props): import("react
|
|
9
|
+
export default function RaterList({ open, onClose, value, ratings }: Props): import("react").JSX.Element;
|
|
9
10
|
export {};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import Box from "@mui/material/Box";
|
|
3
|
+
import { styled } from "@mui/material";
|
|
4
|
+
import Dialog from "@arcblock/ux/lib/Dialog";
|
|
5
|
+
import { Avatar } from "../avatars/index.mjs";
|
|
6
|
+
const StyledDialog = styled(Dialog)`
|
|
7
|
+
.ux-dialog_header {
|
|
8
|
+
padding: 0 16px;
|
|
9
|
+
}
|
|
10
|
+
`;
|
|
11
|
+
export default function RaterList({ open, onClose, value, ratings }) {
|
|
12
|
+
const raters = ratings.filter((item) => item.value === value).map((item) => item.rater);
|
|
13
|
+
return /* @__PURE__ */ jsx(StyledDialog, { open, onClose, PaperProps: { style: { width: 400, minHeight: 200 } }, children: /* @__PURE__ */ jsx(Box, { children: raters.map((rater) => {
|
|
14
|
+
return /* @__PURE__ */ jsxs(
|
|
15
|
+
Box,
|
|
16
|
+
{
|
|
17
|
+
sx: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
gap: 2,
|
|
21
|
+
fontSize: 13,
|
|
22
|
+
color: "grey.700",
|
|
23
|
+
"& + &": { mt: 1 }
|
|
24
|
+
},
|
|
25
|
+
children: [
|
|
26
|
+
/* @__PURE__ */ jsx(Avatar, { did: rater.did, src: rater.avatar, variant: "circle", size: 26 }),
|
|
27
|
+
/* @__PURE__ */ jsx(Box, { children: rater.fullName })
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
rater.did
|
|
31
|
+
);
|
|
32
|
+
}) }) });
|
|
33
|
+
}
|
|
@@ -23,5 +23,5 @@ export interface RatingProps {
|
|
|
23
23
|
}) => Promise<any>;
|
|
24
24
|
onUnrate: () => Promise<any>;
|
|
25
25
|
}
|
|
26
|
-
declare function Rating({ ratingType, values, countPerValue, selectedValue, render, onRate, onUnrate }: RatingProps): import(
|
|
26
|
+
declare function Rating({ ratingType, values, countPerValue, selectedValue, render, onRate, onUnrate }: RatingProps): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
27
27
|
export default Rating;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { useEffect } from "react";
|
|
2
|
+
import { useSetState } from "ahooks";
|
|
3
|
+
function Rating({ ratingType, values, countPerValue, selectedValue, render, onRate, onUnrate }) {
|
|
4
|
+
const [state, setState] = useSetState({
|
|
5
|
+
selectedValue,
|
|
6
|
+
countPerValue: countPerValue || {}
|
|
7
|
+
});
|
|
8
|
+
const hasSelected = !!state.selectedValue;
|
|
9
|
+
const increaseCount = (value, inc) => {
|
|
10
|
+
setState((prevState) => ({
|
|
11
|
+
countPerValue: { ...prevState.countPerValue, [value]: (prevState.countPerValue[value] || 0) + inc }
|
|
12
|
+
}));
|
|
13
|
+
};
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
setState({
|
|
16
|
+
countPerValue: countPerValue || {},
|
|
17
|
+
selectedValue
|
|
18
|
+
});
|
|
19
|
+
}, [countPerValue, selectedValue]);
|
|
20
|
+
if (!render) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
const options = values.map((value) => {
|
|
24
|
+
return {
|
|
25
|
+
value,
|
|
26
|
+
count: state.countPerValue?.[value] || 0,
|
|
27
|
+
selected: state.selectedValue === value
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
const toggleRate = async (value) => {
|
|
31
|
+
try {
|
|
32
|
+
if (state.selectedValue === value) {
|
|
33
|
+
await onUnrate();
|
|
34
|
+
increaseCount(value, -1);
|
|
35
|
+
setState({ selectedValue: void 0 });
|
|
36
|
+
} else {
|
|
37
|
+
await onRate({ ratingType, value });
|
|
38
|
+
if (hasSelected) {
|
|
39
|
+
increaseCount(state.selectedValue, -1);
|
|
40
|
+
}
|
|
41
|
+
increaseCount(value, 1);
|
|
42
|
+
setState({ selectedValue: value });
|
|
43
|
+
}
|
|
44
|
+
} catch (e) {
|
|
45
|
+
console.error("Failed to rate.", e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
return render({ options, toggleRate });
|
|
49
|
+
}
|
|
50
|
+
export default Rating;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import joinUrl from "url-join";
|
|
2
|
+
const { pageGroup } = window.blocklet;
|
|
3
|
+
export const blogPrefix = pageGroup === "blog" ? "" : "blog";
|
|
4
|
+
export const discussionPrefix = pageGroup === "discussion" ? "" : "discussions";
|
|
5
|
+
export const docPrefix = pageGroup === "doc" ? "" : "docs";
|
|
6
|
+
export const bookmarkPrefix = pageGroup === "bookmark" ? "" : "bookmark";
|
|
7
|
+
export const blogPath = (path) => {
|
|
8
|
+
return window.blocklet.pageGroup === "blog" ? path : joinUrl("/blog", path);
|
|
9
|
+
};
|
|
10
|
+
export const discussionPath = (path) => {
|
|
11
|
+
return window.blocklet.pageGroup === "discussion" ? path : joinUrl("/discussions", path);
|
|
12
|
+
};
|
|
13
|
+
export const docPath = (path) => {
|
|
14
|
+
return window.blocklet.pageGroup === "doc" ? path : joinUrl("/docs", path);
|
|
15
|
+
};
|
|
16
|
+
export const bookmarkPath = (path) => {
|
|
17
|
+
return window.blocklet.pageGroup === "bookmark" ? path : joinUrl("/bookmark", path);
|
|
18
|
+
};
|
|
19
|
+
const getPostPrefix = (type) => {
|
|
20
|
+
return {
|
|
21
|
+
blog: "/blog",
|
|
22
|
+
doc: "/docs",
|
|
23
|
+
post: "/discussions",
|
|
24
|
+
bookmark: "/bookmark"
|
|
25
|
+
}[type];
|
|
26
|
+
};
|
|
27
|
+
export { pageGroup, getPostPrefix };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type SxProps } from '@mui/material';
|
|
2
3
|
interface Option {
|
|
3
4
|
value: string;
|
|
4
5
|
label: React.ReactNode;
|
|
@@ -9,5 +10,5 @@ interface Props {
|
|
|
9
10
|
onChange?: (value: string) => void;
|
|
10
11
|
sx?: SxProps;
|
|
11
12
|
}
|
|
12
|
-
export declare function SegmentedControl({ value, options, onChange, sx, ...rest }: Props): import("react
|
|
13
|
+
export declare function SegmentedControl({ value, options, onChange, sx, ...rest }: Props): import("react").JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Box, ToggleButton, ToggleButtonGroup } from "@mui/material";
|
|
3
|
+
import { mergeSx } from "./utils.mjs";
|
|
4
|
+
export function SegmentedControl({ value, options, onChange, sx, ...rest }) {
|
|
5
|
+
const mergedSx = mergeSx(
|
|
6
|
+
{
|
|
7
|
+
display: "inline-flex",
|
|
8
|
+
borderRadius: "100vh"
|
|
9
|
+
},
|
|
10
|
+
sx
|
|
11
|
+
);
|
|
12
|
+
return /* @__PURE__ */ jsx(Box, { sx: mergedSx, ...rest, children: /* @__PURE__ */ jsx(
|
|
13
|
+
ToggleButtonGroup,
|
|
14
|
+
{
|
|
15
|
+
size: "small",
|
|
16
|
+
value,
|
|
17
|
+
exclusive: true,
|
|
18
|
+
onChange: (_, v) => onChange?.(v),
|
|
19
|
+
sx: {
|
|
20
|
+
".MuiToggleButtonGroup-grouped": {
|
|
21
|
+
m: 0.5,
|
|
22
|
+
px: 1.5,
|
|
23
|
+
border: 0,
|
|
24
|
+
borderRadius: "100vh",
|
|
25
|
+
lineHeight: 1.3,
|
|
26
|
+
textTransform: "none",
|
|
27
|
+
color: "text.primary"
|
|
28
|
+
},
|
|
29
|
+
".MuiToggleButtonGroup-grouped.Mui-selected": {
|
|
30
|
+
border: 1,
|
|
31
|
+
borderColor: "divider"
|
|
32
|
+
},
|
|
33
|
+
".MuiToggleButtonGroup-middleButton, .MuiToggleButtonGroup-lastButton": {
|
|
34
|
+
marginLeft: "-1px",
|
|
35
|
+
borderLeft: "1px solid transparent"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
children: options.map((x) => {
|
|
39
|
+
return /* @__PURE__ */ jsx(
|
|
40
|
+
ToggleButton,
|
|
41
|
+
{
|
|
42
|
+
value: x.value,
|
|
43
|
+
sx: {
|
|
44
|
+
"&.Mui-selected": {
|
|
45
|
+
backgroundColor: "action.hover"
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
children: x.label
|
|
49
|
+
},
|
|
50
|
+
x.value
|
|
51
|
+
);
|
|
52
|
+
})
|
|
53
|
+
}
|
|
54
|
+
) });
|
|
55
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
interface Props {
|
|
2
3
|
value: string | number | Date;
|
|
3
4
|
[key: string]: any;
|
|
4
5
|
autoUpdate?: boolean;
|
|
5
6
|
}
|
|
6
|
-
export default function RelativeTime({ value, autoUpdate, ...rest }: Props): import("react
|
|
7
|
+
export default function RelativeTime({ value, autoUpdate, ...rest }: Props): import("react").JSX.Element;
|
|
7
8
|
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import UxRelativeTime from "@arcblock/ux/lib/RelativeTime";
|
|
3
|
+
import { useUpdate } from "ahooks";
|
|
4
|
+
import { useEffect, useMemo } from "react";
|
|
5
|
+
export default function RelativeTime({ value, autoUpdate, ...rest }) {
|
|
6
|
+
const v = value instanceof Date ? value.getTime() : value;
|
|
7
|
+
const update = useUpdate();
|
|
8
|
+
const timestamp = useMemo(() => new Date(v).getTime(), [v]);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
if (autoUpdate) {
|
|
11
|
+
const diff = Math.abs(Date.now() - timestamp);
|
|
12
|
+
const isLessThan45Minutes = diff < 45 * 6e4;
|
|
13
|
+
if (isLessThan45Minutes) {
|
|
14
|
+
const timer = setInterval(update, 6e4);
|
|
15
|
+
return () => clearInterval(timer);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
return void 0;
|
|
19
|
+
}, [autoUpdate, timestamp, update]);
|
|
20
|
+
return /* @__PURE__ */ jsx(UxRelativeTime, { value: v, ...rest });
|
|
21
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import hotToast from "react-hot-toast";
|
|
2
|
+
import bridge from "@arcblock/bridge";
|
|
3
|
+
let toast = Object.assign(hotToast, {
|
|
4
|
+
warning: (message, options) => {
|
|
5
|
+
return hotToast.error(message, { ...options, icon: "\u26A0\uFE0F" });
|
|
6
|
+
}
|
|
7
|
+
});
|
|
8
|
+
const isInArcSphere = window?.navigator?.userAgent.indexOf("ArcSphere") > -1;
|
|
9
|
+
if (isInArcSphere) {
|
|
10
|
+
toast = Object.assign(
|
|
11
|
+
(message) => {
|
|
12
|
+
try {
|
|
13
|
+
return bridge.call("arc__toast", { text: message });
|
|
14
|
+
} catch (e) {
|
|
15
|
+
return hotToast(message);
|
|
16
|
+
}
|
|
17
|
+
},
|
|
18
|
+
hotToast,
|
|
19
|
+
{
|
|
20
|
+
error: (message) => {
|
|
21
|
+
try {
|
|
22
|
+
return bridge.call("arc__toast", { text: message, level: "error" });
|
|
23
|
+
} catch (e) {
|
|
24
|
+
return hotToast.error(message);
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
success: (message) => {
|
|
28
|
+
try {
|
|
29
|
+
return bridge.call("arc__toast", { text: message, level: "success" });
|
|
30
|
+
} catch (e) {
|
|
31
|
+
return hotToast.success(message);
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
warning: (message, options) => {
|
|
35
|
+
try {
|
|
36
|
+
return bridge.call("arc__toast", { text: message, level: "warning" });
|
|
37
|
+
} catch (e) {
|
|
38
|
+
return hotToast.error(message, { ...options, icon: "\u26A0\uFE0F" });
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
export { toast };
|
|
@@ -3,11 +3,11 @@ export * from './utils';
|
|
|
3
3
|
interface UploaderProviderProps {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
}
|
|
6
|
-
export declare const UploaderContext: import(
|
|
6
|
+
export declare const UploaderContext: import("react").Context<null>;
|
|
7
7
|
export declare function useUploader(): never;
|
|
8
8
|
export declare function UploaderTrigger({ onChange, children }: {
|
|
9
9
|
onChange?: Function;
|
|
10
10
|
children?: ReactNode;
|
|
11
|
-
}): import("react
|
|
12
|
-
export declare function UploaderProvider({ children }: UploaderProviderProps): import("react
|
|
11
|
+
}): import("react").JSX.Element;
|
|
12
|
+
export declare function UploaderProvider({ children }: UploaderProviderProps): import("react").JSX.Element;
|
|
13
13
|
export default UploaderProvider;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "@mui/material";
|
|
3
|
+
import { createContext, useContext, useRef, Suspense } from "react";
|
|
4
|
+
import { lazyRetry as lazy } from "@arcblock/ux/lib/Util";
|
|
5
|
+
import { createPortal } from "react-dom";
|
|
6
|
+
import { useLocaleContext } from "@arcblock/ux/lib/Locale/context";
|
|
7
|
+
export * from "./utils.mjs";
|
|
8
|
+
const UploaderComponent = lazy(() => import("@blocklet/uploader").then((res) => ({ default: res.Uploader })));
|
|
9
|
+
export const UploaderContext = createContext(null);
|
|
10
|
+
export function useUploader() {
|
|
11
|
+
const uploaderRef = useContext(UploaderContext);
|
|
12
|
+
if (!uploaderRef) {
|
|
13
|
+
throw new Error("useUploader must be used within an UploaderProvider");
|
|
14
|
+
}
|
|
15
|
+
return uploaderRef;
|
|
16
|
+
}
|
|
17
|
+
export function UploaderTrigger({ onChange, children }) {
|
|
18
|
+
const uploaderRef = useUploader();
|
|
19
|
+
const handleOpen = () => {
|
|
20
|
+
const uploader = uploaderRef?.current?.getUploader();
|
|
21
|
+
const setMaxNumberOfFiles = (maxNumberOfFiles) => {
|
|
22
|
+
uploader?.setOptions({
|
|
23
|
+
// @ts-ignore
|
|
24
|
+
restrictions: {
|
|
25
|
+
maxNumberOfFiles
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
};
|
|
29
|
+
uploader?.open();
|
|
30
|
+
setMaxNumberOfFiles(1);
|
|
31
|
+
uploader?.onClose(() => {
|
|
32
|
+
setMaxNumberOfFiles(void 0);
|
|
33
|
+
});
|
|
34
|
+
if (onChange) {
|
|
35
|
+
uploader.onceUploadSuccess((...args) => {
|
|
36
|
+
onChange(...args);
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
return /* @__PURE__ */ jsx(Box, { onClick: handleOpen, children });
|
|
41
|
+
}
|
|
42
|
+
export function UploaderProvider({ children }) {
|
|
43
|
+
const uploaderRef = useRef(null);
|
|
44
|
+
const { locale } = useLocaleContext();
|
|
45
|
+
window.uploaderRef = uploaderRef;
|
|
46
|
+
return /* @__PURE__ */ jsxs(UploaderContext.Provider, { value: uploaderRef, children: [
|
|
47
|
+
children,
|
|
48
|
+
/* @__PURE__ */ jsx(Suspense, { children: createPortal(
|
|
49
|
+
/* @__PURE__ */ jsx(
|
|
50
|
+
UploaderComponent,
|
|
51
|
+
{
|
|
52
|
+
locale,
|
|
53
|
+
ref: uploaderRef,
|
|
54
|
+
popup: true,
|
|
55
|
+
coreProps: {
|
|
56
|
+
// 不做代码限制,默认使用 Media Kit 配置
|
|
57
|
+
// // 上传限制,参考 https://uppy.io/docs/uppy/#restrictions
|
|
58
|
+
// restrictions: {
|
|
59
|
+
// allowedFileExts: ['.png', '.jpg', '.jpeg', '.gif', '.webp', '.svg', '.mp4', '.webm', '.pdf'],
|
|
60
|
+
// maxNumberOfFiles: undefined, // default is unlimited
|
|
61
|
+
// },
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
"uploader"
|
|
65
|
+
),
|
|
66
|
+
document.body
|
|
67
|
+
) })
|
|
68
|
+
] });
|
|
69
|
+
}
|
|
70
|
+
export default UploaderProvider;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { joinURL } from "ufo";
|
|
2
|
+
export const getUploadedImageUrl = (imageUrl, width = 320) => {
|
|
3
|
+
const prefix = joinURL(window.blocklet?.prefix || "/", "uploads");
|
|
4
|
+
let result = imageUrl;
|
|
5
|
+
if (imageUrl && imageUrl.startsWith("/") && !imageUrl.startsWith(prefix)) {
|
|
6
|
+
result = joinURL(prefix, imageUrl);
|
|
7
|
+
const tmp = new URL(result, window.location.origin);
|
|
8
|
+
if (!imageUrl.endsWith(".gif")) {
|
|
9
|
+
tmp.searchParams.set("imageFilter", "resize");
|
|
10
|
+
tmp.searchParams.set("w", width.toString());
|
|
11
|
+
tmp.searchParams.set("f", "webp");
|
|
12
|
+
}
|
|
13
|
+
return tmp.href;
|
|
14
|
+
}
|
|
15
|
+
return result;
|
|
16
|
+
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { SxProps, Theme } from '@mui/material';
|
|
2
|
-
import { SystemStyleObject } from '@mui/system';
|
|
1
|
+
import type { SxProps, Theme } from '@mui/material';
|
|
2
|
+
import type { SystemStyleObject } from '@mui/system';
|
|
3
3
|
export declare const repairBase64Avatar: (avatar?: string) => string | undefined;
|
|
4
4
|
export declare const getResizedAvatar: (avatar: string, size?: number) => string;
|
|
5
5
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -9,7 +9,7 @@ export declare const copy: (text: string) => void;
|
|
|
9
9
|
export declare const getLastItem: <T>(arr: T[]) => T | null;
|
|
10
10
|
export declare function tryParseJSONObject(str: string): boolean;
|
|
11
11
|
export declare const getPreference: (key: string) => any;
|
|
12
|
-
export declare const getBlockletMountPointInfo: (name: string) =>
|
|
12
|
+
export declare const getBlockletMountPointInfo: (name: string) => any;
|
|
13
13
|
export declare const blockletExists: (name: string) => boolean;
|
|
14
14
|
export declare const getExcerptFromLexicalContent: (content: any, size?: number) => string;
|
|
15
15
|
export declare const mergeSx: (initial: SystemStyleObject<Theme>, sx?: SxProps<Theme>) => any[];
|
|
@@ -19,5 +19,5 @@ export declare const discussKitUploadsUrl: string;
|
|
|
19
19
|
export declare const isInDiscussKitApp: boolean | "" | undefined;
|
|
20
20
|
export declare const openProfile: (did: string, newTab?: boolean) => void;
|
|
21
21
|
export declare const randomId: () => string;
|
|
22
|
-
export declare const getDiscussKitClientId: () =>
|
|
22
|
+
export declare const getDiscussKitClientId: () => any;
|
|
23
23
|
export declare const getPaymentKitMountPoint: () => string | undefined;
|