@lobehub/ui 1.119.4 → 1.120.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/es/ActionIcon/index.d.ts +1 -0
- package/es/ActionIcon/index.js +4 -3
- package/es/ActionIcon/style.d.ts +2 -0
- package/es/ActionIcon/style.js +5 -3
- package/es/Image/ImageGallery.d.ts +9 -0
- package/es/Image/ImageGallery.js +21 -0
- package/es/Image/Preview.d.ts +6 -0
- package/es/Image/Preview.js +24 -0
- package/es/Image/index.d.ts +10 -0
- package/es/Image/index.js +64 -0
- package/es/Image/style.d.ts +10 -0
- package/es/Image/style.js +24 -0
- package/es/Image/usePreview.d.ts +3 -0
- package/es/Image/usePreview.js +95 -0
- package/es/Markdown/index.js +5 -23
- package/es/ThemeProvider/GlobalStyle/antdOverride.js +2 -2
- package/es/index.d.ts +2 -0
- package/es/index.js +2 -0
- package/package.json +1 -1
package/es/ActionIcon/index.d.ts
CHANGED
package/es/ActionIcon/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay", "fillOpacity", "fillRule", "focusable"];
|
|
3
|
+
var _excluded = ["color", "fill", "className", "active", "icon", "size", "style", "glass", "title", "placement", "arrow", "spotlight", "onClick", "children", "loading", "tooltipDelay", "fillOpacity", "fillRule", "focusable", "disable"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
6
|
import { Loader2 } from 'lucide-react';
|
|
@@ -35,6 +35,7 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
35
35
|
fillOpacity = _ref.fillOpacity,
|
|
36
36
|
fillRule = _ref.fillRule,
|
|
37
37
|
focusable = _ref.focusable,
|
|
38
|
+
disable = _ref.disable,
|
|
38
39
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
39
40
|
var _useStyles = useStyles({
|
|
40
41
|
active: Boolean(active),
|
|
@@ -65,8 +66,8 @@ var ActionIcon = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
65
66
|
spin: true
|
|
66
67
|
}));
|
|
67
68
|
var actionIconBlock = /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
68
|
-
className: cx(styles.block, className),
|
|
69
|
-
onClick: loading ? undefined : onClick,
|
|
69
|
+
className: cx(styles.block, disable ? styles.disabled : styles.normal, className),
|
|
70
|
+
onClick: loading || disable ? undefined : onClick,
|
|
70
71
|
ref: ref,
|
|
71
72
|
style: _objectSpread({
|
|
72
73
|
borderRadius: borderRadius,
|
package/es/ActionIcon/style.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export declare const useStyles: (props?: {
|
|
|
3
3
|
glass: boolean;
|
|
4
4
|
} | undefined) => import("antd-style").ReturnStyles<{
|
|
5
5
|
block: string;
|
|
6
|
+
disabled: import("antd-style").SerializedStyles;
|
|
6
7
|
icon: import("antd-style").SerializedStyles;
|
|
8
|
+
normal: import("antd-style").SerializedStyles;
|
|
7
9
|
}>;
|
package/es/ActionIcon/style.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
-
var _templateObject, _templateObject2;
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
4
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
5
|
var css = _ref.css,
|
|
@@ -9,7 +9,9 @@ export var useStyles = createStyles(function (_ref, _ref2) {
|
|
|
9
9
|
var active = _ref2.active,
|
|
10
10
|
glass = _ref2.glass;
|
|
11
11
|
return {
|
|
12
|
-
block: cx(glass && stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n
|
|
13
|
-
|
|
12
|
+
block: cx(glass && stylish.blur, css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n\n display: flex;\n flex: none;\n align-items: center;\n justify-content: center;\n\n color: ", ";\n\n background: ", ";\n\n transition:\n color 600ms ", ",\n scale 400ms ", ",\n background-color 100ms ", ";\n "])), active ? token.colorText : token.colorTextTertiary, active ? token.colorFillTertiary : 'transparent', token.motionEaseOut, token.motionEaseOut, token.motionEaseOut)),
|
|
13
|
+
disabled: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: not-allowed;\n opacity: 0.5;\n "]))),
|
|
14
|
+
icon: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n transition: scale 400ms ", ";\n\n &:active {\n scale: 0.8;\n }\n "])), token.motionEaseOut),
|
|
15
|
+
normal: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n cursor: pointer;\n\n &:hover {\n color: ", ";\n background-color: ", ";\n }\n\n &:active {\n color: ", ";\n background-color: ", ";\n }\n "])), token.colorText, token.colorFillSecondary, token.colorText, token.colorFill)
|
|
14
16
|
};
|
|
15
17
|
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ImageProps } from 'antd';
|
|
2
|
+
import { PropsWithChildren } from 'react';
|
|
3
|
+
export interface ImageGalleryProps extends PropsWithChildren {
|
|
4
|
+
enable?: boolean;
|
|
5
|
+
items?: string[];
|
|
6
|
+
preview?: ImageProps['preview'];
|
|
7
|
+
}
|
|
8
|
+
declare const ImageGallery: import("react").NamedExoticComponent<ImageGalleryProps>;
|
|
9
|
+
export default ImageGallery;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Image } from 'antd';
|
|
2
|
+
import { memo } from 'react';
|
|
3
|
+
import usePreview from "./usePreview";
|
|
4
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
+
var PreviewGroup = Image.PreviewGroup;
|
|
6
|
+
var ImageGallery = /*#__PURE__*/memo(function (_ref) {
|
|
7
|
+
var items = _ref.items,
|
|
8
|
+
children = _ref.children,
|
|
9
|
+
_ref$enable = _ref.enable,
|
|
10
|
+
enable = _ref$enable === void 0 ? true : _ref$enable,
|
|
11
|
+
_ref$preview = _ref.preview,
|
|
12
|
+
preview = _ref$preview === void 0 ? {} : _ref$preview;
|
|
13
|
+
var mergePreivew = usePreview(preview);
|
|
14
|
+
if (!enable) return children;
|
|
15
|
+
return /*#__PURE__*/_jsx(PreviewGroup, {
|
|
16
|
+
items: items,
|
|
17
|
+
preview: mergePreivew,
|
|
18
|
+
children: children
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
export default ImageGallery;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { memo, useEffect, useRef } from 'react';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
var Preview = /*#__PURE__*/memo(function (_ref) {
|
|
4
|
+
var children = _ref.children,
|
|
5
|
+
visible = _ref.visible;
|
|
6
|
+
var ref = useRef();
|
|
7
|
+
useEffect(function () {
|
|
8
|
+
var handleDisableZoom = function handleDisableZoom(event) {
|
|
9
|
+
event.preventDefault();
|
|
10
|
+
};
|
|
11
|
+
if (visible) {
|
|
12
|
+
ref.current.addEventListener('wheel', handleDisableZoom, {
|
|
13
|
+
passive: false
|
|
14
|
+
});
|
|
15
|
+
} else {
|
|
16
|
+
ref.current.removeEventListener('wheel', handleDisableZoom);
|
|
17
|
+
}
|
|
18
|
+
}, [visible]);
|
|
19
|
+
return /*#__PURE__*/_jsx("div", {
|
|
20
|
+
ref: ref,
|
|
21
|
+
children: children
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
export default Preview;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ImageProps as AntImageProps } from 'antd';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
export interface ImageProps extends AntImageProps {
|
|
4
|
+
actions?: ReactNode;
|
|
5
|
+
isLoading?: boolean;
|
|
6
|
+
minSize?: number;
|
|
7
|
+
size?: number;
|
|
8
|
+
}
|
|
9
|
+
declare const Image: import("react").NamedExoticComponent<ImageProps>;
|
|
10
|
+
export default Image;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["wrapperClassName", "style", "preview", "isLoading", "minSize", "size", "actions"];
|
|
4
|
+
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; }
|
|
5
|
+
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; }
|
|
6
|
+
import { Image as AntImage, Skeleton } from 'antd';
|
|
7
|
+
import { Eye } from 'lucide-react';
|
|
8
|
+
import { memo } from 'react';
|
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
|
10
|
+
import Icon from "../Icon";
|
|
11
|
+
import usePreview from "./usePreview";
|
|
12
|
+
import { useStyles } from "./style";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
+
var Image = /*#__PURE__*/memo(function (_ref) {
|
|
16
|
+
var wrapperClassName = _ref.wrapperClassName,
|
|
17
|
+
style = _ref.style,
|
|
18
|
+
_ref$preview = _ref.preview,
|
|
19
|
+
preview = _ref$preview === void 0 ? {} : _ref$preview,
|
|
20
|
+
isLoading = _ref.isLoading,
|
|
21
|
+
_ref$minSize = _ref.minSize,
|
|
22
|
+
minSize = _ref$minSize === void 0 ? 64 : _ref$minSize,
|
|
23
|
+
_ref$size = _ref.size,
|
|
24
|
+
size = _ref$size === void 0 ? '100%' : _ref$size,
|
|
25
|
+
actions = _ref.actions,
|
|
26
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
27
|
+
var _useStyles = useStyles({
|
|
28
|
+
minSize: minSize,
|
|
29
|
+
size: size
|
|
30
|
+
}),
|
|
31
|
+
styles = _useStyles.styles,
|
|
32
|
+
cx = _useStyles.cx,
|
|
33
|
+
theme = _useStyles.theme;
|
|
34
|
+
var mergePreivew = usePreview(preview);
|
|
35
|
+
if (isLoading) return /*#__PURE__*/_jsx(Skeleton.Avatar, {
|
|
36
|
+
active: true,
|
|
37
|
+
style: {
|
|
38
|
+
borderRadius: theme.borderRadius,
|
|
39
|
+
height: size,
|
|
40
|
+
minHeight: minSize,
|
|
41
|
+
minWidth: minSize,
|
|
42
|
+
width: size
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
46
|
+
className: cx(styles.imageWrapper, wrapperClassName),
|
|
47
|
+
style: style,
|
|
48
|
+
children: [actions && /*#__PURE__*/_jsx("div", {
|
|
49
|
+
className: styles.actions,
|
|
50
|
+
children: actions
|
|
51
|
+
}), /*#__PURE__*/_jsx(AntImage, _objectSpread({
|
|
52
|
+
fallback: styles.imageOff,
|
|
53
|
+
loading: 'lazy',
|
|
54
|
+
preview: _objectSpread({
|
|
55
|
+
mask: actions ? /*#__PURE__*/_jsx("div", {}) : /*#__PURE__*/_jsx(Icon, {
|
|
56
|
+
icon: Eye,
|
|
57
|
+
size: 'normal'
|
|
58
|
+
})
|
|
59
|
+
}, mergePreivew),
|
|
60
|
+
wrapperClassName: styles.image
|
|
61
|
+
}, rest))]
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
export default Image;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const useStyles: (props?: {
|
|
2
|
+
minSize?: string | number | undefined;
|
|
3
|
+
size?: string | number | undefined;
|
|
4
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
5
|
+
actions: string;
|
|
6
|
+
image: import("antd-style").SerializedStyles;
|
|
7
|
+
imageOff: string;
|
|
8
|
+
imageWrapper: import("antd-style").SerializedStyles;
|
|
9
|
+
toolbar: string;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
|
+
import { createStyles } from 'antd-style';
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
|
+
export var useStyles = createStyles(function (_ref) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
token = _ref.token,
|
|
8
|
+
cx = _ref.cx,
|
|
9
|
+
stylish = _ref.stylish,
|
|
10
|
+
isDarkMode = _ref.isDarkMode;
|
|
11
|
+
var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
|
|
12
|
+
minSize = _ref2.minSize,
|
|
13
|
+
size = _ref2.size;
|
|
14
|
+
var SIZE = typeof size === 'number' ? "".concat(size, "px") : size;
|
|
15
|
+
var MIN_SIZE = typeof minSize === 'number' ? "".concat(minSize, "px") : minSize;
|
|
16
|
+
var actions = cx(css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: pointer;\n\n position: absolute;\n z-index: 1;\n top: 0;\n right: 0;\n\n opacity: 0;\n "]))));
|
|
17
|
+
return {
|
|
18
|
+
actions: actions,
|
|
19
|
+
image: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: relative;\n overflow: hidden;\n width: 100%;\n height: 100%;\n\n img {\n width: ", " !important;\n min-width: ", " !important;\n height: ", " !important;\n min-height: ", " !important;\n\n object-fit: contain;\n }\n "])), SIZE, MIN_SIZE, SIZE, MIN_SIZE),
|
|
20
|
+
imageOff: isDarkMode ? 'https://gw.alipayobjects.com/zos/kitchen/BpCkC%26aex5/image_off_dark.webp' : 'https://gw.alipayobjects.com/zos/kitchen/AYB4XBJBSA/image_off_light.webp',
|
|
21
|
+
imageWrapper: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n width: ", ";\n min-width: ", ";\n height: ", ";\n min-height: ", ";\n margin-block: 0 1em;\n\n background: ", ";\n border-radius: ", "px;\n box-shadow: 0 0 0 1px ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n }\n "])), SIZE, MIN_SIZE, SIZE, MIN_SIZE, rgba(token.colorBgLayout, 0.25), token.borderRadius, token.colorFillTertiary, actions),
|
|
22
|
+
toolbar: cx(stylish.blur, css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n padding: 4px;\n background: ", ";\n border-radius: ", "px;\n "])), rgba(token.colorBgMask, 0.1), token.borderRadiusLG))
|
|
23
|
+
};
|
|
24
|
+
});
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
+
var _excluded = ["onVisibleChange", "styles"];
|
|
5
|
+
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; }
|
|
6
|
+
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; }
|
|
7
|
+
import { FlipHorizontal, FlipVertical, RotateCcw, RotateCw, X, ZoomIn, ZoomOut } from 'lucide-react';
|
|
8
|
+
import { useState } from 'react';
|
|
9
|
+
import { Flexbox } from 'react-layout-kit';
|
|
10
|
+
import ActionIcon from "../ActionIcon";
|
|
11
|
+
import Icon from "../Icon";
|
|
12
|
+
import Preview from "./Preview";
|
|
13
|
+
import { useStyles } from "./style";
|
|
14
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
16
|
+
export var usePreview = function usePreview() {
|
|
17
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
18
|
+
_onVisibleChange = _ref.onVisibleChange,
|
|
19
|
+
_ref$styles = _ref.styles,
|
|
20
|
+
previewStyle = _ref$styles === void 0 ? {} : _ref$styles,
|
|
21
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
22
|
+
var _useState = useState(false),
|
|
23
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
24
|
+
visible = _useState2[0],
|
|
25
|
+
setVisible = _useState2[1];
|
|
26
|
+
var _useStyles = useStyles(),
|
|
27
|
+
styles = _useStyles.styles;
|
|
28
|
+
return _objectSpread({
|
|
29
|
+
closeIcon: /*#__PURE__*/_jsx(Icon, {
|
|
30
|
+
icon: X,
|
|
31
|
+
size: {
|
|
32
|
+
fontSize: 18,
|
|
33
|
+
strokeWidth: 3
|
|
34
|
+
}
|
|
35
|
+
}),
|
|
36
|
+
imageRender: function imageRender(node) {
|
|
37
|
+
return /*#__PURE__*/_jsx(Preview, {
|
|
38
|
+
visible: visible,
|
|
39
|
+
children: node
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
onVisibleChange: function onVisibleChange(e) {
|
|
43
|
+
setVisible(e);
|
|
44
|
+
_onVisibleChange === null || _onVisibleChange === void 0 || _onVisibleChange(e);
|
|
45
|
+
},
|
|
46
|
+
styles: _objectSpread({
|
|
47
|
+
mask: {
|
|
48
|
+
backdropFilter: 'blur(2px)'
|
|
49
|
+
}
|
|
50
|
+
}, previewStyle),
|
|
51
|
+
toolbarRender: function toolbarRender(_, _ref2) {
|
|
52
|
+
var scale = _ref2.transform.scale,
|
|
53
|
+
_ref2$actions = _ref2.actions,
|
|
54
|
+
onFlipY = _ref2$actions.onFlipY,
|
|
55
|
+
onFlipX = _ref2$actions.onFlipX,
|
|
56
|
+
onRotateLeft = _ref2$actions.onRotateLeft,
|
|
57
|
+
onRotateRight = _ref2$actions.onRotateRight,
|
|
58
|
+
onZoomOut = _ref2$actions.onZoomOut,
|
|
59
|
+
onZoomIn = _ref2$actions.onZoomIn;
|
|
60
|
+
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
61
|
+
className: styles.toolbar,
|
|
62
|
+
gap: 4,
|
|
63
|
+
horizontal: true,
|
|
64
|
+
children: [/*#__PURE__*/_jsx(ActionIcon, {
|
|
65
|
+
color: '#fff',
|
|
66
|
+
icon: FlipHorizontal,
|
|
67
|
+
onClick: onFlipX
|
|
68
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
69
|
+
color: '#fff',
|
|
70
|
+
icon: FlipVertical,
|
|
71
|
+
onClick: onFlipY
|
|
72
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
73
|
+
color: '#fff',
|
|
74
|
+
icon: RotateCcw,
|
|
75
|
+
onClick: onRotateLeft
|
|
76
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
77
|
+
color: '#fff',
|
|
78
|
+
icon: RotateCw,
|
|
79
|
+
onClick: onRotateRight
|
|
80
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
81
|
+
color: '#fff',
|
|
82
|
+
disable: scale === 1,
|
|
83
|
+
icon: ZoomOut,
|
|
84
|
+
onClick: onZoomOut
|
|
85
|
+
}), /*#__PURE__*/_jsx(ActionIcon, {
|
|
86
|
+
color: '#fff',
|
|
87
|
+
disable: scale === 50,
|
|
88
|
+
icon: ZoomIn,
|
|
89
|
+
onClick: onZoomIn
|
|
90
|
+
})]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
}, rest);
|
|
94
|
+
};
|
|
95
|
+
export default usePreview;
|
package/es/Markdown/index.js
CHANGED
|
@@ -3,14 +3,15 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["children", "className", "style", "fullFeaturedCodeBlock", "onDoubleClick"];
|
|
4
4
|
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; }
|
|
5
5
|
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; }
|
|
6
|
-
import { Collapse, Divider,
|
|
6
|
+
import { Collapse, Divider, Typography } from 'antd';
|
|
7
7
|
import { memo } from 'react';
|
|
8
8
|
import { ErrorBoundary } from 'react-error-boundary';
|
|
9
|
-
import { Flexbox } from 'react-layout-kit';
|
|
10
9
|
import ReactMarkdown from 'react-markdown';
|
|
11
10
|
import rehypeKatex from 'rehype-katex';
|
|
12
11
|
import remarkGfm from 'remark-gfm';
|
|
13
12
|
import remarkMath from 'remark-math';
|
|
13
|
+
import Image from "../Image";
|
|
14
|
+
import ImageGallery from "../Image/ImageGallery";
|
|
14
15
|
import { CodeFullFeatured, CodeLite } from "./CodeBlock";
|
|
15
16
|
import { useStyles } from "./style";
|
|
16
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -42,19 +43,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
43
|
});
|
|
43
44
|
},
|
|
44
45
|
img: function img(props) {
|
|
45
|
-
return /*#__PURE__*/_jsx(
|
|
46
|
-
className: styles.imageWrapper,
|
|
47
|
-
children: /*#__PURE__*/_jsx(Image, _objectSpread({
|
|
48
|
-
preview: {
|
|
49
|
-
styles: {
|
|
50
|
-
mask: {
|
|
51
|
-
backdropFilter: 'blur(2px)'
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
},
|
|
55
|
-
wrapperClassName: styles.image
|
|
56
|
-
}, props))
|
|
57
|
-
});
|
|
46
|
+
return /*#__PURE__*/_jsx(Image, _objectSpread({}, props));
|
|
58
47
|
},
|
|
59
48
|
pre: fullFeaturedCodeBlock ? CodeFullFeatured : CodeLite
|
|
60
49
|
};
|
|
@@ -62,14 +51,7 @@ var Markdown = /*#__PURE__*/memo(function (_ref) {
|
|
|
62
51
|
className: className,
|
|
63
52
|
onDoubleClick: onDoubleClick,
|
|
64
53
|
style: style,
|
|
65
|
-
children: /*#__PURE__*/_jsx(
|
|
66
|
-
preview: {
|
|
67
|
-
styles: {
|
|
68
|
-
mask: {
|
|
69
|
-
backdropFilter: 'blur(2px)'
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
},
|
|
54
|
+
children: /*#__PURE__*/_jsx(ImageGallery, {
|
|
73
55
|
children: /*#__PURE__*/_jsx(ErrorBoundary, {
|
|
74
56
|
fallback: /*#__PURE__*/_jsx(ReactMarkdown, _objectSpread(_objectSpread({
|
|
75
57
|
className: styles.markdown,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject;
|
|
3
3
|
import { css } from 'antd-style';
|
|
4
|
-
import { readableColor } from 'polished';
|
|
4
|
+
import { readableColor, rgba } from 'polished';
|
|
5
5
|
export default (function (token) {
|
|
6
|
-
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-btn {\n box-shadow: none;\n }\n\n .", "-btn-primary {\n color: ", " !important;\n\n &:hover {\n color: ", " !important;\n }\n\n &:active {\n color: ", " !important;\n }\n }\n\n .", "-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: ", " !important;\n\n background-color: ", " !important;\n border-radius: ", "px !important;\n }\n\n .", "-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .", "-switch-handle::before {\n background: ", " !important;\n }\n\n @media (max-width: 575px) {\n .", "-tooltip {\n display: none !important;\n }\n }\n"])), token.prefixCls, token.prefixCls, readableColor(token.colorPrimary), readableColor(token.colorPrimary), readableColor(token.colorPrimaryActive), token.prefixCls, token.colorBgLayout, token.colorText, token.borderRadiusSM, token.prefixCls, token.colorText, token.prefixCls, token.colorBgContainer, token.prefixCls);
|
|
6
|
+
return css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n .", "-btn {\n box-shadow: none;\n }\n\n .", "-btn-primary {\n color: ", " !important;\n\n &:hover {\n color: ", " !important;\n }\n\n &:active {\n color: ", " !important;\n }\n }\n\n .", "-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: ", " !important;\n\n background-color: ", " !important;\n border-radius: ", "px !important;\n }\n\n .", "-tooltip-arrow {\n &::before,\n &::after {\n background: ", " !important;\n }\n }\n\n .", "-switch-handle::before {\n background: ", " !important;\n }\n\n .", "-image-preview-close,\n .", "-image-preview-switch-right,.", "-image-preview-switch-left {\n ", ";\n border-radius: ", "px;\n background: ", ";\n\n width: 32px;\n height: 32px;\n\n display: flex;\n align-items: center;\n justify-content: center;\n\n padding: 0;\n }\n\n @media (max-width: 575px) {\n .", "-tooltip {\n display: none !important;\n }\n }\n"])), token.prefixCls, token.prefixCls, readableColor(token.colorPrimary), readableColor(token.colorPrimary), readableColor(token.colorPrimaryActive), token.prefixCls, token.colorBgLayout, token.colorText, token.borderRadiusSM, token.prefixCls, token.colorText, token.prefixCls, token.colorBgContainer, token.prefixCls, token.prefixCls, token.prefixCls, token.stylish.blur, token.borderRadiusLG, rgba(token.colorBgMask, 0.1), token.prefixCls);
|
|
7
7
|
});
|
package/es/index.d.ts
CHANGED
|
@@ -46,6 +46,8 @@ export { default as Highlighter, type HighlighterProps, SyntaxHighlighter, type
|
|
|
46
46
|
export { useChatListActionsBar } from './hooks/useChatListActionsBar';
|
|
47
47
|
export { default as Icon, type IconProps, type IconSize } from './Icon';
|
|
48
48
|
export * from './Icon/icons';
|
|
49
|
+
export { default as Image, type ImageProps } from './Image';
|
|
50
|
+
export { default as ImageGallery, type ImageGalleryProps } from './Image/ImageGallery';
|
|
49
51
|
export { Input, type InputProps, TextArea, type TextAreaProps } from './Input';
|
|
50
52
|
export { default as Layout, LayoutFooter, type LayoutFooterProps, LayoutHeader, type LayoutHeaderProps, LayoutMain, type LayoutMainProps, type LayoutProps, LayoutSidebar, LayoutSidebarInner, type LayoutSidebarInnerProps, type LayoutSidebarProps, LayoutToc, type LayoutTocProps, } from './Layout';
|
|
51
53
|
export { default as List, type ListItemProps } from './List';
|
package/es/index.js
CHANGED
|
@@ -45,6 +45,8 @@ export { default as Highlighter, SyntaxHighlighter } from "./Highlighter";
|
|
|
45
45
|
export { useChatListActionsBar } from "./hooks/useChatListActionsBar";
|
|
46
46
|
export { default as Icon } from "./Icon";
|
|
47
47
|
export * from "./Icon/icons";
|
|
48
|
+
export { default as Image } from "./Image";
|
|
49
|
+
export { default as ImageGallery } from "./Image/ImageGallery";
|
|
48
50
|
export { Input, TextArea } from "./Input";
|
|
49
51
|
export { default as Layout, LayoutFooter, LayoutHeader, LayoutMain, LayoutSidebar, LayoutSidebarInner, LayoutToc } from "./Layout";
|
|
50
52
|
export { default as List } from "./List";
|