@lobehub/ui 1.71.0 → 1.72.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.
|
@@ -3,7 +3,6 @@ import { useThemeMode } from 'antd-style';
|
|
|
3
3
|
import { Loader2 } from 'lucide-react';
|
|
4
4
|
import { memo, useEffect } from 'react';
|
|
5
5
|
import { Center } from 'react-layout-kit';
|
|
6
|
-
import { shallow } from 'zustand/shallow';
|
|
7
6
|
import Icon from "../../Icon";
|
|
8
7
|
import { useHighlight } from "../../hooks/useHighlight";
|
|
9
8
|
import { useStyles } from "./style";
|
|
@@ -20,7 +19,7 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
20
19
|
isDarkMode = _useThemeMode.isDarkMode;
|
|
21
20
|
var _useHighlight = useHighlight(function (s) {
|
|
22
21
|
return [s.codeToHtml, !s.highlighter];
|
|
23
|
-
}
|
|
22
|
+
}),
|
|
24
23
|
_useHighlight2 = _slicedToArray(_useHighlight, 2),
|
|
25
24
|
codeToHtml = _useHighlight2[0],
|
|
26
25
|
isLoading = _useHighlight2[1];
|
package/es/LogoThree/Logo.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
3
|
import _objectDestructuringEmpty from "@babel/runtime/helpers/esm/objectDestructuringEmpty";
|
|
3
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; }
|
|
4
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 { a, config, useSpring } from '@react-spring/three';
|
|
5
7
|
import { useGLTF } from '@react-three/drei';
|
|
6
8
|
import { useFrame } from '@react-three/fiber';
|
|
7
|
-
import { memo, useRef } from 'react';
|
|
9
|
+
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
8
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
11
|
var NUM = 10;
|
|
10
12
|
var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
@@ -12,6 +14,37 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
12
14
|
var ref = useRef(null);
|
|
13
15
|
var _useGLTF = useGLTF('https://gw.alipayobjects.com/os/kitchen/ygwdCZyaMZ/lobehub.gltf'),
|
|
14
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]);
|
|
15
48
|
useFrame(function (state) {
|
|
16
49
|
var t = state.clock.getElapsedTime();
|
|
17
50
|
ref.current.rotation.set(Math.cos(t / 4) / NUM, Math.sin(t / 3) / NUM / 2, 0.15 + Math.sin(t / 2) / NUM);
|
|
@@ -19,9 +52,15 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
|
|
|
19
52
|
});
|
|
20
53
|
return /*#__PURE__*/_jsx("group", {
|
|
21
54
|
ref: ref,
|
|
22
|
-
children: /*#__PURE__*/_jsx(
|
|
23
|
-
|
|
24
|
-
|
|
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
|
+
})
|
|
25
64
|
});
|
|
26
65
|
});
|
|
27
66
|
export default Logo;
|
|
@@ -22,5 +22,5 @@ interface Store {
|
|
|
22
22
|
*/
|
|
23
23
|
initHighlighter: (options?: HighlighterOptions) => Promise<void>;
|
|
24
24
|
}
|
|
25
|
-
export declare const useHighlight: import("zustand").
|
|
25
|
+
export declare const useHighlight: import("zustand/traditional").UseBoundStoreWithEqualityFn<import("zustand/vanilla").StoreApi<Store>>;
|
|
26
26
|
export {};
|
package/es/hooks/useHighlight.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
2
|
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
3
3
|
import { getHighlighter } from 'shiki-es';
|
|
4
|
-
import {
|
|
4
|
+
import { shallow } from 'zustand/shallow';
|
|
5
|
+
import { createWithEqualityFn } from 'zustand/traditional';
|
|
5
6
|
import { themeConfig } from "../Highlighter/theme";
|
|
6
7
|
export var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', 'less', 'css', 'typescript', 'ts', 'tsx', 'diff', 'bash'];
|
|
7
8
|
|
|
@@ -9,7 +10,7 @@ export var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', '
|
|
|
9
10
|
* @title 代码高亮的存储对象
|
|
10
11
|
*/
|
|
11
12
|
|
|
12
|
-
export var useHighlight =
|
|
13
|
+
export var useHighlight = createWithEqualityFn(function (set, get) {
|
|
13
14
|
return {
|
|
14
15
|
codeToHtml: function codeToHtml(text, language, isDarkMode) {
|
|
15
16
|
var _get = get(),
|
|
@@ -57,4 +58,4 @@ export var useHighlight = create(function (set, get) {
|
|
|
57
58
|
return initHighlighter;
|
|
58
59
|
}()
|
|
59
60
|
};
|
|
60
|
-
});
|
|
61
|
+
}, shallow);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.72.1",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -75,6 +75,7 @@
|
|
|
75
75
|
"@floating-ui/react": "^0",
|
|
76
76
|
"@giscus/react": "^2",
|
|
77
77
|
"@lobehub/emojilib": "latest",
|
|
78
|
+
"@react-spring/three": "^9",
|
|
78
79
|
"@react-spring/web": "^9",
|
|
79
80
|
"@react-three/drei": "^9",
|
|
80
81
|
"@react-three/fiber": "^8",
|
|
@@ -104,8 +105,8 @@
|
|
|
104
105
|
"three": "^0.150",
|
|
105
106
|
"ts-md5": "^1",
|
|
106
107
|
"use-merge-value": "^1",
|
|
107
|
-
"zustand": "^4",
|
|
108
|
-
"zustand-utils": "^1"
|
|
108
|
+
"zustand": "^4.4.1",
|
|
109
|
+
"zustand-utils": "^1.3.1"
|
|
109
110
|
},
|
|
110
111
|
"devDependencies": {
|
|
111
112
|
"@commitlint/cli": "^17",
|