@lobehub/ui 1.114.2 → 1.115.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.
@@ -1,12 +1,12 @@
1
- import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
2
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
3
3
  import _regeneratorRuntime from "@babel/runtime/regenerator";
4
4
  import data from '@emoji-mart/data';
5
- import defaultI18n from '@emoji-mart/data/i18n/en.json';
6
5
  import Picker from '@emoji-mart/react';
7
6
  import { Avatar } from "./..";
8
7
  import { Popover } from 'antd';
9
- import { memo, useEffect, useState } from 'react';
8
+ import { memo } from 'react';
9
+ import useSWR from 'swr';
10
10
  import useMergeState from 'use-merge-value';
11
11
  import { useStyles } from "./style";
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -21,44 +21,29 @@ var EmojiPicker = /*#__PURE__*/memo(function (_ref) {
21
21
  locale = _ref$locale === void 0 ? 'en-US' : _ref$locale;
22
22
  var _useStyles = useStyles(),
23
23
  styles = _useStyles.styles;
24
- var _useState = useState(defaultI18n),
25
- _useState2 = _slicedToArray(_useState, 2),
26
- i18n = _useState2[0],
27
- setI18n = _useState2[1];
28
- var _useMergeState = useMergeState('🤖', {
29
- defaultValue: defaultAvatar,
30
- onChange: onChange,
31
- value: value
32
- }),
33
- _useMergeState2 = _slicedToArray(_useMergeState, 2),
34
- ava = _useMergeState2[0],
35
- setAva = _useMergeState2[1];
36
- var getI18n = /*#__PURE__*/function () {
37
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(localeName) {
38
- var i18n;
24
+ var _useSWR = useSWR(locale, /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
39
25
  return _regeneratorRuntime.wrap(function _callee$(_context) {
40
26
  while (1) switch (_context.prev = _context.next) {
41
27
  case 0:
42
28
  _context.next = 2;
43
- return import("@emoji-mart/data/i18n/".concat(localeName, ".json"));
29
+ return import("@emoji-mart/data/i18n/".concat(locale.split('-')[0], ".json"));
44
30
  case 2:
45
- i18n = _context.sent;
46
- setI18n(i18n);
47
- case 4:
31
+ return _context.abrupt("return", _context.sent);
32
+ case 3:
48
33
  case "end":
49
34
  return _context.stop();
50
35
  }
51
36
  }, _callee);
52
- }));
53
- return function getI18n(_x) {
54
- return _ref2.apply(this, arguments);
55
- };
56
- }();
57
- useEffect(function () {
58
- if (locale === 'en-US') return;
59
- var localeName = locale.split('-')[0];
60
- getI18n(localeName);
61
- }, [locale]);
37
+ }))),
38
+ i18n = _useSWR.data;
39
+ var _useMergeState = useMergeState('🤖', {
40
+ defaultValue: defaultAvatar,
41
+ onChange: onChange,
42
+ value: value
43
+ }),
44
+ _useMergeState2 = _slicedToArray(_useMergeState, 2),
45
+ ava = _useMergeState2[0],
46
+ setAva = _useMergeState2[1];
62
47
  return /*#__PURE__*/_jsx(Popover, {
63
48
  content: /*#__PURE__*/_jsx("div", {
64
49
  className: styles.picker,
@@ -1,20 +1,24 @@
1
- import { Html } from '@react-three/drei';
2
1
  import { Loader2 } from 'lucide-react';
3
2
  import { memo } from 'react';
4
3
  import { Center } from 'react-layout-kit';
5
4
  import Icon from "../Icon";
6
5
  import { jsx as _jsx } from "react/jsx-runtime";
7
6
  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
- })
7
+ var _ref$size = _ref.size,
8
+ size = _ref$size === void 0 ? 32 : _ref$size;
9
+ return /*#__PURE__*/_jsx(Center, {
10
+ height: '100%',
11
+ justify: 'center',
12
+ style: {
13
+ position: 'absolute'
14
+ },
15
+ width: '100%',
16
+ children: /*#__PURE__*/_jsx(Icon, {
17
+ icon: Loader2,
18
+ size: {
19
+ fontSize: size
20
+ },
21
+ spin: true
18
22
  })
19
23
  });
20
24
  });
