@yakit-libs/yakit-ui-icons 0.2.0 → 0.2.2
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/README.md +68 -1
- package/dist/IconBase.d.ts +9 -0
- package/dist/browser/colorful/index.js +2 -0
- package/dist/browser/index.js +2 -0
- package/dist/browser/oldicon/index.js +2 -0
- package/dist/browser/outline/index.js +2 -0
- package/dist/browser/registry.js +2 -0
- package/dist/browser/solid/index.js +2 -0
- package/dist/colorful/catalog.d.ts +2379 -0
- package/dist/colorful/index.d.ts +297 -0
- package/dist/colorful/index.js +300 -0
- package/dist/colorful/types.d.ts +4 -0
- package/dist/createIcon-CNgBwNTZ.js +70 -0
- package/dist/createIcon.d.ts +2 -3
- package/dist/icon.css +29 -0
- package/dist/index-BGCwJlMA.js +1864 -0
- package/dist/{index-COg0_949.js → index-DkTgsEMh.js} +72 -72
- package/dist/{index-MM6ZyIq4.js → index-_bt7cO4x.js} +28 -28
- package/dist/index.d.ts +3 -1
- package/dist/index.js +944 -640
- package/dist/loading/index.d.ts +4 -3
- package/dist/oldicon/index.d.ts +381 -0
- package/dist/oldicon/index.js +1213 -0
- package/dist/outline/index.d.ts +351 -350
- package/dist/outline/index.js +2 -2
- package/dist/registry.d.ts +19 -10
- package/dist/registry.js +2715 -38
- package/dist/solid/index.d.ts +256 -255
- package/dist/solid/index.js +2 -2
- package/dist/types.d.ts +14 -4
- package/package.json +24 -2
- package/dist/createIcon-QEZGVf73.js +0 -22
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @yakit-libs/yakit-ui-icons
|
|
2
2
|
|
|
3
|
-
Yakit UI 的 React
|
|
3
|
+
Yakit UI 的 React 图标包。它不依赖组件库或 CSS-in-JS 运行时,颜色 token 由运行时依赖 `@yakit-libs/color` 提供。
|
|
4
4
|
|
|
5
5
|
## 安装
|
|
6
6
|
|
|
@@ -21,6 +21,12 @@ applyThemeColors(theme, getColors(theme));
|
|
|
21
21
|
|
|
22
22
|
## 使用
|
|
23
23
|
|
|
24
|
+
`@yakit-libs/yakit-ui-icons` 是 Yakit 图标的规范导入包。即使项目同时安装了
|
|
25
|
+
`@yakit-libs/yakit-ui`,新增代码也应优先使用本包,而不是兼容入口
|
|
26
|
+
`@yakit-libs/yakit-ui/icons*`。
|
|
27
|
+
|
|
28
|
+
本包与 `@yakit-libs/yakit-ui` 独立遵循 SemVer,版本号不要求相同;任一包单独发布不会强制另一个包升版。
|
|
29
|
+
|
|
24
30
|
```tsx
|
|
25
31
|
import { HomeSolid, HomeOutlined } from "@yakit-libs/yakit-ui-icons";
|
|
26
32
|
|
|
@@ -32,6 +38,20 @@ export const HomeEntry = () => (
|
|
|
32
38
|
);
|
|
33
39
|
```
|
|
34
40
|
|
|
41
|
+
所有默认图标都会渲染为与 Yakit 原 Ant Design 4.8 自定义图标兼容的结构:
|
|
42
|
+
|
|
43
|
+
```html
|
|
44
|
+
<span role="img" class="anticon yakit-icon consumer-class">
|
|
45
|
+
<svg aria-hidden="true" focusable="false">...</svg>
|
|
46
|
+
</span>
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
`className`、`style`、事件、ARIA 属性和 `ref<HTMLSpanElement>` 属于外层 `span`;`size` 设置内层 SVG 的宽高。确需修改 SVG 表现属性时使用 `svgProps`,该入口不会接受内层事件、ARIA、焦点、ref 或内容注入。`color="currentColor"` 不产生内联颜色,可继续继承现有 Yakit/Ant 样式。
|
|
50
|
+
|
|
51
|
+
浏览器条件入口会自动关联静态 `icon.css`,根入口和 `/outline`、`/solid`、`/colorful` 多次导入时由打包器合并为一份样式;Node SSR 使用无 CSS 的通用入口,不会访问 DOM 或尝试加载 CSS 模块。无法识别 package `browser` condition 的自定义构建环境可显式导入 `@yakit-libs/yakit-ui-icons/icon.css`。
|
|
52
|
+
|
|
53
|
+
多色、品牌、头像和状态类图标同样从根入口导出。它们会保留 Figma 定义的固定色、渐变与局部主题色;注册表中的 `paintMode` 可用于区分 `literal`、`mixed` 和 `currentColor` 行为。
|
|
54
|
+
|
|
35
55
|
Outline 与 Solid 的主色默认使用 `var(--Colors-Use-Neutral-Text-1-Title, #353639)`。消费者仍可以通过 `color`、`style.color`、`color="inherit"` 或局部覆盖 CSS 变量改变颜色:
|
|
36
56
|
|
|
37
57
|
```tsx
|
|
@@ -51,10 +71,57 @@ Outline 与 Solid 的主色默认使用 `var(--Colors-Use-Neutral-Text-1-Title,
|
|
|
51
71
|
```tsx
|
|
52
72
|
import { HomeOutlined } from "@yakit-libs/yakit-ui-icons/outline";
|
|
53
73
|
import { HomeSolid } from "@yakit-libs/yakit-ui-icons/solid";
|
|
74
|
+
import * as ColorfulIcons from "@yakit-libs/yakit-ui-icons/colorful";
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
### 遗留图标兼容入口
|
|
78
|
+
|
|
79
|
+
仍在 Yakit 中使用、但无法用现有正式图标安全替换的旧 SVG 通过独立的 `oldicon`
|
|
80
|
+
兼容入口提供:
|
|
81
|
+
|
|
82
|
+
```tsx
|
|
83
|
+
import { PopoverArrowIcon } from "@yakit-libs/yakit-ui-icons/oldicon";
|
|
54
84
|
```
|
|
55
85
|
|
|
86
|
+
`oldicon` 保留旧实现的几何、paint、`viewBox` 和固有尺寸,仅用于迁移既有消费者。
|
|
87
|
+
它不是第四个正式图标家族,不会进入根入口或 `iconRegistry`;新功能应优先选择
|
|
88
|
+
`/outline`、`/solid` 或 `/colorful`。同名但图形不同的旧实现会使用来源限定的导出名,
|
|
89
|
+
迁移时应按生成清单中的源文件映射选择,不能仅凭名称互换。
|
|
90
|
+
|
|
56
91
|
完整注册表是显式的重入口,仅在图标浏览器等需要枚举所有图标的场景使用:
|
|
57
92
|
|
|
58
93
|
```tsx
|
|
59
94
|
import { iconRegistry } from "@yakit-libs/yakit-ui-icons/registry";
|
|
60
95
|
```
|
|
96
|
+
|
|
97
|
+
### 编辑器自动导入
|
|
98
|
+
|
|
99
|
+
TypeScript/VS Code 可能为同一个图标发现多个公开候选;候选顺序由编辑器决定,npm 包不能从包元数据层面
|
|
100
|
+
强制排序。应选择 `@yakit-libs/yakit-ui-icons` 或上文列出的公开子路径,并拒绝包含 `/dist/`、`/src/`
|
|
101
|
+
的深层导入。
|
|
102
|
+
|
|
103
|
+
如果自动导入没有扫描 `package.json` 依赖,可以在 VS Code 工作区设置中显式开启:
|
|
104
|
+
|
|
105
|
+
```json
|
|
106
|
+
{
|
|
107
|
+
"typescript.preferences.includePackageJsonAutoImports": "on",
|
|
108
|
+
"typescript.preferences.importModuleSpecifier": "non-relative"
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
这些是消费者编辑器偏好,不会随 npm 包安装自动生效。仓库使用真实 tsserver 协议覆盖 TypeScript
|
|
113
|
+
5.8.3/5.9.2、TS/TSX、`Bundler`/`NodeNext` 以及单包/双包安装组合;可运行:
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
pnpm run test:auto-import
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
#### English note
|
|
120
|
+
|
|
121
|
+
Use `@yakit-libs/yakit-ui-icons` as the canonical package for new icon imports. The
|
|
122
|
+
`@yakit-libs/yakit-ui/icons*` paths are compatibility-only. Both packages follow SemVer
|
|
123
|
+
independently, so their versions do not need to match. Auto-import ordering is editor-controlled;
|
|
124
|
+
the package exposes public module specifiers but does not install or enforce editor-private
|
|
125
|
+
configuration.
|
|
126
|
+
|
|
127
|
+
带渐变、遮罩或裁剪的图标通过 React `useId()` 隔离 SVG fragment ID。一个页面存在多个独立 React root 时,每个 root 必须使用不同的 `identifierPrefix`;同一组 SSR 与 hydration 必须使用完全相同的 prefix。跨 root 重用 prefix 可能产生 DOM ID 冲突,`useId()` 本身不提供该跨 root 保证。
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type ComponentType, type SVGProps } from 'react';
|
|
2
|
+
import type { IconProps } from './types.js';
|
|
3
|
+
type SvgIcon = ComponentType<SVGProps<SVGSVGElement>>;
|
|
4
|
+
interface IconBaseProps extends IconProps {
|
|
5
|
+
defaultColor: string;
|
|
6
|
+
Svg: SvgIcon;
|
|
7
|
+
}
|
|
8
|
+
export declare const IconBase: import("react").ForwardRefExoticComponent<IconBaseProps & import("react").RefAttributes<HTMLSpanElement>>;
|
|
9
|
+
export {};
|