@lobehub/ui 1.11.0 → 1.11.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.
Files changed (91) hide show
  1. package/lib/ActionIcon/index.js +77 -79
  2. package/lib/ActionIcon/style.js +17 -61
  3. package/lib/Avatar/index.js +62 -67
  4. package/lib/Chat/const.js +6 -27
  5. package/lib/Chat/index.js +24 -28
  6. package/lib/Chat/store/index.js +46 -40
  7. package/lib/Chat/store/initialState.js +6 -27
  8. package/lib/Chat/store/messageReducer.js +51 -58
  9. package/lib/Chat/store/selectors.js +44 -46
  10. package/lib/Chat/store/store.js +242 -115
  11. package/lib/Chat/types.js +4 -16
  12. package/lib/Chat/utils/fetch.js +104 -68
  13. package/lib/ContextMenu/MenuItem/icons.js +48 -66
  14. package/lib/ContextMenu/MenuItem/index.js +73 -66
  15. package/lib/ContextMenu/MenuItem/style.js +19 -89
  16. package/lib/ContextMenu/index.js +194 -178
  17. package/lib/ContextMenu/style.js +17 -85
  18. package/lib/ContextMenu/types/index.js +15 -18
  19. package/lib/ContextMenu/types/menuItem.js +4 -16
  20. package/lib/Conversation/App.js +47 -50
  21. package/lib/Conversation/ChatList/MessageItem/Content.js +98 -93
  22. package/lib/Conversation/ChatList/MessageItem/Toolbar.js +94 -104
  23. package/lib/Conversation/ChatList/MessageItem/index.js +125 -157
  24. package/lib/Conversation/ChatList/index.js +64 -58
  25. package/lib/Conversation/InputArea/ActionBar.js +74 -92
  26. package/lib/Conversation/InputArea/index.js +103 -142
  27. package/lib/Conversation/StoreUpdater.js +28 -48
  28. package/lib/Conversation/index.js +30 -42
  29. package/lib/CopyButton/index.js +37 -62
  30. package/lib/DraggablePanel/index.js +192 -207
  31. package/lib/DraggablePanel/style.js +30 -278
  32. package/lib/DraggablePanel/utils.js +14 -35
  33. package/lib/EditableMessage/index.js +66 -89
  34. package/lib/EditableMessageList/index.js +97 -112
  35. package/lib/EditableText/index.js +36 -49
  36. package/lib/Highlighter/SyntaxHighlighter/Prism.js +43 -38
  37. package/lib/Highlighter/SyntaxHighlighter/index.js +62 -53
  38. package/lib/Highlighter/SyntaxHighlighter/style.js +18 -56
  39. package/lib/Highlighter/index.js +52 -58
  40. package/lib/Highlighter/style.js +22 -101
  41. package/lib/Icon/index.js +29 -36
  42. package/lib/Input/index.js +45 -43
  43. package/lib/Input/style.js +17 -67
  44. package/lib/List/ListItem/index.js +108 -150
  45. package/lib/List/ListItem/time.js +15 -47
  46. package/lib/List/index.js +9 -37
  47. package/lib/Logo/Divider.js +21 -34
  48. package/lib/Logo/Logo3D.js +17 -33
  49. package/lib/Logo/LogoFlat.js +108 -118
  50. package/lib/Logo/LogoHighContrast.js +30 -33
  51. package/lib/Logo/LogoText.js +21 -34
  52. package/lib/Logo/index.js +97 -59
  53. package/lib/Logo/style.js +13 -36
  54. package/lib/Markdown/Code.js +16 -30
  55. package/lib/Markdown/CodeBlock.js +33 -65
  56. package/lib/Markdown/index.js +35 -54
  57. package/lib/Markdown/style.js +15 -129
  58. package/lib/MessageInput/index.js +60 -56
  59. package/lib/MessageModal/index.js +80 -91
  60. package/lib/SearchBar/index.js +86 -73
  61. package/lib/SearchBar/style.js +18 -46
  62. package/lib/SideNav/index.js +43 -31
  63. package/lib/SideNav/style.js +13 -43
  64. package/lib/Snippet/index.js +42 -45
  65. package/lib/Snippet/style.js +13 -71
  66. package/lib/StroyBook/index.js +60 -61
  67. package/lib/StroyBook/style.js +19 -87
  68. package/lib/Swatches/index.js +35 -53
  69. package/lib/TabsNav/index.js +23 -31
  70. package/lib/TabsNav/style.js +17 -60
  71. package/lib/ThemeProvider/GlobalStyle.js +29 -92
  72. package/lib/ThemeProvider/index.js +43 -57
  73. package/lib/ThemeSwitch/index.js +62 -46
  74. package/lib/Tooltip/index.js +26 -31
  75. package/lib/Tooltip/style.js +13 -49
  76. package/lib/components/ControlInput.js +86 -87
  77. package/lib/hooks/useCopied.js +27 -37
  78. package/lib/hooks/useHighlight.js +65 -70
  79. package/lib/index.js +211 -120
  80. package/lib/styles/algorithms/generateColorPalette.js +28 -60
  81. package/lib/styles/algorithms/generateCustomStylish.js +22 -117
  82. package/lib/styles/algorithms/generateCustomToken.js +51 -65
  83. package/lib/styles/algorithms/generateTheme.js +22 -53
  84. package/lib/styles/colors.js +121 -1766
  85. package/lib/styles/index.js +23 -32
  86. package/lib/styles/theme/base.js +11 -32
  87. package/lib/styles/theme/dark.js +38 -62
  88. package/lib/styles/theme/light.js +38 -62
  89. package/lib/types/index.js +4 -16
  90. package/lib/utils/colorUtils.js +14 -48
  91. package/package.json +1 -1
