@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.
Files changed (70) hide show
  1. package/dist/components/api-error-handler/api-error-handler.d.ts +2 -1
  2. package/dist/components/api-error-handler/default-handler.d.ts +1 -0
  3. package/dist/components/api-error-handler/json-validation-interceptor.d.ts +2 -1
  4. package/dist/components/authz/access-control.d.ts +3 -3
  5. package/dist/components/avatars/Avatars.stories.d.ts +2 -1
  6. package/dist/components/avatars/author-info.d.ts +2 -2
  7. package/dist/components/avatars/avatars.d.ts +3 -2
  8. package/dist/components/back.d.ts +1 -0
  9. package/dist/components/blog/blog-link.d.ts +1 -0
  10. package/dist/components/blog/blog-list.d.ts +3 -3
  11. package/dist/components/blog/cover-image.d.ts +2 -2
  12. package/dist/components/blog/permalink.d.ts +2 -1
  13. package/dist/components/blog/types.d.ts +2 -1
  14. package/dist/components/chat/channel-group.d.ts +2 -2
  15. package/dist/components/chat/chat-client.d.ts +3 -2
  16. package/dist/components/chat/chat-list.d.ts +1 -0
  17. package/dist/components/chat/chat-room.d.ts +2 -1
  18. package/dist/components/chat/chat.d.ts +1 -0
  19. package/dist/components/chat/context.d.ts +4 -4
  20. package/dist/components/chat/message-list.d.ts +2 -1
  21. package/dist/components/chat/message.d.ts +2 -1
  22. package/dist/components/chat/participants.d.ts +2 -1
  23. package/dist/components/chat/time.d.ts +2 -1
  24. package/dist/components/chat/types.d.ts +2 -1
  25. package/dist/components/chat/unread-notification.d.ts +2 -1
  26. package/dist/components/confirm.d.ts +3 -2
  27. package/dist/components/dayjs.d.ts +2 -1
  28. package/dist/components/default-editor-config-provider.d.ts +2 -2
  29. package/dist/components/dirty-prompt.d.ts +1 -1
  30. package/dist/components/editor/editor.d.ts +3 -3
  31. package/dist/components/editor/lazy-editor.d.ts +2 -1
  32. package/dist/components/editor/preview.d.ts +2 -2
  33. package/dist/components/emoji-icon.d.ts +1 -0
  34. package/dist/components/hooks/responsive.d.ts +2 -1
  35. package/dist/components/input/auto-clear-plugin.d.ts +1 -0
  36. package/dist/components/input/comment-input.d.ts +1 -1
  37. package/dist/components/input/input.d.ts +2 -2
  38. package/dist/components/input/post-edit.d.ts +1 -0
  39. package/dist/components/input/scrollable-editor-wrapper.d.ts +1 -1
  40. package/dist/components/label-picker.d.ts +1 -0
  41. package/dist/components/lexical.d.ts +1 -0
  42. package/dist/components/pagination.d.ts +2 -1
  43. package/dist/components/posts/Post.stories.d.ts +3 -2
  44. package/dist/components/posts/comment-list/context.d.ts +3 -2
  45. package/dist/components/posts/comment.d.ts +2 -1
  46. package/dist/components/posts/menu.d.ts +3 -3
  47. package/dist/components/posts/post-content.d.ts +1 -0
  48. package/dist/components/posts/post.d.ts +4 -3
  49. package/dist/components/profile-card/ProfileCard.stories.d.ts +2 -1
  50. package/dist/components/profile-card/profile-card.d.ts +2 -1
  51. package/dist/components/rating/binary-thumb.d.ts +3 -2
  52. package/dist/components/rating/github-reaction.d.ts +3 -3
  53. package/dist/components/rating/rater-list.d.ts +2 -1
  54. package/dist/components/rating/rating.d.ts +1 -1
  55. package/dist/components/segmented-control.d.ts +2 -2
  56. package/dist/components/shared/dialog.d.ts +1 -1
  57. package/dist/components/uploader/index.d.ts +2 -1
  58. package/dist/components/utils.d.ts +3 -2
  59. package/dist/editor-g8aVzRyQ.mjs +37 -0
  60. package/dist/{index-KsyZ0KOb.mjs → index-BvgOMp6U.mjs} +163 -70
  61. package/dist/index.d.ts +1 -1
  62. package/dist/index.es.js +59 -120
  63. package/dist/index.umd.js +106 -13
  64. package/dist/preferences.d.ts +7 -0
  65. package/dist/test/fixtures/index.d.ts +2 -1
  66. package/dist/theme/index.d.ts +9 -0
  67. package/dist/theme/typography.d.ts +3 -0
  68. package/package.json +8 -8
  69. package/dist/components/shared/theme.d.ts +0 -5
  70. package/dist/editor-5I4Vr3U6.mjs +0 -105
