@lobehub/ui 1.10.0 → 1.11.1

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 (161) hide show
  1. package/es/ActionIcon/style.js +1 -1
  2. package/es/Highlighter/style.js +1 -2
  3. package/es/Input/index.js +7 -5
  4. package/es/Input/style.js +2 -3
  5. package/es/Markdown/style.js +1 -1
  6. package/es/SearchBar/index.js +2 -1
  7. package/es/Snippet/style.js +1 -2
  8. package/es/StroyBook/style.js +1 -1
  9. package/es/ThemeProvider/index.d.ts +2 -6
  10. package/es/ThemeProvider/index.js +8 -18
  11. package/es/styles/algorithms/generateColorPalette.d.ts +11 -0
  12. package/es/styles/algorithms/generateColorPalette.js +31 -0
  13. package/es/styles/{customStylish.d.ts → algorithms/generateCustomStylish.d.ts} +1 -1
  14. package/es/styles/{customStylish.js → algorithms/generateCustomStylish.js} +1 -1
  15. package/es/styles/algorithms/generateCustomToken.d.ts +3 -0
  16. package/es/styles/algorithms/generateCustomToken.js +57 -0
  17. package/es/styles/algorithms/generateTheme.d.ts +5 -0
  18. package/es/styles/algorithms/generateTheme.js +18 -0
  19. package/es/styles/colors.d.ts +38 -0
  20. package/es/styles/colors.js +176 -0
  21. package/es/styles/index.d.ts +3 -3
  22. package/es/styles/index.js +3 -3
  23. package/es/styles/theme/base.d.ts +2 -2
  24. package/es/styles/theme/base.js +8 -14
  25. package/es/styles/theme/dark.d.ts +3 -4
  26. package/es/styles/theme/dark.js +40 -71
  27. package/es/styles/theme/light.d.ts +3 -4
  28. package/es/styles/theme/light.js +41 -32
  29. package/es/types/customToken.d.ts +1027 -0
  30. package/es/types/global.d.ts +12 -0
  31. package/es/types/index.d.ts +5 -28
  32. package/es/types/index.js +1 -0
  33. package/lib/ActionIcon/index.js +77 -79
  34. package/lib/ActionIcon/style.js +17 -61
  35. package/lib/Avatar/index.js +62 -67
  36. package/lib/Chat/const.js +6 -27
  37. package/lib/Chat/index.js +24 -28
  38. package/lib/Chat/store/index.js +46 -40
  39. package/lib/Chat/store/initialState.js +6 -27
  40. package/lib/Chat/store/messageReducer.js +51 -58
  41. package/lib/Chat/store/selectors.js +44 -46
  42. package/lib/Chat/store/store.js +242 -115
  43. package/lib/Chat/types.js +4 -16
  44. package/lib/Chat/utils/fetch.js +104 -68
  45. package/lib/ContextMenu/MenuItem/icons.js +48 -66
  46. package/lib/ContextMenu/MenuItem/index.js +73 -66
  47. package/lib/ContextMenu/MenuItem/style.js +19 -89
  48. package/lib/ContextMenu/index.js +194 -178
  49. package/lib/ContextMenu/style.js +17 -85
  50. package/lib/ContextMenu/types/index.js +15 -18
  51. package/lib/ContextMenu/types/menuItem.js +4 -16
  52. package/lib/Conversation/App.js +47 -50
  53. package/lib/Conversation/ChatList/MessageItem/Content.js +98 -93
  54. package/lib/Conversation/ChatList/MessageItem/Toolbar.js +94 -104
  55. package/lib/Conversation/ChatList/MessageItem/index.js +125 -157
  56. package/lib/Conversation/ChatList/index.js +64 -58
  57. package/lib/Conversation/InputArea/ActionBar.js +74 -92
  58. package/lib/Conversation/InputArea/index.js +103 -142
  59. package/lib/Conversation/StoreUpdater.js +28 -48
  60. package/lib/Conversation/index.js +30 -42
  61. package/lib/CopyButton/index.js +37 -62
  62. package/lib/DraggablePanel/index.js +192 -207
  63. package/lib/DraggablePanel/style.js +30 -278
  64. package/lib/DraggablePanel/utils.js +14 -35
  65. package/lib/EditableMessage/index.js +66 -89
  66. package/lib/EditableMessageList/index.js +97 -112
  67. package/lib/EditableText/index.js +36 -49
  68. package/lib/Highlighter/SyntaxHighlighter/Prism.js +43 -38
  69. package/lib/Highlighter/SyntaxHighlighter/index.js +62 -53
  70. package/lib/Highlighter/SyntaxHighlighter/style.js +18 -56
  71. package/lib/Highlighter/index.js +52 -58
  72. package/lib/Highlighter/style.js +22 -102
  73. package/lib/Icon/index.js +29 -36
  74. package/lib/Input/index.js +45 -39
  75. package/lib/Input/style.js +17 -68
  76. package/lib/List/ListItem/index.js +108 -150
  77. package/lib/List/ListItem/time.js +15 -47
  78. package/lib/List/index.js +9 -37
  79. package/lib/Logo/Divider.js +21 -34
  80. package/lib/Logo/Logo3D.js +17 -33
  81. package/lib/Logo/LogoFlat.js +108 -118
  82. package/lib/Logo/LogoHighContrast.js +30 -33
  83. package/lib/Logo/LogoText.js +21 -34
  84. package/lib/Logo/index.js +97 -59
  85. package/lib/Logo/style.js +13 -36
  86. package/lib/Markdown/Code.js +16 -30
  87. package/lib/Markdown/CodeBlock.js +33 -65
  88. package/lib/Markdown/index.js +35 -54
  89. package/lib/Markdown/style.js +15 -125
  90. package/lib/MessageInput/index.js +60 -56
  91. package/lib/MessageModal/index.js +80 -91
  92. package/lib/SearchBar/index.js +86 -72
  93. package/lib/SearchBar/style.js +18 -46
  94. package/lib/SideNav/index.js +43 -31
  95. package/lib/SideNav/style.js +13 -43
  96. package/lib/Snippet/index.js +42 -45
  97. package/lib/Snippet/style.js +13 -72
  98. package/lib/StroyBook/index.js +60 -61
  99. package/lib/StroyBook/style.js +19 -87
  100. package/lib/Swatches/index.js +35 -53
  101. package/lib/TabsNav/index.js +23 -31
  102. package/lib/TabsNav/style.js +17 -60
  103. package/lib/ThemeProvider/GlobalStyle.js +29 -92
  104. package/lib/ThemeProvider/index.d.ts +2 -6
  105. package/lib/ThemeProvider/index.js +44 -69
  106. package/lib/ThemeSwitch/index.js +62 -46
  107. package/lib/Tooltip/index.js +26 -31
  108. package/lib/Tooltip/style.js +13 -49
  109. package/lib/components/ControlInput.js +86 -87
  110. package/lib/hooks/useCopied.js +27 -37
  111. package/lib/hooks/useHighlight.js +65 -70
  112. package/lib/index.js +211 -120
  113. package/lib/styles/algorithms/generateColorPalette.d.ts +11 -0
  114. package/lib/styles/algorithms/generateColorPalette.js +40 -0
  115. package/lib/styles/{customStylish.d.ts → algorithms/generateCustomStylish.d.ts} +1 -1
  116. package/lib/styles/algorithms/generateCustomStylish.js +27 -0
  117. package/lib/styles/algorithms/generateCustomToken.d.ts +3 -0
  118. package/lib/styles/algorithms/generateCustomToken.js +65 -0
  119. package/lib/styles/algorithms/generateTheme.d.ts +5 -0
  120. package/lib/styles/algorithms/generateTheme.js +28 -0
  121. package/lib/styles/colors.d.ts +38 -0
  122. package/lib/styles/colors.js +183 -0
  123. package/lib/styles/index.d.ts +3 -3
  124. package/lib/styles/index.js +25 -20
  125. package/lib/styles/theme/base.d.ts +2 -2
  126. package/lib/styles/theme/base.js +17 -44
  127. package/lib/styles/theme/dark.d.ts +3 -4
  128. package/lib/styles/theme/dark.js +45 -119
  129. package/lib/styles/theme/light.d.ts +3 -4
  130. package/lib/styles/theme/light.js +47 -61
  131. package/lib/types/customToken.d.ts +1027 -0
  132. package/lib/types/global.d.ts +12 -0
  133. package/lib/types/index.d.ts +5 -28
  134. package/lib/types/index.js +5 -0
  135. package/lib/utils/colorUtils.js +14 -48
  136. package/package.json +1 -1
  137. package/es/styles/algorithms/colorRelationship.d.ts +0 -6
  138. package/es/styles/algorithms/colorRelationship.js +0 -88
  139. package/es/styles/algorithms/index.d.ts +0 -15
  140. package/es/styles/algorithms/index.js +0 -66
  141. package/es/styles/algorithms/paletteGenerator.d.ts +0 -51
  142. package/es/styles/algorithms/paletteGenerator.js +0 -74
  143. package/es/styles/antdTheme.d.ts +0 -2
  144. package/es/styles/antdTheme.js +0 -4
  145. package/es/styles/customToken.d.ts +0 -65
  146. package/es/styles/customToken.js +0 -24
  147. package/es/styles/theme/index.d.ts +0 -2
  148. package/es/styles/theme/index.js +0 -2
  149. package/lib/styles/algorithms/colorRelationship.d.ts +0 -6
  150. package/lib/styles/algorithms/colorRelationship.js +0 -87
  151. package/lib/styles/algorithms/index.d.ts +0 -15
  152. package/lib/styles/algorithms/index.js +0 -81
  153. package/lib/styles/algorithms/paletteGenerator.d.ts +0 -51
  154. package/lib/styles/algorithms/paletteGenerator.js +0 -91
  155. package/lib/styles/antdTheme.d.ts +0 -2
  156. package/lib/styles/antdTheme.js +0 -30
  157. package/lib/styles/customStylish.js +0 -118
  158. package/lib/styles/customToken.d.ts +0 -65
  159. package/lib/styles/customToken.js +0 -54
  160. package/lib/styles/theme/index.d.ts +0 -2
  161. package/lib/styles/theme/index.js +0 -32
