@lobehub/ui 1.156.3 → 1.156.4
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/CodeEditor/index.d.ts
CHANGED
package/es/CodeEditor/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
4
4
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
5
|
-
var _excluded = ["style", "language", "value", "onValueChange", "resize", "className", "textareaClassName", "type"];
|
|
5
|
+
var _excluded = ["style", "language", "value", "onValueChange", "resize", "className", "textareaClassName", "type", "fontSize"];
|
|
6
6
|
import { forwardRef } from 'react';
|
|
7
7
|
import Editor from 'react-simple-code-editor';
|
|
8
8
|
import SyntaxHighlighter from "../Highlighter/SyntaxHighlighter";
|
|
@@ -19,8 +19,11 @@ var CodeEditor = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
19
19
|
textareaClassName = _ref.textareaClassName,
|
|
20
20
|
_ref$type = _ref.type,
|
|
21
21
|
type = _ref$type === void 0 ? 'ghost' : _ref$type,
|
|
22
|
+
_ref$fontSize = _ref.fontSize,
|
|
23
|
+
fontSize = _ref$fontSize === void 0 ? 12 : _ref$fontSize,
|
|
22
24
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
23
25
|
var _useStyles = useStyles({
|
|
26
|
+
fontSize: fontSize,
|
|
24
27
|
resize: resize,
|
|
25
28
|
type: type
|
|
26
29
|
}),
|
package/es/CodeEditor/style.d.ts
CHANGED
package/es/CodeEditor/style.js
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
2
2
|
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
3
3
|
import { createStyles } from 'antd-style';
|
|
4
|
+
import { isNumber } from 'lodash-es';
|
|
4
5
|
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
5
6
|
var cx = _ref.cx,
|
|
6
7
|
css = _ref.css,
|
|
7
8
|
token = _ref.token;
|
|
8
9
|
var type = _ref2.type,
|
|
9
|
-
resize = _ref2.resize
|
|
10
|
+
resize = _ref2.resize,
|
|
11
|
+
fontSize = _ref2.fontSize;
|
|
12
|
+
var size = isNumber(fontSize) ? "".concat(fontSize, "px") : fontSize;
|
|
10
13
|
var typeStylish = css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding-block: 8px;\n padding-inline: 12px;\n\n background-color: ", ";\n border: 1px solid ", ";\n border-radius: ", "px;\n\n transition:\n background-color 100ms ", ",\n border-color 200ms ", ";\n\n &:hover {\n background-color: ", ";\n border-color: ", ";\n }\n "])), type === 'block' ? token.colorFillTertiary : 'transparent', type === 'block' ? 'transparent' : token.colorBorderSecondary, token.borderRadius, token.motionEaseOut, token.motionEaseOut, type === 'block' ? token.colorFillSecondary : token.colorFillQuaternary, token.colorBorder);
|
|
11
14
|
return {
|
|
12
|
-
container: cx(type !== 'pure' && typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden auto;\n width: 100%;\n height: fit-content;\n "])))),
|
|
15
|
+
container: cx(type !== 'pure' && typeStylish, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden auto;\n width: 100%;\n height: fit-content;\n\n * {\n font-size: ", " !important;\n line-height: 1.5 !important;\n }\n "])), size)),
|
|
13
16
|
editor: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n resize: ", ";\n height: fit-content;\n min-height: 100%;\n font-family: ", " !important;\n\n textarea {\n min-height: 36px !important;\n }\n\n pre {\n min-height: 36px !important;\n word-break: break-all;\n word-wrap: break-word;\n white-space: pre-wrap;\n\n &.shiki {\n margin: 0;\n }\n }\n "])), resize ? 'vertical' : 'none', token.fontFamilyCode),
|
|
14
17
|
textarea: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n overflow: hidden auto;\n\n height: 100% !important;\n\n color: transparent !important;\n word-break: break-all !important;\n word-wrap: break-word !important;\n\n caret-color: ", ";\n\n -webkit-text-fill-color: unset !important;\n\n &::placeholder {\n color: ", ";\n }\n\n &:focus {\n border: none !important;\n outline: none !important;\n box-shadow: none !important;\n }\n "])), token.colorText, token.colorTextQuaternary)
|
|
15
18
|
};
|