@@ -1,4 +1,5 @@
1
- import type { AxiosInstance, AxiosError } from 'axios';
1
+ import { AxiosInstance, AxiosError } from 'axios';
2
+
2
3
  export interface ApiError extends AxiosError {
3
4
  markAsHandled: Function;
4
5
  }
@@ -1,4 +1,5 @@
1
1
  import { AxiosInstance } from 'axios';
2
+
2
3
  interface Options {
3
4
  request: AxiosInstance;
4
5
  }
@@ -1,2 +1,3 @@
1
- import type { AxiosResponse } from 'axios';
1
+ import { AxiosResponse } from 'axios';
2
+
2
3
  export declare const jsonValidationInterceptor: (response: AxiosResponse) => AxiosResponse<any, any>;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { SessionContextUser } from '../hooks/session';
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("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
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
- import Avatars from './avatars';
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,5 @@
1
- /// <reference types="react" />
2
- import type { User } from '../../types';
1
+ import { User } from '../../types';
2
+
3
3
  interface Props {
4
4
  user: User;
5
5
  newTitle?: string;
@@ -1,5 +1,6 @@
1
- import type { AvatarGroupProps } from '@mui/material/AvatarGroup';
2
- import type { User } from '../../types';
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,4 +1,5 @@
1
1
  import { SxProps, ButtonProps } from '@mui/material';
2
+
2
3
  interface BackProps {
3
4
  url?: string;
4
5
  fallbackUrl?: string;
@@ -1,4 +1,5 @@
1
1
  import { BlogPost } from './types';
2
+
2
3
  type PartialBlog = Pick<BlogPost, 'id' | 'slug' | 'createdAt' | 'locale'>;
3
4
  export declare const getBlogLink: (post: PartialBlog) => any;
4
5
  export {};
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { BlogPost } from './types';
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("react").ForwardRefExoticComponent<CardProps & import("react").RefAttributes<HTMLDivElement>>;
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,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { BoxProps } from '@mui/material/Box';
1
+ import { BoxProps } from '@mui/material/Box';
2
+
3
3
  interface CoverImageUploadProps extends Omit<BoxProps, 'onChange'> {
4
4
  url?: string;
5
5
  onChange: (url: string | null) => void;
@@ -1,4 +1,5 @@
1
- import type { BoxProps } from '@mui/material';
1
+ import { BoxProps } from '@mui/material';
2
+
2
3
  interface Props extends Omit<BoxProps, 'onChange'> {
3
4
  slug: string;
4
5
  onChange: (slug: string) => void;
@@ -1,4 +1,5 @@
1
- import type { User } from '../../types';
1
+ import { User } from '../../types';
2
+
2
3
  export interface BlogPost {
3
4
  id: string;
4
5
  slug: string;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { Chat } from './types';
1
+ import { Chat } from './types';
2
+
3
3
  interface Props {
4
4
  chat: Chat;
5
5
  size?: 'sm' | 'normal';
@@ -1,6 +1,7 @@
1
+ import { User } from '../../types';
2
+ import { Chat, Message, Channel } from './types';
1
3
  import { Emitter } from 'mitt';
2
- import type { Chat, Message, Channel } from './types';
3
- import type { User } from '../../types';
4
+
4
5
  type Events = {
5
6
  init: {
6
7
  chats: Chat[];
@@ -1,4 +1,5 @@
1
1
  import { SxProps } from '@mui/material';
2
+
2
3
  interface Props {
3
4
  sx?: SxProps;
4
5
  }
@@ -1,4 +1,5 @@
1
- import type { Chat } from './types';
1
+ import { Chat } from './types';
2
+
2
3
  interface ChatProps {
3
4
  chat: Chat;
4
5
  }
@@ -1,4 +1,5 @@
1
1
  import { SxProps } from '@mui/material';
2
+
2
3
  interface ChatProps {
3
4
  sx: SxProps;
4
5
  }
@@ -1,7 +1,7 @@
1
- /// <reference types="react" />
2
- import ChatClient from './chat-client';
3
- import type { Chat as ChatType } from './types';
4
- import type { User } from '../../types';
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 type { Chat } from './types';
1
+ import { Chat } from './types';
2
+
2
3
  interface ChatProps {
3
4
  chat: Chat;
4
5
  }
@@ -1,4 +1,5 @@
1
- import type { Chat, Message as MessageType, NotificationMessage as NotificationMessageType } from './types';
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,5 +1,6 @@
1
+ import { User } from '../../types';
1
2
  import { SxProps } from '@mui/material';
2
- import type { User } from '../../types';
3
+
3
4
  interface Props {
4
5
  users: User[];
5
6
  sx?: SxProps;
@@ -1,4 +1,5 @@
1
- import React from 'react';
1
+ import { default as React } from 'react';
2
+
2
3
  interface TimeShowProps {
3
4
  createdAt: string | Date;
4
5
  }
@@ -1,4 +1,5 @@
1
- import type { User } from '../../types';
1
+ import { User } from '../../types';
2
+
2
3
  export interface Message {
3
4
  id: string;
4
5
  content?: string;
@@ -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("react").Context<UnreadNotificationContextType>;
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("react").Context<ConfirmContextType>;
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,2 +1,3 @@
1
- import dayjs from 'dayjs';
1
+ import { default as dayjs } from 'dayjs';
2
+
2
3
  export default dayjs;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { AxiosInstance } from 'axios';
1
+ import { AxiosInstance } from 'axios';
2
+
3
3
  export default function DefaultEditorConfigProvider({ request, children, }: {
4
4
  request: AxiosInstance;
5
5
  children: React.ReactNode;
@@ -1,4 +1,4 @@
1
- export declare const DirtyPromptContainer: import("unstated-next").Container<{
1
+ export declare const DirtyPromptContainer: import('unstated-next').Container<{
2
2
  dirty: boolean;
3
3
  markDirty: () => void;
4
4
  reset: () => void;
@@ -1,6 +1,6 @@
1
- /// <reference types="react" />
2
- import type { BlockletEditorProps } from '@blocklet/editor';
3
- import type { EditorState, LexicalEditor } from 'lexical';
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,2 +1,3 @@
1
- import type { EditorProps } from './editor';
1
+ import { EditorProps } from './editor';
2
+
2
3
  export default function LazyEditor(props: EditorProps): import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { BlockletEditorProps } from '@blocklet/editor';
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
1
  import { BoxProps } from '@mui/material/Box';
2
+
2
3
  interface InternalIconProps extends BoxProps {
3
4
  title: string;
4
5
  icon?: string;
@@ -1,4 +1,5 @@
1
- import { type Breakpoint } from '@mui/material';
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,4 +1,5 @@
1
1
  import { EditorState } from 'lexical';
2
+
2
3
  interface Props {
3
4
  value: EditorState | null;
4
5
  isChanged: boolean;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { InputProps } from './input';
2
+
3
3
  interface Props extends Omit<InputProps, 'render'> {
4
4
  sendText?: string;
5
5
  sendIcon?: React.ReactNode;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import type { EditorState } from 'lexical';
1
+ import { EditorState } from 'lexical';
2
+
3
3
  export type Send = (content: string) => Promise<any>;
4
4
  interface RenderProps {
5
5
  content: EditorState | null;
@@ -1,4 +1,5 @@
1
1
  import { Send } from './input';
2
+
2
3
  interface Props {
3
4
  content: string;
4
5
  send: Send;
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import { SxProps } from '@mui/material';
2
+
3
3
  interface Props {
4
4
  safeDistance?: number;
5
5
  sx?: SxProps;
@@ -1,4 +1,5 @@
1
1
  import { Label } from '@blocklet/labels';
2
+
2
3
  interface LabelPickerProps {
3
4
  data: Label[];
4
5
  value: string[];
@@ -1,4 +1,5 @@
1
1
  import { EditorState, LexicalEditor } from 'lexical';
2
+
2
3
  export declare const getTextContent: (editorState: EditorState) => Promise<string>;
3
4
  /**
4
5
  * 检查 editor 内容是否为空
@@ -1,4 +1,5 @@
1
- import { type SxProps } from '@mui/material/styles';
1
+ import { SxProps } from '@mui/material/styles';
2
+
2
3
  interface PaginationProps {
3
4
  page?: number;
4
5
  size?: number;
@@ -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
- import Post from './post';
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 React from 'react';
2
- import type { Post, Target, CommentAPI } from '../../../types';
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,6 @@
1
+ import { CommentAPI } from '../../types';
1
2
  import { PostProps } from './post';
2
- import type { CommentAPI } from '../../types';
3
+
3
4
  export interface CommentProps {
4
5
  onDelete: CommentAPI['deleteComment'];
5
6
  onRate: CommentAPI['rate'];
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
- import MuiMenuItem from '@mui/material/MenuItem';
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("@mui/material").ExtendButtonBase<import("@mui/material/MenuItem").MenuItemTypeMap<{}, "li">>;
10
+ var Item: import('@mui/material').ExtendButtonBase<import("@mui/material/MenuItem").MenuItemTypeMap<{}, "li">>;
11
11
  }
12
12
  export default Menu;
@@ -1,4 +1,5 @@
1
1
  import { Send } from '../input/input';
2
+
2
3
  interface Props {
3
4
  content: string;
4
5
  editing?: boolean;
@@ -1,6 +1,7 @@
1
- import React from 'react';
2
- import MuiMenuItem from '@mui/material/MenuItem';
3
- import type { Post } from '../../types';
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
- import ProfileCard from './profile-card';
3
+
3
4
  declare const _default: ComponentMeta<typeof ProfileCard>;
4
5
  export default _default;
5
6
  export declare const Basic: ComponentStory<typeof ProfileCard>;
@@ -1,4 +1,5 @@
1
- import type { User } from '../../types';
1
+ import { User } from '../../types';
2
+
2
3
  interface ProfileCardProps {
3
4
  user: User;
4
5
  click: () => void;
@@ -1,5 +1,6 @@
1
- import { type RatingProps } from './rating';
2
- import type { Rating as RatingType } from '../../types';
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
- /// <reference types="react" />
2
- import { type BoxProps } from '@mui/material';
3
- import type { Rating as RatingType } from '../../types';
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 }: {
@@ -1,4 +1,5 @@
1
- import type { Rating } from '../../types';
1
+ import { Rating } from '../../types';
2
+
2
3
  interface Props {
3
4
  open: boolean;
4
5
  onClose: () => void;
@@ -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("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
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,5 +1,5 @@
1
- /// <reference types="react" />
2
- import { type SxProps } from '@mui/material';
1
+ import { SxProps } from '@mui/material';
2
+
3
3
  interface Option {
4
4
  value: string;
5
5
  label: React.ReactNode;
@@ -1,4 +1,4 @@
1
- declare const StyledDialog: import("@emotion/styled").StyledComponent<any, {}, {
1
+ declare const StyledDialog: import('@emotion/styled').StyledComponent<any, {}, {
2
2
  ref?: import("react").Ref<any> | undefined;
3
3
  }>;
4
4
  export default StyledDialog;
@@ -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("react").Context<null>;
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 type { SxProps, Theme } from '@mui/material';
2
- import type { SystemStyleObject } from '@mui/system';
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
+ };