@lobehub/ui 1.164.10 → 1.164.12

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.
@@ -9,8 +9,8 @@ export var useStyles = createStyles(function (_ref) {
9
9
  stylish = _ref.stylish;
10
10
  var prefix = "".concat(prefixCls, "-highlighter");
11
11
  return {
12
- loading: cx(stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n inset-block-start: 0;\n inset-inline-end: 0;\n\n height: 34px;\n padding-block: 0;\n padding-inline: 8px;\n\n font-family: ", ";\n color: ", ";\n\n border-radius: ", ";\n "])), token.fontFamilyCode, token.colorTextTertiary, token.borderRadius)),
13
- shiki: cx("".concat(prefix, "-shiki"), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n margin: 0;\n padding: 0;\n\n .shiki {\n overflow-x: auto;\n margin: 0;\n padding: 0;\n background: none !important;\n\n code {\n display: block;\n\n .line {\n display: inline-block;\n\n width: calc(100% + 32px);\n margin-block: 0;\n margin-inline: -16px;\n padding-block: 0;\n padding-inline: 16px;\n }\n }\n\n &.has-focused {\n .line:not(.focused) {\n opacity: 0.5;\n }\n }\n\n .highlighted {\n background: ", ";\n\n &.warning {\n background: ", ";\n }\n\n &.error {\n background: ", ";\n }\n }\n\n .highlighted-word {\n padding-block: 0.1em;\n padding-inline: 0.2em;\n\n background: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n }\n\n .diff {\n &.remove {\n background: ", ";\n\n &::before {\n content: '-';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n\n &.add {\n background: ", ";\n\n &::before {\n content: '+';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n }\n }\n "])), token.colorFillTertiary, token.colorWarningBg, token.colorErrorBg, token.colorFillTertiary, token.colorBorderSecondary, token.borderRadius, token.colorErrorBg, token.colorErrorText, token.colorSuccessBg, token.colorSuccessText)),
12
+ loading: cx(stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 10;\n inset-block-start: 0;\n inset-inline-end: 0;\n\n height: 34px;\n padding-block: 0;\n padding-inline: 8px;\n border-radius: ", ";\n\n font-family: ", ";\n color: ", ";\n "])), token.borderRadius, token.fontFamilyCode, token.colorTextTertiary)),
13
+ shiki: cx("".concat(prefix, "-shiki"), css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n direction: ltr;\n margin: 0;\n padding: 0;\n text-align: start;\n\n .shiki {\n overflow-x: auto;\n margin: 0;\n padding: 0;\n background: none !important;\n\n code {\n display: block;\n\n .line {\n display: inline-block;\n\n width: calc(100% + 32px);\n margin-block: 0;\n margin-inline: -16px;\n padding-block: 0;\n padding-inline: 16px;\n }\n }\n\n &.has-focused {\n .line:not(.focused) {\n opacity: 0.5;\n }\n }\n\n .highlighted {\n background: ", ";\n\n &.warning {\n background: ", ";\n }\n\n &.error {\n background: ", ";\n }\n }\n\n .highlighted-word {\n padding-block: 0.1em;\n padding-inline: 0.2em;\n border: 1px solid ", ";\n border-radius: ", "px;\n\n background: ", ";\n }\n\n .diff {\n &.remove {\n background: ", ";\n\n &::before {\n content: '-';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n\n &.add {\n background: ", ";\n\n &::before {\n content: '+';\n\n position: absolute;\n inset-inline-start: 4px;\n\n display: inline-block;\n\n color: ", ";\n }\n }\n }\n }\n "])), token.colorFillTertiary, token.colorWarningBg, token.colorErrorBg, token.colorBorderSecondary, token.borderRadius, token.colorFillTertiary, token.colorErrorBg, token.colorErrorText, token.colorSuccessBg, token.colorSuccessText)),
14
14
  unshiki: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorTextDescription)
15
15
  };
16
16
  });
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
3
  function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
4
- var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "aboveMessage", "belowMessage", "markdownProps"];
4
+ var _excluded = ["avatarAddon", "onAvatarClick", "avatarProps", "actions", "className", "primary", "loading", "message", "placeholderMessage", "placement", "type", "avatar", "error", "showTitle", "time", "editing", "onChange", "onEditingChange", "messageExtra", "renderMessage", "text", "errorMessage", "onDoubleClick", "fontSize", "aboveMessage", "belowMessage", "markdownProps"];
5
5
  function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
6
6
  function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
7
7
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
@@ -20,6 +20,7 @@ import MessageContent from "./components/MessageContent";
20
20
  import Title from "./components/Title";
21
21
  import { useStyles } from "./style";
22
22
  import { jsx as _jsx } from "react/jsx-runtime";
23
+ import { Fragment as _Fragment } from "react/jsx-runtime";
23
24
  import { jsxs as _jsxs } from "react/jsx-runtime";
24
25
  var MOBILE_AVATAR_SIZE = 32;
25
26
  var ChatItem = /*#__PURE__*/memo(function (_ref) {
@@ -31,6 +32,8 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
31
32
  primary = _ref.primary,
32
33
  loading = _ref.loading,
33
34
  message = _ref.message,
35
+ _ref$placeholderMessa = _ref.placeholderMessage,
36
+ placeholderMessage = _ref$placeholderMessa === void 0 ? '...' : _ref$placeholderMessa,
34
37
  _ref$placement = _ref.placement,
35
38
  placement = _ref$placement === void 0 ? 'left' : _ref$placement,
36
39
  _ref$type = _ref.type,
@@ -91,24 +94,32 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
91
94
  className: styles.messageContent,
92
95
  direction: type === 'block' ? placement === 'left' ? 'horizontal' : 'horizontal-reverse' : 'vertical',
93
96
  gap: 8,
94
- children: [error ? /*#__PURE__*/_jsx(ErrorContent, {
95
- error: error,
96
- message: errorMessage,
97
- placement: placement
98
- }) : /*#__PURE__*/_jsx(MessageContent, {
99
- editing: editing,
100
- fontSize: fontSize,
101
- markdownProps: markdownProps,
102
- message: message,
103
- messageExtra: messageExtra,
104
- onChange: onChange,
105
- onDoubleClick: onDoubleClick,
106
- onEditingChange: onEditingChange,
107
- placement: placement,
108
- primary: primary,
109
- renderMessage: renderMessage,
110
- text: text,
111
- type: type
97
+ children: [/*#__PURE__*/_jsx(Flexbox, {
98
+ children: error && (message === placeholderMessage || !message) ? /*#__PURE__*/_jsx(ErrorContent, {
99
+ error: error,
100
+ message: errorMessage,
101
+ placement: placement
102
+ }) : /*#__PURE__*/_jsx(MessageContent, {
103
+ editing: editing,
104
+ fontSize: fontSize,
105
+ markdownProps: markdownProps,
106
+ message: message,
107
+ messageExtra: /*#__PURE__*/_jsxs(_Fragment, {
108
+ children: [error && /*#__PURE__*/_jsx(ErrorContent, {
109
+ error: error,
110
+ message: errorMessage,
111
+ placement: placement
112
+ }), messageExtra]
113
+ }),
114
+ onChange: onChange,
115
+ onDoubleClick: onDoubleClick,
116
+ onEditingChange: onEditingChange,
117
+ placement: placement,
118
+ primary: primary,
119
+ renderMessage: renderMessage,
120
+ text: text,
121
+ type: type
122
+ })
112
123
  }), /*#__PURE__*/_jsx(Actions, {
113
124
  actions: actions,
114
125
  editing: editing,
@@ -50,6 +50,10 @@ export interface ChatItemProps extends Omit<FlexboxProps, 'children' | 'onChange
50
50
  * @param editing - The new editing mode
51
51
  */
52
52
  onEditingChange?: (editing: boolean) => void;
53
+ /**
54
+ * @default "..."
55
+ */
56
+ placeholderMessage?: string;
53
57
  /**
54
58
  * @description The placement of the chat item
55
59
  * @default 'left'
@@ -1,3 +1,3 @@
1
1
  export declare const FALLBACK_LANG = "txt";
2
- export declare const useHighlight: (text: string, lang: string, enableTransformer?: boolean) => import("swr/dist/_internal").SWRResponse<string, any, any>;
2
+ export declare const useHighlight: (text: string, lang: string, enableTransformer?: boolean) => import("swr/dist/_internal/types").SWRResponse<string, any, any>;
3
3
  export { default as languageMap } from './languageMap';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.164.10",
3
+ "version": "1.164.12",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",