@@ -1,130 +1,20 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/Markdown/style.ts
20
- var style_exports = {};
21
- __export(style_exports, {
22
- useStyles: () => useStyles
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(style_exports);
25
- var import_antd_style = require("antd-style");
26
- var useStyles = (0, import_antd_style.createStyles)(({ css, token, isDarkMode }) => {
7
+ exports.useStyles = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _antdStyle = require("antd-style");
10
+ var _templateObject, _templateObject2;
11
+ var useStyles = (0, _antdStyle.createStyles)(function (_ref) {
12
+ var css = _ref.css,
13
+ token = _ref.token,
14
+ isDarkMode = _ref.isDarkMode;
27
15
  return {
28
- container: css`
29
- color: ${isDarkMode ? token.colorTextSecondary : token.colorText};
30
-
31
- p {
32
- margin: 20px auto;
33
-
34
- font-size: 14px;
35
- line-height: 1.8;
36
- color: ${token.colorText};
37
- text-align: justify;
38
- word-wrap: break-word;
39
- }
40
-
41
- blockquote {
42
- margin: 16px 0;
43
- padding: 0 12px;
44
- p {
45
- font-style: italic;
46
- color: ${token.colorTextDescription};
47
- }
48
- }
49
-
50
- p:not(:last-child) {
51
- margin-bottom: 1em;
52
- }
53
-
54
- a {
55
- color: ${token.colorLink};
56
-
57
- &:hover {
58
- color: ${token.colorLinkHover};
59
- }
60
-
61
- &:active {
62
- color: ${token.colorLinkActive};
63
- }
64
- }
65
-
66
- img {
67
- max-width: 100%;
68
- }
69
-
70
- > :not([data-code-type='highlighter']) code {
71
- padding: 2px 6px;
72
- color: ${isDarkMode ? token["cyan-7"] : token.colorPrimaryText};
73
- background: ${isDarkMode ? token["cyan-1"] : token.colorPrimaryBg};
74
- border-radius: 4px;
75
- }
76
-
77
- table {
78
- border-spacing: 0;
79
-
80
- width: 100%;
81
- margin-block-start: 1em;
82
- margin-block-end: 1em;
83
- margin-inline-start: 0px;
84
- margin-inline-end: 0px;
85
- padding: 8px;
86
-
87
- border: 1px solid ${token.colorBorder};
88
- border-radius: ${token.borderRadius}px;
89
- }
90
-
91
- th,
92
- td {
93
- padding-block-start: 10px;
94
- padding-block-end: 10px;
95
- padding-inline-start: 16px;
96
- padding-inline-end: 16px;
97
- }
98
-
99
- thead {
100
- tr {
101
- th {
102
- background: ${token.colorFillTertiary};
103
- &:first-child {
104
- border-top-left-radius: ${token.borderRadius}px;
105
- border-bottom-left-radius: ${token.borderRadius}px;
106
- }
107
- &:last-child {
108
- border-top-right-radius: ${token.borderRadius}px;
109
- border-bottom-right-radius: ${token.borderRadius}px;
110
- }
111
- }
112
- }
113
- }
114
-
115
- ul li {
116
- line-height: 1.8;
117
- }
118
- `,
119
- code: css`
120
- padding: 2px 4px;
121
- font-family: ${token.fontFamilyCode} !important;
122
- color: ${isDarkMode ? token.cyan8 : token.pink7};
123
- border-radius: 4px;
124
- `
16
+ container: css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n color: ", ";\n\n p {\n margin: 20px auto;\n\n font-size: 14px;\n line-height: 1.8;\n color: ", ";\n text-align: justify;\n word-wrap: break-word;\n }\n\n blockquote {\n margin: 16px 0;\n padding: 0 12px;\n p {\n font-style: italic;\n color: ", ";\n }\n }\n\n p:not(:last-child) {\n margin-bottom: 1em;\n }\n\n a {\n color: ", ";\n\n &:hover {\n color: ", ";\n }\n\n &:active {\n color: ", ";\n }\n }\n\n img {\n max-width: 100%;\n }\n\n > :not([data-code-type='highlighter']) code {\n padding: 2px 6px;\n color: ", ";\n background: ", ";\n border-radius: 4px;\n }\n\n table {\n border-spacing: 0;\n\n width: 100%;\n margin-block-start: 1em;\n margin-block-end: 1em;\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding: 8px;\n\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n th,\n td {\n padding-block-start: 10px;\n padding-block-end: 10px;\n padding-inline-start: 16px;\n padding-inline-end: 16px;\n }\n\n thead {\n tr {\n th {\n background: ", ";\n &:first-child {\n border-top-left-radius: ", "px;\n border-bottom-left-radius: ", "px;\n }\n &:last-child {\n border-top-right-radius: ", "px;\n border-bottom-right-radius: ", "px;\n }\n }\n }\n }\n\n ul li {\n line-height: 1.8;\n }\n\n pre {\n border-radius: ", "px;\n }\n "])), isDarkMode ? token.colorTextSecondary : token.colorText, token.colorText, token.colorTextDescription, token.colorLink, token.colorLinkHover, token.colorLinkActive, isDarkMode ? token['cyan-7'] : token.colorPrimaryText, isDarkMode ? token['cyan-1'] : token.colorPrimaryBg, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius, token.borderRadius),
17
+ code: css(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n padding: 2px 4px;\n font-family: ", " !important;\n color: ", ";\n border-radius: 4px;\n "])), token.fontFamilyCode, isDarkMode ? token.cyan8 : token.pink7)
125
18
  };
126
19
  });
127
- // Annotate the CommonJS export names for ESM import in node:
128
- 0 && (module.exports = {
129
- useStyles
130
- });
20
+ exports.useStyles = useStyles;
@@ -1,59 +1,63 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/MessageInput/index.tsx
20
- var MessageInput_exports = {};
21
- __export(MessageInput_exports, {
22
- default: () => MessageInput_default
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(MessageInput_exports);
25
- var import__ = require("../index");
26
- var import_antd = require("antd");
27
- var import_antd_style = require("antd-style");
28
- var import_react = require("react");
29
- var import_react_layout_kit = require("react-layout-kit");
30
- var MessageInput = (0, import_react.memo)(
31
- ({ type, onCancel, defaultValue, onConfirm, renderButtons, height, className }) => {
32
- const [tempSystemRole, setRole] = (0, import_react.useState)(defaultValue || "");
33
- return /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { gap: 8 }, /* @__PURE__ */ React.createElement(
34
- import__.TextArea,
35
- {
36
- type,
37
- value: tempSystemRole,
38
- placeholder: "例如:你是一名擅长翻译的翻译官,请将用户所输入的英文都翻译为中文。",
39
- style: { height: height ?? 200 },
40
- onChange: (e) => {
41
- setRole(e.target.value);
42
- },
43
- className: (0, import_antd_style.cx)("nowheel", className)
44
- }
45
- ), /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { direction: "horizontal-reverse", gap: 8 }, renderButtons ? renderButtons(tempSystemRole).map((buttonProps, index) => /* @__PURE__ */ React.createElement(import_antd.Button, { key: index, ...buttonProps })) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(
46
- import_antd.Button,
47
- {
48
- type: "primary",
49
- onClick: () => {
50
- onConfirm == null ? void 0 : onConfirm(tempSystemRole);
51
- }
7
+ exports.default = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _ = require("./..");
11
+ var _antd = require("antd");
12
+ var _antdStyle = require("antd-style");
13
+ var _react = require("react");
14
+ var _reactLayoutKit = require("react-layout-kit");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ var MessageInput = /*#__PURE__*/(0, _react.memo)(function (_ref) {
17
+ var type = _ref.type,
18
+ onCancel = _ref.onCancel,
19
+ defaultValue = _ref.defaultValue,
20
+ onConfirm = _ref.onConfirm,
21
+ renderButtons = _ref.renderButtons,
22
+ height = _ref.height,
23
+ className = _ref.className;
24
+ var _useState = (0, _react.useState)(defaultValue || ''),
25
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
26
+ tempSystemRole = _useState2[0],
27
+ setRole = _useState2[1];
28
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactLayoutKit.Flexbox, {
29
+ gap: 8,
30
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.TextArea, {
31
+ type: type,
32
+ value: tempSystemRole,
33
+ placeholder: '例如:你是一名擅长翻译的翻译官,请将用户所输入的英文都翻译为中文。',
34
+ style: {
35
+ height: height !== null && height !== void 0 ? height : 200
52
36
  },
53
- "Confirm"
54
- ), /* @__PURE__ */ React.createElement(import_antd.Button, { type: "text", onClick: onCancel }, "Cancel"))));
55
- }
56
- );
57
- var MessageInput_default = MessageInput;
58
- // Annotate the CommonJS export names for ESM import in node:
59
- 0 && (module.exports = {});
37
+ onChange: function onChange(e) {
38
+ setRole(e.target.value);
39
+ },
40
+ className: (0, _antdStyle.cx)('nowheel', className)
41
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactLayoutKit.Flexbox, {
42
+ direction: 'horizontal-reverse',
43
+ gap: 8,
44
+ children: renderButtons ? renderButtons(tempSystemRole).map(function (buttonProps, index) {
45
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, (0, _objectSpread2.default)({}, buttonProps), index);
46
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
47
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
48
+ type: "primary",
49
+ onClick: function onClick() {
50
+ onConfirm === null || onConfirm === void 0 ? void 0 : onConfirm(tempSystemRole);
51
+ },
52
+ children: "Confirm"
53
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Button, {
54
+ type: "text",
55
+ onClick: onCancel,
56
+ children: "Cancel"
57
+ })]
58
+ })
59
+ })]
60
+ });
61
+ });
62
+ var _default = MessageInput;
63
+ exports.default = _default;
@@ -1,98 +1,87 @@
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);
1
+ "use strict";
28
2
 
