@ichaingo/iconfont 1.4.94 → 1.4.95
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/dist/index.d.ts +2 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -11
- package/eslint.config.mjs +2 -8
- package/package.json +1 -4
- package/src/index.tsx +2 -24
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
export
|
|
3
|
-
lightType?: string;
|
|
4
|
-
darkType?: string;
|
|
5
|
-
}
|
|
6
|
-
declare const IconFont: (props: IProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
export default IconFont;
|
|
1
|
+
declare const _default: import('react').FC<import('@ant-design/icons/lib/components/IconFont').IconFontProps<string>>;
|
|
2
|
+
export default _default;
|
|
8
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":";AAIA,wBAEG"}
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
import { useTheme as T } from "@ichaingo/next-themes";
|
|
5
|
-
const h = y({
|
|
2
|
+
import { createFromIconfontCN as o } from "@ant-design/icons";
|
|
3
|
+
const t = o({
|
|
6
4
|
scriptUrl: "//cdn.ichatgo.ai/common/iconfont/20251024/iconfont.js"
|
|
7
5
|
// 在 iconfont.cn 上生成
|
|
8
|
-
})
|
|
9
|
-
const { type: e, lightType: c, darkType: s, ...m } = r, { resolvedTheme: a, theme: i } = T(), t = a || i, [o, n] = p(e);
|
|
10
|
-
return f(() => {
|
|
11
|
-
n(t === "dark" ? s || e : c || e);
|
|
12
|
-
}, [t]), /* @__PURE__ */ l(h, { ...m, type: o, key: o });
|
|
13
|
-
};
|
|
6
|
+
});
|
|
14
7
|
export {
|
|
15
|
-
|
|
8
|
+
t as default
|
|
16
9
|
};
|
package/eslint.config.mjs
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
2
|
import baseConfig from '../../eslint.config.mjs';
|
|
3
3
|
|
|
4
4
|
export default [
|
|
5
|
-
...baseConfig
|
|
6
|
-
...nx.configs['flat/react'],
|
|
7
|
-
{
|
|
8
|
-
files: ['**/*.ts', '**/*.tsx', '**/*.js', '**/*.jsx'],
|
|
9
|
-
// Override or add rules here
|
|
10
|
-
rules: {},
|
|
11
|
-
},
|
|
5
|
+
...baseConfig
|
|
12
6
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ichaingo/iconfont",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.95",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -19,9 +19,6 @@
|
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"react": "19.1.1",
|
|
21
21
|
"react-dom": "19.1.1",
|
|
22
|
-
"tailwind-merge": "3.3.1",
|
|
23
|
-
"next": "15.5.6",
|
|
24
|
-
"@ichaingo/next-themes": "0.5.0",
|
|
25
22
|
"@ant-design/icons": "5.6.1"
|
|
26
23
|
}
|
|
27
24
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,29 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { createFromIconfontCN } from '@ant-design/icons';
|
|
4
|
-
import type { IconFontProps } from '@ant-design/icons/lib/components/IconFont';
|
|
5
|
-
import { useTheme } from '@ichaingo/next-themes';
|
|
6
|
-
import { useEffect, useState } from 'react';
|
|
7
4
|
|
|
8
|
-
|
|
5
|
+
export default createFromIconfontCN({
|
|
9
6
|
scriptUrl: '//cdn.ichatgo.ai/common/iconfont/20251024/iconfont.js', // 在 iconfont.cn 上生成
|
|
10
|
-
});
|
|
11
|
-
export interface IProps extends IconFontProps {
|
|
12
|
-
lightType?: string; // 浅色主题下的图标类型
|
|
13
|
-
darkType?: string; // 深色主题下的图标类型
|
|
14
|
-
}
|
|
15
|
-
const IconFont = (props: IProps) => {
|
|
16
|
-
const { type, lightType, darkType, ...restProps } = props;
|
|
17
|
-
const { resolvedTheme, theme } = useTheme();
|
|
18
|
-
const currentTheme = resolvedTheme || theme;
|
|
19
|
-
const [finalType, setFinalType] = useState(type);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
if (currentTheme === 'dark') {
|
|
22
|
-
setFinalType(darkType || type);
|
|
23
|
-
} else {
|
|
24
|
-
setFinalType(lightType || type);
|
|
25
|
-
}
|
|
26
|
-
}, [currentTheme]);
|
|
27
|
-
return <Instance {...restProps} type={finalType} key={finalType} />;
|
|
28
|
-
};
|
|
29
|
-
export default IconFont;
|
|
7
|
+
});
|