@@ -1,54 +1,18 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/Tooltip/style.ts
20
- var style_exports = {};
21
- __export(style_exports, {
22
- useStyles: () => useStyles
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(style_exports);
25
- var import_antd_style = require("antd-style");
26
- var useStyles = (0, import_antd_style.createStyles)(({ css, token }) => {
7
+ exports.useStyles = void 0;
8
+ var _taggedTemplateLiteral2 = _interopRequireDefault(require("@babel/runtime/helpers/taggedTemplateLiteral"));
9
+ var _antdStyle = require("antd-style");
10
+ var _templateObject;
11
+ var useStyles = (0, _antdStyle.createStyles)(function (_ref) {
12
+ var css = _ref.css,
13
+ token = _ref.token;
27
14
  return {
28
- tooltip: css`
29
- .ant-tooltip-inner {
30
- display: flex;
31
- align-items: center;
32
- justify-content: center;
33
-
34
- min-height: unset;
35
- padding: 4px 8px;
36
-
37
- color: ${token.colorBgLayout};
38
-
39
- background-color: ${token.colorText};
40
- border-radius: ${token.borderRadiusSM}px;
41
- }
42
- .ant-tooltip-arrow {
43
- &:before,
44
- &:after {
45
- background: ${token.colorText};
46
- }
47
- }
48
- `
15
+ tooltip: css(_templateObject || (_templateObject = (0, _taggedTemplateLiteral2.default)(["\n .ant-tooltip-inner {\n display: flex;\n align-items: center;\n justify-content: center;\n\n min-height: unset;\n padding: 4px 8px;\n\n color: ", ";\n\n background-color: ", ";\n border-radius: ", "px;\n }\n .ant-tooltip-arrow {\n &:before,\n &:after {\n background: ", ";\n }\n }\n "])), token.colorBgLayout, token.colorText, token.borderRadiusSM, token.colorText)
49
16
  };
50
17
  });
51
- // Annotate the CommonJS export names for ESM import in node:
52
- 0 && (module.exports = {
53
- useStyles
54
- });
18
+ exports.useStyles = useStyles;
@@ -1,91 +1,90 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/components/ControlInput.tsx
20
- var ControlInput_exports = {};
21
- __export(ControlInput_exports, {
22
- ControlInput: () => ControlInput
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(ControlInput_exports);
25
- var import__ = require("../index");
26
- var import_antd = require("antd");
27
- var import_lucide_react = require("lucide-react");
28
- var import_react = require("react");
29
- var ControlInput = (0, import_react.memo)(
30
- ({ value, onChange, onValueChanging, onChangeEnd, ...props }) => {
31
- const [input, setInput] = (0, import_react.useState)(value || "");
32
- const inputRef = (0, import_react.useRef)(null);
33
- const isChineseInput = (0, import_react.useRef)(false);
34
- const isFocusing = (0, import_react.useRef)(false);
35
- const updateValue = (0, import_react.useCallback)(() => {
36
- onChange == null ? void 0 : onChange(input);
37
- }, [input]);
38
- (0, import_react.useEffect)(() => {
39
- if (typeof value !== "undefined")
40
- setInput(value);
41
- }, [value]);
42
- return /* @__PURE__ */ React.createElement(
43
- import__.Input,
44
- {
45
- ref: inputRef,
46
- ...props,
47
- value: input,
48
- onCompositionStart: () => {
49
- isChineseInput.current = true;
50
- },
51
- onCompositionEnd: () => {
52
- isChineseInput.current = false;
53
- },
54
- onFocus: () => {
55
- isFocusing.current = true;
56
- },
57
- onBlur: () => {
58
- isFocusing.current = false;
59
- onChangeEnd == null ? void 0 : onChangeEnd(input);
60
- },
61
- onChange: (e) => {
62
- setInput(e.target.value);
63
- onValueChanging == null ? void 0 : onValueChanging(e.target.value);
64
- },
65
- onPressEnter: (e) => {
66
- if (!e.shiftKey && !isChineseInput.current) {
67
- e.preventDefault();
68
- updateValue();
69
- isFocusing.current = false;
70
- onChangeEnd == null ? void 0 : onChangeEnd(input);
71
- }
72
- },
73
- suffix: value === input ? /* @__PURE__ */ React.createElement("span", null) : /* @__PURE__ */ React.createElement(import_antd.ConfigProvider, { theme: { token: { fontSize: 14 } } }, /* @__PURE__ */ React.createElement(import_antd.Space, { size: 2 }, /* @__PURE__ */ React.createElement(
74
- import__.ActionIcon,
75
- {
76
- title: "Reset",
77
- icon: import_lucide_react.RotateCcw,
78
- size: "small",
79
- onClick: () => {
80
- setInput(value);
81
- }
82
- }
83
- ), /* @__PURE__ */ React.createElement(import__.ActionIcon, { title: "✅ Save", icon: import_lucide_react.Save, size: "small", onClick: updateValue })))
7
+ exports.ControlInput = void 0;
8
+ var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
9
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
10
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
+ var _ = require("./..");
12
+ var _antd = require("antd");
13
+ var _lucideReact = require("lucide-react");
14
+ var _react = require("react");
15
+ var _jsxRuntime = require("react/jsx-runtime");
16
+ var _excluded = ["value", "onChange", "onValueChanging", "onChangeEnd"];
17
+ var ControlInput = /*#__PURE__*/(0, _react.memo)(function (_ref) {
18
+ var value = _ref.value,
19
+ onChange = _ref.onChange,
20
+ onValueChanging = _ref.onValueChanging,
21
+ onChangeEnd = _ref.onChangeEnd,
22
+ props = (0, _objectWithoutProperties2.default)(_ref, _excluded);
23
+ var _useState = (0, _react.useState)(value || ''),
24
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
25
+ input = _useState2[0],
26
+ setInput = _useState2[1];
27
+ var inputRef = (0, _react.useRef)(null);
28
+ var isChineseInput = (0, _react.useRef)(false);
29
+ var isFocusing = (0, _react.useRef)(false);
30
+ var updateValue = (0, _react.useCallback)(function () {
31
+ onChange === null || onChange === void 0 ? void 0 : onChange(input);
32
+ }, [input]);
33
+ (0, _react.useEffect)(function () {
34
+ if (typeof value !== 'undefined') setInput(value);
35
+ }, [value]);
36
+ return /*#__PURE__*/(0, _jsxRuntime.jsx)(_.Input, (0, _objectSpread2.default)((0, _objectSpread2.default)({
37
+ ref: inputRef
38
+ }, props), {}, {
39
+ value: input,
40
+ onCompositionStart: function onCompositionStart() {
41
+ isChineseInput.current = true;
42
+ },
43
+ onCompositionEnd: function onCompositionEnd() {
44
+ isChineseInput.current = false;
45
+ },
46
+ onFocus: function onFocus() {
47
+ isFocusing.current = true;
48
+ },
49
+ onBlur: function onBlur() {
50
+ isFocusing.current = false;
51
+ onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(input);
52
+ },
53
+ onChange: function onChange(e) {
54
+ setInput(e.target.value);
55
+ onValueChanging === null || onValueChanging === void 0 ? void 0 : onValueChanging(e.target.value);
56
+ },
57
+ onPressEnter: function onPressEnter(e) {
58
+ if (!e.shiftKey && !isChineseInput.current) {
59
+ e.preventDefault();
60
+ updateValue();
61
+ isFocusing.current = false;
62
+ onChangeEnd === null || onChangeEnd === void 0 ? void 0 : onChangeEnd(input);
84
63
  }
85
- );
86
- }
87
- );
88
- // Annotate the CommonJS export names for ESM import in node:
89
- 0 && (module.exports = {
90
- ControlInput
64
+ },
65
+ suffix: value === input ? /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {}) : /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.ConfigProvider, {
66
+ theme: {
67
+ token: {
68
+ fontSize: 14
69
+ }
70
+ },
71
+ children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Space, {
72
+ size: 2,
73
+ children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_.ActionIcon, {
74
+ title: "Reset",
75
+ icon: _lucideReact.RotateCcw,
76
+ size: "small",
77
+ onClick: function onClick() {
78
+ setInput(value);
79
+ }
80
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_.ActionIcon, {
81
+ title: "\u2705 Save",
82
+ icon: _lucideReact.Save,
83
+ size: "small",
84
+ onClick: updateValue
85
+ })]
86
+ })
87
+ })
88
+ }));
91
89
  });
90
+ exports.ControlInput = ControlInput;
@@ -1,44 +1,34 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/hooks/useCopied.ts
20
- var useCopied_exports = {};
21
- __export(useCopied_exports, {
22
- useCopied: () => useCopied
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
23
6
  });
24
- module.exports = __toCommonJS(useCopied_exports);
25
- var import_react = require("react");
26
- var useCopied = () => {
27
- const [copied, setCopy] = (0, import_react.useState)(false);
28
- (0, import_react.useEffect)(() => {
29
- if (!copied)
30
- return;
31
- const timer = setTimeout(() => {
7
+ exports.useCopied = void 0;
8
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
9
+ var _react = require("react");
10
+ var useCopied = function useCopied() {
11
+ var _useState = (0, _react.useState)(false),
12
+ _useState2 = (0, _slicedToArray2.default)(_useState, 2),
13
+ copied = _useState2[0],
14
+ setCopy = _useState2[1];
15
+ (0, _react.useEffect)(function () {
16
+ if (!copied) return;
17
+ var timer = setTimeout(function () {
32
18
  setCopy(false);
33
- }, 2e3);
34
- return () => {
19
+ }, 2000);
20
+ return function () {
35
21
  clearTimeout(timer);
36
22
  };
37
23
  }, [copied]);
38
- const setCopied = (0, import_react.useCallback)(() => setCopy(true), []);
39
- return (0, import_react.useMemo)(() => ({ copied, setCopied }), [copied]);
24
+ var setCopied = (0, _react.useCallback)(function () {
25
+ return setCopy(true);
26
+ }, []);
27
+ return (0, _react.useMemo)(function () {
28
+ return {
29
+ copied: copied,
30
+ setCopied: setCopied
31
+ };
32
+ }, [copied]);
40
33
  };
41
- // Annotate the CommonJS export names for ESM import in node:
42
- 0 && (module.exports = {
43
- useCopied
44
- });
34
+ exports.useCopied = useCopied;
@@ -1,76 +1,71 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
1
+ "use strict";
18
2
 
19
- // src/hooks/useHighlight.ts
20
- var useHighlight_exports = {};
21
- __export(useHighlight_exports, {
22
- languageMap: () => languageMap,
23
- useHighlight: () => useHighlight
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
24
6
  });
25
- module.exports = __toCommonJS(useHighlight_exports);
26
- var import_shiki_es = require("shiki-es");
27
- var import_zustand = require("zustand");
7
+ exports.useHighlight = exports.languageMap = void 0;
8
+ var _regeneratorRuntime2 = _interopRequireDefault(require("@babel/runtime/helpers/regeneratorRuntime"));
9
+ var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
10
+ var _shikiEs = require("shiki-es");
11
+ var _zustand = require("zustand");
28
12
  var THEME = {
29
- dark: "material-darker",
30
- light: "material-lighter"
13
+ dark: 'material-darker',
14
+ light: 'material-lighter'
31
15
  };
32
- var languageMap = [
33
- "javascript",
34
- "js",
35
- "jsx",
36
- "json",
37
- "markdown",
38
- "md",
39
- "less",
40
- "css",
41
- "typescript",
42
- "ts",
43
- "tsx",
44
- "diff",
45
- "bash"
46
- ];
47
- var useHighlight = (0, import_zustand.create)((set, get) => ({
48
- highlighter: void 0,
49
- initHighlighter: async () => {
50
- if (!get().highlighter) {
51
- const highlighter = await (0, import_shiki_es.getHighlighter)({
52
- langs: languageMap,
53
- themes: Object.values(THEME)
54
- });
55
- set({ highlighter });
56
- }
57
- },
58
- codeToHtml: (text, language, isDarkMode) => {
59
- const { highlighter } = get();
60
- if (!highlighter)
61
- return "";
62
- try {
63
- return highlighter == null ? void 0 : highlighter.codeToHtml(text, {
64
- lang: language,
65
- theme: isDarkMode ? THEME.dark : THEME.light
66
- });
67
- } catch (e) {
68
- return text;
16
+ var languageMap = ['javascript', 'js', 'jsx', 'json', 'markdown', 'md', 'less', 'css', 'typescript', 'ts', 'tsx', 'diff', 'bash'];
17
+
18
+ /**
19
+ * @title 代码高亮的存储对象
20
+ */
21
+ exports.languageMap = languageMap;
22
+ var useHighlight = (0, _zustand.create)(function (set, get) {
23
+ return {
24
+ highlighter: undefined,
25
+ initHighlighter: function () {
26
+ var _initHighlighter = (0, _asyncToGenerator2.default)( /*#__PURE__*/(0, _regeneratorRuntime2.default)().mark(function _callee() {
27
+ var highlighter;
28
+ return (0, _regeneratorRuntime2.default)().wrap(function _callee$(_context) {
29
+ while (1) switch (_context.prev = _context.next) {
30
+ case 0:
31
+ if (get().highlighter) {
32
+ _context.next = 5;
33
+ break;
34
+ }
35
+ _context.next = 3;
36
+ return (0, _shikiEs.getHighlighter)({
37
+ langs: languageMap,
38
+ themes: Object.values(THEME)
39
+ });
40
+ case 3:
41
+ highlighter = _context.sent;
42
+ set({
43
+ highlighter: highlighter
44
+ });
45
+ case 5:
46
+ case "end":
47
+ return _context.stop();
48
+ }
49
+ }, _callee);
50
+ }));
51
+ function initHighlighter() {
52
+ return _initHighlighter.apply(this, arguments);
53
+ }
54
+ return initHighlighter;
55
+ }(),
56
+ codeToHtml: function codeToHtml(text, language, isDarkMode) {
57
+ var _get = get(),
58
+ highlighter = _get.highlighter;
59
+ if (!highlighter) return '';
60
+ try {
61
+ return highlighter === null || highlighter === void 0 ? void 0 : highlighter.codeToHtml(text, {
62
+ lang: language,
63
+ theme: isDarkMode ? THEME.dark : THEME.light
64
+ });
65
+ } catch (e) {
66
+ return text;
67
+ }
69
68
  }
70
- }
71
- }));
72
- // Annotate the CommonJS export names for ESM import in node:
73
- 0 && (module.exports = {
74
- languageMap,
75
- useHighlight
69
+ };
76
70
  });
71
+ exports.useHighlight = useHighlight;