@lobehub/ui 1.165.8 → 1.166.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.
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { MermaidProps } from './type';
|
|
3
|
-
export
|
|
3
|
+
export interface MermaidFullFeaturedProps extends Omit<MermaidProps, 'children'> {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
content: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
|
+
export declare const MermaidFullFeatured: import("react").NamedExoticComponent<MermaidFullFeaturedProps>;
|
|
7
8
|
export default MermaidFullFeatured;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
-
var _excluded = ["showLanguage", "content", "children", "className", "copyable", "actionsRender", "style"];
|
|
2
|
+
var _excluded = ["showLanguage", "content", "children", "className", "copyable", "actionsRender", "style", "enablePanZoom", "fileName"];
|
|
3
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
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
5
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -13,14 +13,56 @@ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" !=
|
|
|
13
13
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
14
14
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
15
15
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
16
|
-
import { ChevronDown, ChevronRight } from 'lucide-react';
|
|
16
|
+
import { AlignVerticalSpaceAroundIcon, ChevronDown, ChevronRight, MinusIcon, PlusIcon } from 'lucide-react';
|
|
17
17
|
import { memo, useState } from 'react';
|
|
18
18
|
import { Flexbox } from 'react-layout-kit';
|
|
19
|
+
import { TransformComponent, TransformWrapper, useControls } from 'react-zoom-pan-pinch';
|
|
19
20
|
import ActionIcon from "../ActionIcon";
|
|
20
21
|
import CopyButton from "../CopyButton";
|
|
21
22
|
import { useStyles } from "./style";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
|
+
var Controls = function Controls() {
|
|
26
|
+
var _useControls = useControls(),
|
|
27
|
+
zoomIn = _useControls.zoomIn,
|
|
28
|
+
zoomOut = _useControls.zoomOut,
|
|
29
|
+
resetTransform = _useControls.resetTransform;
|
|
30
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
31
|
+
gap: 4,
|
|
32
|
+
horizontal: true,
|
|
33
|
+
style: {
|
|
34
|
+
bottom: 8,
|
|
35
|
+
position: 'absolute',
|
|
36
|
+
right: 8,
|
|
37
|
+
zIndex: 1
|
|
38
|
+
},
|
|
39
|
+
children: [/*#__PURE__*/_jsx(ActionIcon, {
|
|
40
|
+
active: true,
|
|
41
|
+
glass: true,
|
|
42
|
+
icon: PlusIcon,
|
|
43
|
+
onClick: function onClick() {
|
|
44
|
+
return zoomIn();
|
|
45
|
+
},
|
|
46
|
+
size: 'small'
|
|
47
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
48
|
+
active: true,
|
|
49
|
+
glass: true,
|
|
50
|
+
icon: MinusIcon,
|
|
51
|
+
onClick: function onClick() {
|
|
52
|
+
return zoomOut();
|
|
53
|
+
},
|
|
54
|
+
size: 'small'
|
|
55
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
56
|
+
active: true,
|
|
57
|
+
glass: true,
|
|
58
|
+
icon: AlignVerticalSpaceAroundIcon,
|
|
59
|
+
onClick: function onClick() {
|
|
60
|
+
return resetTransform();
|
|
61
|
+
},
|
|
62
|
+
size: 'small'
|
|
63
|
+
})]
|
|
64
|
+
});
|
|
65
|
+
};
|
|
24
66
|
export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
25
67
|
var showLanguage = _ref.showLanguage,
|
|
26
68
|
content = _ref.content,
|
|
@@ -29,6 +71,10 @@ export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
29
71
|
copyable = _ref.copyable,
|
|
30
72
|
actionsRender = _ref.actionsRender,
|
|
31
73
|
style = _ref.style,
|
|
74
|
+
_ref$enablePanZoom = _ref.enablePanZoom,
|
|
75
|
+
enablePanZoom = _ref$enablePanZoom === void 0 ? true : _ref$enablePanZoom,
|
|
76
|
+
_ref$fileName = _ref.fileName,
|
|
77
|
+
fileName = _ref$fileName === void 0 ? 'Mermaid' : _ref$fileName,
|
|
32
78
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
33
79
|
var _useState = useState(true),
|
|
34
80
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -79,9 +125,7 @@ export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
79
125
|
gap: 2,
|
|
80
126
|
horizontal: true,
|
|
81
127
|
justify: 'center',
|
|
82
|
-
children:
|
|
83
|
-
children: "mermaid"
|
|
84
|
-
})
|
|
128
|
+
children: fileName
|
|
85
129
|
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
86
130
|
align: 'center',
|
|
87
131
|
flex: 'none',
|
|
@@ -94,7 +138,13 @@ export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
94
138
|
height: 0,
|
|
95
139
|
overflow: 'hidden'
|
|
96
140
|
},
|
|
97
|
-
children:
|
|
141
|
+
children: enablePanZoom ? /*#__PURE__*/_jsxs(TransformWrapper, {
|
|
142
|
+
initialScale: 1,
|
|
143
|
+
children: [expand && /*#__PURE__*/_jsx(Controls, {}), /*#__PURE__*/_jsx(TransformComponent, {
|
|
144
|
+
wrapperClass: styles.zoomPanContainer,
|
|
145
|
+
children: children
|
|
146
|
+
})]
|
|
147
|
+
}) : children
|
|
98
148
|
})]
|
|
99
149
|
}));
|
|
100
150
|
});
|
package/es/Mermaid/style.d.ts
CHANGED
package/es/Mermaid/style.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7;
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5, _templateObject6, _templateObject7, _templateObject8;
|
|
2
2
|
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, type) {
|
|
@@ -17,6 +17,7 @@ export var useStyles = createStyles(function (_ref, type) {
|
|
|
17
17
|
header: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n padding-block: 4px;\n padding-inline: 8px;\n background: ", ";\n "])), token.colorFillQuaternary),
|
|
18
18
|
lang: cx(langHoverCls, stylish.blur, css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 8px;\n inset-inline-end: 0;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary)),
|
|
19
19
|
scroller: css(_templateObject6 || (_templateObject6 = _taggedTemplateLiteral(["\n overflow: auto;\n width: 100%;\n height: 100%;\n "]))),
|
|
20
|
-
select: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n user-select: none;\n\n position: absolute;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n\n min-width: 100px;\n\n font-size: 14px;\n color: ", ";\n text-align: center;\n .", "-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription, prefixCls, token.colorTextDescription)
|
|
20
|
+
select: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral(["\n user-select: none;\n\n position: absolute;\n inset-inline-start: 50%;\n transform: translateX(-50%);\n\n min-width: 100px;\n\n font-size: 14px;\n color: ", ";\n text-align: center;\n .", "-select-selection-item {\n min-width: 100px;\n padding-inline-end: 0 !important;\n color: ", ";\n text-align: center;\n }\n "])), token.colorTextDescription, prefixCls, token.colorTextDescription),
|
|
21
|
+
zoomPanContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n width: 100%;\n min-height: 240px;\n "])))
|
|
21
22
|
};
|
|
22
23
|
});
|
package/es/Mermaid/type.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export interface MermaidProps extends DivProps {
|
|
|
15
15
|
children: string;
|
|
16
16
|
copyButtonSize?: CopyButtonProps['size'];
|
|
17
17
|
copyable?: boolean;
|
|
18
|
+
enablePanZoom?: boolean;
|
|
19
|
+
fileName?: string;
|
|
18
20
|
fullFeatured?: boolean;
|
|
19
21
|
showLanguage?: boolean;
|
|
20
22
|
type?: 'ghost' | 'block' | 'pure';
|
package/es/Mermaid/useMermaid.js
CHANGED
|
@@ -26,17 +26,30 @@ export var useMermaid = function useMermaid(content) {
|
|
|
26
26
|
},
|
|
27
27
|
securityLevel: 'loose',
|
|
28
28
|
startOnLoad: true,
|
|
29
|
-
theme: theme.isDarkMode ? 'dark' : '
|
|
29
|
+
theme: theme.isDarkMode ? 'dark' : 'neutral',
|
|
30
30
|
themeVariables: {
|
|
31
|
-
errorBkgColor: theme.
|
|
32
|
-
errorTextColor: theme.
|
|
31
|
+
errorBkgColor: theme.colorErrorBg,
|
|
32
|
+
errorTextColor: theme.colorErrorText,
|
|
33
|
+
fontFamily: theme.fontFamily,
|
|
33
34
|
fontSize: 14,
|
|
34
|
-
lineColor: theme.
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
lineColor: theme.colorTextSecondary,
|
|
36
|
+
mainBkg: theme.colorBgContainer,
|
|
37
|
+
noteBkgColor: theme.colorInfoBg,
|
|
38
|
+
noteTextColor: theme.colorInfoText,
|
|
39
|
+
pie1: theme.geekblue,
|
|
40
|
+
pie2: theme.colorWarning,
|
|
41
|
+
pie3: theme.colorSuccess,
|
|
42
|
+
pie4: theme.colorError,
|
|
43
|
+
primaryBorderColor: theme.colorBorder,
|
|
44
|
+
primaryColor: theme.colorBgContainer,
|
|
37
45
|
primaryTextColor: theme.colorText,
|
|
38
|
-
|
|
39
|
-
|
|
46
|
+
secondaryBorderColor: theme.colorInfoBorder,
|
|
47
|
+
secondaryColor: theme.colorInfoBg,
|
|
48
|
+
secondaryTextColor: theme.colorInfoText,
|
|
49
|
+
tertiaryBorderColor: theme.colorSuccessBorder,
|
|
50
|
+
tertiaryColor: theme.colorSuccessBg,
|
|
51
|
+
tertiaryTextColor: theme.colorSuccessText,
|
|
52
|
+
textColor: theme.colorText
|
|
40
53
|
}
|
|
41
54
|
});
|
|
42
55
|
mermaid.contentLoaded();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.166.0",
|
|
4
4
|
"description": "Lobe UI is an open-source UI component library for building AIGC web apps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"react-markdown": "^9.1.0",
|
|
85
85
|
"react-merge-refs": "^2.1.1",
|
|
86
86
|
"react-rnd": "^10.5.2",
|
|
87
|
+
"react-zoom-pan-pinch": "^3.7.0",
|
|
87
88
|
"rehype-katex": "^7.0.1",
|
|
88
89
|
"rehype-raw": "^7.0.0",
|
|
89
90
|
"remark-breaks": "^4.0.0",
|