@lobehub/ui 1.3.0 → 1.5.0

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 (73) hide show
  1. package/es/Avatar/index.d.ts +10 -0
  2. package/es/Avatar/index.js +61 -0
  3. package/es/ContextMenu/MenuItem/icons.d.ts +4 -0
  4. package/es/ContextMenu/MenuItem/icons.js +73 -0
  5. package/es/ContextMenu/MenuItem/index.d.ts +12 -0
  6. package/es/ContextMenu/MenuItem/index.js +73 -0
  7. package/es/ContextMenu/MenuItem/style.d.ts +7 -0
  8. package/es/ContextMenu/MenuItem/style.js +16 -0
  9. package/es/ContextMenu/index.d.ts +9 -0
  10. package/es/ContextMenu/index.js +265 -0
  11. package/es/ContextMenu/style.d.ts +4 -0
  12. package/es/ContextMenu/style.js +12 -0
  13. package/es/ContextMenu/types/index.d.ts +5 -0
  14. package/es/ContextMenu/types/index.js +2 -0
  15. package/es/ContextMenu/types/menuItem.d.ts +21 -0
  16. package/es/ContextMenu/types/menuItem.js +1 -0
  17. package/es/DraggablePanel/index.d.ts +7 -1
  18. package/es/DraggablePanel/index.js +6 -7
  19. package/es/DraggablePanel/utils.d.ts +1 -1
  20. package/es/EditableMessage/index.d.ts +43 -0
  21. package/es/EditableMessage/index.js +67 -0
  22. package/es/List/ListItem/index.d.ts +64 -0
  23. package/es/List/ListItem/index.js +110 -0
  24. package/es/List/ListItem/time.d.ts +2 -0
  25. package/es/List/ListItem/time.js +10 -0
  26. package/es/List/index.d.ts +5 -0
  27. package/es/List/index.js +5 -0
  28. package/es/Markdown/CodeBlock.js +2 -1
  29. package/es/Markdown/index.js +2 -0
  30. package/es/Markdown/style.js +1 -1
  31. package/es/MessageModal/index.d.ts +11 -0
  32. package/es/MessageModal/index.js +80 -0
  33. package/es/ThemeProvider/GlobalStyle.js +1 -1
  34. package/es/index.d.ts +5 -0
  35. package/es/index.js +5 -0
  36. package/es/styles/theme/base.js +1 -1
  37. package/lib/Avatar/index.d.ts +10 -0
  38. package/lib/Avatar/index.js +74 -0
  39. package/lib/ContextMenu/MenuItem/icons.d.ts +4 -0
  40. package/lib/ContextMenu/MenuItem/icons.js +100 -0
  41. package/lib/ContextMenu/MenuItem/index.d.ts +12 -0
  42. package/lib/ContextMenu/MenuItem/index.js +72 -0
  43. package/lib/ContextMenu/MenuItem/style.d.ts +7 -0
  44. package/lib/ContextMenu/MenuItem/style.js +94 -0
  45. package/lib/ContextMenu/index.d.ts +9 -0
  46. package/lib/ContextMenu/index.js +254 -0
  47. package/lib/ContextMenu/style.d.ts +4 -0
  48. package/lib/ContextMenu/style.js +88 -0
  49. package/lib/ContextMenu/types/index.d.ts +5 -0
  50. package/lib/ContextMenu/types/index.js +19 -0
  51. package/lib/ContextMenu/types/menuItem.d.ts +21 -0
  52. package/lib/ContextMenu/types/menuItem.js +17 -0
  53. package/lib/DraggablePanel/index.d.ts +7 -1
  54. package/lib/DraggablePanel/index.js +17 -19
  55. package/lib/DraggablePanel/utils.d.ts +1 -1
  56. package/lib/EditableMessage/index.d.ts +43 -0
  57. package/lib/EditableMessage/index.js +96 -0
  58. package/lib/List/ListItem/index.d.ts +64 -0
  59. package/lib/List/ListItem/index.js +157 -0
  60. package/lib/List/ListItem/time.d.ts +2 -0
  61. package/lib/List/ListItem/time.js +50 -0
  62. package/lib/List/index.d.ts +5 -0
  63. package/lib/List/index.js +41 -0
  64. package/lib/Markdown/CodeBlock.js +5 -1
  65. package/lib/Markdown/index.js +10 -1
  66. package/lib/Markdown/style.js +84 -9
  67. package/lib/MessageModal/index.d.ts +11 -0
  68. package/lib/MessageModal/index.js +98 -0
  69. package/lib/ThemeProvider/GlobalStyle.js +0 -18
  70. package/lib/index.d.ts +5 -0
  71. package/lib/index.js +15 -0
  72. package/lib/styles/theme/base.js +1 -1
  73. package/package.json +4 -1
