@lobehub/ui 1.140.0 → 1.140.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/Avatar/index.js
CHANGED
|
@@ -6,7 +6,6 @@ var _excluded = ["className", "avatar", "title", "animation", "size", "shape", "
|
|
|
6
6
|
import { Avatar as AntAvatar } from 'antd';
|
|
7
7
|
import { forwardRef, isValidElement, useMemo } from 'react';
|
|
8
8
|
import FluentEmoji from "../FluentEmoji";
|
|
9
|
-
import { EmojiType } from "../FluentEmoji/utils";
|
|
10
9
|
import Img from "../Img";
|
|
11
10
|
import { getEmoji } from "../utils/getEmojiByCharacter";
|
|
12
11
|
import { useStyles } from "./style";
|
|
@@ -63,7 +62,7 @@ var Avatar = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
63
62
|
children: emoji ? /*#__PURE__*/_jsx(FluentEmoji, {
|
|
64
63
|
emoji: emoji,
|
|
65
64
|
size: size * 0.8,
|
|
66
|
-
type: animation ?
|
|
65
|
+
type: animation ? 'anim' : '3d',
|
|
67
66
|
unoptimized: unoptimized
|
|
68
67
|
}) : text === null || text === void 0 ? void 0 : text.toUpperCase().slice(0, 2)
|
|
69
68
|
}));
|
package/es/FluentEmoji/index.js
CHANGED
|
@@ -6,14 +6,14 @@ import { memo, useMemo, useState } from 'react';
|
|
|
6
6
|
import { Center } from 'react-layout-kit';
|
|
7
7
|
import Img from "../Img";
|
|
8
8
|
import { useStyles } from "./style";
|
|
9
|
-
import {
|
|
9
|
+
import { genEmojiUrl } from "./utils";
|
|
10
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
11
|
var FluentEmoji = /*#__PURE__*/memo(function (_ref) {
|
|
12
12
|
var emoji = _ref.emoji,
|
|
13
13
|
className = _ref.className,
|
|
14
14
|
style = _ref.style,
|
|
15
15
|
_ref$type = _ref.type,
|
|
16
|
-
type = _ref$type === void 0 ?
|
|
16
|
+
type = _ref$type === void 0 ? '3d' : _ref$type,
|
|
17
17
|
_ref$size = _ref.size,
|
|
18
18
|
size = _ref$size === void 0 ? 40 : _ref$size,
|
|
19
19
|
unoptimized = _ref.unoptimized;
|
|
@@ -1,9 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
Anim = "anim",
|
|
3
|
-
Flat = "flat",
|
|
4
|
-
Modern = "modern",
|
|
5
|
-
Mono = "mono",
|
|
6
|
-
Pure = "pure",
|
|
7
|
-
ThreeD = "3d"
|
|
8
|
-
}
|
|
1
|
+
export type EmojiType = 'anim' | 'flat' | 'modern' | 'mono' | 'pure' | '3d';
|
|
9
2
|
export declare const genEmojiUrl: (emoji: string, type: EmojiType) => string | null;
|
package/es/FluentEmoji/utils.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
export var EmojiType = /*#__PURE__*/function (EmojiType) {
|
|
3
|
-
EmojiType["Anim"] = "anim";
|
|
4
|
-
EmojiType["Flat"] = "flat";
|
|
5
|
-
EmojiType["Modern"] = "modern";
|
|
6
|
-
EmojiType["Mono"] = "mono";
|
|
7
|
-
EmojiType["Pure"] = "pure";
|
|
8
|
-
EmojiType["ThreeD"] = "3d";
|
|
9
|
-
return EmojiType;
|
|
10
|
-
}({});
|
|
11
2
|
function isFlagEmoji(emoji) {
|
|
12
3
|
var flagRegex = /(?:\uD83C[\uDDE6-\uDDFF]){2}/;
|
|
13
4
|
return flagRegex.test(emoji);
|
|
@@ -20,7 +11,7 @@ function emojiToUnicode(emoji) {
|
|
|
20
11
|
}
|
|
21
12
|
export var genEmojiUrl = function genEmojiUrl(emoji, type) {
|
|
22
13
|
if (isFlagEmoji(emoji)) return "https://jsdelivr.lobehub-inc.cn/gh/RealityRipple/emoji/noto/".concat(emojiToUnicode(emoji), ".png");
|
|
23
|
-
if (type ===
|
|
24
|
-
var ext = [
|
|
14
|
+
if (type === 'pure') return null;
|
|
15
|
+
var ext = ['anim', '3d'].includes(type) ? 'webp' : 'svg';
|
|
25
16
|
return "https://jsdelivr.lobehub-inc.cn/gh/lobehub/fluent-emoji/packages/".concat(type, "/assets/").concat(emojiToUnicode(emoji), ".").concat(ext);
|
|
26
17
|
};
|