@lobehub/ui 1.94.1 → 1.94.3

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,9 +1,11 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
1
2
  import { useThemeMode } from 'antd-style';
2
3
  import { Loader2 } from 'lucide-react';
3
- import { memo } from 'react';
4
+ import { memo, useEffect, useState } from 'react';
4
5
  import { Center } from 'react-layout-kit';
6
+ import { codeToHtml } from 'shikiji';
7
+ import { themeConfig } from "../theme";
5
8
  import Icon from "../../Icon";
6
- import { useHighlight } from "../../hooks/useHighlight";
7
9
  import { useStyles } from "./style";
8
10
  import { jsx as _jsx } from "react/jsx-runtime";
9
11
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -18,9 +20,24 @@ var SyntaxHighlighter = /*#__PURE__*/memo(function (_ref) {
18
20
  cx = _useStyles.cx;
19
21
  var _useThemeMode = useThemeMode(),
20
22
  isDarkMode = _useThemeMode.isDarkMode;
21
- var _useHighlight = useHighlight(children, language, isDarkMode),
22
- isLoading = _useHighlight.isLoading,
23
- data = _useHighlight.data;
23
+ var _useState = useState(true),
24
+ _useState2 = _slicedToArray(_useState, 2),
25
+ isLoading = _useState2[0],
26
+ setIsLoading = _useState2[1];
27
+ var _useState3 = useState(''),
28
+ _useState4 = _slicedToArray(_useState3, 2),
29
+ data = _useState4[0],
30
+ setData = _useState4[1];
31
+ useEffect(function () {
32
+ setIsLoading(true);
33
+ codeToHtml(children.trim(), {
34
+ lang: language,
35
+ theme: themeConfig(isDarkMode)
36
+ }).then(function (code) {
37
+ setData(code);
38
+ setIsLoading(false);
39
+ });
40
+ }, [children, language, isDarkMode]);
24
41
  return /*#__PURE__*/_jsxs(_Fragment, {
25
42
  children: [isLoading ? /*#__PURE__*/_jsx("code", {
26
43
  className: className,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.94.1",
3
+ "version": "1.94.3",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",