@blocklet/discuss-kit-ux 1.6.211 → 1.6.213
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/api-error-handler/api-error-handler.d.ts +2 -1
- package/dist/components/api-error-handler/default-handler.d.ts +1 -0
- package/dist/components/api-error-handler/json-validation-interceptor.d.ts +2 -1
- package/dist/components/authz/access-control.d.ts +3 -3
- package/dist/components/avatars/Avatars.stories.d.ts +2 -1
- package/dist/components/avatars/author-info.d.ts +2 -2
- package/dist/components/avatars/avatars.d.ts +3 -2
- package/dist/components/back.d.ts +1 -0
- package/dist/components/blog/blog-link.d.ts +1 -0
- package/dist/components/blog/blog-list.d.ts +3 -3
- package/dist/components/blog/cover-image.d.ts +2 -2
- package/dist/components/blog/permalink.d.ts +2 -1
- package/dist/components/blog/types.d.ts +2 -1
- package/dist/components/chat/channel-group.d.ts +2 -2
- package/dist/components/chat/chat-client.d.ts +3 -2
- package/dist/components/chat/chat-list.d.ts +1 -0
- package/dist/components/chat/chat-room.d.ts +2 -1
- package/dist/components/chat/chat.d.ts +1 -0
- package/dist/components/chat/context.d.ts +4 -4
- package/dist/components/chat/message-list.d.ts +2 -1
- package/dist/components/chat/message.d.ts +2 -1
- package/dist/components/chat/participants.d.ts +2 -1
- package/dist/components/chat/time.d.ts +2 -1
- package/dist/components/chat/types.d.ts +2 -1
- package/dist/components/chat/unread-notification.d.ts +2 -1
- package/dist/components/confirm.d.ts +3 -2
- package/dist/components/dayjs.d.ts +2 -1
- package/dist/components/default-editor-config-provider.d.ts +2 -2
- package/dist/components/dirty-prompt.d.ts +1 -1
- package/dist/components/editor/editor.d.ts +3 -3
- package/dist/components/editor/lazy-editor.d.ts +2 -1
- package/dist/components/editor/preview.d.ts +2 -2
- package/dist/components/emoji-icon.d.ts +1 -0
- package/dist/components/hooks/responsive.d.ts +2 -1
- package/dist/components/input/auto-clear-plugin.d.ts +1 -0
- package/dist/components/input/comment-input.d.ts +1 -1
- package/dist/components/input/input.d.ts +2 -2
- package/dist/components/input/post-edit.d.ts +1 -0
- package/dist/components/input/scrollable-editor-wrapper.d.ts +1 -1
- package/dist/components/label-picker.d.ts +1 -0
- package/dist/components/lexical.d.ts +1 -0
- package/dist/components/pagination.d.ts +2 -1
- package/dist/components/posts/Post.stories.d.ts +3 -2
- package/dist/components/posts/comment-list/context.d.ts +3 -2
- package/dist/components/posts/comment.d.ts +2 -1
- package/dist/components/posts/menu.d.ts +3 -3
- package/dist/components/posts/post-content.d.ts +1 -0
- package/dist/components/posts/post.d.ts +4 -3
- package/dist/components/profile-card/ProfileCard.stories.d.ts +2 -1
- package/dist/components/profile-card/profile-card.d.ts +2 -1
- package/dist/components/rating/binary-thumb.d.ts +3 -2
- package/dist/components/rating/github-reaction.d.ts +3 -3
- package/dist/components/rating/rater-list.d.ts +2 -1
- package/dist/components/rating/rating.d.ts +1 -1
- package/dist/components/segmented-control.d.ts +2 -2
- package/dist/components/shared/dialog.d.ts +1 -1
- package/dist/components/uploader/index.d.ts +2 -1
- package/dist/components/utils.d.ts +3 -2
- package/dist/editor-g8aVzRyQ.mjs +37 -0
- package/dist/{index-KsyZ0KOb.mjs → index-BvgOMp6U.mjs} +163 -70
- package/dist/index.d.ts +1 -1
- package/dist/index.es.js +59 -120
- package/dist/index.umd.js +106 -13
- package/dist/preferences.d.ts +7 -0
- package/dist/test/fixtures/index.d.ts +2 -1
- package/dist/theme/index.d.ts +9 -0
- package/dist/theme/typography.d.ts +3 -0
- package/package.json +8 -8
- package/dist/components/shared/theme.d.ts +0 -5
- package/dist/editor-5I4Vr3U6.mjs +0 -105
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { SessionContextUser } from '../hooks/session';
|
|
2
|
+
|
|
3
3
|
interface AccessControlProps {
|
|
4
4
|
authenticated?: boolean;
|
|
5
5
|
permissions?: string | string[];
|
|
@@ -7,5 +7,5 @@ interface AccessControlProps {
|
|
|
7
7
|
check?: (user: SessionContextUser) => boolean;
|
|
8
8
|
children: React.ReactElement;
|
|
9
9
|
}
|
|
10
|
-
export default function AccessControl({ authenticated, permissions, roles, check, children, }: AccessControlProps): import(
|
|
10
|
+
export default function AccessControl({ authenticated, permissions, roles, check, children, }: AccessControlProps): import('react').ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
|
|
11
11
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { default as Avatars } from './avatars';
|
|
1
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
-
|
|
3
|
+
|
|
3
4
|
declare const _default: ComponentMeta<typeof Avatars>;
|
|
4
5
|
export default _default;
|
|
5
6
|
export declare const Basic: ComponentStory<typeof Avatars>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { User } from '../../types';
|
|
2
|
+
import { AvatarGroupProps } from '@mui/material/AvatarGroup';
|
|
3
|
+
|
|
3
4
|
interface AvatarsProps extends Omit<AvatarGroupProps, 'variant'> {
|
|
4
5
|
users: User[];
|
|
5
6
|
variant?: 'circle' | 'rounded';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BlogPost } from './types';
|
|
2
|
+
|
|
3
3
|
interface BlogListProps {
|
|
4
4
|
posts: BlogPost[];
|
|
5
5
|
boardId?: string;
|
|
@@ -20,7 +20,7 @@ type CardProps = {
|
|
|
20
20
|
compactLayout?: '0' | '1';
|
|
21
21
|
loading?: boolean;
|
|
22
22
|
};
|
|
23
|
-
export declare const BlogCard: import(
|
|
23
|
+
export declare const BlogCard: import('react').ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
24
24
|
export default function BlogListWrapper({ variant, cardsLayout, ...rest }: BlogListProps & {
|
|
25
25
|
variant?: 'card' | 'list';
|
|
26
26
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { User } from '../../types';
|
|
2
|
+
import { Chat, Message, Channel } from './types';
|
|
1
3
|
import { Emitter } from 'mitt';
|
|
2
|
-
|
|
3
|
-
import type { User } from '../../types';
|
|
4
|
+
|
|
4
5
|
type Events = {
|
|
5
6
|
init: {
|
|
6
7
|
chats: Chat[];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
1
|
+
import { User } from '../../types';
|
|
2
|
+
import { Chat as ChatType } from './types';
|
|
3
|
+
import { default as ChatClient } from './chat-client';
|
|
4
|
+
|
|
5
5
|
export interface ChatProviderProps {
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
client: ChatClient;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Chat, Message as MessageType, NotificationMessage as NotificationMessageType } from './types';
|
|
2
|
+
|
|
2
3
|
interface MessageProps {
|
|
3
4
|
message: MessageType;
|
|
4
5
|
prevMessage?: MessageType;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
|
|
2
3
|
interface UnreadNotificationProviderProps {
|
|
3
4
|
fetchUnreadState: () => Promise<boolean>;
|
|
4
5
|
children: ReactNode;
|
|
@@ -7,7 +8,7 @@ interface UnreadNotificationContextType {
|
|
|
7
8
|
unread: boolean;
|
|
8
9
|
markAsUnread: (value?: boolean) => void;
|
|
9
10
|
}
|
|
10
|
-
export declare const UnreadNotificationContext: import(
|
|
11
|
+
export declare const UnreadNotificationContext: import('react').Context<UnreadNotificationContextType>;
|
|
11
12
|
export declare const useUnreadNotification: () => UnreadNotificationContextType;
|
|
12
13
|
export declare function UnreadNotificationProvider({ fetchUnreadState, children }: UnreadNotificationProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
13
14
|
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { DialogProps, ButtonProps } from '@mui/material';
|
|
2
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { DialogProps, ButtonProps } from '@mui/material';
|
|
3
|
+
|
|
3
4
|
interface ConfirmProviderProps {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
}
|
|
@@ -23,7 +24,7 @@ interface ConfirmProps extends Omit<DialogProps, 'title'>, Omit<ConfirmOptions,
|
|
|
23
24
|
handleCancel: () => void;
|
|
24
25
|
}
|
|
25
26
|
export declare function Confirm({ open, title, description, handleOk, handleCancel, okText, okButtonProps, cancelText, cancelButtonProps, actions, ...rest }: ConfirmProps): import("react/jsx-runtime").JSX.Element | null;
|
|
26
|
-
export declare const ConfirmContext: import(
|
|
27
|
+
export declare const ConfirmContext: import('react').Context<ConfirmContextType>;
|
|
27
28
|
export declare const useConfirm: () => ConfirmContextType;
|
|
28
29
|
export declare function ConfirmProvider({ children }: ConfirmProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
|
|
1
|
+
import { EditorState, LexicalEditor } from 'lexical';
|
|
2
|
+
import { BlockletEditorProps } from '@blocklet/editor';
|
|
3
|
+
|
|
4
4
|
export type OnChangeHandler = ({ content, editorState, editor, isEmpty, getExcerpt, }: {
|
|
5
5
|
content: string;
|
|
6
6
|
editorState: EditorState;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { BlockletEditorProps } from '@blocklet/editor';
|
|
2
|
+
|
|
3
3
|
export interface EditorProps extends Omit<BlockletEditorProps, 'onChange' | 'ref'> {
|
|
4
4
|
content: string;
|
|
5
5
|
children?: React.ReactNode;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Breakpoint } from '@mui/material';
|
|
2
|
+
|
|
2
3
|
export declare const useDownBreakpoint: (breakpoint: Breakpoint) => boolean;
|
|
3
4
|
export declare const useUpBreakpoint: (breakpoint: Breakpoint) => boolean;
|
|
4
5
|
export declare function useResponsive(): (responsiveValues: {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { default as Comment } from './comment';
|
|
2
|
+
import { default as Post } from './post';
|
|
1
3
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import Comment from './comment';
|
|
4
|
+
|
|
4
5
|
declare const _default: ComponentMeta<typeof Post>;
|
|
5
6
|
export default _default;
|
|
6
7
|
export declare const Basic: ComponentStory<typeof Post>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { Post, Target, CommentAPI } from '../../../types';
|
|
2
|
+
import { default as React } from 'react';
|
|
3
|
+
|
|
3
4
|
type Order = 'asc' | 'desc';
|
|
4
5
|
interface CommentsProviderProps {
|
|
5
6
|
target: Target;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { default as MuiMenuItem } from '@mui/material/MenuItem';
|
|
2
|
+
|
|
3
3
|
interface MenuProps {
|
|
4
4
|
items: React.ReactElement<typeof MuiMenuItem>[];
|
|
5
5
|
style?: React.CSSProperties;
|
|
@@ -7,6 +7,6 @@ interface MenuProps {
|
|
|
7
7
|
}
|
|
8
8
|
declare function Menu({ items, ...rest }: MenuProps): import("react/jsx-runtime").JSX.Element | null;
|
|
9
9
|
declare namespace Menu {
|
|
10
|
-
var Item: import(
|
|
10
|
+
var Item: import('@mui/material').ExtendButtonBase<import("@mui/material/MenuItem").MenuItemTypeMap<{}, "li">>;
|
|
11
11
|
}
|
|
12
12
|
export default Menu;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import
|
|
2
|
-
import MuiMenuItem from '@mui/material/MenuItem';
|
|
3
|
-
import
|
|
1
|
+
import { Post } from '../../types';
|
|
2
|
+
import { default as MuiMenuItem } from '@mui/material/MenuItem';
|
|
3
|
+
import { default as React } from 'react';
|
|
4
|
+
|
|
4
5
|
export interface PostProps {
|
|
5
6
|
post: Post;
|
|
6
7
|
interactive?: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { default as ProfileCard } from './profile-card';
|
|
1
2
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
2
|
-
|
|
3
|
+
|
|
3
4
|
declare const _default: ComponentMeta<typeof ProfileCard>;
|
|
4
5
|
export default _default;
|
|
5
6
|
export declare const Basic: ComponentStory<typeof ProfileCard>;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
1
|
+
import { Rating as RatingType } from '../../types';
|
|
2
|
+
import { RatingProps } from './rating';
|
|
3
|
+
|
|
3
4
|
export type BinaryThumbProps = {
|
|
4
5
|
data: RatingType[];
|
|
5
6
|
variant?: 'default' | 'inverse';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { Rating as RatingType } from '../../types';
|
|
2
|
+
import { BoxProps } from '@mui/material';
|
|
3
|
+
|
|
4
4
|
type GithubReactionProps = {
|
|
5
5
|
data: RatingType[];
|
|
6
6
|
onRate: ({ ratingType, value }: {
|
|
@@ -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;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
|
|
2
3
|
export * from './utils';
|
|
3
4
|
interface UploaderProviderProps {
|
|
4
5
|
children: ReactNode;
|
|
5
6
|
}
|
|
6
|
-
export declare const UploaderContext: import(
|
|
7
|
+
export declare const UploaderContext: import('react').Context<null>;
|
|
7
8
|
export declare function useUploader(): never;
|
|
8
9
|
export declare function UploaderTrigger({ onChange, children }: {
|
|
9
10
|
onChange?: Function;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import { SystemStyleObject } from '@mui/system';
|
|
2
|
+
import { SxProps, Theme } from '@mui/material';
|
|
3
|
+
|
|
3
4
|
export declare const repairBase64Avatar: (avatar?: string) => string | undefined;
|
|
4
5
|
export declare const getResizedAvatar: (avatar: string, size?: number) => string;
|
|
5
6
|
export declare const sleep: (ms: number) => Promise<unknown>;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { styled, Box } from "@mui/material";
|
|
3
|
+
import { OnContentChangePlugin } from "@blocklet/editor/lib/ext/OnContentChangePlugin";
|
|
4
|
+
import { CtrlsShortcutPlugin } from "@blocklet/editor/lib/ext/ShortcutPlugin";
|
|
5
|
+
import { SafeAreaPlugin } from "@blocklet/editor/lib/ext/SafeAreaPlugin";
|
|
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-BvgOMp6U.mjs";
|
|
8
|
+
const BlockletEditor = lazy(() => import("@blocklet/editor"));
|
|
9
|
+
const Root = styled(Box)`
|
|
10
|
+
.be-editable,
|
|
11
|
+
.be-content {
|
|
12
|
+
min-height: 150px;
|
|
13
|
+
}
|
|
14
|
+
`;
|
|
15
|
+
function Editor({ initialContent, onChange, children, onSave, ...rest }) {
|
|
16
|
+
const handleChange = async (editorState, editor) => {
|
|
17
|
+
const isEmpty = await isEmptyContent(editorState, editor);
|
|
18
|
+
onChange == null ? void 0 : onChange({
|
|
19
|
+
content: isEmpty ? "" : stringify(editorState),
|
|
20
|
+
editorState,
|
|
21
|
+
editor,
|
|
22
|
+
isEmpty,
|
|
23
|
+
getExcerpt: () => getExcerptSync(editorState)
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
return /* @__PURE__ */ jsx(Root, { children: /* @__PURE__ */ jsxs(BlockletEditor, { editorState: inferInitialEditorState(initialContent), ...rest, children: [
|
|
27
|
+
/* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
|
|
28
|
+
/* @__PURE__ */ jsx(VideoPathFixerPlugin, {}),
|
|
29
|
+
/* @__PURE__ */ jsx(OnContentChangePlugin, { onChange: handleChange }),
|
|
30
|
+
onSave && /* @__PURE__ */ jsx(CtrlsShortcutPlugin, { callback: onSave }),
|
|
31
|
+
/* @__PURE__ */ jsx(SafeAreaPlugin, {}),
|
|
32
|
+
children
|
|
33
|
+
] }) });
|
|
34
|
+
}
|
|
35
|
+
export {
|
|
36
|
+
Editor as default
|
|
37
|
+
};
|