@@ -26,29 +26,104 @@ var import_antd_style = require("antd-style");
26
26
  var useStyles = (0, import_antd_style.createStyles)(({ css, token, isDarkMode }) => {
27
27
  return {
28
28
  container: css`
29
+ color: ${isDarkMode ? token.colorTextSecondary : token.colorText};
30
+
31
+
32
+
29
33
  p {
30
34
  margin: 20px auto;
31
35
  line-height: 2;
32
36
  word-wrap: break-word;
33
37
  font-size: 14px;
34
38
  color: ${token.colorText};
39
+
40
+ &:not(:last-child) {
41
+ margin-bottom: 1em;
42
+ }
43
+ }
44
+
45
+ // hyperlink
46
+ a {
47
+ color: ${token.colorLink};
48
+
49
+ &:hover {
50
+ color: ${token.colorLinkHover};
51
+ }
52
+
53
+ &:active {
54
+ color: ${token.colorLinkActive};
55
+ }
56
+ }
57
+
58
+ img {
59
+ max-width: 100%;
60
+ }
61
+
62
+ // inline code
63
+ > :not([data-code-type='highlighter']) code {
64
+ padding: 2px 6px;
65
+ color: ${isDarkMode ? token["cyan-7"] : token.colorPrimaryText};
66
+ background: ${isDarkMode ? token["cyan-1"] : token.colorPrimaryBg};
67
+ border-radius: 4px;
68
+ }
69
+
70
+
71
+ // table
72
+ table {
73
+ width: 100%;
74
+ border-spacing: 0;
75
+ border: 1px solid ${token.colorBorder};
76
+ border-radius: ${token.borderRadius}px;
77
+ padding: 8px;
78
+ margin-block-start: 1em;
79
+ margin-block-end: 1em;
80
+ margin-inline-start: 0px;
81
+ margin-inline-end: 0px;
35
82
  }
36
83
 
37
- p:not(:last-child) {
38
- margin-bottom: 1em;
84
+ th {
85
+
86
+ }
87
+
88
+ thead {
89
+ tr {
90
+ th {
91
+ background: ${token.colorFillTertiary};
92
+ &:first-child {
93
+ border-top-left-radius: ${token.borderRadius}px;
94
+ border-bottom-left-radius: ${token.borderRadius}px;
95
+ }
96
+ &:last-child {
97
+ border-top-right-radius: ${token.borderRadius}px;
98
+ border-bottom-right-radius: ${token.borderRadius}px;
99
+ }
100
+ }
101
+ }
39
102
  }
40
103
 
41
- blockquote p {
42
- color: ${token.colorTextDescription};
104
+ th,
105
+ td {
106
+ padding-block-start: 10px;
107
+ padding-block-end: 10px;
108
+ padding-inline-start: 16px;
109
+ padding-inline-end: 16px;
43
110
  }
44
111
 
45
- ol,
46
- ul {
47
- li {
48
- line-height: 2;
49
- display: list-item;
112
+ // blockquote
113
+ blockquote {
114
+ margin: 16px 0;
115
+ padding: 0 12px;
116
+ p {
117
+ font-style: italic;
118
+ color: ${token.colorTextDescription};
50
119
  }
51
120
  }
121
+
122
+ // list
123
+ ul li {
124
+ line-height: 1.8;
125
+ }
126
+ }
52
127
  `,
53
128
  code: css`
54
129
  padding: 2px 4px;
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ export interface MessageModalProps {
3
+ open?: boolean;
4
+ onOpenChange?: (open: boolean) => void;
5
+ editing?: boolean;
6
+ onEditingChange?: (editing: boolean) => void;
7
+ onChange?: (text: string) => void;
8
+ value: string;
9
+ }
10
+ declare const MessageModal: import("react").NamedExoticComponent<MessageModalProps>;
11
+ export default MessageModal;
@@ -0,0 +1,98 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
27
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+
29
+ // src/MessageModal/index.tsx
30
+ var MessageModal_exports = {};
31
+ __export(MessageModal_exports, {
32
+ default: () => MessageModal_default
33
+ });
34
+ module.exports = __toCommonJS(MessageModal_exports);
35
+ var import_icons = require("@ant-design/icons");
36
+ var import_antd = require("antd");
37
+ var import_antd_style = require("antd-style");
38
+ var import_react = require("react");
39
+ var import_react_layout_kit = require("react-layout-kit");
40
+ var import_use_merge_value = __toESM(require("use-merge-value"));
41
+ var import_Markdown = __toESM(require("../Markdown"));
42
+ var import_MessageInput = __toESM(require("../MessageInput"));
43
+ var useStyles = (0, import_antd_style.createStyles)(({ css, prefixCls }) => ({
44
+ modal: css`
45
+ height: 70%;
46
+ .${prefixCls}-modal-header {
47
+ margin-bottom: 24px;
48
+ }
49
+ `,
50
+ body: css`
51
+ overflow-y: scroll;
52
+ max-height: 70vh;
53
+ `
54
+ }));
55
+ var MessageModal = (0, import_react.memo)(
56
+ ({ editing, open, onOpenChange, onEditingChange, value, onChange }) => {
57
+ const { styles } = useStyles();
58
+ const [isEdit, setTyping] = (0, import_use_merge_value.default)(false, {
59
+ value: editing,
60
+ onChange: onEditingChange
61
+ });
62
+ const [expand, setExpand] = (0, import_use_merge_value.default)(false, {
63
+ value: open,
64
+ onChange: onOpenChange
65
+ });
66
+ return /* @__PURE__ */ React.createElement(
67
+ import_antd.Modal,
68
+ {
69
+ open: expand,
70
+ width: 800,
71
+ onCancel: () => setExpand(false),
72
+ okText: "编辑",
73
+ onOk: () => {
74
+ setTyping(true);
75
+ },
76
+ footer: isEdit ? null : void 0,
77
+ cancelText: "关闭",
78
+ title: /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, align: "center", gap: 4 }, /* @__PURE__ */ React.createElement(import_icons.AimOutlined, null), "提示词"),
79
+ className: styles.modal
80
+ },
81
+ isEdit ? /* @__PURE__ */ React.createElement(
82
+ import_MessageInput.default,
83
+ {
84
+ onConfirm: (text) => {
85
+ setTyping(false);
86
+ onChange == null ? void 0 : onChange(text);
87
+ },
88
+ onCancel: () => setTyping(false),
89
+ defaultValue: value,
90
+ height: 400
91
+ }
92
+ ) : /* @__PURE__ */ React.createElement(import_Markdown.default, { className: styles.body }, value)
93
+ );
94
+ }
95
+ );
96
+ var MessageModal_default = MessageModal;
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {});
@@ -46,24 +46,6 @@ var GlobalStyle = import_antd_style.createGlobalStyle`
46
46
  #root {
47
47
  min-height: 100vh;
48
48
  }
49
-
50
- @font-face {
51
- font-family: AliPuHui;
52
- font-weight: normal;
53
- src: url('//at.alicdn.com/t/webfont_exesdog9toj.woff2') format('woff2'),
54
- url('//at.alicdn.com/t/webfont_exesdog9toj.woff') format('woff'),
55
- url('//at.alicdn.com/t/webfont_exesdog9toj.ttf') format('truetype');
56
- font-display: swap;
57
- }
58
-
59
- @font-face {
60
- font-family: AliPuHui;
61
- font-weight: bold;
62
- src: url('https://at.alicdn.com/wf/webfont/exMpJIukiCms/Gsw2PSKrftc1yNWMNlXgw.woff2') format('woff2'),
63
- url('https://at.alicdn.com/wf/webfont/exMpJIukiCms/vtu73by4O2gEBcvBuLgeu.woff') format('woff');
64
- font-display: swap;
65
- }
66
-
67
49
  /* 定义滚动槽的样式 */
68
50
  ::-webkit-scrollbar {
69
51
  width: 0;
package/lib/index.d.ts CHANGED
@@ -1,12 +1,17 @@
1
1
  export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
2
+ export { default as Avatar, type AvatarProps } from './Avatar';
3
+ export { default as ContextMenu, type ContextMenuProps } from './ContextMenu';
2
4
  export { default as CopyButton, type CopyButtonProps } from './CopyButton';
3
5
  export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
6
+ export { default as EditableMessage, type EditableMessageProps } from './EditableMessage';
4
7
  export { default as EditableText, type EditableTextProps } from './EditableText';
5
8
  export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
6
9
  export { default as Icon, type IconProps, type IconSize } from './Icon';
10
+ export { default as List } from './List';
7
11
  export { default as Logo, type LogoProps } from './Logo';
8
12
  export { default as Markdown, type MarkdownProps } from './Markdown';
9
13
  export { default as MessageInput, type MessageInputProps } from './MessageInput';
14
+ export { default as MessageModal, type MessageModalProps } from './MessageModal';
10
15
  export { default as SearchBar, type SearchBarProps } from './SearchBar';
11
16
  export { default as SideNav, type SideNavProps } from './SideNav';
12
17
  export { default as Snippet, type SnippetProps } from './Snippet';
package/lib/index.js CHANGED
@@ -30,14 +30,19 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  var src_exports = {};
31
31
  __export(src_exports, {
32
32
  ActionIcon: () => import_ActionIcon.default,
33
+ Avatar: () => import_Avatar.default,
34
+ ContextMenu: () => import_ContextMenu.default,
33
35
  CopyButton: () => import_CopyButton.default,
34
36
  DraggablePanel: () => import_DraggablePanel.default,
37
+ EditableMessage: () => import_EditableMessage.default,
35
38
  EditableText: () => import_EditableText.default,
36
39
  Highlighter: () => import_Highlighter.default,
37
40
  Icon: () => import_Icon.default,
41
+ List: () => import_List.default,
38
42
  Logo: () => import_Logo.default,
39
43
  Markdown: () => import_Markdown.default,
40
44
  MessageInput: () => import_MessageInput.default,
45
+ MessageModal: () => import_MessageModal.default,
41
46
  SearchBar: () => import_SearchBar.default,
42
47
  SideNav: () => import_SideNav.default,
43
48
  Snippet: () => import_Snippet.default,
@@ -53,14 +58,19 @@ __export(src_exports, {
53
58
  });
54
59
  module.exports = __toCommonJS(src_exports);
55
60
  var import_ActionIcon = __toESM(require("./ActionIcon"));
61
+ var import_Avatar = __toESM(require("./Avatar"));
62
+ var import_ContextMenu = __toESM(require("./ContextMenu"));
56
63
  var import_CopyButton = __toESM(require("./CopyButton"));
57
64
  var import_DraggablePanel = __toESM(require("./DraggablePanel"));
65
+ var import_EditableMessage = __toESM(require("./EditableMessage"));
58
66
  var import_EditableText = __toESM(require("./EditableText"));
59
67
  var import_Highlighter = __toESM(require("./Highlighter"));
60
68
  var import_Icon = __toESM(require("./Icon"));
69
+ var import_List = __toESM(require("./List"));
61
70
  var import_Logo = __toESM(require("./Logo"));
62
71
  var import_Markdown = __toESM(require("./Markdown"));
63
72
  var import_MessageInput = __toESM(require("./MessageInput"));
73
+ var import_MessageModal = __toESM(require("./MessageModal"));
64
74
  var import_SearchBar = __toESM(require("./SearchBar"));
65
75
  var import_SideNav = __toESM(require("./SideNav"));
66
76
  var import_Snippet = __toESM(require("./Snippet"));
@@ -73,14 +83,19 @@ var import_Tooltip = __toESM(require("./Tooltip"));
73
83
  // Annotate the CommonJS export names for ESM import in node:
74
84
  0 && (module.exports = {
75
85
  ActionIcon,
86
+ Avatar,
87
+ ContextMenu,
76
88
  CopyButton,
77
89
  DraggablePanel,
90
+ EditableMessage,
78
91
  EditableText,
79
92
  Highlighter,
80
93
  Icon,
94
+ List,
81
95
  Logo,
82
96
  Markdown,
83
97
  MessageInput,
98
+ MessageModal,
84
99
  SearchBar,
85
100
  SideNav,
86
101
  Snippet,
@@ -33,7 +33,7 @@ var baseTheme = {
33
33
  borderRadiusSM: 3,
34
34
  borderRadiusLG: 8,
35
35
  controlHeight: 36,
36
- fontFamily: `'Segoe UI', SegoeUI, AliPuHui, -apple-system ,BlinkMacSystemFont,Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'`,
36
+ fontFamily: `'Segoe UI', SegoeUI, -apple-system ,BlinkMacSystemFont,Roboto,'Helvetica Neue',Arial,'Noto Sans',sans-serif,'Apple Color Emoji','Segoe UI Emoji','Segoe UI Symbol','Noto Color Emoji'`,
37
37
  fontFamilyCode: `'Hack Nerd Font Mono', 'Hack', 'Fira Code', 'Fira Mono', Menlo, Consolas, 'DejaVu Sans Mono', monospace`
38
38
  }
39
39
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building chatbot web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -65,10 +65,12 @@
65
65
  "dependencies": {
66
66
  "@ant-design/icons": "^5",
67
67
  "@babel/runtime": "^7",
68
+ "@floating-ui/react": "^0.24",
68
69
  "ahooks": "^3",
69
70
  "antd-style": "^3",
70
71
  "chroma-js": "^2",
71
72
  "copy-to-clipboard": "^3",
73
+ "dayjs": "^1",
72
74
  "leva": "^0.9.34",
73
75
  "lodash": "^4",
74
76
  "lucide-react": "latest",
@@ -78,6 +80,7 @@
78
80
  "react-layout-kit": "^1",
79
81
  "react-markdown": "^8",
80
82
  "react-rnd": "^10",
83
+ "remark-gfm": "^3.0.1",
81
84
  "shiki-es": "^0.2",
82
85
  "styled-components": "^6.0.0-rc.1",
83
86
  "use-merge-value": "^1",