@lobehub/ui 1.164.4 → 1.164.6
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,10 +1,13 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { FormItemProps as AntdFormItemProps } from 'antd';
|
|
3
3
|
import { type FormTitleProps } from './FormTitle';
|
|
4
|
-
export declare const useStyles: (props?:
|
|
4
|
+
export declare const useStyles: (props?: {
|
|
5
|
+
minWidth?: string | number | undefined;
|
|
6
|
+
} | undefined) => import("antd-style").ReturnStyles<{
|
|
5
7
|
item: import("antd-style").SerializedStyles;
|
|
6
8
|
itemMinWidth: import("antd-style").SerializedStyles;
|
|
7
9
|
itemNoDivider: import("antd-style").SerializedStyles;
|
|
10
|
+
verticalLayout: import("antd-style").SerializedStyles;
|
|
8
11
|
}>;
|
|
9
12
|
export interface FormItemProps extends AntdFormItemProps {
|
|
10
13
|
avatar?: FormTitleProps['avatar'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
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); }
|
|
4
|
-
var _excluded = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider"];
|
|
5
|
-
var _templateObject, _templateObject2, _templateObject3;
|
|
4
|
+
var _excluded = ["desc", "tag", "minWidth", "avatar", "className", "label", "children", "divider", "layout"];
|
|
5
|
+
var _templateObject, _templateObject2, _templateObject3, _templateObject4;
|
|
6
6
|
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; }
|
|
7
7
|
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; }
|
|
8
8
|
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; }
|
|
@@ -21,38 +21,45 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
21
|
import { Fragment as _Fragment } from "react/jsx-runtime";
|
|
22
22
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
23
|
var Item = Form.Item;
|
|
24
|
-
export var useStyles = createStyles(function (_ref,
|
|
24
|
+
export var useStyles = createStyles(function (_ref, _ref2) {
|
|
25
25
|
var css = _ref.css,
|
|
26
26
|
responsive = _ref.responsive,
|
|
27
27
|
prefixCls = _ref.prefixCls;
|
|
28
|
+
var minWidth = _ref2.minWidth;
|
|
28
29
|
return {
|
|
29
30
|
item: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n &.", "-form-item {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-form-item-label {\n text-align: start;\n }\n\n .", "-row {\n gap: 12px;\n justify-content: space-between;\n\n > div {\n flex: unset;\n flex-grow: unset;\n }\n }\n\n .", "-form-item-required::before {\n align-self: flex-start;\n }\n\n ", " {\n .", "-row {\n flex-direction: column;\n align-items: stretch;\n\n > div {\n width: 100%;\n }\n }\n }\n\n ", " {\n padding-block: 16px;\n padding-inline: 0;\n\n .", "-row {\n flex-wrap: wrap;\n gap: 4px;\n }\n }\n }\n "])), prefixCls, prefixCls, prefixCls, prefixCls, responsive.md, prefixCls, responsive.mobile, prefixCls),
|
|
30
|
-
itemMinWidth: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n ", " {\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), prefixCls, isNumber(
|
|
31
|
-
itemNoDivider: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-block-start: 0;\n }\n "])))
|
|
31
|
+
itemMinWidth: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n .", "-form-item-control {\n width: ", ";\n }\n ", " {\n .", "-row {\n flex-direction: column;\n gap: 4px;\n }\n\n .", "-form-item-control {\n flex: 1;\n width: 100%;\n }\n }\n "])), prefixCls, isNumber(minWidth) ? "".concat(minWidth, "px") : minWidth, responsive.mobile, prefixCls, prefixCls),
|
|
32
|
+
itemNoDivider: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n &:not(:first-child) {\n padding-block-start: 0;\n }\n "]))),
|
|
33
|
+
verticalLayout: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n &.", "-form-item {\n .", "-row {\n align-items: stretch;\n }\n }\n "])), prefixCls, prefixCls)
|
|
32
34
|
};
|
|
33
35
|
});
|
|
34
|
-
var FormItem = /*#__PURE__*/memo(function (
|
|
35
|
-
var desc =
|
|
36
|
-
tag =
|
|
37
|
-
minWidth =
|
|
38
|
-
avatar =
|
|
39
|
-
className =
|
|
40
|
-
label =
|
|
41
|
-
children =
|
|
42
|
-
divider =
|
|
43
|
-
|
|
44
|
-
|
|
36
|
+
var FormItem = /*#__PURE__*/memo(function (_ref3) {
|
|
37
|
+
var desc = _ref3.desc,
|
|
38
|
+
tag = _ref3.tag,
|
|
39
|
+
minWidth = _ref3.minWidth,
|
|
40
|
+
avatar = _ref3.avatar,
|
|
41
|
+
className = _ref3.className,
|
|
42
|
+
label = _ref3.label,
|
|
43
|
+
children = _ref3.children,
|
|
44
|
+
divider = _ref3.divider,
|
|
45
|
+
layout = _ref3.layout,
|
|
46
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
47
|
+
var _useStyles = useStyles({
|
|
48
|
+
minWidth: minWidth
|
|
49
|
+
}),
|
|
45
50
|
cx = _useStyles.cx,
|
|
46
51
|
styles = _useStyles.styles;
|
|
52
|
+
var isVertical = layout === 'vertical';
|
|
47
53
|
return /*#__PURE__*/_jsxs(_Fragment, {
|
|
48
54
|
children: [divider && /*#__PURE__*/_jsx(FormDivider, {}), /*#__PURE__*/_jsx(Item, _objectSpread(_objectSpread({
|
|
49
|
-
className: cx(styles.item, Boolean(minWidth) && styles.itemMinWidth, !divider && styles.itemNoDivider, className),
|
|
55
|
+
className: cx(styles.item, Boolean(minWidth) && styles.itemMinWidth, !divider && styles.itemNoDivider, isVertical && styles.verticalLayout, className),
|
|
50
56
|
label: /*#__PURE__*/_jsx(FormTitle, {
|
|
51
57
|
avatar: avatar,
|
|
52
58
|
desc: desc,
|
|
53
59
|
tag: tag,
|
|
54
60
|
title: label
|
|
55
|
-
})
|
|
61
|
+
}),
|
|
62
|
+
layout: layout
|
|
56
63
|
}, rest), {}, {
|
|
57
64
|
children: children
|
|
58
65
|
}))]
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { HighlighterProps } from './type';
|
|
3
3
|
interface HighlighterFullFeaturedProps extends Omit<HighlighterProps, 'children'> {
|
|
4
|
-
children: ReactNode;
|
|
5
4
|
content: string;
|
|
6
5
|
}
|
|
7
6
|
export declare const HighlighterFullFeatured: import("react").NamedExoticComponent<HighlighterFullFeaturedProps>;
|
|
@@ -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 = ["
|
|
2
|
+
var _excluded = ["content", "language", "showLanguage", "className", "style", "allowChangeLanguage", "fileName", "icon", "actionsRender", "copyable", "type", "defalutExpand", "bodyRender", "enableTransformer"];
|
|
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; }
|
|
@@ -19,6 +19,7 @@ import { memo, useState } from 'react';
|
|
|
19
19
|
import { Flexbox } from 'react-layout-kit';
|
|
20
20
|
import ActionIcon from "../ActionIcon";
|
|
21
21
|
import CopyButton from "../CopyButton";
|
|
22
|
+
import SyntaxHighlighter from "./SyntaxHighlighter";
|
|
22
23
|
import { languageMap } from "../hooks/useHighlight";
|
|
23
24
|
import { useStyles } from "./style";
|
|
24
25
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -30,8 +31,7 @@ var options = languageMap.map(function (item) {
|
|
|
30
31
|
};
|
|
31
32
|
});
|
|
32
33
|
export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
33
|
-
var
|
|
34
|
-
content = _ref.content,
|
|
34
|
+
var content = _ref.content,
|
|
35
35
|
language = _ref.language,
|
|
36
36
|
showLanguage = _ref.showLanguage,
|
|
37
37
|
className = _ref.className,
|
|
@@ -45,6 +45,8 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
45
45
|
type = _ref.type,
|
|
46
46
|
_ref$defalutExpand = _ref.defalutExpand,
|
|
47
47
|
defalutExpand = _ref$defalutExpand === void 0 ? true : _ref$defalutExpand,
|
|
48
|
+
bodyRender = _ref.bodyRender,
|
|
49
|
+
enableTransformer = _ref.enableTransformer,
|
|
48
50
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
49
51
|
var _useState = useState(defalutExpand),
|
|
50
52
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -73,6 +75,16 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
73
75
|
language: language,
|
|
74
76
|
originalNode: origianlActions
|
|
75
77
|
}) : origianlActions;
|
|
78
|
+
var originalBody = /*#__PURE__*/_jsx(SyntaxHighlighter, {
|
|
79
|
+
enableTransformer: enableTransformer,
|
|
80
|
+
language: lang === null || lang === void 0 ? void 0 : lang.toLowerCase(),
|
|
81
|
+
children: content
|
|
82
|
+
});
|
|
83
|
+
var body = bodyRender ? bodyRender({
|
|
84
|
+
content: content,
|
|
85
|
+
language: lang,
|
|
86
|
+
originalNode: originalBody
|
|
87
|
+
}) : originalBody;
|
|
76
88
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
77
89
|
className: cx(styles.container, className),
|
|
78
90
|
"data-code-type": "highlighter",
|
|
@@ -122,7 +134,7 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref) {
|
|
|
122
134
|
height: 0,
|
|
123
135
|
overflow: 'hidden'
|
|
124
136
|
},
|
|
125
|
-
children:
|
|
137
|
+
children: body
|
|
126
138
|
})]
|
|
127
139
|
}));
|
|
128
140
|
});
|
package/es/Highlighter/index.js
CHANGED
|
@@ -42,6 +42,18 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
42
42
|
styles = _useStyles.styles,
|
|
43
43
|
cx = _useStyles.cx;
|
|
44
44
|
var tirmedChildren = children.trim();
|
|
45
|
+
if (fullFeatured) return /*#__PURE__*/_jsx(FullFeatured, _objectSpread({
|
|
46
|
+
actionsRender: actionsRender,
|
|
47
|
+
bodyRender: bodyRender,
|
|
48
|
+
className: className,
|
|
49
|
+
content: tirmedChildren,
|
|
50
|
+
copyable: copyable,
|
|
51
|
+
enableTransformer: enableTransformer,
|
|
52
|
+
language: language,
|
|
53
|
+
showLanguage: showLanguage,
|
|
54
|
+
type: type,
|
|
55
|
+
wrap: wrap
|
|
56
|
+
}, rest));
|
|
45
57
|
var originalActions = copyable && /*#__PURE__*/_jsx(CopyButton, {
|
|
46
58
|
content: tirmedChildren,
|
|
47
59
|
placement: "left",
|
|
@@ -63,20 +75,6 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
|
|
|
63
75
|
language: language,
|
|
64
76
|
originalNode: originalBody
|
|
65
77
|
}) : originalBody;
|
|
66
|
-
if (fullFeatured) return /*#__PURE__*/_jsx(FullFeatured, _objectSpread(_objectSpread({
|
|
67
|
-
actionsRender: actionsRender,
|
|
68
|
-
bodyRender: bodyRender,
|
|
69
|
-
className: className,
|
|
70
|
-
content: tirmedChildren,
|
|
71
|
-
copyable: copyable,
|
|
72
|
-
enableTransformer: enableTransformer,
|
|
73
|
-
language: language,
|
|
74
|
-
showLanguage: showLanguage,
|
|
75
|
-
type: type,
|
|
76
|
-
wrap: wrap
|
|
77
|
-
}, rest), {}, {
|
|
78
|
-
children: body
|
|
79
|
-
}));
|
|
80
78
|
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
81
79
|
className: cx(styles.container, !wrap && styles.nowrap, className),
|
|
82
80
|
"data-code-type": "highlighter",
|