@lobehub/ui 3.2.0 → 3.3.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.
@@ -0,0 +1,4 @@
1
+ import { type FC } from 'react';
2
+ import type { CenterProps } from './type';
3
+ declare const Center: FC<CenterProps>;
4
+ export default Center;
@@ -0,0 +1,23 @@
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 = ["children", "ref"];
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
+ 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
+ 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; }
6
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
+ 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); }
8
+ 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; }
9
+ 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; }
10
+ import FlexBasic from "./FlexBasic";
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ var Center = function Center(_ref) {
13
+ var children = _ref.children,
14
+ ref = _ref.ref,
15
+ props = _objectWithoutProperties(_ref, _excluded);
16
+ return /*#__PURE__*/_jsx(FlexBasic, _objectSpread(_objectSpread({}, props), {}, {
17
+ align: "center",
18
+ justify: "center",
19
+ ref: ref,
20
+ children: children
21
+ }));
22
+ };
23
+ export default Center;
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import './style.css';
3
+ import type { FlexBasicProps } from './type';
4
+ declare const _default: import("react").NamedExoticComponent<FlexBasicProps>;
5
+ export default _default;
@@ -0,0 +1,79 @@
1
+ 'use client';
2
+
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 = ["visible", "flex", "gap", "direction", "horizontal", "align", "justify", "distribution", "height", "width", "padding", "paddingInline", "paddingBlock", "prefixCls", "as", "className", "style", "children", "wrap", "ref"];
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
+ 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; }
8
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
9
+ 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); }
10
+ 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; }
11
+ 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; }
12
+ import { memo } from 'react';
13
+ import "./style.css";
14
+ import { getCssValue, getFlexDirection, isHorizontal, isSpaceDistribution } from "./utils";
15
+ import { jsx as _jsx } from "react/jsx-runtime";
16
+ var FlexBasic = function FlexBasic(_ref) {
17
+ var visible = _ref.visible,
18
+ flex = _ref.flex,
19
+ gap = _ref.gap,
20
+ direction = _ref.direction,
21
+ horizontal = _ref.horizontal,
22
+ align = _ref.align,
23
+ justify = _ref.justify,
24
+ distribution = _ref.distribution,
25
+ height = _ref.height,
26
+ width = _ref.width,
27
+ padding = _ref.padding,
28
+ paddingInline = _ref.paddingInline,
29
+ paddingBlock = _ref.paddingBlock,
30
+ prefixCls = _ref.prefixCls,
31
+ _ref$as = _ref.as,
32
+ Container = _ref$as === void 0 ? 'div' : _ref$as,
33
+ className = _ref.className,
34
+ style = _ref.style,
35
+ children = _ref.children,
36
+ wrap = _ref.wrap,
37
+ ref = _ref.ref,
38
+ props = _objectWithoutProperties(_ref, _excluded);
39
+ var justifyContent = justify || distribution;
40
+ var calcWidth = function calcWidth() {
41
+ if (isHorizontal(direction, horizontal) && !width && isSpaceDistribution(justifyContent)) return '100%';
42
+ return getCssValue(width);
43
+ };
44
+ var finalWidth = calcWidth();
45
+ var cssVars = _objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread(_objectSpread({}, flex !== undefined ? {
46
+ '--lobe-flex': String(flex)
47
+ } : {}), direction || horizontal ? {
48
+ '--lobe-flex-direction': getFlexDirection(direction, horizontal)
49
+ } : {}), wrap !== undefined ? {
50
+ '--lobe-flex-wrap': wrap
51
+ } : {}), justifyContent !== undefined ? {
52
+ '--lobe-flex-justify': justifyContent
53
+ } : {}), align !== undefined ? {
54
+ '--lobe-flex-align': align
55
+ } : {}), finalWidth !== undefined ? {
56
+ '--lobe-flex-width': finalWidth
57
+ } : {}), height !== undefined ? {
58
+ '--lobe-flex-height': getCssValue(height)
59
+ } : {}), padding !== undefined ? {
60
+ '--lobe-flex-padding': getCssValue(padding)
61
+ } : {}), paddingInline !== undefined ? {
62
+ '--lobe-flex-padding-inline': getCssValue(paddingInline)
63
+ } : {}), paddingBlock !== undefined ? {
64
+ '--lobe-flex-padding-block': getCssValue(paddingBlock)
65
+ } : {}), gap !== undefined ? {
66
+ '--lobe-flex-gap': getCssValue(gap)
67
+ } : {});
68
+ var mergedStyle = _objectSpread(_objectSpread({}, cssVars), style);
69
+ var baseClassName = 'lobe-flex';
70
+ var mergedClassName = [baseClassName, visible === false ? "".concat(baseClassName, "--hidden") : undefined, prefixCls ? "".concat(prefixCls, "-flex") : undefined, className].filter(Boolean).join(' ');
71
+ return /*#__PURE__*/_jsx(Container, _objectSpread(_objectSpread({
72
+ ref: ref
73
+ }, props), {}, {
74
+ className: mergedClassName,
75
+ style: mergedStyle,
76
+ children: children
77
+ }));
78
+ };
79
+ export default /*#__PURE__*/memo(FlexBasic);
@@ -0,0 +1,2 @@
1
+ export { default } from './FlexBasic';
2
+ export { default as Flexbox } from './FlexBasic';
@@ -0,0 +1,2 @@
1
+ export { default } from "./FlexBasic";
2
+ export { default as Flexbox } from "./FlexBasic";
@@ -0,0 +1,4 @@
1
+ export { default as Center } from './Center';
2
+ export { default as FlexBasic } from './FlexBasic';
3
+ export { default as Flexbox } from './Flexbox';
4
+ export type { CenterProps, ContentPosition, FlexBasicProps, FlexboxProps, FlexDirection, } from './type';
@@ -0,0 +1,3 @@
1
+ export { default as Center } from "./Center";
2
+ export { default as FlexBasic } from "./FlexBasic";
3
+ export { default as Flexbox } from "./Flexbox";
@@ -0,0 +1,20 @@
1
+ .lobe-flex {
2
+ display: flex;
3
+ flex: var(--lobe-flex, 0 1 auto);
4
+ flex-direction: var(--lobe-flex-direction, column);
5
+ flex-wrap: var(--lobe-flex-wrap, nowrap);
6
+ justify-content: var(--lobe-flex-justify, flex-start);
7
+ align-items: var(--lobe-flex-align, stretch);
8
+ width: var(--lobe-flex-width, auto);
9
+ height: var(--lobe-flex-height, auto);
10
+ padding: var(--lobe-flex-padding, 0);
11
+ padding-inline: var(--lobe-flex-padding-inline, initial);
12
+ padding-block: var(--lobe-flex-padding-block, initial);
13
+ gap: var(--lobe-flex-gap, 0);
14
+ }
15
+
16
+ .lobe-flex--hidden {
17
+ display: none;
18
+ }
19
+
20
+
@@ -0,0 +1,105 @@
1
+ import type { CSSProperties, ElementType, HTMLAttributes, ReactNode, Ref } from 'react';
2
+ import { DOMAttributes } from 'react';
3
+ export type ContentPosition = 'center' | 'end' | 'flex-end' | 'flex-start' | 'start' | 'stretch' | 'baseline';
4
+ export type FlexDirection = 'vertical' | 'vertical-reverse' | 'horizontal' | 'horizontal-reverse';
5
+ export type DivProps = DOMAttributes<HTMLDivElement> & HTMLAttributes<HTMLDivElement>;
6
+ export type CommonSpaceNumber = 2 | 4 | 8 | 12 | 16 | 24;
7
+ /**
8
+ * Flexbox 布局组件的接口
9
+ */
10
+ export interface IFlexbox {
11
+ /**
12
+ * 交叉轴对齐方式
13
+ * @default "stretch"
14
+ */
15
+ align?: ContentPosition;
16
+ /**
17
+ * 渲染的 HTML 元素类型
18
+ * @default "div"
19
+ */
20
+ as?: ElementType;
21
+ /**
22
+ * 子元素
23
+ */
24
+ children?: ReactNode;
25
+ /**
26
+ * 自定义类名
27
+ */
28
+ className?: string;
29
+ /**
30
+ * 主轴方向
31
+ * @default "horizontal"
32
+ */
33
+ direction?: FlexDirection;
34
+ /**
35
+ * 内容分布
36
+ */
37
+ distribution?: CSSProperties['justifyContent'];
38
+ /**
39
+ * flex 值
40
+ * @default "0 1 auto"
41
+ */
42
+ flex?: number | string;
43
+ /**
44
+ * 主轴方向上的间距
45
+ * @default 0
46
+ */
47
+ gap?: CommonSpaceNumber | number | string;
48
+ /**
49
+ * 高度
50
+ * @default "auto"
51
+ */
52
+ height?: number | string;
53
+ /**
54
+ * 是否横向
55
+ * @default false
56
+ */
57
+ horizontal?: boolean;
58
+ /**
59
+ * 主轴对齐方式
60
+ */
61
+ justify?: CSSProperties['justifyContent'];
62
+ /**
63
+ * 内边距
64
+ * @default 0
65
+ */
66
+ padding?: string | number | CommonSpaceNumber;
67
+ /**
68
+ * 块内边距
69
+ */
70
+ paddingBlock?: string | number;
71
+ /**
72
+ * 内联内边距
73
+ */
74
+ paddingInline?: string | number;
75
+ /**
76
+ * 类名前缀
77
+ */
78
+ prefixCls?: string;
79
+ /**
80
+ * ref 引用
81
+ */
82
+ ref?: Ref<HTMLElement>;
83
+ /**
84
+ * 自定义样式
85
+ */
86
+ style?: CSSProperties;
87
+ /**
88
+ * 是否显示
89
+ * @default true
90
+ */
91
+ visible?: boolean;
92
+ /**
93
+ * 宽度
94
+ * @default "auto"
95
+ */
96
+ width?: number | string;
97
+ /**
98
+ * 换行方式
99
+ */
100
+ wrap?: CSSProperties['flexWrap'];
101
+ }
102
+ export interface FlexBasicProps extends IFlexbox, DivProps {
103
+ }
104
+ export type FlexboxProps = FlexBasicProps;
105
+ export type CenterProps = Omit<FlexBasicProps, 'distribution' | 'direction' | 'align'>;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,7 @@
1
+ import type { FlexDirection } from './type';
2
+ export declare const getPrefix: (prefixCls?: string) => string;
3
+ export declare const getFlexDirection: (direction?: FlexDirection, isHorizontal?: boolean) => "column" | "column-reverse" | "row" | "row-reverse";
4
+ export declare const isSpaceDistribution: (distribution?: string) => boolean | undefined;
5
+ export declare const isHorizontal: (direction?: FlexDirection, isHorizontal?: boolean) => boolean;
6
+ export declare const isVertical: (direction?: FlexDirection, isHorizontal?: boolean) => boolean;
7
+ export declare const getCssValue: (value: string | number | undefined) => string | undefined;
@@ -0,0 +1,39 @@
1
+ export var getPrefix = function getPrefix(prefixCls) {
2
+ if (prefixCls) return prefixCls;
3
+ return 'lobe';
4
+ };
5
+ export var getFlexDirection = function getFlexDirection(direction, isHorizontal) {
6
+ if (isHorizontal) return 'row';
7
+ switch (direction) {
8
+ case 'horizontal':
9
+ {
10
+ return 'row';
11
+ }
12
+ case 'horizontal-reverse':
13
+ {
14
+ return 'row-reverse';
15
+ }
16
+ case 'vertical':
17
+ default:
18
+ {
19
+ return 'column';
20
+ }
21
+ case 'vertical-reverse':
22
+ {
23
+ return 'column-reverse';
24
+ }
25
+ }
26
+ };
27
+ export var isSpaceDistribution = function isSpaceDistribution(distribution) {
28
+ if (!distribution) return;
29
+ return ['space-between', 'space-around', 'space-evenly'].includes(distribution);
30
+ };
31
+ export var isHorizontal = function isHorizontal(direction, _isHorizontal) {
32
+ return getFlexDirection(direction, _isHorizontal) === 'row';
33
+ };
34
+ export var isVertical = function isVertical(direction, isHorizontal) {
35
+ return getFlexDirection(direction, isHorizontal) === 'column';
36
+ };
37
+ export var getCssValue = function getCssValue(value) {
38
+ return typeof value === 'number' ? "".concat(value, "px") : value;
39
+ };
@@ -1,7 +1,7 @@
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 = ["content", "language", "setLanguage", "showLanguage", "className", "style", "allowChangeLanguage", "fileName", "icon", "actionsRender", "copyable", "variant", "shadow", "wrap", "defaultExpand", "children"];
4
+ var _excluded = ["content", "language", "setLanguage", "showLanguage", "className", "classNames", "styles", "style", "allowChangeLanguage", "fileName", "icon", "actionsRender", "copyable", "variant", "shadow", "wrap", "defaultExpand", "children"];
5
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
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
7
  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; }
