@lobehub/editor 1.26.0 → 1.26.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.
- package/es/plugins/image/react/components/Image.d.ts +6 -3
- package/es/plugins/image/react/components/Image.js +34 -118
- package/es/plugins/image/react/components/ResizeHandle.d.ts +10 -0
- package/es/plugins/image/react/components/ResizeHandle.js +75 -0
- package/es/plugins/image/react/components/style.d.ts +5 -38
- package/es/plugins/image/react/components/style.js +11 -39
- package/es/plugins/image/react/style.d.ts +2 -19
- package/es/plugins/image/react/style.js +6 -20
- package/package.json +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { BlockImageNode } from '../../node/block-image-node';
|
|
3
3
|
import { ImageNode } from '../../node/image-node';
|
|
4
|
-
|
|
5
|
-
className?: string
|
|
4
|
+
export interface ImageProps {
|
|
5
|
+
className?: string;
|
|
6
6
|
node: ImageNode | BlockImageNode;
|
|
7
|
-
|
|
7
|
+
/** Whether to show scale info when resizing. Defaults to false */
|
|
8
|
+
showScaleInfo?: boolean;
|
|
9
|
+
}
|
|
10
|
+
declare const Image: React.NamedExoticComponent<ImageProps>;
|
|
8
11
|
export default Image;
|
|
@@ -1,15 +1,9 @@
|
|
|
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
1
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
3
2
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
4
3
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
5
4
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
6
5
|
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
7
6
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
8
|
-
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; }
|
|
9
|
-
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; }
|
|
10
|
-
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; }
|
|
11
|
-
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
|
|
12
|
-
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
7
|
import { COMMAND_PRIORITY_LOW, SELECTION_CHANGE_COMMAND } from 'lexical';
|
|
14
8
|
import React, { memo, useCallback, useMemo, useRef, useState } from 'react';
|
|
15
9
|
import { useLexicalEditor } from "../../../../editor-kernel/react/useLexicalEditor";
|
|
@@ -17,110 +11,16 @@ import { useLexicalNodeSelection } from "../../../../editor-kernel/react/useLexi
|
|
|
17
11
|
import { $isBlockImageNode } from "../../node/block-image-node";
|
|
18
12
|
import BrokenImage from "./BrokenImage";
|
|
19
13
|
import LazyImage from "./LazyImage";
|
|
14
|
+
import { ResizeHandle } from "./ResizeHandle";
|
|
20
15
|
import { useStyles } from "./style";
|
|
21
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
17
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
18
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
isBlock = _ref.isBlock,
|
|
30
|
-
imageRef = _ref.imageRef;
|
|
31
|
-
var startWidthRef = useRef(0);
|
|
32
|
-
var handleMouseDown = useCallback(function (e) {
|
|
33
|
-
var _imageRef$current;
|
|
34
|
-
e.preventDefault();
|
|
35
|
-
e.stopPropagation();
|
|
36
|
-
|
|
37
|
-
// Get the actual current width at mousedown time
|
|
38
|
-
var initialWidth = ((_imageRef$current = imageRef.current) === null || _imageRef$current === void 0 ? void 0 : _imageRef$current.offsetWidth) || 0;
|
|
39
|
-
startWidthRef.current = initialWidth;
|
|
40
|
-
|
|
41
|
-
// Notify parent component of the initial width
|
|
42
|
-
onResizeStart(initialWidth);
|
|
43
|
-
var startX = e.clientX;
|
|
44
|
-
var startY = e.clientY;
|
|
45
|
-
var rect = isBlock ? e.target.getBoundingClientRect() : {
|
|
46
|
-
height: 0,
|
|
47
|
-
left: 0,
|
|
48
|
-
top: 0,
|
|
49
|
-
width: 0
|
|
50
|
-
};
|
|
51
|
-
var centerX = rect.left + rect.width / 2;
|
|
52
|
-
var lastDeltaX = 0;
|
|
53
|
-
var lastDeltaY = 0;
|
|
54
|
-
var handleMouseMove = function handleMouseMove(e) {
|
|
55
|
-
var deltaX = e.clientX - startX;
|
|
56
|
-
var deltaY = e.clientY - startY;
|
|
57
|
-
|
|
58
|
-
// Only adjust deltaX based on the resize handle position
|
|
59
|
-
switch (position) {
|
|
60
|
-
case 'left':
|
|
61
|
-
{
|
|
62
|
-
deltaX = isBlock ? centerX - e.clientX : -deltaX;
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
case 'right':
|
|
66
|
-
{
|
|
67
|
-
if (isBlock) {
|
|
68
|
-
deltaX = e.clientX - centerX;
|
|
69
|
-
}
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
lastDeltaX = deltaX;
|
|
74
|
-
lastDeltaY = deltaY;
|
|
75
|
-
onResize(deltaX, deltaY, position);
|
|
76
|
-
};
|
|
77
|
-
var handleMouseUp = function handleMouseUp() {
|
|
78
|
-
document.removeEventListener('mousemove', handleMouseMove);
|
|
79
|
-
document.removeEventListener('mouseup', handleMouseUp);
|
|
80
|
-
if (typeof onResizeEnd === 'function') {
|
|
81
|
-
onResizeEnd(lastDeltaX, lastDeltaY);
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
document.addEventListener('mousemove', handleMouseMove);
|
|
85
|
-
document.addEventListener('mouseup', handleMouseUp);
|
|
86
|
-
}, [onResize, onResizeEnd, onResizeStart, position, imageRef]);
|
|
87
|
-
var getPositionStyle = function getPositionStyle() {
|
|
88
|
-
var baseStyle = {
|
|
89
|
-
backgroundColor: '#999999',
|
|
90
|
-
borderRadius: 2,
|
|
91
|
-
cursor: 'col-resize',
|
|
92
|
-
height: '60%',
|
|
93
|
-
opacity: 0.6,
|
|
94
|
-
pointerEvents: 'auto',
|
|
95
|
-
position: 'absolute',
|
|
96
|
-
top: '20%',
|
|
97
|
-
width: 4,
|
|
98
|
-
zIndex: 9999
|
|
99
|
-
};
|
|
100
|
-
switch (position) {
|
|
101
|
-
case 'left':
|
|
102
|
-
{
|
|
103
|
-
return _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
104
|
-
left: 20
|
|
105
|
-
});
|
|
106
|
-
}
|
|
107
|
-
case 'right':
|
|
108
|
-
{
|
|
109
|
-
return _objectSpread(_objectSpread({}, baseStyle), {}, {
|
|
110
|
-
right: 20
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
return /*#__PURE__*/_jsx("div", {
|
|
116
|
-
onMouseDown: handleMouseDown,
|
|
117
|
-
style: getPositionStyle()
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
ResizeHandle.displayName = 'ResizeHandle';
|
|
121
|
-
var Image = /*#__PURE__*/memo(function (_ref2) {
|
|
122
|
-
var node = _ref2.node,
|
|
123
|
-
className = _ref2.className;
|
|
19
|
+
var Image = /*#__PURE__*/memo(function (_ref) {
|
|
20
|
+
var node = _ref.node,
|
|
21
|
+
className = _ref.className,
|
|
22
|
+
_ref$showScaleInfo = _ref.showScaleInfo,
|
|
23
|
+
showScaleInfo = _ref$showScaleInfo === void 0 ? false : _ref$showScaleInfo;
|
|
124
24
|
var _useStyles = useStyles(),
|
|
125
25
|
styles = _useStyles.styles,
|
|
126
26
|
cx = _useStyles.cx;
|
|
@@ -128,21 +28,25 @@ var Image = /*#__PURE__*/memo(function (_ref2) {
|
|
|
128
28
|
_useLexicalNodeSelect2 = _slicedToArray(_useLexicalNodeSelect, 2),
|
|
129
29
|
isSelected = _useLexicalNodeSelect2[0],
|
|
130
30
|
setSelected = _useLexicalNodeSelect2[1];
|
|
131
|
-
var _useState = useState(
|
|
31
|
+
var _useState = useState(false),
|
|
132
32
|
_useState2 = _slicedToArray(_useState, 2),
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
var _useState3 = useState(
|
|
33
|
+
isHovered = _useState2[0],
|
|
34
|
+
setIsHovered = _useState2[1];
|
|
35
|
+
var _useState3 = useState(1),
|
|
36
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
37
|
+
scale = _useState4[0],
|
|
38
|
+
setScale = _useState4[1];
|
|
39
|
+
var _useState5 = useState({
|
|
136
40
|
height: 0,
|
|
137
41
|
width: 0
|
|
138
42
|
}),
|
|
139
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
140
|
-
size = _useState4[0],
|
|
141
|
-
setSize = _useState4[1];
|
|
142
|
-
var _useState5 = useState(null),
|
|
143
43
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
144
|
-
|
|
145
|
-
|
|
44
|
+
size = _useState6[0],
|
|
45
|
+
setSize = _useState6[1];
|
|
46
|
+
var _useState7 = useState(null),
|
|
47
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
48
|
+
newWidth = _useState8[0],
|
|
49
|
+
setNewWidth = _useState8[1];
|
|
146
50
|
var imageRef = useRef(null);
|
|
147
51
|
var originalSizeRef = useRef({
|
|
148
52
|
height: 0,
|
|
@@ -227,6 +131,16 @@ var Image = /*#__PURE__*/memo(function (_ref2) {
|
|
|
227
131
|
}
|
|
228
132
|
});
|
|
229
133
|
}, []);
|
|
134
|
+
|
|
135
|
+
// Mouse enter handler
|
|
136
|
+
var handleMouseEnter = useCallback(function () {
|
|
137
|
+
setIsHovered(true);
|
|
138
|
+
}, []);
|
|
139
|
+
|
|
140
|
+
// Mouse leave handler
|
|
141
|
+
var handleMouseLeave = useCallback(function () {
|
|
142
|
+
setIsHovered(false);
|
|
143
|
+
}, []);
|
|
230
144
|
var children = useMemo(function () {
|
|
231
145
|
switch (node.status) {
|
|
232
146
|
case 'error':
|
|
@@ -289,14 +203,16 @@ var Image = /*#__PURE__*/memo(function (_ref2) {
|
|
|
289
203
|
draggable: false,
|
|
290
204
|
onClick: handleClick,
|
|
291
205
|
onDoubleClick: handleDoubleClick,
|
|
206
|
+
onMouseEnter: handleMouseEnter,
|
|
207
|
+
onMouseLeave: handleMouseLeave,
|
|
292
208
|
ref: imageRef,
|
|
293
209
|
style: {
|
|
294
210
|
width: size.width || 'auto'
|
|
295
211
|
},
|
|
296
|
-
children: [children, isSelected && scale !== 1 && /*#__PURE__*/_jsxs("div", {
|
|
212
|
+
children: [children, showScaleInfo && isSelected && scale !== 1 && /*#__PURE__*/_jsxs("div", {
|
|
297
213
|
className: styles.scaleInfo,
|
|
298
214
|
children: [Math.round(scale * 100), "%"]
|
|
299
|
-
}),
|
|
215
|
+
}), isHovered && /*#__PURE__*/_jsxs(_Fragment, {
|
|
300
216
|
children: [/*#__PURE__*/_jsx(ResizeHandle, {
|
|
301
217
|
imageRef: imageRef,
|
|
302
218
|
isBlock: isBlock,
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type RefObject } from 'react';
|
|
2
|
+
export interface ResizeHandleProps {
|
|
3
|
+
imageRef: RefObject<HTMLDivElement | null>;
|
|
4
|
+
isBlock: boolean;
|
|
5
|
+
onResize: (deltaX: number, deltaY: number, position: 'left' | 'right') => void;
|
|
6
|
+
onResizeEnd?: (deltaX: number, deltaY: number) => void;
|
|
7
|
+
onResizeStart: (initialWidth: number) => void;
|
|
8
|
+
position: 'left' | 'right';
|
|
9
|
+
}
|
|
10
|
+
export declare const ResizeHandle: import("react").NamedExoticComponent<ResizeHandleProps>;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { memo, useCallback, useRef } from 'react';
|
|
2
|
+
import { useStyles } from "./style";
|
|
3
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
4
|
+
export var ResizeHandle = /*#__PURE__*/memo(function (_ref) {
|
|
5
|
+
var imageRef = _ref.imageRef,
|
|
6
|
+
isBlock = _ref.isBlock,
|
|
7
|
+
onResize = _ref.onResize,
|
|
8
|
+
onResizeEnd = _ref.onResizeEnd,
|
|
9
|
+
onResizeStart = _ref.onResizeStart,
|
|
10
|
+
position = _ref.position;
|
|
11
|
+
var _useStyles = useStyles(),
|
|
12
|
+
styles = _useStyles.styles,
|
|
13
|
+
cx = _useStyles.cx;
|
|
14
|
+
var startWidthRef = useRef(0);
|
|
15
|
+
var handleMouseDown = useCallback(function (e) {
|
|
16
|
+
var _imageRef$current;
|
|
17
|
+
e.preventDefault();
|
|
18
|
+
e.stopPropagation();
|
|
19
|
+
|
|
20
|
+
// Get the actual current width at mousedown time
|
|
21
|
+
var initialWidth = ((_imageRef$current = imageRef.current) === null || _imageRef$current === void 0 ? void 0 : _imageRef$current.offsetWidth) || 0;
|
|
22
|
+
startWidthRef.current = initialWidth;
|
|
23
|
+
|
|
24
|
+
// Notify parent component of the initial width
|
|
25
|
+
onResizeStart(initialWidth);
|
|
26
|
+
var startX = e.clientX;
|
|
27
|
+
var startY = e.clientY;
|
|
28
|
+
var rect = isBlock ? e.target.getBoundingClientRect() : {
|
|
29
|
+
height: 0,
|
|
30
|
+
left: 0,
|
|
31
|
+
top: 0,
|
|
32
|
+
width: 0
|
|
33
|
+
};
|
|
34
|
+
var centerX = rect.left + rect.width / 2;
|
|
35
|
+
var lastDeltaX = 0;
|
|
36
|
+
var lastDeltaY = 0;
|
|
37
|
+
var handleMouseMove = function handleMouseMove(e) {
|
|
38
|
+
var deltaX = e.clientX - startX;
|
|
39
|
+
var deltaY = e.clientY - startY;
|
|
40
|
+
|
|
41
|
+
// Only adjust deltaX based on the resize handle position
|
|
42
|
+
switch (position) {
|
|
43
|
+
case 'left':
|
|
44
|
+
{
|
|
45
|
+
deltaX = isBlock ? centerX - e.clientX : -deltaX;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
case 'right':
|
|
49
|
+
{
|
|
50
|
+
if (isBlock) {
|
|
51
|
+
deltaX = e.clientX - centerX;
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
lastDeltaX = deltaX;
|
|
57
|
+
lastDeltaY = deltaY;
|
|
58
|
+
onResize(deltaX, deltaY, position);
|
|
59
|
+
};
|
|
60
|
+
var handleMouseUp = function handleMouseUp() {
|
|
61
|
+
document.removeEventListener('mousemove', handleMouseMove);
|
|
62
|
+
document.removeEventListener('mouseup', handleMouseUp);
|
|
63
|
+
if (typeof onResizeEnd === 'function') {
|
|
64
|
+
onResizeEnd(lastDeltaX, lastDeltaY);
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
document.addEventListener('mousemove', handleMouseMove);
|
|
68
|
+
document.addEventListener('mouseup', handleMouseUp);
|
|
69
|
+
}, [imageRef, isBlock, onResize, onResizeEnd, onResizeStart, position]);
|
|
70
|
+
return /*#__PURE__*/_jsx("div", {
|
|
71
|
+
className: cx(styles.resizeHandle, position === 'left' ? styles.resizeHandleLeft : styles.resizeHandleRight),
|
|
72
|
+
onMouseDown: handleMouseDown
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
ResizeHandle.displayName = 'ResizeHandle';
|
|
@@ -1,40 +1,7 @@
|
|
|
1
1
|
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
-
imageContainer:
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
'&.selected::after': {
|
|
8
|
-
backgroundColor: "rgba(0, 102, 255, 0.15)";
|
|
9
|
-
bottom: number;
|
|
10
|
-
content: "\"\"";
|
|
11
|
-
left: number;
|
|
12
|
-
pointerEvents: "none";
|
|
13
|
-
position: "absolute";
|
|
14
|
-
right: number;
|
|
15
|
-
top: number;
|
|
16
|
-
zIndex: number;
|
|
17
|
-
};
|
|
18
|
-
cursor: "default";
|
|
19
|
-
display: "inline-block";
|
|
20
|
-
height: string;
|
|
21
|
-
maxWidth: string;
|
|
22
|
-
outline: string;
|
|
23
|
-
position: "relative";
|
|
24
|
-
transition: "border-color 0.2s ease";
|
|
25
|
-
userSelect: "none";
|
|
26
|
-
width: string;
|
|
27
|
-
};
|
|
28
|
-
scaleInfo: {
|
|
29
|
-
backgroundColor: "rgba(0, 0, 0, 0.7)";
|
|
30
|
-
borderRadius: number;
|
|
31
|
-
color: "white";
|
|
32
|
-
fontSize: number;
|
|
33
|
-
left: number;
|
|
34
|
-
padding: string;
|
|
35
|
-
pointerEvents: "none";
|
|
36
|
-
position: "absolute";
|
|
37
|
-
top: number;
|
|
38
|
-
zIndex: number;
|
|
39
|
-
};
|
|
2
|
+
imageContainer: import("antd-style").SerializedStyles;
|
|
3
|
+
resizeHandle: import("antd-style").SerializedStyles;
|
|
4
|
+
resizeHandleLeft: import("antd-style").SerializedStyles;
|
|
5
|
+
resizeHandleRight: import("antd-style").SerializedStyles;
|
|
6
|
+
scaleInfo: import("antd-style").SerializedStyles;
|
|
40
7
|
}>;
|
|
@@ -1,43 +1,15 @@
|
|
|
1
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
1
3
|
import { createStyles } from 'antd-style';
|
|
2
|
-
|
|
4
|
+
import { rgba } from 'polished';
|
|
5
|
+
export var useStyles = createStyles(function (_ref) {
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
token = _ref.token;
|
|
3
8
|
return {
|
|
4
|
-
imageContainer: {
|
|
5
|
-
'
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
'&.selected::after': {
|
|
10
|
-
backgroundColor: 'rgba(0, 102, 255, 0.15)',
|
|
11
|
-
bottom: 0,
|
|
12
|
-
content: '""',
|
|
13
|
-
left: 0,
|
|
14
|
-
pointerEvents: 'none',
|
|
15
|
-
position: 'absolute',
|
|
16
|
-
right: 0,
|
|
17
|
-
top: 0,
|
|
18
|
-
zIndex: 10
|
|
19
|
-
},
|
|
20
|
-
'cursor': 'default',
|
|
21
|
-
'display': 'inline-block',
|
|
22
|
-
'height': 'auto',
|
|
23
|
-
'maxWidth': '100%',
|
|
24
|
-
'outline': '2px solid transparent',
|
|
25
|
-
'position': 'relative',
|
|
26
|
-
'transition': 'border-color 0.2s ease',
|
|
27
|
-
'userSelect': 'none',
|
|
28
|
-
'width': 'auto'
|
|
29
|
-
},
|
|
30
|
-
scaleInfo: {
|
|
31
|
-
backgroundColor: 'rgba(0, 0, 0, 0.7)',
|
|
32
|
-
borderRadius: 3,
|
|
33
|
-
color: 'white',
|
|
34
|
-
fontSize: 12,
|
|
35
|
-
left: 0,
|
|
36
|
-
padding: '2px 6px',
|
|
37
|
-
pointerEvents: 'none',
|
|
38
|
-
position: 'absolute',
|
|
39
|
-
top: -25,
|
|
40
|
-
zIndex: 11
|
|
41
|
-
}
|
|
9
|
+
imageContainer: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n\n position: relative;\n\n overflow: hidden;\n display: inline-block;\n\n width: auto;\n max-width: 100%;\n height: auto;\n border-radius: ", "px;\n\n transition: border-color 0.2s ease;\n\n &.selected {\n cursor: pointer;\n outline: none;\n\n &::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n z-index: 10;\n inset: 0;\n\n background-color: ", ";\n }\n }\n "])), token.borderRadiusSM, rgba(token.yellow, 0.1)),
|
|
10
|
+
resizeHandle: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n pointer-events: auto;\n cursor: col-resize;\n\n position: absolute;\n z-index: 9999;\n inset-block-start: 0;\n\n width: 6px;\n height: 100%;\n\n &::after {\n pointer-events: none;\n content: '';\n\n position: absolute;\n inset-block-start: 50%;\n inset-inline-start: 0;\n transform: translateY(-50%);\n\n width: 6px;\n height: min(80px, 80%);\n border: 1px solid rgba(255, 255, 255, 75%);\n border-radius: 3px;\n\n background-color: rgba(0, 0, 0, 50%);\n }\n "]))),
|
|
11
|
+
resizeHandleLeft: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n inset-inline-start: 8px;\n "]))),
|
|
12
|
+
resizeHandleRight: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n inset-inline-end: 8px;\n "]))),
|
|
13
|
+
scaleInfo: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n pointer-events: none;\n\n position: absolute;\n z-index: 11;\n inset-block-start: 2px;\n inset-inline-start: 2px;\n\n padding-block: 2px;\n padding-inline: 6px;\n border-radius: ", "px;\n\n font-size: 12px;\n color: white;\n\n background-color: rgba(0, 0, 0, 50%);\n "])), token.borderRadiusSM)
|
|
42
14
|
};
|
|
43
15
|
});
|
|
@@ -1,22 +1,5 @@
|
|
|
1
1
|
export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
|
|
2
|
-
image:
|
|
3
|
-
|
|
4
|
-
position: "relative";
|
|
5
|
-
display: "inline-block";
|
|
6
|
-
cursor: "default";
|
|
7
|
-
'&.selected': {
|
|
8
|
-
backgroundColor: string;
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
blockImage: {
|
|
12
|
-
userSelect: "none";
|
|
13
|
-
position: "relative";
|
|
14
|
-
display: "block";
|
|
15
|
-
textAlign: "center";
|
|
16
|
-
cursor: "default";
|
|
17
|
-
'&.selected': {
|
|
18
|
-
backgroundColor: string;
|
|
19
|
-
};
|
|
20
|
-
};
|
|
2
|
+
image: import("antd-style").SerializedStyles;
|
|
3
|
+
blockImage: import("antd-style").SerializedStyles;
|
|
21
4
|
}>;
|
|
22
5
|
export declare const imageBroken = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA2NDAgNDAwIj48cGF0aCBmaWxsPSIjM0IzQjNCIiBkPSJNMCAwaDY0MHY0MDBIMHoiLz48cGF0aCBzdHJva2U9IiM2MjYyNjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIxNSIgZD0iTTM3Mi41IDEzMi41aC0xMDVjLTguMjg0IDAtMTUgNi43MTYtMTUgMTV2MTA1YzAgOC4yODQgNi43MTYgMTUgMTUgMTVoMTA1YzguMjg0IDAgMTUtNi43MTYgMTUtMTV2LTEwNWMwLTguMjg0LTYuNzE2LTE1LTE1LTE1eiIvPjxwYXRoIHN0cm9rZT0iIzYyNjI2MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjE1IiBkPSJNMjk3LjUgMTkyLjVjOC4yODQgMCAxNS02LjcxNiAxNS0xNSAwLTguMjg0LTYuNzE2LTE1LTE1LTE1LTguMjg0IDAtMTUgNi43MTYtMTUgMTUgMCA4LjI4NCA2LjcxNiAxNSAxNSAxNXpNMzg3LjUgMjIyLjUwMmwtMjMuMTQ1LTIzLjE0NWExNS4wMDEgMTUuMDAxIDAgMDAtMjEuMjEgMEwyNzUgMjY3LjUwMiIvPjwvc3ZnPg==";
|
|
@@ -1,27 +1,13 @@
|
|
|
1
|
+
var _templateObject, _templateObject2;
|
|
2
|
+
function _taggedTemplateLiteral(strings, raw) { if (!raw) { raw = strings.slice(0); } return Object.freeze(Object.defineProperties(strings, { raw: { value: Object.freeze(raw) } })); }
|
|
1
3
|
/* eslint-disable sort-keys-fix/sort-keys-fix */
|
|
2
4
|
import { createStyles } from 'antd-style';
|
|
3
5
|
export var useStyles = createStyles(function (_ref) {
|
|
4
|
-
var
|
|
6
|
+
var css = _ref.css,
|
|
7
|
+
token = _ref.token;
|
|
5
8
|
return {
|
|
6
|
-
image: {
|
|
7
|
-
|
|
8
|
-
'position': 'relative',
|
|
9
|
-
'display': 'inline-block',
|
|
10
|
-
'cursor': 'default',
|
|
11
|
-
'&.selected': {
|
|
12
|
-
backgroundColor: token.colorPrimaryBg
|
|
13
|
-
}
|
|
14
|
-
},
|
|
15
|
-
blockImage: {
|
|
16
|
-
'userSelect': 'none',
|
|
17
|
-
'position': 'relative',
|
|
18
|
-
'display': 'block',
|
|
19
|
-
'textAlign': 'center',
|
|
20
|
-
'cursor': 'default',
|
|
21
|
-
'&.selected': {
|
|
22
|
-
backgroundColor: token.colorPrimaryBg
|
|
23
|
-
}
|
|
24
|
-
}
|
|
9
|
+
image: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n position: relative;\n display: inline-block;\n\n &.selected {\n background-color: ", ";\n }\n "])), token.colorPrimaryBg),
|
|
10
|
+
blockImage: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n cursor: default;\n user-select: none;\n\n position: relative;\n\n display: block;\n\n text-align: center;\n\n &.selected {\n background-color: ", ";\n }\n "])), token.colorPrimaryBg)
|
|
25
11
|
};
|
|
26
12
|
});
|
|
27
13
|
export var imageBroken = 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCA2NDAgNDAwIj48cGF0aCBmaWxsPSIjM0IzQjNCIiBkPSJNMCAwaDY0MHY0MDBIMHoiLz48cGF0aCBzdHJva2U9IiM2MjYyNjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIgc3Ryb2tlLWxpbmVqb2luPSJyb3VuZCIgc3Ryb2tlLXdpZHRoPSIxNSIgZD0iTTM3Mi41IDEzMi41aC0xMDVjLTguMjg0IDAtMTUgNi43MTYtMTUgMTV2MTA1YzAgOC4yODQgNi43MTYgMTUgMTUgMTVoMTA1YzguMjg0IDAgMTUtNi43MTYgMTUtMTV2LTEwNWMwLTguMjg0LTYuNzE2LTE1LTE1LTE1eiIvPjxwYXRoIHN0cm9rZT0iIzYyNjI2MiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtbGluZWpvaW49InJvdW5kIiBzdHJva2Utd2lkdGg9IjE1IiBkPSJNMjk3LjUgMTkyLjVjOC4yODQgMCAxNS02LjcxNiAxNS0xNSAwLTguMjg0LTYuNzE2LTE1LTE1LTE1LTguMjg0IDAtMTUgNi43MTYtMTUgMTUgMCA4LjI4NCA2LjcxNiAxNSAxNSAxNXpNMzg3LjUgMjIyLjUwMmwtMjMuMTQ1LTIzLjE0NWExNS4wMDEgMTUuMDAxIDAgMDAtMjEuMjEgMEwyNzUgMjY3LjUwMiIvPjwvc3ZnPg==';
|
package/package.json
CHANGED