@lobehub/ui 1.168.6 → 1.168.8

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,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const RightClickIcon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
3
- export default RightClickIcon;
2
+ declare const Icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
3
+ export default Icon;
@@ -1,9 +1,10 @@
1
1
  import { createLucideIcon } from 'lucide-react';
2
- var RightClickIcon = createLucideIcon('right-click', [['path', {
2
+ import { KeyMap } from "../type";
3
+ var Icon = createLucideIcon(KeyMap.LeftClick, [['path', {
3
4
  d: 'M19 10a7 7 0 10-14 0v4a7 7 0 1014 0v-4zM2 9.333C2 6.36 3.491 3.71 5.814 2',
4
5
  key: '1'
5
6
  }], ['path', {
6
7
  d: 'M12 4v7H6',
7
8
  key: '2'
8
9
  }]]);
9
- export default RightClickIcon;
10
+ export default Icon;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
3
+ export default Icon;
@@ -0,0 +1,7 @@
1
+ import { createLucideIcon } from 'lucide-react';
2
+ import { KeyMap } from "../type";
3
+ var Icon = createLucideIcon(KeyMap.LeftDoubleClick, [['path', {
4
+ d: 'M19 10v4a7 7 0 11-14 0v-3m0 0v-1a7 7 0 017-7v8H5zM2 9.333C2 6.36 3.491 3.71 5.814 2M20.5 2h1.25c.69 0 1.25.56 1.25 1.25v0c0 .69-.56 1.25-1.25 1.25v0c-.69 0-1.25.56-1.25 1.25V7H23M15 4l3 3M18 4l-3 3',
5
+ key: '1'
6
+ }]]);
7
+ export default Icon;
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- declare const RightClickIcon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
3
- export default RightClickIcon;
2
+ declare const Icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
3
+ export default Icon;
@@ -1,9 +1,10 @@
1
1
  import { createLucideIcon } from 'lucide-react';
2
- var RightClickIcon = createLucideIcon('right-click', [['path', {
2
+ import { KeyMap } from "../type";
3
+ var Icon = createLucideIcon(KeyMap.RightClick, [['path', {
3
4
  d: 'M19 10a7 7 0 10-14 0v4a7 7 0 1014 0v-4zM22 9.333C22 6.36 20.509 3.71 18.186 2',
4
5
  key: '1'
5
6
  }], ['path', {
6
7
  d: 'M12 4v7h6',
7
8
  key: '2'
8
9
  }]]);
9
- export default RightClickIcon;
10
+ export default Icon;
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ declare const Icon: import("react").ForwardRefExoticComponent<Omit<import("lucide-react").LucideProps, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
3
+ export default Icon;
@@ -0,0 +1,10 @@
1
+ import { createLucideIcon } from 'lucide-react';
2
+ import { KeyMap } from "../type";
3
+ var Icon = createLucideIcon(KeyMap.RightDoubleClick, [['path', {
4
+ d: 'M12 3a7 7 0 017 7v4a7 7 0 11-14 0v-4',
5
+ key: '1'
6
+ }], ['path', {
7
+ d: 'M12 3v8h6.5M22 9.333C22 6.36 20.509 3.71 18.186 2M6.5 2h1.25C8.44 2 9 2.56 9 3.25v0c0 .69-.56 1.25-1.25 1.25v0c-.69 0-1.25.56-1.25 1.25V7H9M1 4l3 3M4 4L1 7',
8
+ key: '2'
9
+ }]]);
10
+ export default Icon;
@@ -20,7 +20,9 @@ import { memo, useEffect, useMemo, useState } from 'react';
20
20
  import { Flexbox } from 'react-layout-kit';
21
21
  import Icon from "../Icon";
22
22
  import LeftClickIcon from "./components/LeftClickIcon";
23
+ import LeftDoubleClickIcon from "./components/LeftDoubleClickIcon";
23
24
  import RightClickIcon from "./components/RightClickIcon";
25
+ import RightDoubleClickIcon from "./components/RightDoubleClickIcon";
24
26
  import { useStyles } from "./style";
25
27
  import { KeyMap } from "./type";
26
28
  import { checkIsAppleDevice, splitKeysByPlus, startCase } from "./utils";
@@ -40,7 +42,7 @@ var mappingKey = function mappingKey(isAppleDevice) {
40
42
  }) : 'Enter'), KeyMap.LeftClick, /*#__PURE__*/_jsx(Icon, {
41
43
  icon: LeftClickIcon,
42
44
  size: {
43
- fontSize: '1.15em',
45
+ fontSize: '1.2em',
44
46
  strokeWidth: 1.75
45
47
  }
46
48
  })), KeyMap.Left, /*#__PURE__*/_jsx(Icon, {
@@ -52,15 +54,27 @@ var mappingKey = function mappingKey(isAppleDevice) {
52
54
  })), KeyMap.MiddleClick, /*#__PURE__*/_jsx(Icon, {
53
55
  icon: MouseIcon,
54
56
  size: {
55
- fontSize: '1.15em',
57
+ fontSize: '1.2em',
56
58
  strokeWidth: 1.75
57
59
  }
58
60
  })), KeyMap.Mod, isAppleDevice ? /*#__PURE__*/_jsx(Icon, {
59
61
  icon: Command
60
- }) : 'Ctrl'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, KeyMap.RightClick, /*#__PURE__*/_jsx(Icon, {
62
+ }) : 'Ctrl'), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_ref, KeyMap.RightClick, /*#__PURE__*/_jsx(Icon, {
61
63
  icon: RightClickIcon,
62
64
  size: {
63
- fontSize: '1.15em',
65
+ fontSize: '1.2em',
66
+ strokeWidth: 1.75
67
+ }
68
+ })), KeyMap.RightDoubleClick, /*#__PURE__*/_jsx(Icon, {
69
+ icon: RightDoubleClickIcon,
70
+ size: {
71
+ fontSize: '1.2em',
72
+ strokeWidth: 1.75
73
+ }
74
+ })), KeyMap.LeftDoubleClick, /*#__PURE__*/_jsx(Icon, {
75
+ icon: LeftDoubleClickIcon,
76
+ size: {
77
+ fontSize: '1.2em',
64
78
  strokeWidth: 1.75
65
79
  }
66
80
  })), KeyMap.Right, /*#__PURE__*/_jsx(Icon, {
@@ -6,11 +6,13 @@ export declare const enum KeyMap {
6
6
  Enter = "enter",
7
7
  Left = "left",
8
8
  LeftClick = "left-click",
9
+ LeftDoubleClick = "left-double-click",
9
10
  Meta = "meta",
10
11
  MiddleClick = "middle-click",
11
12
  Mod = "mod",
12
13
  Right = "right",
13
14
  RightClick = "right-click",
15
+ RightDoubleClick = "right-double-click",
14
16
  Shift = "shift",
15
17
  Space = "space",
16
18
  Tab = "tab",
package/es/Hotkey/type.js CHANGED
@@ -6,11 +6,13 @@ export var KeyMap = {
6
6
  Enter: "enter",
7
7
  Left: "left",
8
8
  LeftClick: "left-click",
9
+ LeftDoubleClick: "left-double-click",
9
10
  Meta: "meta",
10
11
  MiddleClick: "middle-click",
11
12
  Mod: "mod",
12
13
  Right: "right",
13
14
  RightClick: "right-click",
15
+ RightDoubleClick: "right-double-click",
14
16
  Shift: "shift",
15
17
  Space: "space",
16
18
  Tab: "tab",
@@ -1,9 +1,10 @@
1
- /// <reference types="react" />
1
+ import { Ref } from 'react';
2
2
  import { ChatItemProps } from "..";
3
3
  export interface ActionsProps {
4
4
  actions: ChatItemProps['actions'];
5
5
  editing?: boolean;
6
6
  placement?: ChatItemProps['placement'];
7
+ ref?: Ref<HTMLDivElement>;
7
8
  type?: ChatItemProps['type'];
8
9
  }
9
10
  declare const Actions: import("react").NamedExoticComponent<ActionsProps>;
@@ -6,7 +6,8 @@ var Actions = /*#__PURE__*/memo(function (_ref) {
6
6
  var actions = _ref.actions,
7
7
  placement = _ref.placement,
8
8
  type = _ref.type,
9
- editing = _ref.editing;
9
+ editing = _ref.editing,
10
+ ref = _ref.ref;
10
11
  var _useStyles = useStyles({
11
12
  editing: editing,
12
13
  placement: placement,
@@ -16,6 +17,7 @@ var Actions = /*#__PURE__*/memo(function (_ref) {
16
17
  return /*#__PURE__*/_jsx(Flexbox, {
17
18
  align: 'flex-start',
18
19
  className: styles.actions,
20
+ ref: ref,
19
21
  role: "menubar",
20
22
  children: actions
21
23
  });
@@ -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", "placeholderMessage", "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", "actionsWrapWidth"];
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; }
@@ -60,6 +60,8 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
60
60
  aboveMessage = _ref.aboveMessage,
61
61
  belowMessage = _ref.belowMessage,
62
62
  markdownProps = _ref.markdownProps,
63
+ _ref$actionsWrapWidth = _ref.actionsWrapWidth,
64
+ actionsWrapWidth = _ref$actionsWrapWidth === void 0 ? 54 : _ref$actionsWrapWidth,
63
65
  rest = _objectWithoutProperties(_ref, _excluded);
64
66
  var _useResponsive = useResponsive(),
65
67
  mobile = _useResponsive.mobile;
@@ -96,17 +98,16 @@ var ChatItem = /*#__PURE__*/memo(function (_ref) {
96
98
  var contentWidth = contentRef.current.scrollWidth; // 使用scrollWidth获取实际内容宽度
97
99
 
98
100
  // 预留给Actions的最小空间 (根据实际Actions大小调整)
99
- var actionsMinWidth = 54;
100
- console.log(contentWidth, actionsMinWidth, containerWidth);
101
+
101
102
  // 只有当内容宽度 + Actions最小宽度 > 容器宽度时才切换布局
102
- setLayoutMode(contentWidth + actionsMinWidth > containerWidth ? 'vertical' : 'horizontal');
103
+ setLayoutMode(contentWidth + actionsWrapWidth > containerWidth ? 'vertical' : 'horizontal');
103
104
  });
104
105
  observer.observe(contentRef.current);
105
106
  observer.observe(containerRef.current);
106
107
  return function () {
107
108
  return observer.disconnect();
108
109
  };
109
- }, [type]);
110
+ }, [type, actionsWrapWidth]);
110
111
  return /*#__PURE__*/_jsxs(Flexbox, _objectSpread(_objectSpread({
111
112
  className: cx(styles.container, className),
112
113
  direction: placement === 'left' ? 'horizontal' : 'horizontal-reverse',
@@ -11,6 +11,7 @@ export interface ChatItemProps extends Omit<FlexboxProps, 'children' | 'onChange
11
11
  * @description Actions to be displayed in the chat item
12
12
  */
13
13
  actions?: ReactNode;
14
+ actionsWrapWidth?: number;
14
15
  /**
15
16
  * @description Metadata for the avatar
16
17
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.168.6",
3
+ "version": "1.168.8",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",