@@ -72,6 +72,8 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref2) {
72
72
  setLanguage = _ref2.setLanguage,
73
73
  showLanguage = _ref2.showLanguage,
74
74
  className = _ref2.className,
75
+ classNames = _ref2.classNames,
76
+ customStyles = _ref2.styles,
75
77
  style = _ref2.style,
76
78
  _ref2$allowChangeLang = _ref2.allowChangeLanguage,
77
79
  allowChangeLanguage = _ref2$allowChangeLang === void 0 ? false : _ref2$allowChangeLang,
@@ -196,11 +198,12 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref2) {
196
198
  }, rest), {}, {
197
199
  children: [/*#__PURE__*/_jsxs(Flexbox, {
198
200
  align: 'center',
199
- className: headerVariants({
201
+ className: cx(headerVariants({
200
202
  variant: variant
201
- }),
203
+ }), classNames === null || classNames === void 0 ? void 0 : classNames.header),
202
204
  horizontal: true,
203
205
  justify: 'space-between',
206
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.header,
204
207
  children: [/*#__PURE__*/_jsx(ActionIcon, {
205
208
  icon: expand ? ChevronDown : ChevronRight,
206
209
  onClick: handleToggleExpand,
@@ -222,9 +225,10 @@ export var HighlighterFullFeatured = /*#__PURE__*/memo(function (_ref2) {
222
225
  children: actions
223
226
  })]
224
227
  }), /*#__PURE__*/_jsx(Flexbox, {
225
- className: bodyVariants({
228
+ className: cx(bodyVariants({
226
229
  expand: expand
227
- }),
230
+ }), classNames === null || classNames === void 0 ? void 0 : classNames.body),
231
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.body,
228
232
  children: children
229
233
  })]
230
234
  }));
