@blocklet/discuss-kit-ux 1.5.183 → 1.5.185

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.
@@ -1,14 +1,17 @@
1
+ /// <reference types="react" />
1
2
  import type { BoxProps } from '@mui/material/Box';
2
3
  interface CoverImageUploadProps extends Omit<BoxProps, 'onChange'> {
3
4
  url?: string;
4
5
  onChange: (url: string | null) => void;
5
6
  }
6
- export declare function CoverImage({ url, aspectRatio, width, sx, fetchpriority, loading, }: {
7
+ export declare function CoverImage({ url, aspectRatio, width, sx, fetchpriority, loading, shadow, fallback, ...rest }: {
7
8
  url?: string;
8
9
  aspectRatio?: number;
9
10
  width?: number;
10
11
  loading?: 'lazy' | 'eager';
11
12
  fetchpriority?: 'auto' | 'low' | 'high';
13
+ shadow?: boolean;
14
+ fallback?: React.ReactNode;
12
15
  } & BoxProps): import("react/jsx-runtime").JSX.Element;
13
16
  export declare function CoverImageUpload({ url, onChange, ...rest }: CoverImageUploadProps): import("react/jsx-runtime").JSX.Element;
14
17
  export {};
@@ -1,2 +1,3 @@
1
1
  export { default as LazyEditor } from './lazy-editor';
2
2
  export type { OnChangeHandler } from './editor';
3
+ export { EditorPreview } from './preview';
@@ -0,0 +1,7 @@
1
+ /// <reference types="react" />
2
+ import type { BlockletEditorProps } from '@blocklet/editor';
3
+ export interface EditorProps extends Omit<BlockletEditorProps, 'onChange' | 'ref'> {
4
+ content: string;
5
+ children?: React.ReactNode;
6
+ }
7
+ export declare function EditorPreview({ content, children, ...rest }: EditorProps): import("react/jsx-runtime").JSX.Element;
@@ -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 { lazy } from "react";
7
- import { i as inferInitialEditorState, I as ImagePathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-ab9ee961.mjs";
7
+ import { i as inferInitialEditorState, I as ImagePathFixerPlugin, a as isEmptyContent, s as stringify, g as getExcerptSync } from "./index-8d296d98.mjs";
8
8
  import "@blocklet/labels";
9
9
  import "@mui/material/styles";
10
10
  import "@mui/material/Box";
@@ -33,6 +33,7 @@ import "lodash/flatMap";
33
33
  import "lodash/uniqBy";
34
34
  import "lodash/trim";
35
35
  import "@mui/material/Avatar";
36
+ import "@mui/icons-material/BrokenImage";
36
37
  import "@iconify/react";
37
38
  import "react-router-dom";
38
39
  import "@mui/material/colors";
@@ -35,7 +35,8 @@ import flatMap from "lodash/flatMap";
35
35
  import uniqBy from "lodash/uniqBy";
36
36
  import trim from "lodash/trim";
37
37
  import Avatar$1 from "@mui/material/Avatar";
38
- import { iconExists, Icon } from "@iconify/react";
38
+ import BrokenImageIcon from "@mui/icons-material/BrokenImage";
39
+ import { Icon } from "@iconify/react";
39
40
  import { Link, useNavigate, useLocation, useSearchParams, unstable_useBlocker } from "react-router-dom";
40
41
  import { green } from "@mui/material/colors";
41
42
  import { SessionContext } from "@arcblock/did-connect/lib/Session";
@@ -362,7 +363,7 @@ const useMeasure = () => {
362
363
  const size = useSize(ref);
363
364
  return [ref, size || { width: 0, height: 0 }];
364
365
  };
365
- const BlockletEditor$1 = lazy(() => import("@blocklet/editor"));
366
+ const BlockletEditor$2 = lazy(() => import("@blocklet/editor"));
366
367
  const Root$5 = styled(Box)`
367
368
  position: relative;
368
369
  .be-shell {
@@ -462,7 +463,7 @@ const Input = ({
462
463
  };
463
464
  const editorState = draftKey && draftContent && !initialContent ? draftContent : inferInitialEditorState(initialContent);
464
465
  return /* @__PURE__ */ createElement(Root$5, { ref, ...rest, key: draftKey }, /* @__PURE__ */ jsx(EditorConfigProvider, { value: mergedEditorConfig, children: /* @__PURE__ */ jsxs(
465
- BlockletEditor$1,
466
+ BlockletEditor$2,
466
467
  {
467
468
  placeholder,
468
469
  editorState,
@@ -704,20 +705,24 @@ function Badge({ startComponent, passports, pointInfo, did, spacing = 0.5, ...re
704
705
  const { badgeName, badgeIcon, badgeColor, badgeBackground } = item;
705
706
  let icon;
706
707
  if (badgeIcon) {
707
- if (iconExists(badgeIcon)) {
708
+ const isHttpIcon = ["http", "/", "data"].some((prefix2) => badgeIcon.startsWith(prefix2));
709
+ if (!isHttpIcon) {
708
710
  icon = /* @__PURE__ */ jsx(Icon, { icon: badgeIcon, color: badgeColor, style: { ...iconStyle } });
709
711
  } else {
710
712
  icon = /* @__PURE__ */ jsx(
711
713
  Avatar$1,
712
714
  {
713
715
  sx: {
714
- userSelect: "none",
715
- WebkitUserDrag: "none !important",
716
+ img: {
717
+ userSelect: "none !important",
718
+ WebkitUserSelect: "none !important",
719
+ WebkitUserDrag: "none !important"
720
+ },
721
+ background: "transparent",
716
722
  ...iconStyle
717
723
  },
718
- alt: badgeName,
719
724
  src: badgeIcon,
720
- children: badgeName
725
+ children: /* @__PURE__ */ jsx(BrokenImageIcon, { sx: { ...iconStyle, color: badgeColor } })
721
726
  }
722
727
  );
723
728
  }
@@ -1036,8 +1041,8 @@ function ViewMore({ children, ...rest }) {
1036
1041
  )
1037
1042
  ] });
1038
1043
  }
1039
- const BlockletEditor = lazy(() => import("@blocklet/editor"));
1040
- const StyledBlockletEditor = styled$1(BlockletEditor)`
1044
+ const BlockletEditor$1 = lazy(() => import("@blocklet/editor"));
1045
+ const StyledBlockletEditor = styled$1(BlockletEditor$1)`
1041
1046
  .editor-scroller {
1042
1047
  min-height: initial;
1043
1048
  }
@@ -2353,7 +2358,10 @@ function CoverImage({
2353
2358
  width = 320,
2354
2359
  sx,
2355
2360
  fetchpriority = "auto",
2356
- loading = "eager"
2361
+ loading = "eager",
2362
+ shadow = true,
2363
+ fallback,
2364
+ ...rest
2357
2365
  }) {
2358
2366
  const [loaded, setLoaded] = useState(false);
2359
2367
  return /* @__PURE__ */ jsxs(
@@ -2366,12 +2374,13 @@ function CoverImage({
2366
2374
  overflow: "hidden",
2367
2375
  position: "relative",
2368
2376
  borderRadius: 2,
2369
- boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px",
2377
+ ...shadow && { boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px" },
2370
2378
  // https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari
2371
2379
  transform: "translateZ(0)"
2372
2380
  },
2373
2381
  ...Array.isArray(sx) ? sx : [sx]
2374
2382
  ],
2383
+ ...rest,
2375
2384
  children: [
2376
2385
  (!loaded || !url) && /* @__PURE__ */ jsx(
2377
2386
  Skeleton,
@@ -2387,7 +2396,7 @@ function CoverImage({
2387
2396
  }
2388
2397
  }
2389
2398
  ),
2390
- /* @__PURE__ */ jsx(
2399
+ !!url && /* @__PURE__ */ jsx(
2391
2400
  "img",
2392
2401
  {
2393
2402
  src: url ? composeImageUrl(url, width) : "",
@@ -2406,6 +2415,19 @@ function CoverImage({
2406
2415
  alt: "cover",
2407
2416
  onLoad: () => setLoaded(true)
2408
2417
  }
2418
+ ),
2419
+ !url && /* @__PURE__ */ jsx(
2420
+ Box$1,
2421
+ {
2422
+ sx: {
2423
+ position: "absolute",
2424
+ top: 0,
2425
+ left: 0,
2426
+ width: "100%",
2427
+ height: "100%"
2428
+ },
2429
+ children: fallback
2430
+ }
2409
2431
  )
2410
2432
  ]
2411
2433
  }
@@ -4256,7 +4278,7 @@ function Pagination({ page, size = 20, total, onChange, routerMode = true, ...re
4256
4278
  }
4257
4279
  );
4258
4280
  }
4259
- const Editor = lazy(() => import("./editor-3fe3aadd.mjs"));
4281
+ const Editor = lazy(() => import("./editor-c78610e0.mjs"));
4260
4282
  function LazyEditor(props) {
4261
4283
  const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
4262
4284
  /* @__PURE__ */ jsx(Skeleton, {}),
@@ -4266,6 +4288,19 @@ function LazyEditor(props) {
4266
4288
  ] });
4267
4289
  return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsx(Editor, { ...props }) });
4268
4290
  }
4291
+ const BlockletEditor = lazy(() => import("@blocklet/editor"));
4292
+ function EditorPreview({ content, children, ...rest }) {
4293
+ const fallback = /* @__PURE__ */ jsxs(Fragment, { children: [
4294
+ /* @__PURE__ */ jsx(Skeleton, {}),
4295
+ /* @__PURE__ */ jsx(Skeleton, { width: "80%" }),
4296
+ /* @__PURE__ */ jsx(Skeleton, { width: "60%" }),
4297
+ /* @__PURE__ */ jsx(Skeleton, { width: "40%" })
4298
+ ] });
4299
+ return /* @__PURE__ */ jsx(Suspense, { fallback, children: /* @__PURE__ */ jsxs(BlockletEditor, { editorState: inferInitialEditorState(content), editable: false, ...rest, children: [
4300
+ /* @__PURE__ */ jsx(ImagePathFixerPlugin, {}),
4301
+ children
4302
+ ] }) });
4303
+ }
4269
4304
  const useBeforeUnloadPrompt = (dirty) => {
4270
4305
  useEffect(() => {
4271
4306
  const showPrompt = (e) => {
@@ -4350,8 +4385,8 @@ const en = {
4350
4385
  deleted: "This comment has been deleted",
4351
4386
  edit: "Edit",
4352
4387
  empty: "Be the first to leave a comment.",
4353
- loadMore: "Load more",
4354
- readMore: "Read more",
4388
+ loadMore: "Load More",
4389
+ readMore: "Read More",
4355
4390
  saveChanges: "Save Changes",
4356
4391
  sendComment: "Comment",
4357
4392
  showMoreReplies: "Show more replies",
@@ -10087,7 +10122,7 @@ function PointUpProvider({ children }) {
10087
10122
  ] });
10088
10123
  }
10089
10124
  export {
10090
- ConfirmProvider as $,
10125
+ useConfirm as $,
10091
10126
  Avatar as A,
10092
10127
  BinaryThumb as B,
10093
10128
  CommentInput as C,
@@ -10105,35 +10140,37 @@ export {
10105
10140
  ChatClient as O,
10106
10141
  Pagination as P,
10107
10142
  Chat as Q,
10108
- ChatHeaderAddon as R,
10143
+ RelativeTime as R,
10109
10144
  ScrollableEditorWrapper as S,
10110
- useChatContext as T,
10111
- ChatProvider as U,
10112
- UnreadNotificationContext as V,
10113
- useUnreadNotification as W,
10114
- UnreadNotificationProvider as X,
10115
- Confirm as Y,
10116
- ConfirmContext as Z,
10117
- useConfirm as _,
10145
+ ChatHeaderAddon as T,
10146
+ useChatContext as U,
10147
+ ChatProvider as V,
10148
+ UnreadNotificationContext as W,
10149
+ useUnreadNotification as X,
10150
+ UnreadNotificationProvider as Y,
10151
+ Confirm as Z,
10152
+ ConfirmContext as _,
10118
10153
  isEmptyContent as a,
10119
- SecureLabelPicker as a0,
10120
- useApiErrorHandler as a1,
10121
- useDefaultApiErrorHandler as a2,
10122
- PreviousLocationRecorder as a3,
10123
- Back as a4,
10124
- LazyEditor as a5,
10125
- DirtyPromptContainer as a6,
10126
- ConfirmNavigation as a7,
10127
- UploaderContext as a8,
10128
- useUploader as a9,
10129
- UploaderTrigger as aa,
10130
- UploaderProvider as ab,
10131
- composeImageUrl as ac,
10132
- usePointUpContext as ad,
10133
- PointUpProvider as ae,
10134
- create as af,
10135
- getWsClient as ag,
10136
- useSubscription as ah,
10154
+ ConfirmProvider as a0,
10155
+ SecureLabelPicker as a1,
10156
+ useApiErrorHandler as a2,
10157
+ useDefaultApiErrorHandler as a3,
10158
+ PreviousLocationRecorder as a4,
10159
+ Back as a5,
10160
+ LazyEditor as a6,
10161
+ EditorPreview as a7,
10162
+ DirtyPromptContainer as a8,
10163
+ ConfirmNavigation as a9,
10164
+ UploaderContext as aa,
10165
+ useUploader as ab,
10166
+ UploaderTrigger as ac,
10167
+ UploaderProvider as ad,
10168
+ composeImageUrl as ae,
10169
+ usePointUpContext as af,
10170
+ PointUpProvider as ag,
10171
+ create as ah,
10172
+ getWsClient as ai,
10173
+ useSubscription as aj,
10137
10174
  InternalThemeProvider as b,
10138
10175
  Input as c,
10139
10176
  translations as d,
package/dist/index.d.ts CHANGED
@@ -24,3 +24,4 @@ export { default as preferences } from './preferences';
24
24
  export * from './components/uploader';
25
25
  export * from './components/point-up';
26
26
  export * from './ws';
27
+ export { default as RelativeTime } from './components/shared/relative-time';
package/dist/index.es.js CHANGED
@@ -1,5 +1,5 @@
1
1
  export * from "@blocklet/labels";
2
- import { K, j, N, A, h, a4, B, z, y, E, Q, O, R, U, o, C, q, v, x, Y, Z, a7, $, H, J, D, a6, G, c, b, a5, M, P, ae, n, m, a3, S, a0, k, V, X, a8, ab, aa, ac, af, F, ag, l, p, r, t, d, a1, L, e, T, w, _, a2, u, ad, ah, W, a9, f } from "./index-ab9ee961.mjs";
2
+ import { K, j, N, A, h, a5, B, z, y, E, Q, O, T, V, o, C, q, v, x, Z, _, a9, a0, H, J, D, a8, a7, G, c, b, a6, M, P, ag, n, m, a4, R, S, a1, k, W, Y, aa, ad, ac, ae, ah, F, ai, l, p, r, t, d, a2, L, e, U, w, $, a3, u, af, aj, X, ab, f } from "./index-8d296d98.mjs";
3
3
  import "react/jsx-runtime";
4
4
  import "react";
5
5
  import "@mui/material/Box";
@@ -31,6 +31,7 @@ import "lodash/flatMap";
31
31
  import "lodash/uniqBy";
32
32
  import "lodash/trim";
33
33
  import "@mui/material/Avatar";
34
+ import "@mui/icons-material/BrokenImage";
34
35
  import "@iconify/react";
35
36
  import "react-router-dom";
36
37
  import "@mui/material/colors";
@@ -63,66 +64,68 @@ export {
63
64
  N as AuthzProvider,
64
65
  A as Avatar,
65
66
  h as Avatars,
66
- a4 as Back,
67
+ a5 as Back,
67
68
  B as BinaryThumb,
68
69
  z as BlogCard,
69
70
  y as BlogList,
70
71
  E as BlogPermaLink,
71
72
  Q as Chat,
72
73
  O as ChatClient,
73
- R as ChatHeaderAddon,
74
- U as ChatProvider,
74
+ T as ChatHeaderAddon,
75
+ V as ChatProvider,
75
76
  o as Comment,
76
77
  C as CommentInput,
77
78
  q as CommentList,
78
79
  v as CommentsContext,
79
80
  x as CommentsProvider,
80
- Y as Confirm,
81
- Z as ConfirmContext,
82
- a7 as ConfirmNavigation,
83
- $ as ConfirmProvider,
81
+ Z as Confirm,
82
+ _ as ConfirmContext,
83
+ a9 as ConfirmNavigation,
84
+ a0 as ConfirmProvider,
84
85
  H as CoverImage,
85
86
  J as CoverImageUpload,
86
87
  D as DefaultEditorConfigProvider,
87
- a6 as DirtyPromptContainer,
88
+ a8 as DirtyPromptContainer,
89
+ a7 as EditorPreview,
88
90
  G as GithubReaction,
89
91
  c as Input,
90
92
  b as InternalThemeProvider,
91
- a5 as LazyEditor,
93
+ a6 as LazyEditor,
92
94
  M as Menu,
93
95
  P as Pagination,
94
- ae as PointUpProvider,
96
+ ag as PointUpProvider,
95
97
  n as Post,
96
98
  m as PostContent,
97
- a3 as PreviousLocationRecorder,
99
+ a4 as PreviousLocationRecorder,
100
+ R as RelativeTime,
98
101
  S as ScrollableEditorWrapper,
99
- a0 as SecureLabelPicker,
102
+ a1 as SecureLabelPicker,
100
103
  k as SystemUser,
101
- V as UnreadNotificationContext,
102
- X as UnreadNotificationProvider,
103
- a8 as UploaderContext,
104
- ab as UploaderProvider,
105
- aa as UploaderTrigger,
106
- ac as composeImageUrl,
107
- af as create,
104
+ W as UnreadNotificationContext,
105
+ Y as UnreadNotificationProvider,
106
+ aa as UploaderContext,
107
+ ad as UploaderProvider,
108
+ ac as UploaderTrigger,
109
+ ae as composeImageUrl,
110
+ ah as create,
108
111
  F as getBlogLink,
109
- ag as getWsClient,
112
+ ai as getWsClient,
110
113
  l as lexicalUtils,
111
114
  p as preferences,
112
115
  r as routes,
113
116
  t as themeOverrides,
114
117
  d as translations,
115
- a1 as useApiErrorHandler,
118
+ a2 as useApiErrorHandler,
116
119
  L as useAuthzContext,
117
120
  e as useChanged,
118
- T as useChatContext,
121
+ U as useChatContext,
119
122
  w as useCommentsContext,
120
- _ as useConfirm,
121
- a2 as useDefaultApiErrorHandler,
123
+ $ as useConfirm,
124
+ a3 as useDefaultApiErrorHandler,
122
125
  u as useNow,
123
- ad as usePointUpContext,
124
- ah as useSubscription,
125
- W as useUnreadNotification,
126
- a9 as useUploader,
126
+ af as usePointUpContext,
127
+ aj as useSubscription,
128
+ X as useUnreadNotification,
129
+ ab as useUploader,
127
130
  f as utils
128
131
  };
package/dist/index.umd.js CHANGED
@@ -5,8 +5,8 @@ var __publicField = (obj, key, value) => {
5
5
  return value;
6
6
  };
7
7
  (function(global, factory) {
8
- typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/Tooltip"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@iconify/react"), require("react-router-dom"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("react-dom"), require("js-cookie"), require("@arcblock/ws"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/did-connect/lib/Address", "@mui/material/Tooltip", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@iconify/react", "react-router-dom", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "react-dom", "js-cookie", "@arcblock/ws", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.Button, global.DidAvatar, global.useMediaQuery, global.DIDAddress, global.Tooltip, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.react$1, global.reactRouterDom, global.colors, global.Session, global.material, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.reactDom, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode));
9
- })(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, Button, DidAvatar, useMediaQuery, DIDAddress, Tooltip, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, react$1, reactRouterDom, colors, Session, material, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, dayjs, relativeTime, mitt, CircularProgress, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, reactDom, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode) {
8
+ typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("@blocklet/labels"), require("react/jsx-runtime"), require("@mui/material/styles"), require("react"), require("@mui/material/Box"), require("@arcblock/ux/lib/Theme"), require("@blocklet/editor/lib/config"), require("@lexical/react/LexicalComposerContext"), require("lexical"), require("ahooks"), require("@mui/lab/LoadingButton"), require("@mui/icons-material"), require("@arcblock/ux/lib/Locale/context"), require("@mui/material/Alert"), require("@mui/material/Button"), require("@arcblock/did-connect/lib/Avatar"), require("@mui/material/useMediaQuery"), require("@arcblock/did-connect/lib/Address"), require("@mui/material/Tooltip"), require("@arcblock/ux/lib/RelativeTime"), require("@mui/material/Chip"), require("@mui/material/Stack"), require("lodash/groupBy"), require("lodash/flatMap"), require("lodash/uniqBy"), require("lodash/trim"), require("@mui/material/Avatar"), require("@mui/icons-material/BrokenImage"), require("@iconify/react"), require("react-router-dom"), require("@mui/material/colors"), require("@arcblock/did-connect/lib/Session"), require("@mui/material"), require("@blocklet/editor/lib/ext/CheckboxPlugin"), require("@mui/material/MenuItem"), require("clsx"), require("@mui/material/IconButton"), require("@mui/material/Menu"), require("@arcblock/ux/lib/Dialog"), require("lodash/orderBy"), require("@mui/material/Typography"), require("@mui/material/Skeleton"), require("url-join"), require("dayjs"), require("dayjs/plugin/relativeTime"), require("mitt"), require("@mui/material/CircularProgress"), require("@mui/material/Fab"), require("lodash/debounce"), require("@mui/material/TextField"), require("axios"), require("@arcblock/ux/lib/Toast"), require("@mui/material/Pagination"), require("unstated-next"), require("react-dom"), require("js-cookie"), require("@arcblock/ws"), require("@blocklet/editor/lib/ext/OnContentChangePlugin"), require("@blocklet/editor/lib/ext/ShortcutPlugin"), require("@blocklet/editor/lib/ext/SafeAreaPlugin"), require("@lexical/text"), require("@blocklet/editor/lib/main/nodes/ImageNode")) : typeof define === "function" && define.amd ? define(["exports", "@blocklet/labels", "react/jsx-runtime", "@mui/material/styles", "react", "@mui/material/Box", "@arcblock/ux/lib/Theme", "@blocklet/editor/lib/config", "@lexical/react/LexicalComposerContext", "lexical", "ahooks", "@mui/lab/LoadingButton", "@mui/icons-material", "@arcblock/ux/lib/Locale/context", "@mui/material/Alert", "@mui/material/Button", "@arcblock/did-connect/lib/Avatar", "@mui/material/useMediaQuery", "@arcblock/did-connect/lib/Address", "@mui/material/Tooltip", "@arcblock/ux/lib/RelativeTime", "@mui/material/Chip", "@mui/material/Stack", "lodash/groupBy", "lodash/flatMap", "lodash/uniqBy", "lodash/trim", "@mui/material/Avatar", "@mui/icons-material/BrokenImage", "@iconify/react", "react-router-dom", "@mui/material/colors", "@arcblock/did-connect/lib/Session", "@mui/material", "@blocklet/editor/lib/ext/CheckboxPlugin", "@mui/material/MenuItem", "clsx", "@mui/material/IconButton", "@mui/material/Menu", "@arcblock/ux/lib/Dialog", "lodash/orderBy", "@mui/material/Typography", "@mui/material/Skeleton", "url-join", "dayjs", "dayjs/plugin/relativeTime", "mitt", "@mui/material/CircularProgress", "@mui/material/Fab", "lodash/debounce", "@mui/material/TextField", "axios", "@arcblock/ux/lib/Toast", "@mui/material/Pagination", "unstated-next", "react-dom", "js-cookie", "@arcblock/ws", "@blocklet/editor/lib/ext/OnContentChangePlugin", "@blocklet/editor/lib/ext/ShortcutPlugin", "@blocklet/editor/lib/ext/SafeAreaPlugin", "@lexical/text", "@blocklet/editor/lib/main/nodes/ImageNode"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.DiscussKitComponents = {}, global.labels, global.jsxRuntime, global.styles, global.react, global.Box, global.Theme, global.config, global.LexicalComposerContext, global.lexical$1, global.ahooks, global.LoadingButton, global.iconsMaterial, global.context, global.Alert, global.Button, global.DidAvatar, global.useMediaQuery, global.DIDAddress, global.Tooltip, global.UxRelativeTime, global.Chip, global.Stack, global.groupBy, global.flatMap, global.uniqBy, global.trim, global.Avatar$1, global.BrokenImageIcon, global.react$1, global.reactRouterDom, global.colors, global.Session, global.material, global.CheckboxPlugin, global.MuiMenuItem, global.clsx, global.IconButton$1, global.MuiMenu, global.Dialog, global.orderBy, global.Typography, global.Skeleton, global.joinUrl, global.dayjs, global.relativeTime, global.mitt, global.CircularProgress, global.Fab, global.debounce, global.TextField, global.axios, global.Toast, global.MuiPagination, global.unstatedNext, global.reactDom, global.Cookie, global.ws, global.OnContentChangePlugin, global.ShortcutPlugin, global.SafeAreaPlugin, global.text, global.ImageNode));
9
+ })(this, function(exports2, labels, jsxRuntime, styles, react, Box, Theme, config, LexicalComposerContext, lexical$1, ahooks, LoadingButton, iconsMaterial, context, Alert, Button, DidAvatar, useMediaQuery, DIDAddress, Tooltip, UxRelativeTime, Chip, Stack, groupBy, flatMap, uniqBy, trim, Avatar$1, BrokenImageIcon, react$1, reactRouterDom, colors, Session, material, CheckboxPlugin, MuiMenuItem, clsx, IconButton$1, MuiMenu, Dialog, orderBy, Typography, Skeleton, joinUrl, dayjs, relativeTime, mitt, CircularProgress, Fab, debounce, TextField, axios, Toast, MuiPagination, unstatedNext, reactDom, Cookie, ws, OnContentChangePlugin, ShortcutPlugin, SafeAreaPlugin, text, ImageNode) {
10
10
  var _a, _b;
11
11
  "use strict";
12
12
  const themeOverrides = {
@@ -308,7 +308,7 @@ var __publicField = (obj, key, value) => {
308
308
  const size = ahooks.useSize(ref);
309
309
  return [ref, size || { width: 0, height: 0 }];
310
310
  };
311
- const BlockletEditor$2 = react.lazy(() => import("@blocklet/editor"));
311
+ const BlockletEditor$3 = react.lazy(() => import("@blocklet/editor"));
312
312
  const Root$6 = Theme.styled(Box)`
313
313
  position: relative;
314
314
  .be-shell {
@@ -408,7 +408,7 @@ var __publicField = (obj, key, value) => {
408
408
  };
409
409
  const editorState = draftKey && draftContent && !initialContent ? draftContent : inferInitialEditorState(initialContent);
410
410
  return /* @__PURE__ */ react.createElement(Root$6, { ref, ...rest, key: draftKey }, /* @__PURE__ */ jsxRuntime.jsx(config.EditorConfigProvider, { value: mergedEditorConfig, children: /* @__PURE__ */ jsxRuntime.jsxs(
411
- BlockletEditor$2,
411
+ BlockletEditor$3,
412
412
  {
413
413
  placeholder,
414
414
  editorState,
@@ -650,20 +650,24 @@ var __publicField = (obj, key, value) => {
650
650
  const { badgeName, badgeIcon, badgeColor, badgeBackground } = item;
651
651
  let icon;
652
652
  if (badgeIcon) {
653
- if (react$1.iconExists(badgeIcon)) {
653
+ const isHttpIcon = ["http", "/", "data"].some((prefix2) => badgeIcon.startsWith(prefix2));
654
+ if (!isHttpIcon) {
654
655
  icon = /* @__PURE__ */ jsxRuntime.jsx(react$1.Icon, { icon: badgeIcon, color: badgeColor, style: { ...iconStyle } });
655
656
  } else {
656
657
  icon = /* @__PURE__ */ jsxRuntime.jsx(
657
658
  Avatar$1,
658
659
  {
659
660
  sx: {
660
- userSelect: "none",
661
- WebkitUserDrag: "none !important",
661
+ img: {
662
+ userSelect: "none !important",
663
+ WebkitUserSelect: "none !important",
664
+ WebkitUserDrag: "none !important"
665
+ },
666
+ background: "transparent",
662
667
  ...iconStyle
663
668
  },
664
- alt: badgeName,
665
669
  src: badgeIcon,
666
- children: badgeName
670
+ children: /* @__PURE__ */ jsxRuntime.jsx(BrokenImageIcon, { sx: { ...iconStyle, color: badgeColor } })
667
671
  }
668
672
  );
669
673
  }
@@ -982,8 +986,8 @@ var __publicField = (obj, key, value) => {
982
986
  )
983
987
  ] });
984
988
  }
985
- const BlockletEditor$1 = react.lazy(() => import("@blocklet/editor"));
986
- const StyledBlockletEditor = styles.styled(BlockletEditor$1)`
989
+ const BlockletEditor$2 = react.lazy(() => import("@blocklet/editor"));
990
+ const StyledBlockletEditor = styles.styled(BlockletEditor$2)`
987
991
  .editor-scroller {
988
992
  min-height: initial;
989
993
  }
@@ -2299,7 +2303,10 @@ var __publicField = (obj, key, value) => {
2299
2303
  width = 320,
2300
2304
  sx,
2301
2305
  fetchpriority = "auto",
2302
- loading = "eager"
2306
+ loading = "eager",
2307
+ shadow = true,
2308
+ fallback,
2309
+ ...rest
2303
2310
  }) {
2304
2311
  const [loaded, setLoaded] = react.useState(false);
2305
2312
  return /* @__PURE__ */ jsxRuntime.jsxs(
@@ -2312,12 +2319,13 @@ var __publicField = (obj, key, value) => {
2312
2319
  overflow: "hidden",
2313
2320
  position: "relative",
2314
2321
  borderRadius: 2,
2315
- boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px",
2322
+ ...shadow && { boxShadow: "rgb(0 0 0 / 12%) 0px 8px 30px" },
2316
2323
  // https://stackoverflow.com/questions/49066011/overflow-hidden-with-border-radius-not-working-on-safari
2317
2324
  transform: "translateZ(0)"
2318
2325
  },
2319
2326
  ...Array.isArray(sx) ? sx : [sx]
2320
2327
  ],
2328
+ ...rest,
2321
2329
  children: [
2322
2330
  (!loaded || !url) && /* @__PURE__ */ jsxRuntime.jsx(
2323
2331
  material.Skeleton,
@@ -2333,7 +2341,7 @@ var __publicField = (obj, key, value) => {
2333
2341
  }
2334
2342
  }
2335
2343
  ),
2336
- /* @__PURE__ */ jsxRuntime.jsx(
2344
+ !!url && /* @__PURE__ */ jsxRuntime.jsx(
2337
2345
  "img",
2338
2346
  {
2339
2347
  src: url ? composeImageUrl(url, width) : "",
@@ -2352,6 +2360,19 @@ var __publicField = (obj, key, value) => {
2352
2360
  alt: "cover",
2353
2361
  onLoad: () => setLoaded(true)
2354
2362
  }
2363
+ ),
2364
+ !url && /* @__PURE__ */ jsxRuntime.jsx(
2365
+ material.Box,
2366
+ {
2367
+ sx: {
2368
+ position: "absolute",
2369
+ top: 0,
2370
+ left: 0,
2371
+ width: "100%",
2372
+ height: "100%"
2373
+ },
2374
+ children: fallback
2375
+ }
2355
2376
  )
2356
2377
  ]
2357
2378
  }
@@ -4212,6 +4233,19 @@ var __publicField = (obj, key, value) => {
4212
4233
  ] });
4213
4234
  return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsx(Editor$1, { ...props }) });
4214
4235
  }
4236
+ const BlockletEditor$1 = react.lazy(() => import("@blocklet/editor"));
4237
+ function EditorPreview({ content, children, ...rest }) {
4238
+ const fallback = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4239
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, {}),
4240
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "80%" }),
4241
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "60%" }),
4242
+ /* @__PURE__ */ jsxRuntime.jsx(material.Skeleton, { width: "40%" })
4243
+ ] });
4244
+ return /* @__PURE__ */ jsxRuntime.jsx(react.Suspense, { fallback, children: /* @__PURE__ */ jsxRuntime.jsxs(BlockletEditor$1, { editorState: inferInitialEditorState(content), editable: false, ...rest, children: [
4245
+ /* @__PURE__ */ jsxRuntime.jsx(ImagePathFixerPlugin, {}),
4246
+ children
4247
+ ] }) });
4248
+ }
4215
4249
  const useBeforeUnloadPrompt = (dirty) => {
4216
4250
  react.useEffect(() => {
4217
4251
  const showPrompt = (e) => {
@@ -4296,8 +4330,8 @@ var __publicField = (obj, key, value) => {
4296
4330
  deleted: "This comment has been deleted",
4297
4331
  edit: "Edit",
4298
4332
  empty: "Be the first to leave a comment.",
4299
- loadMore: "Load more",
4300
- readMore: "Read more",
4333
+ loadMore: "Load More",
4334
+ readMore: "Read More",
4301
4335
  saveChanges: "Save Changes",
4302
4336
  sendComment: "Comment",
4303
4337
  showMoreReplies: "Show more replies",
@@ -10089,6 +10123,7 @@ var __publicField = (obj, key, value) => {
10089
10123
  exports2.CoverImageUpload = CoverImageUpload;
10090
10124
  exports2.DefaultEditorConfigProvider = DefaultEditorConfigProvider;
10091
10125
  exports2.DirtyPromptContainer = DirtyPromptContainer;
10126
+ exports2.EditorPreview = EditorPreview;
10092
10127
  exports2.GithubReaction = GithubReaction;
10093
10128
  exports2.Input = Input;
10094
10129
  exports2.InternalThemeProvider = InternalThemeProvider;
@@ -10099,6 +10134,7 @@ var __publicField = (obj, key, value) => {
10099
10134
  exports2.Post = PostComponent;
10100
10135
  exports2.PostContent = PostContent;
10101
10136
  exports2.PreviousLocationRecorder = PreviousLocationRecorder;
10137
+ exports2.RelativeTime = RelativeTime;
10102
10138
  exports2.ScrollableEditorWrapper = ScrollableEditorWrapper;
10103
10139
  exports2.SecureLabelPicker = SecureLabelPicker;
10104
10140
  exports2.SystemUser = SystemUser;
@@ -29,5 +29,9 @@ declare const preferences: {
29
29
  socialShareButtonsDiscussion: boolean;
30
30
  socialShareButtonsBlog: boolean;
31
31
  socialShareButtonsDoc: boolean;
32
+ blogListTemplate: "standard" | "corp";
33
+ blogTemplate: "standard" | "corp";
34
+ blogListTemplatePrimaryColor: string;
35
+ blogListTemplateAccentColor: string;
32
36
  };
33
37
  export default preferences;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@blocklet/discuss-kit-ux",
3
- "version": "1.5.183",
3
+ "version": "1.5.185",
4
4
  "files": [
5
5
  "dist"
6
6
  ],
@@ -29,9 +29,9 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@arcblock/ws": "^1.18.95",
32
- "@blocklet/editor": "1.5.183",
33
- "@blocklet/labels": "1.5.183",
34
- "@blocklet/uploader": "^0.0.42",
32
+ "@blocklet/editor": "1.5.185",
33
+ "@blocklet/labels": "1.5.185",
34
+ "@blocklet/uploader": "^0.0.45",
35
35
  "@emotion/css": "^11.10.5",
36
36
  "@emotion/react": "^11.10.5",
37
37
  "@emotion/styled": "^11.10.5",
@@ -93,5 +93,5 @@
93
93
  "resolutions": {
94
94
  "react": "^18.2.0"
95
95
  },
96
- "gitHead": "6d597a12b098da62ff187179e43222c45bf0f629"
96
+ "gitHead": "ddb802ddbf61267404f1b151483ccbdfc549099f"
97
97
  }