29
- // src/MessageModal/index.tsx
30
- var MessageModal_exports = {};
31
- __export(MessageModal_exports, {
32
- default: () => MessageModal_default
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
33
6
  });
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, {
7
+ exports.default = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
10
+ var _icons = require("@ant-design/icons");
11
+ var _antd = require("antd");
12
+ var _antdStyle = require("antd-style");
13
+ var _react = require("react");
14
+ var _reactLayoutKit = require("react-layout-kit");
15
+ var _useMergeValue = _interopRequireDefault(require("use-merge-value"));
16
+ var _Markdown = _interopRequireDefault(require("../Markdown"));
17
+ var _MessageInput = _interopRequireDefault(require("../MessageInput"));
18
+ var _jsxRuntime = require("react/jsx-runtime");
19
+ var _templateObject, _templateObject2;
20
+ var useStyles = (0, _antdStyle.createStyles)(function (_ref) {
21
+ var css = _ref.css,
22
+ prefixCls = _ref.prefixCls;
23
+ return {
24
+ modal: css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n height: 70%;\n .", "-modal-header {\n margin-bottom: 24px;\n }\n "])), prefixCls),
25
+ body: css(_templateObject2 || (_templateObject2 = (0, _taggedTemplateLiteral2.default)(["\n overflow-y: scroll;\n max-height: 70vh;\n "])))
26
+ };
27
+ });
28
+ var MessageModal = /*#__PURE__*/(0, _react.memo)(function (_ref2) {
29
+ var editing = _ref2.editing,
30
+ open = _ref2.open,
31
+ onOpenChange = _ref2.onOpenChange,
32
+ onEditingChange = _ref2.onEditingChange,
33
+ value = _ref2.value,
34
+ onChange = _ref2.onChange;
35
+ var _useStyles = useStyles(),
36
+ styles = _useStyles.styles;
37
+ var _useControlledState = (0, _useMergeValue.default)(false, {
59
38
  value: editing,
60
39
  onChange: onEditingChange
61
- });
62
- const [expand, setExpand] = (0, import_use_merge_value.default)(false, {
40
+ }),
41
+ _useControlledState2 = (0, _slicedToArray2.default)(_useControlledState, 2),
42
+ isEdit = _useControlledState2[0],
43
+ setTyping = _useControlledState2[1];
44
+ var _useControlledState3 = (0, _useMergeValue.default)(false, {
63
45
  value: open,
64
46
  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
47
+ }),
48
+ _useControlledState4 = (0, _slicedToArray2.default)(_useControlledState3, 2),
49
+ expand = _useControlledState4[0],
50
+ setExpand = _useControlledState4[1];
51
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Modal, {
52
+ open: expand,
53
+ width: 800,
54
+ onCancel: function onCancel() {
55
+ return setExpand(false);
56
+ },
57
+ okText: '编辑',
58
+ onOk: function onOk() {
59
+ setTyping(true);
60
+ },
61
+ footer: isEdit ? null : undefined,
62
+ cancelText: '关闭',
63
+ title: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_reactLayoutKit.Flexbox, {
64
+ horizontal: true,
65
+ align: 'center',
66
+ gap: 4,
67
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_icons.AimOutlined, {}), "\u63D0\u793A\u8BCD"]
68
+ }),
69
+ className: styles.modal,
70
+ children: isEdit ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_MessageInput.default, {
71
+ onConfirm: function onConfirm(text) {
72
+ setTyping(false);
73
+ onChange === null || onChange === void 0 ? void 0 : onChange(text);
74
+ },
75
+ onCancel: function onCancel() {
76
+ return setTyping(false);
80
77
  },
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 = {});
78
+ defaultValue: value,
79
+ height: 400
80
+ }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_Markdown.default, {
81
+ className: styles.body,
82
+ children: value
83
+ })
84
+ });
85
+ });
86
+ var _default = MessageModal;
87
+ exports.default = _default;
@@ -1,76 +1,90 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/SearchBar/index.tsx
20
- var SearchBar_exports = {};
21
- __export(SearchBar_exports, {
22
- default: () => SearchBar_default
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(SearchBar_exports);
25
- var import__ = require("../index");
26
- var import_antd = require("antd");
27
- var import_lucide_react = require("lucide-react");
28
- var import_react = require("react");
29
- var import_style = require("./style");
30
- var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(
31
- typeof navigator !== "undefined" ? navigator == null ? void 0 : navigator.platform : ""
32
- );
33
- var symbol = isAppleDevice ? "" : "Ctrl";
34
- var SearchBar = (0, import_react.memo)(
35
- ({ className, value, onChange, placeholder, enableShortKey, shortKey = "f", ...props }) => {
36
- const [showTag, setShowTag] = (0, import_react.useState)(true);
37
- const [inputValue, setInputValue] = (0, import_react.useState)(value);
38
- const { styles, cx } = (0, import_style.useStyles)();
39
- const inputRef = (0, import_react.useRef)(null);
40
- (0, import_react.useEffect)(() => {
41
- if (!enableShortKey)
42
- return;
43
- const handler = (ev) => {
44
- if ((isAppleDevice ? ev.metaKey : ev.ctrlKey) && ev.key === shortKey) {
45
- ev.preventDefault();
46
- inputRef.current.focus();
7
+ exports.default = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _ = require("./..");
12
+ var _antd = require("antd");
13
+ var _lucideReact = require("lucide-react");
14
+ var _react = require("react");
15
+ var _style = require("./style");
16
+ var _jsxRuntime = require("react/jsx-runtime");
17
+ var _excluded = ["className", "value", "onChange", "placeholder", "enableShortKey", "shortKey"];
18
+ var _navigator;
19
+ var isAppleDevice = /(mac|iphone|ipod|ipad)/i.test(typeof navigator !== 'undefined' ? (_navigator = navigator) === null || _navigator === void 0 ? void 0 : _navigator.platform : '');
20
+ var symbol = isAppleDevice ? '⌘' : 'Ctrl';
21
+ var SearchBar = /*#__PURE__*/(0, _react.memo)(function (_ref) {
22
+ var className = _ref.className,
23
+ value = _ref.value,
24
+ _onChange = _ref.onChange,
25
+ placeholder = _ref.placeholder,
26
+ enableShortKey = _ref.enableShortKey,
27
+ _ref$shortKey = _ref.shortKey,
28
+ shortKey = _ref$shortKey === void 0 ? 'f' : _ref$shortKey,
29
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
30
+ var _useState = (0, _react.useState)(true),
31
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
32
+ showTag = _useState2[0],
33
+ setShowTag = _useState2[1];
34
+ var _useState3 = (0, _react.useState)(value),
35
+ _useState4 = (0, _slicedToArray2.default)(_useState3, 2),
36
+ inputValue = _useState4[0],
37
+ setInputValue = _useState4[1];
38
+ var _useStyles = (0, _style.useStyles)(),
39
+ styles = _useStyles.styles,
40
+ cx = _useStyles.cx;
41
+ var inputRef = (0, _react.useRef)(null);
42
+ (0, _react.useEffect)(function () {
43
+ if (!enableShortKey) return;
44
+ var handler = function handler(ev) {
45
+ if ((isAppleDevice ? ev.metaKey : ev.ctrlKey) && ev.key === shortKey) {
46
+ var _inputRef$current;
47
+ ev.preventDefault();
48
+ (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.focus();
49
+ }
50
+ };
51
+ document.addEventListener('keydown', handler);
52
+ return function () {
53
+ return document.removeEventListener('keydown', handler);
54
+ };
55
+ }, []);
56
+ return /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
57
+ className: styles.search,
58
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.Input, (0, _objectSpread2.default)({
59
+ ref: inputRef,
60
+ className: cx(styles.input, className),
61
+ prefix: /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Icon, {
62
+ className: styles.icon,
63
+ icon: _lucideReact.Search,
64
+ size: "small",
65
+ style: {
66
+ marginRight: 4
47
67
  }
48
- };
49
- document.addEventListener("keydown", handler);
50
- return () => document.removeEventListener("keydown", handler);
51
- }, []);
52
- return /* @__PURE__ */ React.createElement("div", { className: styles.search }, /* @__PURE__ */ React.createElement(
53
- import__.Input,
54
- {
55
- ref: inputRef,
56
- className: cx(styles.input, className),
57
- prefix: /* @__PURE__ */ React.createElement(import__.Icon, { className: styles.icon, icon: import_lucide_react.Search, size: "small", style: { marginRight: 4 } }),
58
- allowClear: true,
59
- value,
60
- placeholder: placeholder ?? "Type keywords...",
61
- onChange: (e) => {
62
- setInputValue(e.target.value);
63
- setShowTag(e.target.value ? false : true);
64
- if (onChange)
65
- onChange(e);
66
- },
67
- onFocus: () => setShowTag(false),
68
- onBlur: () => setShowTag(true),
69
- ...props
68
+ }),
69
+ allowClear: true,
70
+ value: value,
71
+ placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Type keywords...',
72
+ onChange: function onChange(e) {
73
+ setInputValue(e.target.value);
74
+ setShowTag(e.target.value ? false : true);
75
+ if (_onChange) _onChange(e);
76
+ },
77
+ onFocus: function onFocus() {
78
+ return setShowTag(false);
79
+ },
80
+ onBlur: function onBlur() {
81
+ return setShowTag(true);
70
82
  }
71
- ), enableShortKey && showTag && !inputValue && /* @__PURE__ */ React.createElement(import_antd.Tag, { className: styles.tag }, symbol, " ", shortKey.toUpperCase()));
72
- }
73
- );
74
- var SearchBar_default = SearchBar;
75
- // Annotate the CommonJS export names for ESM import in node:
76
- 0 && (module.exports = {});
83
+ }, props)), enableShortKey && showTag && !inputValue && /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Tag, {
84
+ className: styles.tag,
85
+ children: [symbol, " ", shortKey.toUpperCase()]
86
+ })]
87
+ });
88
+ });
89
+ var _default = SearchBar;
90
+ exports.default = _default;