@@ -0,0 +1,9 @@
1
+ import { CSSProperties } from 'react';
2
+ export interface LogoSplineProps {
3
+ className?: string;
4
+ height?: number | string;
5
+ style?: CSSProperties;
6
+ width?: number | string;
7
+ }
8
+ declare const LogoSpline: import("react").NamedExoticComponent<LogoSplineProps>;
9
+ export default LogoSpline;
@@ -0,0 +1,47 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
+ 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; }
4
+ 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; }
5
+ import { useThemeMode } from 'antd-style';
6
+ import { Suspense, lazy, memo, useState } from 'react';
7
+ import Loading from "./Loading";
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ import { Fragment as _Fragment } from "react/jsx-runtime";
10
+ import { jsxs as _jsxs } from "react/jsx-runtime";
11
+ var Spline = /*#__PURE__*/lazy(function () {
12
+ return import('@splinetool/react-spline');
13
+ });
14
+ var LIGHT = 'https://gw.alipayobjects.com/os/kitchen/J9jiHITGrs/scene.splinecode';
15
+ var DARK = 'https://gw.alipayobjects.com/os/kitchen/CzQKKvSE8a/scene.splinecode';
16
+ var LogoSpline = /*#__PURE__*/memo(function (_ref) {
17
+ var className = _ref.className,
18
+ style = _ref.style,
19
+ width = _ref.width,
20
+ height = _ref.height;
21
+ var _useThemeMode = useThemeMode(),
22
+ isDarkMode = _useThemeMode.isDarkMode;
23
+ var _useState = useState(true),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ loading = _useState2[0],
26
+ setLoading = _useState2[1];
27
+ return /*#__PURE__*/_jsx("div", {
28
+ className: className,
29
+ style: _objectSpread({
30
+ height: height,
31
+ position: 'relative',
32
+ width: width
33
+ }, style),
34
+ children: /*#__PURE__*/_jsx(Suspense, {
35
+ fallback: /*#__PURE__*/_jsx(Loading, {}),
36
+ children: /*#__PURE__*/_jsxs(_Fragment, {
37
+ children: [loading && /*#__PURE__*/_jsx(Loading, {}), /*#__PURE__*/_jsx(Spline, {
38
+ onLoad: function onLoad() {
39
+ return setLoading(false);
40
+ },
41
+ scene: isDarkMode ? DARK : LIGHT
42
+ })]
43
+ })
44
+ })
45
+ });
46
+ });
47
+ export default LogoSpline;
@@ -1,7 +1,7 @@
1
1
  import { CSSProperties } from 'react';
2
2
  export interface LogoThreeProps {
3
3
  className?: string;
4
- size?: number;
4
+ size?: number | string;
5
5
  style?: CSSProperties;
6
6
  }
7
7
  declare const LogoThree: import("react").NamedExoticComponent<LogoThreeProps>;
@@ -1,42 +1,39 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
3
  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; }
3
4
  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; }
4
- import { Canvas } from '@react-three/fiber';
5
- import { Suspense, memo } from 'react';
6
- import { ErrorBoundary } from 'react-error-boundary';
7
- import LobeHubLogo from "../Logo";
5
+ import { Suspense, lazy, memo, useState } from 'react';
8
6
  import Loading from "./Loading";
