@lobehub/ui 1.101.3 → 1.102.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.
@@ -39,7 +39,7 @@ var Avatar = /*#__PURE__*/memo(function (_ref) {
39
39
  className: cx(styles.avatar, className),
40
40
  shape: shape,
41
41
  size: size,
42
- src: avatar
42
+ srcSet: avatar
43
43
  }, props)) : /*#__PURE__*/_jsx(AntAvatar, _objectSpread(_objectSpread({
44
44
  className: cx(styles.avatar, className),
45
45
  shape: shape,
@@ -24,8 +24,7 @@ var ChatInputArea = /*#__PURE__*/forwardRef(function (_ref, ref) {
24
24
  minHeight = _ref$minHeight === void 0 ? 200 : _ref$minHeight,
25
25
  className = _ref.className,
26
26
  actions = _ref.actions,
27
- _ref$safeArea = _ref.safeArea,
28
- safeArea = _ref$safeArea === void 0 ? true : _ref$safeArea,
27
+ safeArea = _ref.safeArea,
29
28
  expand = _ref.expand,
30
29
  _ref$placeholder = _ref.placeholder,
31
30
  placeholder = _ref$placeholder === void 0 ? 'Type something to chat...' : _ref$placeholder,
@@ -1,11 +1,12 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3;
3
3
  import { createStyles } from 'antd-style';
4
+ import { rgba } from 'polished';
4
5
  export var useStyles = createStyles(function (_ref) {
5
6
  var css = _ref.css,
6
7
  token = _ref.token;
7
8
  return {
8
- container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 12px 0;\n "]))),
9
+ container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n padding: 12px 0;\n background: ", ";\n border-top: 1px solid ", ";\n "])), token.colorBgLayout, rgba(token.colorBorder, 0.25)),
9
10
  inner: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n padding: 0 16px;\n "]))),
10
11
  input: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n background: ", " !important;\n border: none !important;\n "])), token.colorFillSecondary)
11
12
  };
@@ -16,7 +16,7 @@ var Actions = /*#__PURE__*/memo(function (_ref) {
16
16
  return /*#__PURE__*/_jsx(Flexbox, {
17
17
  align: 'flex-start',
18
18
  className: styles.actions,
19
- role: "chat-item-actions",
19
+ role: "widget",
20
20
  children: actions
21
21
  });
22
22
  });
@@ -24,7 +24,7 @@ export var useStyles = createStyles(function (_ref, _ref2) {
24
24
  alert: css(_templateObject7 || (_templateObject7 = _taggedTemplateLiteral([""]))),
25
25
  avatarContainer: css(_templateObject8 || (_templateObject8 = _taggedTemplateLiteral(["\n position: relative;\n flex: none;\n width: ", "px;\n height: ", "px;\n "])), avatarSize, avatarSize),
26
26
  avatarGroupContainer: css(_templateObject9 || (_templateObject9 = _taggedTemplateLiteral(["\n width: ", "px;\n "])), avatarSize),
27
- container: cx(type === 'pure' && pureContainerStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n max-width: 100vw;\n padding: 12px 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='chat-item-actions'] {\n display: flex;\n }\n\n time,\n div[role='chat-item-actions'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='chat-item-actions'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n\n ", " {\n padding: 4px 16px;\n }\n "])), token.motionEaseOut, responsive.mobile)),
27
+ container: cx(type === 'pure' && pureContainerStylish, css(_templateObject10 || (_templateObject10 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n max-width: 100vw;\n padding: 12px 16px;\n\n time {\n display: inline-block;\n white-space: nowrap;\n }\n\n div[role='widget'] {\n display: flex;\n }\n\n time,\n div[role='widget'] {\n pointer-events: none;\n opacity: 0;\n transition: opacity 200ms ", ";\n }\n\n &:hover {\n time,\n div[role='widget'] {\n pointer-events: unset;\n opacity: 1;\n }\n }\n\n ", " {\n padding: 4px 16px;\n }\n "])), token.motionEaseOut, responsive.mobile)),
28
28
  editingContainer: cx(editingStylish, css(_templateObject11 || (_templateObject11 = _taggedTemplateLiteral(["\n padding: 8px 12px 12px;\n border: 1px solid ", ";\n\n &:active,\n &:hover {\n border-color: ", ";\n }\n "])), token.colorBorderSecondary, token.colorBorder), type === 'pure' && css(_templateObject12 || (_templateObject12 = _taggedTemplateLiteral(["\n background: ", ";\n border-radius: ", "px;\n "])), token.colorFillQuaternary, token.borderRadius)),
29
29
  editingInput: css(_templateObject13 || (_templateObject13 = _taggedTemplateLiteral(["\n width: 100%;\n "]))),
30
30
  loading: css(_templateObject14 || (_templateObject14 = _taggedTemplateLiteral(["\n position: absolute;\n right: ", ";\n bottom: 0;\n left: ", ";\n\n width: 16px;\n height: 16px;\n\n color: ", ";\n\n background: ", ";\n border-radius: 50%;\n "])), placement === 'left' ? '-4px' : 'unset', placement === 'right' ? '-4px' : 'unset', token.colorBgLayout, token.colorPrimary),
@@ -1,10 +1,12 @@
1
- import { ReactNode } from 'react';
1
+ import { ElementType, ReactNode } from 'react';
2
2
  import { CDN, CdnApi } from "../utils/genCdnUrl";
3
3
  type CdnFn = ({ pkg, version, path }: CdnApi) => string;
4
4
  export interface Config {
5
5
  customCdnFn?: CdnFn;
6
+ imgAs?: ElementType;
6
7
  proxy: CDN | 'custom';
7
8
  }
9
+ export declare const ConfigContext: import("react").Context<Config | null>;
8
10
  declare const ConfigProvider: import("react").NamedExoticComponent<{
9
11
  children: ReactNode;
10
12
  config: Config;
@@ -1,7 +1,7 @@
1
1
  import { createContext, memo, useContext } from 'react';
2
2
  import { genCdnUrl } from "../utils/genCdnUrl";
3
3
  import { jsx as _jsx } from "react/jsx-runtime";
4
- var ConfigContext = /*#__PURE__*/createContext(null);
4
+ export var ConfigContext = /*#__PURE__*/createContext(null);
5
5
  var ConfigProvider = /*#__PURE__*/memo(function (_ref) {
6
6
  var children = _ref.children,
7
7
  config = _ref.config;
@@ -9,6 +9,7 @@ import { X } from 'lucide-react';
9
9
  import { memo } from 'react';
10
10
  import { Flexbox } from 'react-layout-kit';
11
11
  import useMergeState from 'use-merge-value';
12
+ import Img from "../Img";
12
13
  import { useStyles } from "./style";
13
14
  import { jsx as _jsx } from "react/jsx-runtime";
14
15
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -47,7 +48,7 @@ var EmptyCard = /*#__PURE__*/memo(function (_ref) {
47
48
  blockSize: 24,
48
49
  fontSize: 16
49
50
  }
50
- }), cover && /*#__PURE__*/_jsx("img", {
51
+ }), cover && /*#__PURE__*/_jsx(Img, {
51
52
  alt: alt,
52
53
  className: styles.image,
53
54
  height: height,
@@ -6,6 +6,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
6
6
  import { memo } from 'react';
7
7
  import { Center, Flexbox } from 'react-layout-kit';
8
8
  import Icon from "../Icon";
9
+ import Img from "../Img";
9
10
  import { useStyles } from "./style";
10
11
 
11
12
  // @ts-ignore
@@ -16,7 +17,7 @@ var Image = /*#__PURE__*/memo(function (_ref) {
16
17
  className = _ref.className,
17
18
  title = _ref.title,
18
19
  style = _ref.style;
19
- return image.startsWith('http') ? /*#__PURE__*/_jsx("img", {
20
+ return image.startsWith('http') ? /*#__PURE__*/_jsx(Img, {
20
21
  alt: title,
21
22
  className: className,
22
23
  src: image,
@@ -5,6 +5,7 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
5
5
  import { kebabCase } from 'lodash-es';
6
6
  import { memo, useMemo, useState } from 'react';
7
7
  import { useCdnFn } from "../ConfigProvider";
8
+ import Img from "../Img";
8
9
  import { getEmojiNameByCharacter } from "../utils/getEmojiByCharacter";
9
10
  import { useStyles } from "./style";
10
11
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -72,7 +73,7 @@ var FluentEmoji = /*#__PURE__*/memo(function (_ref) {
72
73
  height: size,
73
74
  width: size
74
75
  }, style),
75
- children: /*#__PURE__*/_jsx("img", {
76
+ children: /*#__PURE__*/_jsx(Img, {
76
77
  alt: emoji,
77
78
  height: "100%",
78
79
  loading: "lazy",
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ImageProps } from 'antd';
3
+ import { ImgProps } from "../types";
4
+ declare const Img: import("react").ForwardRefExoticComponent<ImgProps & ImageProps & import("react").RefAttributes<any>>;
5
+ export default Img;
@@ -0,0 +1,23 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
3
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
4
+ import { createElement, forwardRef, useContext, useMemo } from 'react';
5
+ import { ConfigContext } from "../ConfigProvider";
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var createContainer = function createContainer(as) {
8
+ return /*#__PURE__*/forwardRef(function (props, ref) {
9
+ return /*#__PURE__*/createElement(as, _objectSpread(_objectSpread({}, props), {}, {
10
+ ref: ref
11
+ }));
12
+ });
13
+ };
14
+ var Img = /*#__PURE__*/forwardRef(function (props, ref) {
15
+ var config = useContext(ConfigContext);
16
+ var ImgContainer = useMemo(function () {
17
+ return createContainer((config === null || config === void 0 ? void 0 : config.imgAs) || 'img');
18
+ }, [config]);
19
+ return /*#__PURE__*/_jsx(ImgContainer, _objectSpread({
20
+ ref: ref
21
+ }, props));
22
+ });
23
+ export default Img;
package/es/Logo/index.js CHANGED
@@ -7,6 +7,7 @@ import { useTheme } from 'antd-style';
7
7
  import { memo } from 'react';
8
8
  import { Flexbox } from 'react-layout-kit';
9
9
  import { useCdnFn } from "../ConfigProvider";
10
+ import Img from "../Img";
10
11
  import Divider from "./Divider";
11
12
  import LogoHighContrast from "./LogoHighContrast";
12
13
  import LogoText from "./LogoText";
@@ -31,7 +32,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
31
32
  switch (type) {
32
33
  case '3d':
33
34
  {
34
- logoComponent = /*#__PURE__*/_jsx("img", _objectSpread({
35
+ logoComponent = /*#__PURE__*/_jsx(Img, _objectSpread({
35
36
  alt: "lobehub",
36
37
  src: genCdnUrl(LOGO_3D),
37
38
  style: _objectSpread({
@@ -43,7 +44,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
43
44
  }
44
45
  case 'flat':
45
46
  {
46
- logoComponent = /*#__PURE__*/_jsx("img", {
47
+ logoComponent = /*#__PURE__*/_jsx(Img, {
47
48
  alt: "lobehub",
48
49
  src: genCdnUrl(LOGO_FLAT),
49
50
  style: _objectSpread({
@@ -77,7 +78,7 @@ var Logo = /*#__PURE__*/memo(function (_ref) {
77
78
  case 'combine':
78
79
  {
79
80
  logoComponent = /*#__PURE__*/_jsxs(_Fragment, {
80
- children: [/*#__PURE__*/_jsx("img", {
81
+ children: [/*#__PURE__*/_jsx(Img, {
81
82
  alt: "lobehub",
82
83
  src: genCdnUrl(LOGO_3D),
83
84
  style: {
@@ -1,6 +1,6 @@
1
1
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
2
  center: import("antd-style").SerializedStyles;
3
- container: string;
3
+ container: import("antd-style").SerializedStyles;
4
4
  inner: import("antd-style").SerializedStyles;
5
5
  left: import("antd-style").SerializedStyles;
6
6
  right: import("antd-style").SerializedStyles;
@@ -1,15 +1,12 @@
1
1
  import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
2
2
  var _templateObject, _templateObject2, _templateObject3, _templateObject4, _templateObject5;
3
3
  import { createStyles } from 'antd-style';
4
- import { rgba } from 'polished';
5
4
  export var useStyles = createStyles(function (_ref) {
6
5
  var css = _ref.css,
7
- token = _ref.token,
8
- cx = _ref.cx,
9
- stylish = _ref.stylish;
6
+ token = _ref.token;
10
7
  return {
11
8
  center: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 100%;\n "]))),
12
- container: cx(stylish.blurStrong, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n flex: none;\n width: 100vw;\n background: linear-gradient(\n to bottom,\n ", ",\n ", "\n );\n "])), rgba(token.colorBgLayout, 0.8), rgba(token.colorBgLayout, 0.4))),
9
+ container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n flex: none;\n width: 100vw;\n background: ", ";\n "])), token.colorBgLayout),
13
10
  inner: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n position: relative;\n\n width: 100%;\n height: 44px;\n min-height: 44px;\n max-height: 44px;\n padding: 0 6px;\n "]))),
14
11
  left: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n justify-content: flex-start;\n height: 100%;\n "]))),
15
12
  right: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n justify-content: flex-end;\n height: 100%;\n "])))
@@ -8,8 +8,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  var MobileTabBar = /*#__PURE__*/memo(function (_ref) {
10
10
  var className = _ref.className,
11
- _ref$safeArea = _ref.safeArea,
12
- safeArea = _ref$safeArea === void 0 ? true : _ref$safeArea,
11
+ safeArea = _ref.safeArea,
13
12
  style = _ref.style,
14
13
  items = _ref.items,
15
14
  activeKey = _ref.activeKey,
@@ -1,6 +1,6 @@
1
1
  export declare const useStyles: (props?: unknown) => import("antd-style").ReturnStyles<{
2
2
  active: import("antd-style").SerializedStyles;
3
- container: string;
3
+ container: import("antd-style").SerializedStyles;
4
4
  icon: import("antd-style").SerializedStyles;
5
5
  inner: import("antd-style").SerializedStyles;
6
6
  tab: import("antd-style").SerializedStyles;
@@ -4,12 +4,10 @@ import { createStyles } from 'antd-style';
4
4
  import { rgba } from 'polished';
5
5
  export var useStyles = createStyles(function (_ref) {
6
6
  var css = _ref.css,
7
- token = _ref.token,
8
- cx = _ref.cx,
9
- stylish = _ref.stylish;
7
+ token = _ref.token;
10
8
  return {
11
9
  active: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n color: ", ";\n "])), token.colorPrimary),
12
- container: cx(stylish.blur, css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n flex: none;\n\n width: 100vw;\n padding-bottom: 12px;\n\n background: ", ";\n "])), rgba(token.colorBgLayout, 0.5))),
10
+ container: css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n overflow: hidden;\n flex: none;\n\n width: 100vw;\n\n background: ", ";\n border-top: 1px solid ", ";\n "])), token.colorBgLayout, rgba(token.colorBorder, 0.25)),
13
11
  icon: css(_templateObject3 || (_templateObject3 = _taggedTemplateLiteral(["\n width: 24px;\n height: 24px;\n font-size: 24px;\n "]))),
14
12
  inner: css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: relative;\n width: 100%;\n height: 48px;\n "]))),
15
13
  tab: css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n cursor: pointer;\n width: 48px;\n height: 48px;\n color: ", ";\n "])), token.colorTextSecondary),
package/es/Modal/index.js CHANGED
@@ -5,17 +5,14 @@ var _excluded = ["children", "title", "className", "wrapClassName", "width", "on
5
5
  var _templateObject, _templateObject2;
6
6
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
7
7
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
8
- import { Modal as AntModal, ConfigProvider } from 'antd';
9
- import { Drawer } from 'antd';
8
+ import { Modal as AntModal, ConfigProvider, Drawer } from 'antd';
10
9
  import { createStyles, useResponsive } from 'antd-style';
11
10
  import { X } from 'lucide-react';
12
11
  import { lighten } from 'polished';
13
12
  import { memo } from 'react';
14
13
  import ActionIcon from "../ActionIcon";
15
14
  import Icon from "../Icon";
16
- import MobileSafeArea from "../MobileSafeArea";
17
15
  import { jsx as _jsx } from "react/jsx-runtime";
18
- import { jsxs as _jsxs } from "react/jsx-runtime";
19
16
  var useStyles = createStyles(function (_ref) {
20
17
  var css = _ref.css,
21
18
  token = _ref.token,
@@ -42,7 +39,7 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
42
39
  styles = _useStyles.styles,
43
40
  cx = _useStyles.cx,
44
41
  theme = _useStyles.theme;
45
- if (mobile) return /*#__PURE__*/_jsxs(Drawer, {
42
+ if (mobile) return /*#__PURE__*/_jsx(Drawer, {
46
43
  bodyStyle: {
47
44
  padding: 0
48
45
  },
@@ -55,7 +52,7 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
55
52
  }),
56
53
  destroyOnClose: destroyOnClose,
57
54
  drawerStyle: {
58
- background: theme.colorBgContainer
55
+ background: "linear-gradient(to bottom, ".concat(theme.colorBgContainer, ", ").concat(theme.colorBgLayout, ")")
59
56
  },
60
57
  headerStyle: {
61
58
  padding: '8px 4px'
@@ -66,9 +63,7 @@ var Modal = /*#__PURE__*/memo(function (_ref2) {
66
63
  open: open,
67
64
  placement: 'bottom',
68
65
  title: title,
69
- children: [children, /*#__PURE__*/_jsx(MobileSafeArea, {
70
- position: 'bottom'
71
- })]
66
+ children: children
72
67
  });
73
68
  return /*#__PURE__*/_jsx(ConfigProvider, {
74
69
  theme: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lobehub/ui",
3
- "version": "1.101.3",
3
+ "version": "1.102.0",
4
4
  "description": "Lobe UI is an open-source UI component library for building AIGC web apps",
5
5
  "keywords": [
6
6
  "lobehub",