@lobehub/ui 1.70.0 → 1.71.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.
@@ -1,4 +1,5 @@
1
1
  import { CSSProperties } from 'react';
2
+ import { IconProps } from "../Icon";
2
3
  import type { DivProps } from "../types";
3
4
  export interface FeatureItem {
4
5
  /**
@@ -16,7 +17,7 @@ export interface FeatureItem {
16
17
  /**
17
18
  * @description The name of the icon to display on the feature item.
18
19
  */
19
- icon?: string;
20
+ icon?: IconProps['icon'];
20
21
  /**
21
22
  * @description The URL of the image to display on the feature item.
22
23
  */
@@ -3,10 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["style", "className", "row", "column", "description", "image", "title", "link", "icon", "imageStyle", "openExternal"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- import { Icon } from "./..";
7
- import * as LucideIcon from 'lucide-react';
8
6
  import { memo } from 'react';
9
7
  import { Center, Flexbox } from 'react-layout-kit';
8
+ import Icon from "../Icon";
10
9
  import { useStyles } from "./Item.style";
11
10
 
12
11
  // @ts-ignore
@@ -15,13 +14,16 @@ import { jsxs as _jsxs } from "react/jsx-runtime";
15
14
  var Image = /*#__PURE__*/memo(function (_ref) {
16
15
  var image = _ref.image,
17
16
  className = _ref.className,
18
- title = _ref.title;
17
+ title = _ref.title,
18
+ style = _ref.style;
19
19
  return image.startsWith('http') ? /*#__PURE__*/_jsx("img", {
20
20
  alt: title,
21
21
  className: className,
22
- src: image
22
+ src: image,
23
+ style: style
23
24
  }) : /*#__PURE__*/_jsx(Center, {
24
25
  className: className,
26
+ style: style,
25
27
  children: image
26
28
  });
27
29
  });
@@ -45,9 +47,6 @@ var Item = /*#__PURE__*/memo(function (_ref2) {
45
47
  }),
46
48
  styles = _useStyles.styles,
47
49
  cx = _useStyles.cx;
48
-
49
- // @ts-ignore
50
- var FeatureIcon = icon && LucideIcon[icon];
51
50
  return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
52
51
  className: cx(styles.container, className),
53
52
  style: _objectSpread({
@@ -57,12 +56,12 @@ var Item = /*#__PURE__*/memo(function (_ref2) {
57
56
  }, props), {}, {
58
57
  children: /*#__PURE__*/_jsxs("div", {
59
58
  className: styles.cell,
60
- children: [image || FeatureIcon && /*#__PURE__*/_jsxs(Center, {
59
+ children: [image || icon && /*#__PURE__*/_jsxs(Center, {
61
60
  className: styles.imgContainer,
62
61
  style: imageStyle,
63
- children: [FeatureIcon && /*#__PURE__*/_jsx(Icon, {
62
+ children: [icon && /*#__PURE__*/_jsx(Icon, {
64
63
  className: styles.img,
65
- icon: FeatureIcon
64
+ icon: icon
66
65
  }), image && /*#__PURE__*/_jsx(Image, {
67
66
  className: styles.img,
68
67
  image: image,
@@ -39,6 +39,7 @@ var GridShowcase = /*#__PURE__*/memo(function (_ref) {
39
39
  colorBack: rgba(theme.colorText, 0.24),
40
40
  colorFront: theme.colorText,
41
41
  random: true,
42
+ reverse: true,
42
43
  showBackground: true,
43
44
  style: {
44
45
  zIndex: 0
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ declare const Loading: import("react").NamedExoticComponent<{
3
+ size?: number | undefined;
4
+ }>;
5
+ export default Loading;
@@ -0,0 +1,21 @@
1
+ import { Html } from '@react-three/drei';
2
+ import { Loader2 } from 'lucide-react';
3
+ import { memo } from 'react';
4
+ import { Center } from 'react-layout-kit';
5
+ import Icon from "../Icon";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var Loading = /*#__PURE__*/memo(function (_ref) {
8
+ var size = _ref.size;
9
+ return /*#__PURE__*/_jsx(Html, {
10
+ children: /*#__PURE__*/_jsx(Center, {
11
+ children: /*#__PURE__*/_jsx(Icon, {
12
+ icon: Loader2,
13
+ size: {
14
+ fontSize: size
15
+ },
16
+ spin: true
17
+ })
18
+ })
19
+ });
20
+ });
21
+ export default Loading;
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ export interface LogoProps {
3
+ rotation?: [number, number, number];
4
+ }
5
+ declare const Logo: import("react").NamedExoticComponent<LogoProps>;
6
+ export default Logo;
@@ -0,0 +1,27 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
3
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
4
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
5
+ import { useGLTF } from '@react-three/drei';
6
+ import { useFrame } from '@react-three/fiber';
7
+ import { memo, useRef } from 'react';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ var NUM = 10;
10
+ var Logo = /*#__PURE__*/memo(function (_ref) {
11
+ var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
12
+ var ref = useRef(null);
13
+ var _useGLTF = useGLTF('https://gw.alipayobjects.com/os/kitchen/ygwdCZyaMZ/lobehub.gltf'),
14
+ scene = _useGLTF.scene;
15
+ useFrame(function (state) {
16
+ var t = state.clock.getElapsedTime();
17
+ ref.current.rotation.set(Math.cos(t / 4) / NUM, Math.sin(t / 3) / NUM / 2, 0.15 + Math.sin(t / 2) / NUM);
18
+ ref.current.position.y = -0.2 + (0.8 + Math.cos(t / 2)) / 7;
19
+ });
20
+ return /*#__PURE__*/_jsx("group", {
21
+ ref: ref,
22
+ children: /*#__PURE__*/_jsx("primitive", _objectSpread({
23
+ object: scene
24
+ }, props))
25
+ });
26
+ });
27
+ export default Logo;
@@ -0,0 +1,8 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface LogoThreeProps {
3
+ className?: string;
4
+ size?: number;
5
+ style?: CSSProperties;
6
+ }
7
+ declare const LogoThree: import("react").NamedExoticComponent<LogoThreeProps>;
8
+ export default LogoThree;
@@ -0,0 +1,36 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ import { Canvas } from '@react-three/fiber';
5
+ import { Suspense, memo } from 'react';
6
+ import Loading from "./Loading";
7
+ import Logo from "./Logo";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ var LogoThree = /*#__PURE__*/memo(function (_ref) {
10
+ var _ref$size = _ref.size,
11
+ size = _ref$size === void 0 ? 320 : _ref$size,
12
+ style = _ref.style,
13
+ className = _ref.className;
14
+ return /*#__PURE__*/_jsx(Canvas, {
15
+ camera: {
16
+ fov: 16,
17
+ position: [10, 1, 0]
18
+ },
19
+ className: className,
20
+ style: size ? _objectSpread({
21
+ height: size,
22
+ maxHeight: size,
23
+ maxWidth: size,
24
+ width: size
25
+ }, style) : style,
26
+ children: /*#__PURE__*/_jsx(Suspense, {
27
+ fallback: /*#__PURE__*/_jsx(Loading, {
28
+ size: size / 2 > 48 ? 48 : size / 2
29
+ }),
30
+ children: /*#__PURE__*/_jsx(Logo, {
31
+ rotation: [0, 1.5, 0]
32
+ })
33
+ })
34
+ });
35
+ });
36
+ export default LogoThree;
@@ -12,7 +12,6 @@ export interface TokenTagProps extends DivProps {
12
12
  text?: {
13
13
  overload?: string;
14
14
  remained?: string;
15
- tokens?: string;
16
15
  used?: string;
17
16
  };
18
17
  /**
@@ -3,8 +3,7 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  var _excluded = ["className", "displayMode", "maxValue", "value", "text"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
- import { useHover } from 'ahooks';
7
- import { forwardRef, useRef } from 'react';
6
+ import { forwardRef } from 'react';
8
7
  import FluentEmoji from "../FluentEmoji";
9
8
  import { ICON_SIZE, useStyles } from "./style";
10
9
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -17,8 +16,6 @@ var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
17
16
  value = _ref.value,
18
17
  text = _ref.text,
19
18
  props = _objectWithoutProperties(_ref, _excluded);
20
- var reference = useRef(ref);
21
- var isHovering = useHover(reference);
22
19
  var valueLeft = maxValue - value;
23
20
  var percent = valueLeft / maxValue;
24
21
  var type;
@@ -38,12 +35,12 @@ var TokenTag = /*#__PURE__*/forwardRef(function (_ref, ref) {
38
35
  cx = _useStyles.cx;
39
36
  return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
40
37
  className: cx(styles.container, className),
41
- ref: reference
38
+ ref: ref
42
39
  }, props), {}, {
43
40
  children: [/*#__PURE__*/_jsx(FluentEmoji, {
44
41
  emoji: emoji,
45
42
  size: ICON_SIZE
46
- }), valueLeft > 0 ? [displayMode === 'remained' ? (text === null || text === void 0 ? void 0 : text.remained) || 'Remained' : (text === null || text === void 0 ? void 0 : text.used) || 'Used', displayMode === 'remained' ? valueLeft : value, isHovering ? (text === null || text === void 0 ? void 0 : text.tokens) || 'Tokens' : ''].join(' ') : (text === null || text === void 0 ? void 0 : text.overload) || 'Overload']
43
+ }), valueLeft > 0 ? [displayMode === 'remained' ? (text === null || text === void 0 ? void 0 : text.remained) || 'Remained' : (text === null || text === void 0 ? void 0 : text.used) || 'Used', displayMode === 'remained' ? valueLeft : value].join(' ') : (text === null || text === void 0 ? void 0 : text.overload) || 'Overload']
47
44
  }));
48
45
  });
49
46
  export default TokenTag;
package/es/index.d.ts CHANGED
@@ -41,6 +41,7 @@ export { Input, type InputProps, TextArea, type TextAreaProps } from './Input';
41
41
  export { default as Layout, LayoutFooter, type LayoutFooterProps, LayoutHeader, type LayoutHeaderProps, LayoutMain, type LayoutMainProps, type LayoutProps, LayoutSidebar, LayoutSidebarInner, type LayoutSidebarInnerProps, type LayoutSidebarProps, LayoutToc, type LayoutTocProps, } from './Layout';
42
42
  export { default as List } from './List';
43
43
  export { default as Logo, type LogoProps } from './Logo';
44
+ export { default as LogoThree, type LogoThreeProps } from './LogoThree';
44
45
  export { default as Markdown, type MarkdownProps } from './Markdown';
45
46
  export { default as MessageInput, type MessageInputProps } from './MessageInput';
46
47
  export { default as MessageModal, type MessageModalProps } from './MessageModal';
package/es/index.js CHANGED
@@ -40,6 +40,7 @@ export { Input, TextArea } from "./Input";
40
40
  export { default as Layout, LayoutFooter, LayoutHeader, LayoutMain, LayoutSidebar, LayoutSidebarInner, LayoutToc } from "./Layout";
41
41
  export { default as List } from "./List";
42
42
  export { default as Logo } from "./Logo";
43
+ export { default as LogoThree } from "./LogoThree";
43
44
  export { default as Markdown } from "./Markdown";
44
45
  export { default as MessageInput } from "./MessageInput";
45
46
  export { default as MessageModal } from "./MessageModal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.70.0",
3
+ "version": "1.71.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -76,6 +76,8 @@
76
76
  "@giscus/react": "^2",
77
77
  "@lobehub/emojilib": "latest",
78
78
  "@react-spring/web": "^9",
79
+ "@react-three/drei": "^9",
80
+ "@react-three/fiber": "^8",
79
81
  "ahooks": "^3",
80
82
  "antd": "^5",
81
83
  "chroma-js": "^2",
@@ -99,6 +101,7 @@
99
101
  "remark-gfm": "^3",
100
102
  "shiki-es": "^0",
101
103
  "styled-components": "^6",
104
+ "three": "^0.150",
102
105
  "ts-md5": "^1",
103
106
  "use-merge-value": "^1",
104
107
  "zustand": "^4",
@@ -113,6 +116,7 @@
113
116
  "@types/pangu": "^4",
114
117
  "@types/react": "^18",
115
118
  "@types/react-dom": "^18",
119
+ "@types/three": "^0.149",
116
120
  "@vitest/coverage-v8": "latest",
117
121
  "antd-style": "^3",
118
122
  "babel-plugin-antd-style": "latest",