9
- import Logo from "./Logo";
10
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ import { Fragment as _Fragment } from "react/jsx-runtime";
9
+ import { jsxs as _jsxs } from "react/jsx-runtime";
10
+ var Spline = /*#__PURE__*/lazy(function () {
11
+ return import('@splinetool/react-spline');
12
+ });
11
13
  var LogoThree = /*#__PURE__*/memo(function (_ref) {
12
- var _ref$size = _ref.size,
13
- size = _ref$size === void 0 ? 320 : _ref$size,
14
+ var className = _ref.className,
14
15
  style = _ref.style,
15
- className = _ref.className;
16
- return /*#__PURE__*/_jsx(ErrorBoundary, {
17
- fallback: /*#__PURE__*/_jsx(LobeHubLogo, {
18
- size: size,
19
- type: "3d"
20
- }),
21
- children: /*#__PURE__*/_jsx(Canvas, {
22
- camera: {
23
- fov: 16,
24
- position: [10, 1, 0]
25
- },
26
- className: className,
27
- style: size ? _objectSpread({
28
- height: size,
29
- maxHeight: size,
30
- maxWidth: size,
31
- width: size
32
- }, style) : style,
33
- children: /*#__PURE__*/_jsx(Suspense, {
34
- fallback: /*#__PURE__*/_jsx(Loading, {
35
- size: size / 2 > 48 ? 48 : size / 2
36
- }),
37
- children: /*#__PURE__*/_jsx(Logo, {
38
- rotation: [0, 1.5, 0]
39
- })
16
+ size = _ref.size;
17
+ var _useState = useState(true),
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ loading = _useState2[0],
20
+ setLoading = _useState2[1];
21
+ return /*#__PURE__*/_jsx("div", {
22
+ className: className,
23
+ style: _objectSpread({
24
+ height: size,
25
+ position: 'relative',
26
+ width: size
27
+ }, style),
28
+ children: /*#__PURE__*/_jsx(Suspense, {
29
+ fallback: /*#__PURE__*/_jsx(Loading, {}),
30
+ children: /*#__PURE__*/_jsxs(_Fragment, {
31
+ children: [loading && /*#__PURE__*/_jsx(Loading, {}), /*#__PURE__*/_jsx(Spline, {
32
+ onLoad: function onLoad() {
33
+ return setLoading(false);
34
+ },
35
+ scene: 'https://gw.alipayobjects.com/os/kitchen/8LH7slSv3s/logo.splinecode'
36
+ })]
40
37
  })
41
38
  })
42
39
  });
package/es/index.d.ts CHANGED
@@ -50,6 +50,7 @@ export { default as Layout, LayoutFooter, type LayoutFooterProps, LayoutHeader,
50
50
  export { default as List, type ListItemProps } from './List';
51
51
  export { default as Logo, type LogoProps } from './Logo';
52
52
  export { default as LogoThree, type LogoThreeProps } from './LogoThree';
53
+ export { default as LogoSpline, type LogoSplineProps } from './LogoThree/LogoSpline';
53
54
  export { default as Markdown, type MarkdownProps } from './Markdown';
54
55
  export { default as MessageInput, type MessageInputProps } from './MessageInput';
55
56
  export { default as MessageModal, type MessageModalProps } from './MessageModal';
package/es/index.js CHANGED
@@ -49,6 +49,7 @@ export { default as Layout, LayoutFooter, LayoutHeader, LayoutMain, LayoutSideba
49
49
  export { default as List } from "./List";
50
50
  export { default as Logo } from "./Logo";
51
51
  export { default as LogoThree } from "./LogoThree";
52
+ export { default as LogoSpline } from "./LogoThree/LogoSpline";
52
53
  export { default as Markdown } from "./Markdown";
53
54
  export { default as MessageInput } from "./MessageInput";
54
55
  export { default as MessageModal } from "./MessageModal";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.114.2",
3
+ "version": "1.115.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",
@@ -79,10 +79,8 @@
79
79
  "@giscus/react": "^2",
80
80
  "@lobehub/chat-plugin-sdk": "latest",
81
81
  "@lobehub/emojilib": "latest",
82
- "@react-spring/three": "^9",
83
82
  "@react-spring/web": "^9",
84
- "@react-three/drei": "^9",
85
- "@react-three/fiber": "^8",
83
+ "@splinetool/react-spline": "^2.2.6",
86
84
  "ahooks": "^3",
87
85
  "chroma-js": "^2",
88
86
  "copy-to-clipboard": "^3",
@@ -109,7 +107,6 @@
109
107
  "remark-math": "^5",
110
108
  "shikiji": "^0",
111
109
  "swr": "^2",
112
- "three": "^0.157",
113
110
  "ts-md5": "^1",
114
111
  "url-join": "^5",
115
112
  "use-merge-value": "^1",
@@ -127,7 +124,6 @@
127
124
  "@types/query-string": "^6",
128
125
  "@types/react": "^18",
129
126
  "@types/react-dom": "^18",
130
- "@types/three": "^0.157",
131
127
  "@types/uuid": "^9",
132
128
  "@vitest/coverage-v8": "latest",
133
129
  "antd-style": "^3",
@@ -1,6 +0,0 @@
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;
@@ -1,66 +0,0 @@
1
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
3
- import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
4
- 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; }
5
- 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; }
6
- import { a, config, useSpring } from '@react-spring/three';
7
- import { useGLTF } from '@react-three/drei';
8
- import { useFrame } from '@react-three/fiber';
9
- import { memo, useCallback, useEffect, useRef, useState } from 'react';
10
- import { jsx as _jsx } from "react/jsx-runtime";
11
- var NUM = 10;
12
- var Logo = /*#__PURE__*/memo(function (_ref) {
13
- var props = Object.assign({}, (_objectDestructuringEmpty(_ref), _ref));
14
- var ref = useRef(null);
15
- var _useGLTF = useGLTF('https://gw.alipayobjects.com/os/kitchen/ygwdCZyaMZ/lobehub.gltf'),
16
- scene = _useGLTF.scene;
17
- // Hover state
18
- var _useState = useState(false),
19
- _useState2 = _slicedToArray(_useState, 2),
20
- hovered = _useState2[0],
21
- setHover = _useState2[1];
22
- useEffect(function () {
23
- return void (document.body.style.cursor = hovered ? 'pointer' : 'auto');
24
- }, [hovered]);
25
- // Events
26
- var _useState3 = useState(0),
27
- _useState4 = _slicedToArray(_useState3, 2),
28
- toggle = _useState4[0],
29
- set = _useState4[1];
30
- var _useSpring = useSpring({
31
- config: config.wobbly,
32
- x: toggle
33
- }, [toggle]),
34
- _useSpring2 = _slicedToArray(_useSpring, 1),
35
- x = _useSpring2[0].x;
36
- var onPointerOver = useCallback(function () {
37
- return setHover(true);
38
- }, []);
39
- var onPointerOut = useCallback(function () {
40
- return setHover(false);
41
- }, []);
42
- var onClick = useCallback(function () {
43
- return set(function (toggle) {
44
- return Number(!toggle);
45
- });
46
- }, [set]);
47
- var rotation = x.to([0, 1], [0, Math.PI * 2]);
48
- useFrame(function (state) {
49
- var t = state.clock.getElapsedTime();
50
- ref.current.rotation.set(Math.cos(t / 4) / NUM, Math.sin(t / 3) / NUM / 2, 0.15 + Math.sin(t / 2) / NUM);
51
- ref.current.position.y = -0.2 + (0.8 + Math.cos(t / 2)) / 7;
52
- });
53
- return /*#__PURE__*/_jsx("group", {
54
- ref: ref,
55
- children: /*#__PURE__*/_jsx(a.group, {
56
- onClick: onClick,
57
- onPointerOut: onPointerOut,
58
- onPointerOver: onPointerOver,
59
- "rotation-y": rotation,
60
- children: /*#__PURE__*/_jsx("primitive", _objectSpread({
61
- object: scene
62
- }, props))
63
- })
64
- });
65
- });
66
- export default Logo;