@blocklet/discuss-kit-ux 2.3.29 → 2.3.30
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/icon-button.d.ts +5 -0
- package/dist/components/posts/index.d.ts +0 -1
- package/dist/components/rating/github-reaction-container.d.ts +8 -0
- package/dist/components/rating/github-reaction.d.ts +4 -6
- package/dist/components/rating/index.d.ts +1 -0
- package/dist/components/utils.d.ts +1 -0
- package/dist/{editor-0vgdtLUw.mjs → editor-D7LXxjZZ.mjs} +1 -1
- package/dist/{index-B3SYykDM.mjs → index-DaWKO34e.mjs} +202 -202
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +61 -60
- package/dist/index.umd.js +140 -140
- package/package.json +3 -3
- package/dist/components/posts/comment-icon-button.d.ts +0 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { BoxProps, IconButtonProps } from '@mui/material';
|
|
2
|
+
export declare function IconButton<C extends React.ElementType>({ sx, ...rest }: IconButtonProps<C, {
|
|
3
|
+
component?: C;
|
|
4
|
+
}>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare function IconButtonGroup({ children, sx, ...rest }: BoxProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
2
|
+
import { GithubReactionProps } from './github-reaction';
|
|
3
|
+
interface Props extends Omit<GithubReactionProps, 'data' | 'onRate' | 'onUnrate'> {
|
|
4
|
+
id: string;
|
|
5
|
+
request: AxiosInstance;
|
|
6
|
+
}
|
|
7
|
+
export declare function GithubReactionContainer({ id, request, ...rest }: Props): import("react/jsx-runtime").JSX.Element | null;
|
|
8
|
+
export {};
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { IconButtonProps } from '@mui/material';
|
|
2
2
|
import { Rating as RatingType } from '../../types';
|
|
3
|
-
type GithubReactionProps = {
|
|
3
|
+
export type GithubReactionProps = {
|
|
4
4
|
data: RatingType[];
|
|
5
5
|
onRate: ({ ratingType, value }: {
|
|
6
6
|
ratingType: string;
|
|
7
7
|
value: string;
|
|
8
8
|
}) => Promise<any>;
|
|
9
9
|
onUnrate: () => Promise<any>;
|
|
10
|
-
append?: React.ReactNode;
|
|
11
10
|
interactive?: boolean;
|
|
12
|
-
};
|
|
11
|
+
} & IconButtonProps;
|
|
13
12
|
/**
|
|
14
13
|
* 说明:
|
|
15
14
|
* GithubReaction 与 Rating 组件不兼容, 后者是 n 选 1, GithubReaction 是 n 选 m,
|
|
16
15
|
* 所以 GithubReaction 相当于重写, 与 Rating 组件和 BinaryThumb 组件没有关系
|
|
17
16
|
*/
|
|
18
|
-
export default function GithubReaction({ data, onRate, onUnrate,
|
|
19
|
-
export {};
|
|
17
|
+
export default function GithubReaction({ data, onRate, onUnrate, interactive, sx, ...rest }: GithubReactionProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -14,6 +14,7 @@ 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[];
|
|
16
16
|
export declare const discussKitMountPoint: string | undefined;
|
|
17
|
+
export declare const discussKitApiBaseUrl: string;
|
|
17
18
|
export declare const discussKitUploadsUrl: string;
|
|
18
19
|
export declare const isInDiscussKitApp: boolean | "" | undefined;
|
|
19
20
|
export declare const openProfile: (did: string, newTab?: boolean) => void;
|
|
@@ -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-DaWKO34e.mjs";
|
|
8
8
|
const BlockletEditor = lazyRetry(() => import("@blocklet/editor"));
|
|
9
9
|
const Root = styled(Box)`
|
|
10
10
|
.be-editable,
|
|
@@ -7,7 +7,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
7
7
|
import { useTheme, ThemeProvider, styled as styled$2 } from "@mui/material/styles";
|
|
8
8
|
import { create as create$1, styled } from "@arcblock/ux/lib/Theme";
|
|
9
9
|
import { useEffect, useRef, useState, createElement, useContext, useMemo, useLayoutEffect, useCallback, isValidElement, Suspense, createContext, Fragment as Fragment$1, forwardRef, useImperativeHandle } from "react";
|
|
10
|
-
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$1, Button as Button$1, Stack as Stack$1, Dialog, DialogTitle, DialogContent, DialogActions, DialogContentText, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Divider,
|
|
10
|
+
import { Box, useTheme as useTheme$1, useMediaQuery, styled as styled$1, Button as Button$1, Stack as Stack$1, Dialog, DialogTitle, DialogContent, DialogActions, DialogContentText, IconButton as IconButton$3, Tooltip as Tooltip$1, Chip as Chip$1, alpha, ClickAwayListener, Divider, Skeleton, InputBase, tooltipClasses as tooltipClasses$1, CircularProgress, Backdrop, Autocomplete, Typography as Typography$1, TextField, InputAdornment, SwipeableDrawer, Badge as Badge$1, ToggleButtonGroup, ToggleButton } from "@mui/material";
|
|
11
11
|
import isNil from "lodash/isNil";
|
|
12
12
|
import { useEditorConfig, EditorConfigProvider } from "@blocklet/editor/lib/config";
|
|
13
13
|
import { lazyWithPreload } from "react-lazy-with-preload";
|
|
@@ -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, useUpdate, useInViewport, useSetState,
|
|
20
|
+
import { useSize, useUpdate, useInViewport, useSetState, useCreation, useRequest, useLocalStorageState, 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";
|
|
@@ -54,11 +54,12 @@ import { lazyRetry } from "@arcblock/ux/lib/Util";
|
|
|
54
54
|
import CheckboxPlugin from "@blocklet/editor/lib/ext/CheckboxPlugin";
|
|
55
55
|
import MuiMenuItem from "@mui/material/MenuItem";
|
|
56
56
|
import clsx from "clsx";
|
|
57
|
-
import IconButton$
|
|
57
|
+
import IconButton$2 from "@mui/material/IconButton";
|
|
58
58
|
import MuiMenu from "@mui/material/Menu";
|
|
59
59
|
import { EditorHolderProvider } from "@blocklet/editor/lib/ext/EditorHolderPlugin";
|
|
60
60
|
import red from "@mui/material/colors/red";
|
|
61
61
|
import Dialog$1 from "@arcblock/ux/lib/Dialog";
|
|
62
|
+
import axios, { AxiosError } from "axios";
|
|
62
63
|
import orderBy from "lodash/orderBy";
|
|
63
64
|
import Typography from "@mui/material/Typography";
|
|
64
65
|
import Skeleton$1 from "@mui/material/Skeleton";
|
|
@@ -77,7 +78,6 @@ import debounce from "lodash/debounce";
|
|
|
77
78
|
import { useIsFocused } from "@blocklet/editor/lib/main/hooks/useIsFocused";
|
|
78
79
|
import { BusyPlugin } from "@blocklet/editor/lib/ext/BusyPlugin";
|
|
79
80
|
import { AddonButton } from "@arcblock/ux/lib/Header/addon-button";
|
|
80
|
-
import { AxiosError } from "axios";
|
|
81
81
|
import hotToast from "react-hot-toast";
|
|
82
82
|
import MuiPagination from "@mui/material/Pagination";
|
|
83
83
|
import { createContainer } from "unstated-next";
|
|
@@ -364,6 +364,7 @@ const mergeSx = (initial, sx) => {
|
|
|
364
364
|
return mergedSx;
|
|
365
365
|
};
|
|
366
366
|
const discussKitMountPoint = (_a = getBlockletMountPointInfo("did-comments")) == null ? void 0 : _a.mountPoint;
|
|
367
|
+
const discussKitApiBaseUrl = joinURL(window.location.origin, discussKitMountPoint || "", "api");
|
|
367
368
|
const discussKitUploadsUrl = joinURL(discussKitMountPoint || "", "/uploads");
|
|
368
369
|
const isInDiscussKitApp = discussKitMountPoint && withTrailingSlash(window.blocklet.prefix) === withTrailingSlash(discussKitMountPoint);
|
|
369
370
|
const openProfile = (did, newTab) => {
|
|
@@ -390,6 +391,7 @@ const utils = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePropert
|
|
|
390
391
|
__proto__: null,
|
|
391
392
|
blockletExists,
|
|
392
393
|
copy,
|
|
394
|
+
discussKitApiBaseUrl,
|
|
393
395
|
discussKitMountPoint,
|
|
394
396
|
discussKitUploadsUrl,
|
|
395
397
|
getBlockletMountPointInfo,
|
|
@@ -1709,7 +1711,7 @@ function Menu({ items = [], ...rest }) {
|
|
|
1709
1711
|
}
|
|
1710
1712
|
return /* @__PURE__ */ jsxs(Box$1, { display: "inline-block", ...rest, onClick: handleOnClick, children: [
|
|
1711
1713
|
/* @__PURE__ */ jsx(
|
|
1712
|
-
IconButton$
|
|
1714
|
+
IconButton$2,
|
|
1713
1715
|
{
|
|
1714
1716
|
size: "medium",
|
|
1715
1717
|
className: "menu-icon",
|
|
@@ -2110,7 +2112,7 @@ function BinaryThumb({ data = [], variant = "default", size = "sm", ...rest }) {
|
|
|
2110
2112
|
const icon = option.value === "-1" ? /* @__PURE__ */ jsx(iconoirThumbsUp, { style: { transform: "rotate(180deg)" } }) : /* @__PURE__ */ jsx(iconoirThumbsUp, {});
|
|
2111
2113
|
return /* @__PURE__ */ jsxs("div", { className: "reaction-item", children: [
|
|
2112
2114
|
/* @__PURE__ */ jsx(
|
|
2113
|
-
IconButton,
|
|
2115
|
+
IconButton$1,
|
|
2114
2116
|
{
|
|
2115
2117
|
className: "reaction-item-btn",
|
|
2116
2118
|
icon,
|
|
@@ -2154,7 +2156,7 @@ const Root = styled(Box$1)`
|
|
|
2154
2156
|
align-items: center;
|
|
2155
2157
|
}
|
|
2156
2158
|
`;
|
|
2157
|
-
function IconButton({ icon, text, onClick, selected, variant, size, onTextClick, disabled, ...rest }) {
|
|
2159
|
+
function IconButton$1({ icon, text, onClick, selected, variant, size, onTextClick, disabled, ...rest }) {
|
|
2158
2160
|
const classes = clsx(rest.className, `reaction-btn-${size} reaction-btn-${variant}`, {
|
|
2159
2161
|
"reaction-btn-selected": selected,
|
|
2160
2162
|
"button-disabled": disabled
|
|
@@ -2232,6 +2234,41 @@ const tablerMoodPlus = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24
|
|
|
2232
2234
|
/* @__PURE__ */ jsx("path", { d: "M20.985 12.528a9 9 0 1 0-8.45 8.456M16 19h6m-3-3v6M9 10h.01M15 10h.01" }),
|
|
2233
2235
|
/* @__PURE__ */ jsx("path", { d: "M9.5 15c.658.64 1.56 1 2.5 1s1.842-.36 2.5-1" })
|
|
2234
2236
|
] }) });
|
|
2237
|
+
function IconButton({ sx, ...rest }) {
|
|
2238
|
+
const mergedSx = [
|
|
2239
|
+
{
|
|
2240
|
+
svg: {
|
|
2241
|
+
width: "1em",
|
|
2242
|
+
height: "1em",
|
|
2243
|
+
fontSize: 20
|
|
2244
|
+
},
|
|
2245
|
+
color: "text.secondary",
|
|
2246
|
+
"&:hover": {
|
|
2247
|
+
color: "primary.main"
|
|
2248
|
+
}
|
|
2249
|
+
},
|
|
2250
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
2251
|
+
];
|
|
2252
|
+
return /* @__PURE__ */ jsx(IconButton$3, { color: "primary", size: "small", sx: mergedSx, ...rest, disableFocusRipple: true });
|
|
2253
|
+
}
|
|
2254
|
+
function IconButtonGroup({ children, sx, ...rest }) {
|
|
2255
|
+
const mergedSx = [
|
|
2256
|
+
{
|
|
2257
|
+
display: "flex",
|
|
2258
|
+
alignItems: "center",
|
|
2259
|
+
gap: 2,
|
|
2260
|
+
"& > .MuiIconButton-root:first-child": {
|
|
2261
|
+
ml: "-5px"
|
|
2262
|
+
},
|
|
2263
|
+
// 避免局部 theme 覆盖问题 (如 comment donation 中的 IconButton 会以 donation 局部的 theme palette 为准)
|
|
2264
|
+
".MuiIconButton-root:hover": {
|
|
2265
|
+
color: "primary.main"
|
|
2266
|
+
}
|
|
2267
|
+
},
|
|
2268
|
+
...Array.isArray(sx) ? sx : [sx]
|
|
2269
|
+
];
|
|
2270
|
+
return /* @__PURE__ */ jsx(Box, { ...rest, sx: mergedSx, children });
|
|
2271
|
+
}
|
|
2235
2272
|
const emojiFont = {
|
|
2236
2273
|
fontFamily: '"Twemoji Mozilla", "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji", "EmojiOne Color"'
|
|
2237
2274
|
};
|
|
@@ -2239,7 +2276,6 @@ function GithubReaction({
|
|
|
2239
2276
|
data,
|
|
2240
2277
|
onRate,
|
|
2241
2278
|
onUnrate,
|
|
2242
|
-
append,
|
|
2243
2279
|
interactive = true,
|
|
2244
2280
|
sx,
|
|
2245
2281
|
...rest
|
|
@@ -2294,6 +2330,7 @@ function GithubReaction({
|
|
|
2294
2330
|
const selectedValuesMap = useMemo(() => {
|
|
2295
2331
|
return selectedValues.reduce((acc, cur) => ({ ...acc, [cur]: true }), {});
|
|
2296
2332
|
}, [selectedValues]);
|
|
2333
|
+
const hasReaction = Object.keys(countPerValue).length > 0;
|
|
2297
2334
|
const toggleRate = (value) => {
|
|
2298
2335
|
if (!interactive) {
|
|
2299
2336
|
return;
|
|
@@ -2320,9 +2357,10 @@ function GithubReaction({
|
|
|
2320
2357
|
setOpen(!open);
|
|
2321
2358
|
}
|
|
2322
2359
|
};
|
|
2323
|
-
const mergedSx = [{}, ...Array.isArray(sx) ? sx : [sx]];
|
|
2324
|
-
return /* @__PURE__ */ jsxs(
|
|
2325
|
-
|
|
2360
|
+
const mergedSx = [{ position: "relative", ...hasReaction && { mt: 2 } }, ...Array.isArray(sx) ? sx : [sx]];
|
|
2361
|
+
return /* @__PURE__ */ jsxs(IconButton, { onClick: handleOpen, sx: mergedSx, ...rest, children: [
|
|
2362
|
+
/* @__PURE__ */ jsx(Box, { component: tablerMoodPlus }),
|
|
2363
|
+
hasReaction && /* @__PURE__ */ jsx(Box, { sx: { position: "absolute", top: -24, left: 0, display: "flex", gap: 1 }, children: options.map((option) => {
|
|
2326
2364
|
if (!countPerValue[option.value]) {
|
|
2327
2365
|
return null;
|
|
2328
2366
|
}
|
|
@@ -2353,98 +2391,100 @@ function GithubReaction({
|
|
|
2353
2391
|
bgcolor: (theme) => alpha(theme.palette.warning.light, 0.2)
|
|
2354
2392
|
}
|
|
2355
2393
|
},
|
|
2356
|
-
onClick: () =>
|
|
2394
|
+
onClick: (e) => {
|
|
2395
|
+
e.stopPropagation();
|
|
2396
|
+
toggleRate(option.value);
|
|
2397
|
+
},
|
|
2357
2398
|
onMouseEnter: () => setRaters(getRatersNames(option.value)),
|
|
2358
2399
|
onMouseLeave: () => setRaters(null)
|
|
2359
2400
|
}
|
|
2360
2401
|
) }, option.value);
|
|
2361
2402
|
}) }),
|
|
2362
|
-
/* @__PURE__ */
|
|
2403
|
+
open && /* @__PURE__ */ jsx(ClickAwayListener, { onClickAway: () => setOpen(false), children: /* @__PURE__ */ jsx(
|
|
2363
2404
|
Box,
|
|
2364
2405
|
{
|
|
2365
2406
|
sx: {
|
|
2366
2407
|
display: "flex",
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
color: "secondary.main"
|
|
2378
|
-
}
|
|
2408
|
+
gap: 0.5,
|
|
2409
|
+
position: "absolute",
|
|
2410
|
+
left: 0,
|
|
2411
|
+
bottom: 36,
|
|
2412
|
+
px: 1,
|
|
2413
|
+
py: 0.5,
|
|
2414
|
+
border: 1,
|
|
2415
|
+
borderColor: "grey.300",
|
|
2416
|
+
bgcolor: "background.paper",
|
|
2417
|
+
borderRadius: 1
|
|
2379
2418
|
},
|
|
2380
|
-
children:
|
|
2381
|
-
|
|
2419
|
+
children: options.map((option) => {
|
|
2420
|
+
const selected = selectedValuesMap[option.value];
|
|
2421
|
+
return /* @__PURE__ */ jsx(
|
|
2382
2422
|
Box,
|
|
2383
2423
|
{
|
|
2424
|
+
onClick: () => toggleRate(option.value),
|
|
2384
2425
|
sx: {
|
|
2385
|
-
position: "relative",
|
|
2386
2426
|
display: "flex",
|
|
2387
2427
|
justifyContent: "center",
|
|
2388
2428
|
alignItems: "center",
|
|
2389
|
-
|
|
2390
|
-
|
|
2391
|
-
|
|
2429
|
+
width: 28,
|
|
2430
|
+
height: 28,
|
|
2431
|
+
fontSize: 14,
|
|
2432
|
+
borderRadius: 1,
|
|
2433
|
+
cursor: "pointer",
|
|
2434
|
+
":hover": { bgcolor: "grey.100" },
|
|
2435
|
+
...selected && {
|
|
2436
|
+
bgcolor: (theme) => alpha(theme.palette.primary.light, 0.2)
|
|
2437
|
+
}
|
|
2392
2438
|
},
|
|
2393
|
-
|
|
2394
|
-
|
|
2395
|
-
|
|
2396
|
-
|
|
2397
|
-
|
|
2398
|
-
{
|
|
2399
|
-
sx: {
|
|
2400
|
-
display: "flex",
|
|
2401
|
-
gap: 0.5,
|
|
2402
|
-
position: "absolute",
|
|
2403
|
-
left: 0,
|
|
2404
|
-
bottom: 36,
|
|
2405
|
-
px: 1,
|
|
2406
|
-
py: 0.5,
|
|
2407
|
-
border: 1,
|
|
2408
|
-
borderColor: "grey.300",
|
|
2409
|
-
bgcolor: "#fff",
|
|
2410
|
-
borderRadius: 1
|
|
2411
|
-
},
|
|
2412
|
-
children: options.map((option) => {
|
|
2413
|
-
const selected = selectedValuesMap[option.value];
|
|
2414
|
-
return /* @__PURE__ */ jsx(
|
|
2415
|
-
Box,
|
|
2416
|
-
{
|
|
2417
|
-
onClick: () => toggleRate(option.value),
|
|
2418
|
-
sx: {
|
|
2419
|
-
display: "flex",
|
|
2420
|
-
justifyContent: "center",
|
|
2421
|
-
alignItems: "center",
|
|
2422
|
-
width: 28,
|
|
2423
|
-
height: 28,
|
|
2424
|
-
fontSize: 14,
|
|
2425
|
-
borderRadius: 1,
|
|
2426
|
-
cursor: "pointer",
|
|
2427
|
-
":hover": { bgcolor: "grey.100" },
|
|
2428
|
-
...selected && {
|
|
2429
|
-
bgcolor: (theme) => alpha(theme.palette.primary.light, 0.2)
|
|
2430
|
-
}
|
|
2431
|
-
},
|
|
2432
|
-
children: /* @__PURE__ */ jsx(Box, { sx: emojiFont, children: option.label })
|
|
2433
|
-
},
|
|
2434
|
-
option.value
|
|
2435
|
-
);
|
|
2436
|
-
})
|
|
2437
|
-
}
|
|
2438
|
-
) })
|
|
2439
|
-
]
|
|
2440
|
-
}
|
|
2441
|
-
),
|
|
2442
|
-
append
|
|
2443
|
-
]
|
|
2439
|
+
children: /* @__PURE__ */ jsx(Box, { sx: emojiFont, children: option.label })
|
|
2440
|
+
},
|
|
2441
|
+
option.value
|
|
2442
|
+
);
|
|
2443
|
+
})
|
|
2444
2444
|
}
|
|
2445
|
-
)
|
|
2445
|
+
) })
|
|
2446
2446
|
] });
|
|
2447
2447
|
}
|
|
2448
|
+
const baseConfig = { baseURL: discussKitApiBaseUrl };
|
|
2449
|
+
const createApi = (request) => {
|
|
2450
|
+
return {
|
|
2451
|
+
fetchRatings: async (id2) => {
|
|
2452
|
+
const { data } = await request.get(`/ratings/${id2}`, baseConfig);
|
|
2453
|
+
return data;
|
|
2454
|
+
},
|
|
2455
|
+
rate: async ({ id: id2, ratingType, value }) => {
|
|
2456
|
+
await request.post(`/topics/${id2}/ratings`, { ratingType, value }, baseConfig);
|
|
2457
|
+
},
|
|
2458
|
+
unrate: async ({ id: id2 }) => {
|
|
2459
|
+
await request.delete(`/topics/${id2}/ratings`, baseConfig);
|
|
2460
|
+
}
|
|
2461
|
+
};
|
|
2462
|
+
};
|
|
2463
|
+
function GithubReactionContainer({ id: id2, request, ...rest }) {
|
|
2464
|
+
const { session } = useSessionContext();
|
|
2465
|
+
const api = useCreation(() => createApi(request || axios.create({})), [request]);
|
|
2466
|
+
const { data, loading, error } = useRequest(() => api.fetchRatings(id2), {
|
|
2467
|
+
refreshDeps: [id2]
|
|
2468
|
+
});
|
|
2469
|
+
const handleRate = async ({ ratingType, value }) => {
|
|
2470
|
+
if (!session.user) {
|
|
2471
|
+
session.login();
|
|
2472
|
+
throw new Error("Unauthenticated.");
|
|
2473
|
+
}
|
|
2474
|
+
await api.rate({ id: id2, ratingType, value });
|
|
2475
|
+
};
|
|
2476
|
+
const handleUnrate = async () => {
|
|
2477
|
+
if (!session.user) {
|
|
2478
|
+
session.login();
|
|
2479
|
+
throw new Error("Unauthenticated.");
|
|
2480
|
+
}
|
|
2481
|
+
await api.unrate({ id: id2 });
|
|
2482
|
+
};
|
|
2483
|
+
if (loading || error) {
|
|
2484
|
+
return null;
|
|
2485
|
+
}
|
|
2486
|
+
return /* @__PURE__ */ jsx(GithubReaction, { data, onRate: handleRate, onUnrate: handleUnrate, ...rest });
|
|
2487
|
+
}
|
|
2448
2488
|
function Comment({
|
|
2449
2489
|
onDelete,
|
|
2450
2490
|
onRate,
|
|
@@ -2510,27 +2550,20 @@ function Comment({
|
|
|
2510
2550
|
]
|
|
2511
2551
|
}
|
|
2512
2552
|
) }),
|
|
2513
|
-
/* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", alignItems: "end", gap: 1
|
|
2514
|
-
/* @__PURE__ */
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
onClick: () => protectLogin(session, () => setInputVisible(!inputVisible))
|
|
2528
|
-
}
|
|
2529
|
-
),
|
|
2530
|
-
renderDonation && renderDonation(post)
|
|
2531
|
-
] })
|
|
2532
|
-
}
|
|
2533
|
-
),
|
|
2553
|
+
/* @__PURE__ */ jsxs(Box$1, { sx: { display: "flex", alignItems: "end", gap: 1 }, children: [
|
|
2554
|
+
/* @__PURE__ */ jsxs(IconButtonGroup, { sx: { alignItems: "flex-end" }, children: [
|
|
2555
|
+
/* @__PURE__ */ jsx(
|
|
2556
|
+
GithubReaction,
|
|
2557
|
+
{
|
|
2558
|
+
data: (post == null ? void 0 : post.rating) || [],
|
|
2559
|
+
onRate: ({ value, ratingType }) => onRate(post, value, ratingType),
|
|
2560
|
+
onUnrate: () => onUnrate(post),
|
|
2561
|
+
interactive
|
|
2562
|
+
}
|
|
2563
|
+
),
|
|
2564
|
+
(!!(session == null ? void 0 : session.user) || preferences.displayReplyButtonForAnonymousUsers) && interactive && /* @__PURE__ */ jsx(IconButton, { onClick: () => protectLogin(session, () => setInputVisible(!inputVisible)), children: /* @__PURE__ */ jsx(Icon, { icon: "feather:message-circle" }) }),
|
|
2565
|
+
renderDonation && renderDonation(post)
|
|
2566
|
+
] }),
|
|
2534
2567
|
renderActions == null ? void 0 : renderActions(post)
|
|
2535
2568
|
] }),
|
|
2536
2569
|
inputVisible && /* @__PURE__ */ jsx(Box$1, { my: 2, children: /* @__PURE__ */ jsx(
|
|
@@ -3077,40 +3110,6 @@ function CommentList(props) {
|
|
|
3077
3110
|
) })
|
|
3078
3111
|
] });
|
|
3079
3112
|
}
|
|
3080
|
-
function CommentIconButton({ sx, ...rest }) {
|
|
3081
|
-
const mergedSx = [
|
|
3082
|
-
{
|
|
3083
|
-
svg: {
|
|
3084
|
-
width: "1em",
|
|
3085
|
-
height: "1em",
|
|
3086
|
-
fontSize: 20
|
|
3087
|
-
},
|
|
3088
|
-
"&:hover": {
|
|
3089
|
-
color: "secondary.main"
|
|
3090
|
-
}
|
|
3091
|
-
},
|
|
3092
|
-
...Array.isArray(sx) ? sx : [sx]
|
|
3093
|
-
];
|
|
3094
|
-
return /* @__PURE__ */ jsx(IconButton$2, { size: "small", sx: mergedSx, ...rest, disableFocusRipple: true });
|
|
3095
|
-
}
|
|
3096
|
-
function CommentIconButtonGroup({ children, sx, ...rest }) {
|
|
3097
|
-
const mergedSx = [
|
|
3098
|
-
{
|
|
3099
|
-
display: "flex",
|
|
3100
|
-
alignItems: "center",
|
|
3101
|
-
gap: 2,
|
|
3102
|
-
"& > .MuiIconButton-root:first-child": {
|
|
3103
|
-
ml: "-5px"
|
|
3104
|
-
},
|
|
3105
|
-
// 避免局部 theme 覆盖问题 (如 comment donation 中的 CommentIconButton 会以 donation 局部的 theme palette 为准)
|
|
3106
|
-
".MuiIconButton-root:hover": {
|
|
3107
|
-
color: "secondary.main"
|
|
3108
|
-
}
|
|
3109
|
-
},
|
|
3110
|
-
...Array.isArray(sx) ? sx : [sx]
|
|
3111
|
-
];
|
|
3112
|
-
return /* @__PURE__ */ jsx(Box, { ...rest, sx: mergedSx, children });
|
|
3113
|
-
}
|
|
3114
3113
|
const materialSymbolsUpload = (props) => /* @__PURE__ */ jsx("svg", { viewBox: "0 0 24 24", width: "1.2em", height: "1.2em", ...props, children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M11 16V7.85l-2.6 2.6L7 9l5-5l5 5l-1.4 1.45l-2.6-2.6V16zm-5 4q-.825 0-1.412-.587T4 18v-3h2v3h12v-3h2v3q0 .825-.587 1.413T18 20z" }) });
|
|
3115
3114
|
const getUploadedImageUrl = (imageUrl, width = 320) => {
|
|
3116
3115
|
var _a2;
|
|
@@ -3326,7 +3325,7 @@ function CoverImageUpload({ url, onChange, width, ...rest }) {
|
|
|
3326
3325
|
children: [
|
|
3327
3326
|
/* @__PURE__ */ jsx(CoverImage, { url, width }),
|
|
3328
3327
|
/* @__PURE__ */ jsx(Box, { sx: { position: "absolute", top: 8, right: 8, display: "none" }, className: "cover-image-delete", children: /* @__PURE__ */ jsx(
|
|
3329
|
-
IconButton$
|
|
3328
|
+
IconButton$3,
|
|
3330
3329
|
{
|
|
3331
3330
|
color: "inherit",
|
|
3332
3331
|
sx: { ml: 1, bgcolor: "grey.100", borderRadius: 1, "&:hover": { bgcolor: "grey.200" } },
|
|
@@ -3827,7 +3826,7 @@ function BlogPermaLink({ slug, onChange, ...rest }) {
|
|
|
3827
3826
|
}
|
|
3828
3827
|
),
|
|
3829
3828
|
/* @__PURE__ */ jsx(
|
|
3830
|
-
IconButton$
|
|
3829
|
+
IconButton$3,
|
|
3831
3830
|
{
|
|
3832
3831
|
sx: { px: 1 },
|
|
3833
3832
|
onClick: () => {
|
|
@@ -4951,7 +4950,7 @@ function Back({ url, fallbackUrl, iconOnly, sx, icon, ...rest }) {
|
|
|
4951
4950
|
}
|
|
4952
4951
|
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" }) });
|
|
4953
4952
|
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" }) });
|
|
4954
|
-
const Editor = lazyRetry(() => import("./editor-
|
|
4953
|
+
const Editor = lazyRetry(() => import("./editor-D7LXxjZZ.mjs"));
|
|
4955
4954
|
function LazyEditor(props) {
|
|
4956
4955
|
const fallback2 = /* @__PURE__ */ jsxs(Box, { sx: { px: 3 }, children: [
|
|
4957
4956
|
/* @__PURE__ */ jsx(Skeleton, {}),
|
|
@@ -5702,7 +5701,7 @@ function Chat({ sx, ChannelEditComponent, ...rest }) {
|
|
|
5702
5701
|
children: [
|
|
5703
5702
|
/* @__PURE__ */ jsx(UserSearch, { sx: { fontSize: 16, flex: 1 } }),
|
|
5704
5703
|
/* @__PURE__ */ jsx(AccessControl, { roles: ["owner", "admin"], children: /* @__PURE__ */ jsx(
|
|
5705
|
-
IconButton$
|
|
5704
|
+
IconButton$2,
|
|
5706
5705
|
{
|
|
5707
5706
|
onClick: () => setEditingChannel({ name: "", description: "" }),
|
|
5708
5707
|
sx: { p: 1, borderRadius: 1, border: 1, borderColor: "grey.200", height: 32, width: 32 },
|
|
@@ -12371,7 +12370,7 @@ function ButtonGroup({
|
|
|
12371
12370
|
}
|
|
12372
12371
|
),
|
|
12373
12372
|
urlName !== "type" && /* @__PURE__ */ jsx(AccessControl, { roles: ["admin", "owner"], children: /* @__PURE__ */ jsx(
|
|
12374
|
-
IconButton$
|
|
12373
|
+
IconButton$2,
|
|
12375
12374
|
{
|
|
12376
12375
|
component: Link,
|
|
12377
12376
|
color: "inherit",
|
|
@@ -12564,78 +12563,79 @@ function SubscriptionPaywall({ type, fetchPaymentLink, ...rest }) {
|
|
|
12564
12563
|
);
|
|
12565
12564
|
}
|
|
12566
12565
|
export {
|
|
12567
|
-
|
|
12566
|
+
ChatInWallet as $,
|
|
12568
12567
|
Avatar as A,
|
|
12569
12568
|
Badge as B,
|
|
12570
12569
|
CommentInput as C,
|
|
12571
12570
|
DefaultEditorConfigProvider as D,
|
|
12572
12571
|
useCommentsContext as E,
|
|
12573
12572
|
CommentsProvider as F,
|
|
12574
|
-
|
|
12575
|
-
|
|
12573
|
+
BinaryThumb as G,
|
|
12574
|
+
GithubReaction as H,
|
|
12576
12575
|
ImagePathFixerPlugin as I,
|
|
12577
|
-
|
|
12578
|
-
|
|
12579
|
-
|
|
12576
|
+
GithubReactionContainer as J,
|
|
12577
|
+
EmptyStatus as K,
|
|
12578
|
+
BlogListWrapper as L,
|
|
12580
12579
|
Menu as M,
|
|
12581
|
-
|
|
12582
|
-
|
|
12580
|
+
BlogCard as N,
|
|
12581
|
+
BlogPermaLink as O,
|
|
12583
12582
|
Pagination as P,
|
|
12584
|
-
|
|
12583
|
+
getBlogLink as Q,
|
|
12585
12584
|
RelativeTime as R,
|
|
12586
12585
|
ScrollableEditorWrapper as S,
|
|
12587
|
-
|
|
12588
|
-
|
|
12586
|
+
CoverImage as T,
|
|
12587
|
+
CoverImageUpload as U,
|
|
12589
12588
|
VideoPathFixerPlugin as V,
|
|
12590
|
-
|
|
12591
|
-
|
|
12592
|
-
|
|
12593
|
-
|
|
12594
|
-
|
|
12589
|
+
AccessControl as W,
|
|
12590
|
+
useAuthzContext as X,
|
|
12591
|
+
AuthzProvider as Y,
|
|
12592
|
+
ChatClient as Z,
|
|
12593
|
+
Chat as _,
|
|
12595
12594
|
isEmptyContent as a,
|
|
12596
|
-
|
|
12597
|
-
|
|
12598
|
-
|
|
12599
|
-
|
|
12600
|
-
|
|
12601
|
-
|
|
12602
|
-
|
|
12603
|
-
|
|
12604
|
-
|
|
12605
|
-
|
|
12606
|
-
|
|
12607
|
-
|
|
12608
|
-
|
|
12609
|
-
|
|
12610
|
-
|
|
12611
|
-
|
|
12612
|
-
|
|
12613
|
-
|
|
12614
|
-
ConfirmProvider as
|
|
12615
|
-
SecureLabelPicker as
|
|
12616
|
-
useApiErrorHandler as
|
|
12617
|
-
useDefaultApiErrorHandler as
|
|
12618
|
-
DefaultApiErrorHandler as
|
|
12619
|
-
Back as
|
|
12620
|
-
LazyEditor as
|
|
12621
|
-
EditorPreview as
|
|
12622
|
-
DirtyPromptContainer as
|
|
12623
|
-
ConfirmNavigation as
|
|
12624
|
-
UploaderContext as
|
|
12625
|
-
useUploader as
|
|
12626
|
-
UploaderTrigger as
|
|
12627
|
-
UploaderProvider as
|
|
12628
|
-
getUploadedImageUrl as
|
|
12629
|
-
usePointUpContext as
|
|
12630
|
-
PointUpProvider as
|
|
12631
|
-
ButtonGroup as
|
|
12632
|
-
SegmentedControl as
|
|
12633
|
-
create as
|
|
12634
|
-
getWsClient as
|
|
12635
|
-
useSubscription as
|
|
12636
|
-
toast as
|
|
12637
|
-
isInArcSphere$1 as
|
|
12638
|
-
isInArcSphereDialog as
|
|
12595
|
+
ChatListInWallet as a0,
|
|
12596
|
+
ChatHeaderAddon as a1,
|
|
12597
|
+
useChatContext as a2,
|
|
12598
|
+
ChatProvider as a3,
|
|
12599
|
+
UnreadNotificationContext as a4,
|
|
12600
|
+
useUnreadNotification as a5,
|
|
12601
|
+
UnreadNotificationProvider as a6,
|
|
12602
|
+
Confirm as a7,
|
|
12603
|
+
ConfirmContext as a8,
|
|
12604
|
+
useConfirm as a9,
|
|
12605
|
+
closeArcSphereDialog as aA,
|
|
12606
|
+
useArcSphereDialog as aB,
|
|
12607
|
+
Paywall as aC,
|
|
12608
|
+
SubscriptionPaywall as aD,
|
|
12609
|
+
ProfileCard as aE,
|
|
12610
|
+
ProfileCardTooltip as aF,
|
|
12611
|
+
IconButton as aG,
|
|
12612
|
+
IconButtonGroup as aH,
|
|
12613
|
+
ConfirmProvider as aa,
|
|
12614
|
+
SecureLabelPicker as ab,
|
|
12615
|
+
useApiErrorHandler as ac,
|
|
12616
|
+
useDefaultApiErrorHandler as ad,
|
|
12617
|
+
DefaultApiErrorHandler as ae,
|
|
12618
|
+
Back as af,
|
|
12619
|
+
LazyEditor as ag,
|
|
12620
|
+
EditorPreview as ah,
|
|
12621
|
+
DirtyPromptContainer as ai,
|
|
12622
|
+
ConfirmNavigation as aj,
|
|
12623
|
+
UploaderContext as ak,
|
|
12624
|
+
useUploader as al,
|
|
12625
|
+
UploaderTrigger as am,
|
|
12626
|
+
UploaderProvider as an,
|
|
12627
|
+
getUploadedImageUrl as ao,
|
|
12628
|
+
usePointUpContext as ap,
|
|
12629
|
+
PointUpProvider as aq,
|
|
12630
|
+
ButtonGroup as ar,
|
|
12631
|
+
SegmentedControl as as,
|
|
12632
|
+
create as at,
|
|
12633
|
+
getWsClient as au,
|
|
12634
|
+
useSubscription as av,
|
|
12635
|
+
toast as aw,
|
|
12636
|
+
isInArcSphere$1 as ax,
|
|
12637
|
+
isInArcSphereDialog as ay,
|
|
12638
|
+
openArcSphereDialog as az,
|
|
12639
12639
|
Input as b,
|
|
12640
12640
|
useChanged as c,
|
|
12641
12641
|
useSessionContext as d,
|