@@ -1,6 +1,6 @@
1
1
  'use client';
2
2
 
3
- var _excluded = ["animated", "fullFeatured", "actionIconSize", "children", "language", "className", "copyable", "showLanguage", "variant", "shadow", "wrap", "bodyRender", "actionsRender", "enableTransformer", "theme", "icon", "fileName", "allowChangeLanguage", "defaultExpand"];
3
+ var _excluded = ["animated", "fullFeatured", "actionIconSize", "children", "language", "className", "classNames", "styles", "copyable", "showLanguage", "variant", "shadow", "wrap", "bodyRender", "actionsRender", "enableTransformer", "theme", "icon", "fileName", "allowChangeLanguage", "defaultExpand"];
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
  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; }
@@ -34,6 +34,8 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
34
34
  _ref$language = _ref.language,
35
35
  language = _ref$language === void 0 ? 'markdown' : _ref$language,
36
36
  className = _ref.className,
37
+ classNames = _ref.classNames,
38
+ customStyles = _ref.styles,
37
39
  _ref$copyable = _ref.copyable,
38
40
  copyable = _ref$copyable === void 0 ? true : _ref$copyable,
39
41
  _ref$showLanguage = _ref.showLanguage,
@@ -123,13 +125,17 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
123
125
  var originalBody = useMemo(function () {
124
126
  return /*#__PURE__*/_jsx(SyntaxHighlighter, {
125
127
  animated: animated,
128
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.content,
126
129
  enableTransformer: enableTransformer,
127
130
  language: lang === null || lang === void 0 ? void 0 : lang.toLowerCase(),
131
+ style: _objectSpread({
132
+ height: '100%'
133
+ }, customStyles === null || customStyles === void 0 ? void 0 : customStyles.content),
128
134
  theme: theme,
129
135
  variant: variant,
130
136
  children: tirmedChildren
131
137
  });
132
- }, [animated, enableTransformer, lang, theme, tirmedChildren, variant]);
138
+ }, [animated, enableTransformer, lang, theme, tirmedChildren, variant, customStyles === null || customStyles === void 0 ? void 0 : customStyles.content, customStyles === null || customStyles === void 0 ? void 0 : customStyles.content]);
133
139
  var displayName = useMemo(function () {
134
140
  if (fileName) return fileName;
135
141
  return getCodeLanguageDisplayName(language);
@@ -146,6 +152,7 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
146
152
  actionsRender: actionsRender,
147
153
  allowChangeLanguage: allowChangeLanguage,
148
154
  className: className,
155
+ classNames: classNames,
149
156
  content: tirmedChildren,
150
157
  copyable: copyable,
151
158
  defaultExpand: defaultExpand,
@@ -155,6 +162,7 @@ export var Highlighter = /*#__PURE__*/memo(function (_ref) {
155
162
  setLanguage: setLang,
156
163
  shadow: shadow,
157
164
  showLanguage: showLanguage,
165
+ styles: customStyles,
158
166
  variant: variant,
159
167
  wrap: wrap
160
168
  }, rest), {}, {
@@ -25,7 +25,7 @@ export var useStyles = createStyles(function (_ref) {
25
25
  lang: cx(langHoverCls, stylish.blur, css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 2;\n inset-block-end: 8px;\n inset-inline-end: 8px;\n\n font-family: ", ";\n color: ", ";\n\n opacity: 0;\n background: ", ";\n\n transition: opacity 0.1s;\n "])), token.fontFamilyCode, token.colorTextSecondary, token.colorFillQuaternary)),
26
26
  nowrap: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n pre,\n code {\n text-wrap: nowrap;\n }\n "]))),
27
27
  outlined: stylish.variantOutlinedWithoutHover,
28
- root: cx(prefix, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n width: 100%;\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n code {\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, actionsHoverCls, langHoverCls)),
28
+ root: cx(prefix, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n\n overflow: hidden;\n\n width: 100%;\n border-radius: ", "px;\n\n transition: background-color 100ms ", ";\n\n &:hover {\n .", " {\n opacity: 1;\n }\n\n .", " {\n opacity: 1;\n }\n }\n\n pre {\n height: 100%;\n font-size: 12px;\n }\n\n code {\n background: transparent !important;\n }\n "])), token.borderRadius, token.motionEaseOut, actionsHoverCls, langHoverCls)),
29
29
  select: css(_templateObject11 || (_templateObject11 = _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 "])), token.colorTextDescription),
30
30
  shadow: stylish.shadow,
31
31
  wrap: css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n pre,\n code {\n text-wrap: wrap;\n }\n "])))
@@ -1,4 +1,4 @@
1
- import { ReactNode, type Ref } from 'react';
1
+ import { CSSProperties, ReactNode, type Ref } from 'react';
2
2
  import { FlexboxProps } from 'react-layout-kit';
3
3
  import type { BuiltinTheme } from 'shiki';
4
4
  import type { ActionIconProps } from "../ActionIcon";
@@ -29,6 +29,11 @@ export interface HighlighterProps extends Omit<FlexboxProps, 'children' | 'wrap'
29
29
  originalNode: ReactNode;
30
30
  }) => ReactNode;
31
31
  children: string;
32
+ classNames?: {
33
+ body?: string;
34
+ content?: string;
35
+ header?: string;
36
+ };
32
37
  copyable?: boolean;
33
38
  defaultExpand?: boolean;
34
39
  enableTransformer?: boolean;
@@ -38,6 +43,11 @@ export interface HighlighterProps extends Omit<FlexboxProps, 'children' | 'wrap'
38
43
  language: string;
39
44
  shadow?: boolean;
40
45
  showLanguage?: boolean;
46
+ styles?: {
47
+ body?: CSSProperties;
48
+ content?: CSSProperties;
49
+ header?: CSSProperties;
50
+ };
41
51
  theme?: 'lobe-theme' | BuiltinTheme;
42
52
  variant?: 'filled' | 'outlined' | 'borderless';
43
53
  wrap?: boolean;
@@ -1,7 +1,7 @@
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 = ["showLanguage", "content", "children", "className", "copyable", "actionsRender", "style", "variant", "shadow", "language", "fileName", "defaultExpand"];
4
+ var _excluded = ["showLanguage", "styles", "classNames", "content", "children", "className", "copyable", "actionsRender", "style", "variant", "shadow", "language", "fileName", "defaultExpand"];
5
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
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
7
  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; }
@@ -55,6 +55,8 @@ var MermaidHeaderLanguage = /*#__PURE__*/memo(function (_ref) {
55
55
  });
56
56
  export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref2) {
57
57
  var showLanguage = _ref2.showLanguage,
58
+ customStyles = _ref2.styles,
59
+ classNames = _ref2.classNames,
58
60
  content = _ref2.content,
59
61
  children = _ref2.children,
60
62
  className = _ref2.className,
@@ -164,11 +166,12 @@ export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref2) {
164
166
  }, rest), {}, {
165
167
  children: [/*#__PURE__*/_jsxs(Flexbox, {
166
168
  align: 'center',
167
- className: headerVariants({
169
+ className: cx(headerVariants({
168
170
  variant: variant
169
- }),
171
+ }), classNames === null || classNames === void 0 ? void 0 : classNames.header),
170
172
  horizontal: true,
171
173
  justify: 'space-between',
174
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.header,
172
175
  children: [/*#__PURE__*/_jsx(ActionIcon, {
173
176
  icon: expand ? ChevronDown : ChevronRight,
174
177
  onClick: handleToggleExpand,
@@ -185,9 +188,10 @@ export var MermaidFullFeatured = /*#__PURE__*/memo(function (_ref2) {
185
188
  children: actions
186
189
  })]
187
190
  }), /*#__PURE__*/_jsx(Flexbox, {
188
- className: bodyVariants({
191
+ className: cx(bodyVariants({
189
192
  expand: expand
190
- }),
193
+ }), classNames === null || classNames === void 0 ? void 0 : classNames.body),
194
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.body,
191
195
  children: children
192
196
  })]
193
197
  }));
@@ -1,7 +1,7 @@
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 = ["children", "actionIconSize", "fullFeatured", "copyable", "showLanguage", "language", "style", "variant", "shadow", "enablePanZoom", "defaultExpand", "className", "bodyRender", "fileName", "actionsRender", "theme"];
4
+ var _excluded = ["children", "actionIconSize", "fullFeatured", "copyable", "showLanguage", "language", "style", "styles", "classNames", "variant", "shadow", "enablePanZoom", "defaultExpand", "className", "bodyRender", "fileName", "actionsRender", "theme"];
5
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
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
7
  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; }
@@ -30,6 +30,8 @@ var Mermaid = /*#__PURE__*/memo(function (_ref) {
30
30
  _ref$language = _ref.language,
31
31
  language = _ref$language === void 0 ? 'mermaid' : _ref$language,
32
32
  style = _ref.style,
33
+ customStyles = _ref.styles,
34
+ classNames = _ref.classNames,
33
35
  _ref$variant = _ref.variant,
34
36
  variant = _ref$variant === void 0 ? 'filled' : _ref$variant,
35
37
  shadow = _ref.shadow,
@@ -98,12 +100,14 @@ var Mermaid = /*#__PURE__*/memo(function (_ref) {
98
100
  }, [actionIconSize, actionsRender, getCopyContent, originalActions, tirmedChildren]);
99
101
  var defaultBody = useMemo(function () {
100
102
  return /*#__PURE__*/_jsx(SyntaxMermaid, {
103
+ className: classNames === null || classNames === void 0 ? void 0 : classNames.content,
101
104
  enablePanZoom: enablePanZoom,
105
+ style: customStyles === null || customStyles === void 0 ? void 0 : customStyles.content,
102
106
  theme: theme,
103
107
  variant: variant,
104
108
  children: tirmedChildren
105
109
  });
106
- }, [enablePanZoom, theme, tirmedChildren, variant]);
110
+ }, [enablePanZoom, theme, tirmedChildren, variant, classNames === null || classNames === void 0 ? void 0 : classNames.content, customStyles === null || customStyles === void 0 ? void 0 : customStyles.content]);
107
111
  var body = useMemo(function () {
108
112
  if (!bodyRender) return defaultBody;
109
113
  return bodyRender({
@@ -114,6 +118,7 @@ var Mermaid = /*#__PURE__*/memo(function (_ref) {
114
118
  if (fullFeatured) return /*#__PURE__*/_jsx(FullFeatured, _objectSpread(_objectSpread({
115
119
  actionsRender: actionsRender,
116
120
  className: className,
121
+ classNames: classNames,
117
122
  content: tirmedChildren,
118
123
  copyable: copyable,
119
124
  defaultExpand: defaultExpand,
@@ -122,6 +127,7 @@ var Mermaid = /*#__PURE__*/memo(function (_ref) {
122
127
  shadow: shadow,
123
128
  showLanguage: showLanguage,
124
129
  style: style,
130
+ styles: customStyles,
125
131
  variant: variant
126
132
  }, rest), {}, {
127
133
  children: body
@@ -1,5 +1,11 @@
1
1
  'use client';
2
2
 
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
+ 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
+ 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; }
7
+ function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
8
+ 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); }
3
9
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
10
  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."); }
5
11
  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); }
@@ -17,7 +23,9 @@ var SyntaxMermaid = /*#__PURE__*/memo(function (_ref) {
17
23
  children = _ref.children,
18
24
  customTheme = _ref.theme,
19
25
  variant = _ref.variant,
20
- enablePanZoom = _ref.enablePanZoom;
26
+ enablePanZoom = _ref.enablePanZoom,
27
+ className = _ref.className,
28
+ style = _ref.style;
21
29
  var isDefaultTheme = customTheme === 'lobe-theme' || !customTheme;
22
30
  var background = useMemo(function () {
23
31
  var _mermaidThemes$find;
@@ -76,6 +84,7 @@ var SyntaxMermaid = /*#__PURE__*/memo(function (_ref) {
76
84
  if (!blobUrl) return null;
77
85
  return /*#__PURE__*/_jsx(Image, {
78
86
  alt: 'mermaid',
87
+ className: className,
79
88
  maxHeight: 480,
80
89
  minWidth: 300,
81
90
  objectFit: 'contain',
@@ -84,7 +93,7 @@ var SyntaxMermaid = /*#__PURE__*/memo(function (_ref) {
84
93
  } : false,
85
94
  ref: ref,
86
95
  src: blobUrl,
87
- style: {
96
+ style: _objectSpread({
88
97
  background: variant === 'filled' ? background : undefined,
89
98
  borderRadius: 0,
90
99
  margin: 0,
@@ -92,7 +101,7 @@ var SyntaxMermaid = /*#__PURE__*/memo(function (_ref) {
92
101
  padding: variant === 'borderless' ? 0 : 16,
93
102
  position: 'relative',
94
103
  width: '100%'
95
- },
104
+ }, style),
96
105
  variant: 'borderless',
97
106
  width: '100%'
98
107
  });
@@ -1,11 +1,13 @@
1
1
  import type { MermaidConfig } from 'mermaid/dist/config.type';
2
- import type { ReactNode, Ref } from 'react';
2
+ import { CSSProperties, ReactNode, Ref } from 'react';
3
3
  import type { ActionIconProps } from "../ActionIcon";
4
4
  import type { DivProps } from "../types";
5
5
  export interface SyntaxMermaidProps {
6
6
  children: string;
7
+ className?: string;
7
8
  enablePanZoom?: MermaidProps['enablePanZoom'];
8
9
  ref?: Ref<HTMLDivElement>;
10
+ style?: CSSProperties;
9
11
  theme?: MermaidProps['theme'];
10
12
  variant?: MermaidProps['variant'];
11
13
  }
@@ -22,6 +24,11 @@ export interface MermaidProps extends DivProps {
22
24
  originalNode: ReactNode;
23
25
  }) => ReactNode;
24
26
  children: string;
27
+ classNames?: {
28
+ body?: string;
29
+ content?: string;
30
+ header?: string;
31
+ };
25
32
  copyable?: boolean;
26
33
  defaultExpand?: boolean;
27
34
  enablePanZoom?: boolean;
@@ -30,6 +37,11 @@ export interface MermaidProps extends DivProps {
30
37
  language?: string;
31
38
  shadow?: boolean;
32
39
  showLanguage?: boolean;
40
+ styles?: {
41
+ body?: CSSProperties;
42
+ content?: CSSProperties;
43
+ header?: CSSProperties;
44
+ };
33
45
  theme?: 'lobe-theme' | MermaidConfig['theme'];
34
46
  variant?: 'filled' | 'outlined' | 'borderless';
35
47
  }
package/es/index.d.ts CHANGED
@@ -22,6 +22,7 @@ export { default as EditableText, type EditableTextProps } from './EditableText'
22
22
  export { default as EmojiPicker, type EmojiPickerProps } from './EmojiPicker';
23
23
  export { default as Empty, type EmptyProps } from './Empty';
24
24
  export { default as FileTypeIcon, type FileTypeIconProps } from './FileTypeIcon';
25
+ export { Center, type CenterProps, FlexBasic, type FlexBasicProps, Flexbox, type FlexboxProps, } from './Flex';
25
26
  export { default as FluentEmoji, type FluentEmojiProps } from './FluentEmoji';
26
27
  export { default as FontLoader, type FontLoaderProps } from './FontLoader';
27
28
  export { default as Footer, type FooterProps } from './Footer';
package/es/index.js CHANGED
@@ -22,6 +22,7 @@ export { default as EditableText } from "./EditableText";
22
22
  export { default as EmojiPicker } from "./EmojiPicker";
23
23
  export { default as Empty } from "./Empty";
24
24
  export { default as FileTypeIcon } from "./FileTypeIcon";
25
+ export { Center, FlexBasic, Flexbox } from "./Flex";
25
26
  export { default as FluentEmoji } from "./FluentEmoji";
26
27
  export { default as FontLoader } from "./FontLoader";
27
28
  export { default as Footer } from "./Footer";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "3.2.0",
3
+ "version": "3.3.1",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",