@lobehub/ui 1.1.0 → 1.3.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.
- package/README.md +6 -3
- package/es/ActionIcon/index.d.ts +28 -10
- package/es/ActionIcon/index.js +29 -50
- package/es/ActionIcon/style.d.ts +6 -0
- package/es/ActionIcon/style.js +12 -0
- package/es/CopyButton/index.d.ts +34 -0
- package/es/CopyButton/index.js +49 -0
- package/es/DraggablePanel/index.d.ts +64 -4
- package/es/DraggablePanel/index.js +4 -4
- package/es/DraggablePanel/style.js +1 -1
- package/es/DraggablePanel/utils.d.ts +1 -1
- package/es/EditableText/ControlInput.d.ts +9 -0
- package/es/EditableText/ControlInput.js +88 -0
- package/es/EditableText/index.d.ts +5 -0
- package/es/EditableText/index.js +35 -0
- package/es/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
- package/es/Highlighter/SyntaxHighlighter/Prism.js +40 -0
- package/es/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
- package/es/Highlighter/SyntaxHighlighter/index.js +58 -0
- package/es/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
- package/es/Highlighter/SyntaxHighlighter/style.js +15 -0
- package/es/Highlighter/index.d.ts +36 -0
- package/es/Highlighter/index.js +42 -0
- package/es/Highlighter/style.d.ts +5 -0
- package/es/Highlighter/style.js +18 -0
- package/es/Icon/index.d.ts +20 -0
- package/es/Icon/index.js +36 -0
- package/es/Logo/Divider.d.ts +3 -0
- package/es/Logo/Divider.js +22 -0
- package/es/Logo/Logo3D.d.ts +3 -4
- package/es/Logo/Logo3D.js +6 -4
- package/es/Logo/LogoFlat.d.ts +3 -4
- package/es/Logo/LogoFlat.js +6 -5
- package/es/Logo/LogoHighContrast.d.ts +3 -4
- package/es/Logo/LogoHighContrast.js +6 -5
- package/es/Logo/LogoText.d.ts +3 -4
- package/es/Logo/LogoText.js +6 -4
- package/es/Logo/index.d.ts +16 -4
- package/es/Logo/index.js +53 -9
- package/es/Logo/style.d.ts +4 -0
- package/es/Logo/style.js +10 -0
- package/es/Markdown/Code.d.ts +3 -0
- package/es/Markdown/Code.js +12 -0
- package/es/Markdown/CodeBlock.d.ts +3 -0
- package/es/Markdown/CodeBlock.js +27 -0
- package/es/Markdown/index.d.ts +13 -0
- package/es/Markdown/index.js +28 -0
- package/es/Markdown/style.d.ts +4 -0
- package/es/Markdown/style.js +12 -0
- package/es/MessageInput/index.d.ts +35 -0
- package/es/MessageInput/index.js +63 -0
- package/es/SearchBar/index.d.ts +5 -0
- package/es/SearchBar/index.js +27 -0
- package/es/SideNav/index.d.ts +15 -6
- package/es/SideNav/index.js +17 -20
- package/es/SideNav/style.d.ts +1 -0
- package/es/SideNav/style.js +8 -0
- package/es/Snippet/index.d.ts +29 -0
- package/es/Snippet/index.js +39 -0
- package/es/Snippet/style.d.ts +1 -0
- package/es/Snippet/style.js +9 -0
- package/es/StroyBook/index.d.ts +17 -0
- package/es/StroyBook/index.js +47 -0
- package/es/StroyBook/style.d.ts +8 -0
- package/es/StroyBook/style.js +14 -0
- package/es/Swatches/index.d.ts +8 -0
- package/es/Swatches/index.js +44 -0
- package/es/TabsNav/index.d.ts +22 -0
- package/es/{Template → TabsNav}/index.js +14 -9
- package/es/TabsNav/style.d.ts +3 -0
- package/es/TabsNav/style.js +14 -0
- package/es/ThemeProvider/GlobalStyle.js +1 -1
- package/es/ThemeProvider/index.d.ts +15 -0
- package/es/ThemeProvider/index.js +4 -0
- package/es/ThemeSwitch/index.d.ts +27 -0
- package/es/ThemeSwitch/index.js +60 -0
- package/es/Tooltip/index.d.ts +5 -0
- package/es/Tooltip/index.js +20 -0
- package/es/Tooltip/style.d.ts +3 -0
- package/es/Tooltip/style.js +10 -0
- package/es/hooks/useCopied.d.ts +4 -0
- package/es/hooks/useCopied.js +26 -0
- package/es/hooks/useHighlight.d.ts +36 -0
- package/es/hooks/useHighlight.js +63 -0
- package/es/index.d.ts +15 -3
- package/es/index.js +14 -2
- package/es/styles/theme/base.d.ts +2 -0
- package/es/styles/theme/base.js +15 -0
- package/es/styles/theme/dark.js +6 -14
- package/es/styles/theme/light.js +11 -12
- package/es/types/index.d.ts +14 -5
- package/lib/ActionIcon/index.d.ts +28 -10
- package/lib/ActionIcon/index.js +41 -83
- package/lib/ActionIcon/style.d.ts +6 -0
- package/lib/ActionIcon/style.js +64 -0
- package/lib/CopyButton/index.d.ts +34 -0
- package/lib/CopyButton/index.js +70 -0
- package/lib/DraggablePanel/index.d.ts +64 -4
- package/lib/DraggablePanel/index.js +160 -158
- package/lib/DraggablePanel/style.js +0 -1
- package/lib/DraggablePanel/utils.d.ts +1 -1
- package/lib/EditableText/ControlInput.d.ts +9 -0
- package/lib/EditableText/ControlInput.js +101 -0
- package/lib/EditableText/index.d.ts +5 -0
- package/lib/EditableText/index.js +52 -0
- package/lib/Highlighter/SyntaxHighlighter/Prism.d.ts +7 -0
- package/lib/Highlighter/SyntaxHighlighter/Prism.js +41 -0
- package/lib/Highlighter/SyntaxHighlighter/index.d.ts +5 -0
- package/lib/Highlighter/SyntaxHighlighter/index.js +55 -0
- package/lib/Highlighter/SyntaxHighlighter/style.d.ts +5 -0
- package/lib/Highlighter/SyntaxHighlighter/style.js +58 -0
- package/lib/Highlighter/index.d.ts +36 -0
- package/lib/Highlighter/index.js +62 -0
- package/lib/Highlighter/style.d.ts +5 -0
- package/lib/Highlighter/style.js +107 -0
- package/lib/Icon/index.d.ts +20 -0
- package/lib/Icon/index.js +49 -0
- package/lib/Logo/Divider.d.ts +3 -0
- package/lib/Logo/Divider.js +41 -0
- package/lib/Logo/Logo3D.d.ts +3 -4
- package/lib/Logo/Logo3D.js +4 -14
- package/lib/Logo/LogoFlat.d.ts +3 -4
- package/lib/Logo/LogoFlat.js +18 -28
- package/lib/Logo/LogoHighContrast.d.ts +3 -4
- package/lib/Logo/LogoHighContrast.js +8 -31
- package/lib/Logo/LogoText.d.ts +3 -4
- package/lib/Logo/LogoText.js +5 -15
- package/lib/Logo/index.d.ts +16 -4
- package/lib/Logo/index.js +18 -8
- package/lib/Logo/style.d.ts +4 -0
- package/lib/Logo/style.js +41 -0
- package/lib/Markdown/Code.d.ts +3 -0
- package/lib/Markdown/Code.js +33 -0
- package/lib/Markdown/CodeBlock.d.ts +3 -0
- package/lib/Markdown/CodeBlock.js +64 -0
- package/lib/Markdown/index.d.ts +13 -0
- package/lib/Markdown/index.js +48 -0
- package/lib/Markdown/style.d.ts +4 -0
- package/lib/Markdown/style.js +64 -0
- package/lib/MessageInput/index.d.ts +35 -0
- package/lib/MessageInput/index.js +58 -0
- package/lib/SearchBar/index.d.ts +5 -0
- package/lib/SearchBar/index.js +42 -0
- package/lib/SideNav/index.d.ts +15 -6
- package/lib/SideNav/index.js +7 -31
- package/lib/SideNav/style.d.ts +1 -0
- package/lib/SideNav/style.js +46 -0
- package/lib/Snippet/index.d.ts +29 -0
- package/lib/{Template → Snippet}/index.js +16 -10
- package/lib/Snippet/style.d.ts +1 -0
- package/lib/Snippet/style.js +71 -0
- package/lib/StroyBook/index.d.ts +17 -0
- package/lib/StroyBook/index.js +65 -0
- package/lib/StroyBook/style.d.ts +8 -0
- package/lib/StroyBook/style.js +81 -0
- package/lib/Swatches/index.d.ts +8 -0
- package/lib/Swatches/index.js +68 -0
- package/lib/TabsNav/index.d.ts +22 -0
- package/lib/TabsNav/index.js +34 -0
- package/lib/TabsNav/style.d.ts +3 -0
- package/lib/TabsNav/style.js +65 -0
- package/lib/ThemeProvider/GlobalStyle.js +10 -4
- package/lib/ThemeProvider/index.d.ts +15 -0
- package/lib/ThemeProvider/index.js +1 -1
- package/lib/ThemeSwitch/index.d.ts +27 -0
- package/lib/ThemeSwitch/index.js +50 -0
- package/lib/Tooltip/index.d.ts +5 -0
- package/lib/Tooltip/index.js +34 -0
- package/lib/Tooltip/style.d.ts +3 -0
- package/lib/Tooltip/style.js +51 -0
- package/lib/hooks/useCopied.d.ts +4 -0
- package/lib/hooks/useCopied.js +44 -0
- package/lib/hooks/useHighlight.d.ts +36 -0
- package/lib/hooks/useHighlight.js +76 -0
- package/lib/index.d.ts +15 -3
- package/lib/index.js +47 -5
- package/lib/styles/theme/base.d.ts +2 -0
- package/lib/styles/theme/base.js +43 -0
- package/lib/styles/theme/dark.js +5 -12
- package/lib/styles/theme/light.js +10 -10
- package/lib/types/index.d.ts +14 -5
- package/package.json +18 -9
- package/es/Template/index.d.ts +0 -7
- package/es/ThemeProvider/token.d.ts +0 -3
- package/es/ThemeProvider/token.js +0 -45
- package/es/types/index.js +0 -1
- package/lib/Template/index.d.ts +0 -7
- package/lib/ThemeProvider/token.d.ts +0 -3
- package/lib/ThemeProvider/token.js +0 -73
- package/lib/types/index.js +0 -17
|
@@ -0,0 +1,68 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/Swatches/index.tsx
|
|
20
|
+
var Swatches_exports = {};
|
|
21
|
+
__export(Swatches_exports, {
|
|
22
|
+
default: () => Swatches_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Swatches_exports);
|
|
25
|
+
var import_antd_style = require("antd-style");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_react_layout_kit = require("react-layout-kit");
|
|
28
|
+
var Swatches = (0, import_react.memo)(({ colors, activeColor, onSelect }) => {
|
|
29
|
+
const theme = (0, import_antd_style.useTheme)();
|
|
30
|
+
return /* @__PURE__ */ React.createElement(import_react_layout_kit.Flexbox, { horizontal: true, gap: 8 }, /* @__PURE__ */ React.createElement(
|
|
31
|
+
import_react_layout_kit.Flexbox,
|
|
32
|
+
{
|
|
33
|
+
style: {
|
|
34
|
+
width: 24,
|
|
35
|
+
height: 24,
|
|
36
|
+
background: theme.colorBgContainer,
|
|
37
|
+
boxShadow: `inset 0 0 0px 2px ${!activeColor ? theme.colorPrimary : "rgba(0,0,0,0.1)"}`,
|
|
38
|
+
borderRadius: "50%",
|
|
39
|
+
cursor: "pointer"
|
|
40
|
+
},
|
|
41
|
+
onClick: () => {
|
|
42
|
+
onSelect == null ? void 0 : onSelect(null);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
), colors.map((c) => {
|
|
46
|
+
const borderColor = c === activeColor ? theme.colorPrimary : "rgba(0,0,0,0.1)";
|
|
47
|
+
return /* @__PURE__ */ React.createElement(
|
|
48
|
+
import_react_layout_kit.Flexbox,
|
|
49
|
+
{
|
|
50
|
+
key: c,
|
|
51
|
+
style: {
|
|
52
|
+
width: 24,
|
|
53
|
+
height: 24,
|
|
54
|
+
background: c,
|
|
55
|
+
boxShadow: `inset 0 0 0px 2px ${borderColor}`,
|
|
56
|
+
borderRadius: "50%",
|
|
57
|
+
cursor: "pointer"
|
|
58
|
+
},
|
|
59
|
+
onClick: () => {
|
|
60
|
+
onSelect == null ? void 0 : onSelect(c);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}));
|
|
65
|
+
});
|
|
66
|
+
var Swatches_default = Swatches;
|
|
67
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
68
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { TabsProps } from 'antd';
|
|
3
|
+
export interface TabsNavProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description Additional className to apply to the component
|
|
6
|
+
*/
|
|
7
|
+
className?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @description Callback function that is triggered when a tab is changed
|
|
10
|
+
*/
|
|
11
|
+
onChange?: (activeKey: string) => void;
|
|
12
|
+
/**
|
|
13
|
+
* @description An array of objects representing the tabs to be rendered
|
|
14
|
+
*/
|
|
15
|
+
items?: TabsProps['items'];
|
|
16
|
+
/**
|
|
17
|
+
* @description The key of the active tab
|
|
18
|
+
*/
|
|
19
|
+
activeKey?: TabsProps['activeKey'];
|
|
20
|
+
}
|
|
21
|
+
declare const TabsNav: import("react").NamedExoticComponent<TabsNavProps>;
|
|
22
|
+
export default TabsNav;
|
|
@@ -0,0 +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);
|
|
18
|
+
|
|
19
|
+
// src/TabsNav/index.tsx
|
|
20
|
+
var TabsNav_exports = {};
|
|
21
|
+
__export(TabsNav_exports, {
|
|
22
|
+
default: () => TabsNav_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(TabsNav_exports);
|
|
25
|
+
var import_antd = require("antd");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_style = require("./style");
|
|
28
|
+
var TabsNav = (0, import_react.memo)(({ className, ...props }) => {
|
|
29
|
+
const { styles, cx } = (0, import_style.useStyles)();
|
|
30
|
+
return /* @__PURE__ */ React.createElement(import_antd.Tabs, { className: cx(styles.tabs, className), ...props });
|
|
31
|
+
});
|
|
32
|
+
var TabsNav_default = TabsNav;
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,65 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/TabsNav/style.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
useStyles: () => useStyles
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_antd_style = require("antd-style");
|
|
26
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, token, prefixCls }) => {
|
|
27
|
+
const prefix = `.${prefixCls}-tabs`;
|
|
28
|
+
const marginHoriz = 16;
|
|
29
|
+
const paddingVertical = 6;
|
|
30
|
+
return {
|
|
31
|
+
tabs: css`
|
|
32
|
+
${prefix}-tab + ${prefix}-tab {
|
|
33
|
+
margin: ${marginHoriz}px 4px !important;
|
|
34
|
+
padding: 0 12px !important;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
${prefix}-tab {
|
|
38
|
+
color: ${token.colorTextSecondary};
|
|
39
|
+
transition: background-color 100ms ease-out;
|
|
40
|
+
|
|
41
|
+
&:first-child {
|
|
42
|
+
margin: ${marginHoriz}px 4px ${marginHoriz}px 0;
|
|
43
|
+
padding: ${paddingVertical}px 12px !important;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&:hover {
|
|
47
|
+
color: ${token.colorText} !important;
|
|
48
|
+
background: ${token.colorFillTertiary};
|
|
49
|
+
border-radius: ${token.borderRadius}px;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
${prefix}-nav {
|
|
54
|
+
margin-bottom: 0;
|
|
55
|
+
&::before {
|
|
56
|
+
display: none;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
`
|
|
60
|
+
};
|
|
61
|
+
});
|
|
62
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
63
|
+
0 && (module.exports = {
|
|
64
|
+
useStyles
|
|
65
|
+
});
|
|
@@ -26,8 +26,8 @@ var import_antd_style = require("antd-style");
|
|
|
26
26
|
var GlobalStyle = import_antd_style.createGlobalStyle`
|
|
27
27
|
|
|
28
28
|
body {
|
|
29
|
-
font-family:
|
|
30
|
-
font-size: ${({ theme }) => theme.fontSize};
|
|
29
|
+
font-family: ${({ theme }) => theme.fontFamily};
|
|
30
|
+
font-size: ${({ theme }) => theme.fontSize}px;
|
|
31
31
|
line-height: 1;
|
|
32
32
|
color: ${({ theme }) => theme.colorTextBase};
|
|
33
33
|
|
|
@@ -35,12 +35,18 @@ var GlobalStyle = import_antd_style.createGlobalStyle`
|
|
|
35
35
|
padding: 0;
|
|
36
36
|
background-color: ${(p) => p.theme.colorBgLayout};
|
|
37
37
|
|
|
38
|
+
-webkit-font-smoothing: antialiased;
|
|
39
|
+
-moz-osx-font-smoothing: grayscale;
|
|
38
40
|
}
|
|
39
41
|
|
|
40
42
|
* {
|
|
41
43
|
box-sizing: border-box;
|
|
42
44
|
}
|
|
43
45
|
|
|
46
|
+
#root {
|
|
47
|
+
min-height: 100vh;
|
|
48
|
+
}
|
|
49
|
+
|
|
44
50
|
@font-face {
|
|
45
51
|
font-family: AliPuHui;
|
|
46
52
|
font-weight: normal;
|
|
@@ -60,8 +66,8 @@ var GlobalStyle = import_antd_style.createGlobalStyle`
|
|
|
60
66
|
|
|
61
67
|
/* 定义滚动槽的样式 */
|
|
62
68
|
::-webkit-scrollbar {
|
|
63
|
-
width:
|
|
64
|
-
height:
|
|
69
|
+
width: 0;
|
|
70
|
+
height: 4px;
|
|
65
71
|
margin-right: 4px;
|
|
66
72
|
background-color: transparent; // 定义滚动槽的背景色
|
|
67
73
|
|
|
@@ -1,10 +1,25 @@
|
|
|
1
1
|
import { extractStaticStyle, type ThemeMode } from 'antd-style';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
export interface ThemeProviderProps {
|
|
4
|
+
/**
|
|
5
|
+
* @description Custom tokens to be used in the theme
|
|
6
|
+
*/
|
|
4
7
|
token?: any;
|
|
8
|
+
/**
|
|
9
|
+
* @description The children of the ThemeProvider component
|
|
10
|
+
*/
|
|
5
11
|
children: React.ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* @description The mode of the theme (light or dark)
|
|
14
|
+
*/
|
|
6
15
|
themeMode?: ThemeMode;
|
|
16
|
+
/**
|
|
17
|
+
* @description Whether to inline the styles on server-side rendering or not
|
|
18
|
+
*/
|
|
7
19
|
ssrInline?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* @description Cache for the extracted static styles
|
|
22
|
+
*/
|
|
8
23
|
cache?: typeof extractStaticStyle.cache;
|
|
9
24
|
}
|
|
10
25
|
declare const ThemeProvider: React.FC<ThemeProviderProps>;
|
|
@@ -60,7 +60,7 @@ var ThemeProvider = ({ token, children, themeMode }) => {
|
|
|
60
60
|
customToken: getCustomToken
|
|
61
61
|
},
|
|
62
62
|
/* @__PURE__ */ import_react.default.createElement(import_GlobalStyle.default, null),
|
|
63
|
-
/* @__PURE__ */ import_react.default.createElement(import_antd.App,
|
|
63
|
+
/* @__PURE__ */ import_react.default.createElement(import_antd.App, { style: { minHeight: "inherit", width: "inherit" } }, children)
|
|
64
64
|
));
|
|
65
65
|
};
|
|
66
66
|
var ThemeProvider_default = ThemeProvider;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { type ActionIconSize } from "..";
|
|
3
|
+
import { ThemeMode } from 'antd-style';
|
|
4
|
+
import { DivProps } from "../types";
|
|
5
|
+
export interface ThemeSwitchProps extends DivProps {
|
|
6
|
+
/**
|
|
7
|
+
* @description Size of the action icon
|
|
8
|
+
* @default {
|
|
9
|
+
* blockSize: 34,
|
|
10
|
+
* fontSize: 20,
|
|
11
|
+
* strokeWidth: 1.5,
|
|
12
|
+
* }
|
|
13
|
+
*/
|
|
14
|
+
size?: ActionIconSize;
|
|
15
|
+
/**
|
|
16
|
+
* @description The theme mode of the component
|
|
17
|
+
* @type ThemeMode
|
|
18
|
+
*/
|
|
19
|
+
themeMode: ThemeMode;
|
|
20
|
+
/**
|
|
21
|
+
* @description Callback function when the theme mode is switched
|
|
22
|
+
* @type {(themeMode: ThemeMode) => void}
|
|
23
|
+
*/
|
|
24
|
+
onThemeSwitch: (themeMode: ThemeMode) => void;
|
|
25
|
+
}
|
|
26
|
+
declare const ThemeSwitch: import("react").NamedExoticComponent<ThemeSwitchProps>;
|
|
27
|
+
export default ThemeSwitch;
|
|
@@ -0,0 +1,50 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/ThemeSwitch/index.tsx
|
|
20
|
+
var ThemeSwitch_exports = {};
|
|
21
|
+
__export(ThemeSwitch_exports, {
|
|
22
|
+
default: () => ThemeSwitch_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(ThemeSwitch_exports);
|
|
25
|
+
var import_ui = require("..");
|
|
26
|
+
var import_antd = require("antd");
|
|
27
|
+
var import_lucide_react = require("lucide-react");
|
|
28
|
+
var import_react = require("react");
|
|
29
|
+
var icons = {
|
|
30
|
+
auto: import_lucide_react.Monitor,
|
|
31
|
+
light: import_lucide_react.Sun,
|
|
32
|
+
dark: import_lucide_react.Moon
|
|
33
|
+
};
|
|
34
|
+
var items = [
|
|
35
|
+
{ label: "System", icon: /* @__PURE__ */ React.createElement(import_ui.Icon, { size: "small", icon: icons.auto }), key: "auto" },
|
|
36
|
+
{ label: "Light", icon: /* @__PURE__ */ React.createElement(import_ui.Icon, { size: "small", icon: icons.light }), key: "light" },
|
|
37
|
+
{ label: "Dark", icon: /* @__PURE__ */ React.createElement(import_ui.Icon, { size: "small", icon: icons.dark }), key: "dark" }
|
|
38
|
+
];
|
|
39
|
+
var ThemeSwitch = (0, import_react.memo)(
|
|
40
|
+
({ size = "site", themeMode, onThemeSwitch, ...props }) => {
|
|
41
|
+
const menuProps = {
|
|
42
|
+
items,
|
|
43
|
+
onClick: (e) => onThemeSwitch(e.key)
|
|
44
|
+
};
|
|
45
|
+
return /* @__PURE__ */ React.createElement(import_antd.Dropdown, { menu: menuProps, trigger: ["click"], ...props }, /* @__PURE__ */ React.createElement(import_ui.ActionIcon, { size, icon: icons[themeMode] }));
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
var ThemeSwitch_default = ThemeSwitch;
|
|
49
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
50
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +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);
|
|
18
|
+
|
|
19
|
+
// src/Tooltip/index.tsx
|
|
20
|
+
var Tooltip_exports = {};
|
|
21
|
+
__export(Tooltip_exports, {
|
|
22
|
+
default: () => Tooltip_default
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(Tooltip_exports);
|
|
25
|
+
var import_antd = require("antd");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_style = require("./style");
|
|
28
|
+
var Tooltip = (0, import_react.memo)(({ className, ...props }) => {
|
|
29
|
+
const { styles, cx } = (0, import_style.useStyles)();
|
|
30
|
+
return /* @__PURE__ */ React.createElement(import_antd.Tooltip, { overlayClassName: cx(styles.tooltip, className), ...props });
|
|
31
|
+
});
|
|
32
|
+
var Tooltip_default = Tooltip;
|
|
33
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
34
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,51 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/Tooltip/style.ts
|
|
20
|
+
var style_exports = {};
|
|
21
|
+
__export(style_exports, {
|
|
22
|
+
useStyles: () => useStyles
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(style_exports);
|
|
25
|
+
var import_antd_style = require("antd-style");
|
|
26
|
+
var useStyles = (0, import_antd_style.createStyles)(({ css, token }) => {
|
|
27
|
+
return {
|
|
28
|
+
tooltip: css`
|
|
29
|
+
.ant-tooltip-inner {
|
|
30
|
+
background-color: ${token.colorText};
|
|
31
|
+
color: ${token.colorBgLayout};
|
|
32
|
+
padding: 4px 8px;
|
|
33
|
+
border-radius: ${token.borderRadiusSM}px;
|
|
34
|
+
min-height: unset;
|
|
35
|
+
display: flex;
|
|
36
|
+
align-items: center;
|
|
37
|
+
justify-content: center;
|
|
38
|
+
}
|
|
39
|
+
.ant-tooltip-arrow {
|
|
40
|
+
&:before,
|
|
41
|
+
&:after {
|
|
42
|
+
background: ${token.colorText};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
`
|
|
46
|
+
};
|
|
47
|
+
});
|
|
48
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
49
|
+
0 && (module.exports = {
|
|
50
|
+
useStyles
|
|
51
|
+
});
|
|
@@ -0,0 +1,44 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useCopied.ts
|
|
20
|
+
var useCopied_exports = {};
|
|
21
|
+
__export(useCopied_exports, {
|
|
22
|
+
useCopied: () => useCopied
|
|
23
|
+
});
|
|
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(() => {
|
|
32
|
+
setCopy(false);
|
|
33
|
+
}, 2e3);
|
|
34
|
+
return () => {
|
|
35
|
+
clearTimeout(timer);
|
|
36
|
+
};
|
|
37
|
+
}, [copied]);
|
|
38
|
+
const setCopied = (0, import_react.useCallback)(() => setCopy(true), []);
|
|
39
|
+
return (0, import_react.useMemo)(() => ({ copied, setCopied }), [copied]);
|
|
40
|
+
};
|
|
41
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
+
0 && (module.exports = {
|
|
43
|
+
useCopied
|
|
44
|
+
});
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Highlighter, Theme } from 'shiki-es';
|
|
2
|
+
export interface ShikiSyntaxTheme {
|
|
3
|
+
/**
|
|
4
|
+
* @title 暗色模式主题
|
|
5
|
+
*/
|
|
6
|
+
dark: Theme;
|
|
7
|
+
/**
|
|
8
|
+
* @title 亮色模式主题
|
|
9
|
+
*/
|
|
10
|
+
light: Theme;
|
|
11
|
+
}
|
|
12
|
+
export declare const languageMap: readonly ["javascript", "js", "jsx", "json", "markdown", "md", "less", "css", "typescript", "ts", "tsx", "diff", "bash"];
|
|
13
|
+
/**
|
|
14
|
+
* @title 代码高亮的存储对象
|
|
15
|
+
*/
|
|
16
|
+
interface Store {
|
|
17
|
+
/**
|
|
18
|
+
* @title 高亮器对象
|
|
19
|
+
*/
|
|
20
|
+
highlighter?: Highlighter;
|
|
21
|
+
/**
|
|
22
|
+
* @title 初始化高亮器对象
|
|
23
|
+
* @returns 初始化 Promise 对象
|
|
24
|
+
*/
|
|
25
|
+
initHighlighter: () => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* @title 将代码转化为 HTML 字符串
|
|
28
|
+
* @param text - 代码文本
|
|
29
|
+
* @param language - 代码语言
|
|
30
|
+
* @param isDarkMode - 是否为暗黑模式
|
|
31
|
+
* @returns HTML 字符串
|
|
32
|
+
*/
|
|
33
|
+
codeToHtml: (text: string, language: string, isDarkMode: boolean) => string;
|
|
34
|
+
}
|
|
35
|
+
export declare const useHighlight: import("zustand").UseBoundStore<import("zustand").StoreApi<Store>>;
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,76 @@
|
|
|
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);
|
|
18
|
+
|
|
19
|
+
// src/hooks/useHighlight.ts
|
|
20
|
+
var useHighlight_exports = {};
|
|
21
|
+
__export(useHighlight_exports, {
|
|
22
|
+
languageMap: () => languageMap,
|
|
23
|
+
useHighlight: () => useHighlight
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(useHighlight_exports);
|
|
26
|
+
var import_shiki_es = require("shiki-es");
|
|
27
|
+
var import_zustand = require("zustand");
|
|
28
|
+
var THEME = {
|
|
29
|
+
dark: "material-darker",
|
|
30
|
+
light: "material-lighter"
|
|
31
|
+
};
|
|
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;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
languageMap,
|
|
75
|
+
useHighlight
|
|
76
|
+
});
|
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
|
-
export { default as ActionIcon, type ActionIconProps } from './ActionIcon';
|
|
1
|
+
export { default as ActionIcon, type ActionIconProps, type ActionIconSize } from './ActionIcon';
|
|
2
|
+
export { default as CopyButton, type CopyButtonProps } from './CopyButton';
|
|
2
3
|
export { default as DraggablePanel, type DraggablePanelProps } from './DraggablePanel';
|
|
3
|
-
export { default as
|
|
4
|
+
export { default as EditableText, type EditableTextProps } from './EditableText';
|
|
5
|
+
export { default as Highlighter, SyntaxHighlighter, type HighlighterProps, type SyntaxHighlighterProps, } from './Highlighter';
|
|
6
|
+
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
|
7
|
+
export { default as Logo, type LogoProps } from './Logo';
|
|
8
|
+
export { default as Markdown, type MarkdownProps } from './Markdown';
|
|
9
|
+
export { default as MessageInput, type MessageInputProps } from './MessageInput';
|
|
10
|
+
export { default as SearchBar, type SearchBarProps } from './SearchBar';
|
|
4
11
|
export { default as SideNav, type SideNavProps } from './SideNav';
|
|
5
|
-
export { default as
|
|
12
|
+
export { default as Snippet, type SnippetProps } from './Snippet';
|
|
13
|
+
export { default as StroyBook, useControls, useCreateStore, type StroyBookProps, } from './StroyBook';
|
|
14
|
+
export { default as Swatches, type SwatchesProps } from './Swatches';
|
|
15
|
+
export { default as TabsNav, type TabsNavProps } from './TabsNav';
|
|
6
16
|
export { default as ThemeProvider } from './ThemeProvider';
|
|
17
|
+
export { default as ThemeSwitch, type ThemeSwitchProps } from './ThemeSwitch';
|
|
18
|
+
export { default as Tooltip, type TooltipProps } from './Tooltip';
|