@fibrae/semi-icons-svelte 0.4.0 → 0.6.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.
- package/README.md +23 -7
- package/README.zh-CN.md +23 -7
- package/dist/components/icon.svelte +2 -3
- package/dist/components/icon.svelte.d.ts +0 -1
- package/dist/illustrations/illustration-construction-dark.svelte +8 -0
- package/dist/illustrations/illustration-construction-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-construction.svelte +8 -0
- package/dist/illustrations/illustration-construction.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-failure-dark.svelte +8 -0
- package/dist/illustrations/illustration-failure-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-failure.svelte +8 -0
- package/dist/illustrations/illustration-failure.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-idle-dark.svelte +8 -0
- package/dist/illustrations/illustration-idle-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-idle.svelte +8 -0
- package/dist/illustrations/illustration-idle.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-no-access-dark.svelte +8 -0
- package/dist/illustrations/illustration-no-access-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-no-access.svelte +8 -0
- package/dist/illustrations/illustration-no-access.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-no-content-dark.svelte +8 -0
- package/dist/illustrations/illustration-no-content-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-no-content.svelte +8 -0
- package/dist/illustrations/illustration-no-content.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-no-result-dark.svelte +8 -0
- package/dist/illustrations/illustration-no-result-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-no-result.svelte +8 -0
- package/dist/illustrations/illustration-no-result.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-not-found-dark.svelte +8 -0
- package/dist/illustrations/illustration-not-found-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-not-found.svelte +8 -0
- package/dist/illustrations/illustration-not-found.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-success-dark.svelte +8 -0
- package/dist/illustrations/illustration-success-dark.svelte.d.ts +4 -0
- package/dist/illustrations/illustration-success.svelte +8 -0
- package/dist/illustrations/illustration-success.svelte.d.ts +4 -0
- package/dist/illustrations/index.d.ts +16 -0
- package/dist/illustrations/index.js +16 -0
- package/package.json +10 -5
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
The Svelte icon components of Semi Design Next, sharing the data and styles of `@fibrae/semi-icons-core` with the icon packages of other frameworks, for Svelte applications and `@fibrae/semi-ui-svelte`.
|
|
5
|
+
The Svelte icon and illustration components of Semi Design Next, sharing the data and styles of `@fibrae/semi-icons-core` with the icon packages of other frameworks, for Svelte applications and `@fibrae/semi-ui-svelte`.
|
|
6
6
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@ Peer dependency: `svelte` ^5.57.0. `@fibrae/semi-icons-core` is a regular depend
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
- Styles load with the components, with no separate import.
|
|
26
|
-
- A single icon has no props of its own, and all attributes pass through to `Icon`. `Icon` props: `size` (`inherit`, `extra-small`, `small`, `default`, `large` or `extra-large`, `default` by default), `spin`, `rotate`, `
|
|
26
|
+
- A single icon has no props of its own, and all attributes pass through to `Icon`. `Icon` props: `size` (`inherit`, `extra-small`, `small`, `default`, `large` or `extra-large`, `default` by default), `spin`, `rotate`, `type` and `fill` (`string` or `string[]`). `style` accepts strings only.
|
|
27
27
|
- On multi-color icons, `fill` colors each part in order. Other icons pass `fill` to the root `svg`.
|
|
28
28
|
- Icons are decorative by default (`aria-hidden`). With `aria-label`, `aria-labelledby` or `tabindex >= 0`, they become `role="img"` and are no longer hidden.
|
|
29
29
|
- Custom icons: the default-exported `Icon` renders your own `svg` with a `children` snippet, and the snippet parameter carries `fill`. `elementType` and ref from the React version are not supported.
|
|
@@ -46,23 +46,39 @@ Peer dependency: `svelte` ^5.57.0. `@fibrae/semi-icons-core` is a regular depend
|
|
|
46
46
|
import { IconAnchor } from '@fibrae/semi-icons-svelte/lab';
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
### Illustrations
|
|
50
|
+
|
|
51
|
+
```svelte
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
import { IllustrationIdle } from '@fibrae/semi-icons-svelte/illustrations';
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<IllustrationIdle width="150" height="150" />
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- The export name is `Illustration` plus the illustration name, and dark variants add a `Dark` suffix.
|
|
60
|
+
- Each illustration is an `svg` component whose attributes pass through to the root `svg`, with a default size of 200, and decorative by default (`aria-hidden`).
|
|
61
|
+
- Gradient, mask and clipPath ids are generated per instance (`$props.id()`), so multiple instances on a page do not interfere, and the server and browser agree.
|
|
62
|
+
- Colors use `var(--semi-color-*)`, so the page must have the Semi theme styles loaded (provided by the styles of `semi-ui-svelte`).
|
|
63
|
+
|
|
49
64
|
### Entry points
|
|
50
65
|
|
|
51
66
|
| Entry | Contents |
|
|
52
67
|
| ------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
53
68
|
| `@fibrae/semi-icons-svelte` | Default export `Icon`, named exports `IconXxx`, the types `IconProps`, `SvgProps` and others |
|
|
54
69
|
| `@fibrae/semi-icons-svelte/lab` | Color icons |
|
|
55
|
-
| `@fibrae/semi-icons-svelte/
|
|
70
|
+
| `@fibrae/semi-icons-svelte/illustrations` | Illustrations `IllustrationXxx` and `IllustrationXxxDark` |
|
|
71
|
+
| `@fibrae/semi-icons-svelte/components/svg.svelte` | Component that renders icon or illustration data as a plain `svg` |
|
|
56
72
|
|
|
57
|
-
Component docs are in [website/content/basic/icon](../../website/content/basic/icon).
|
|
73
|
+
Component docs are in [website/content/basic/icon](../../website/content/basic/icon) and [website/content/show/empty](../../website/content/show/empty).
|
|
58
74
|
|
|
59
75
|
## Related packages
|
|
60
76
|
|
|
61
|
-
- Depends on the icon data and styles of `@fibrae/semi-icons-core`.
|
|
62
|
-
- Used by `@fibrae/semi-ui-svelte` and `@fibrae/semi-
|
|
77
|
+
- Depends on the icon and illustration data and the icon styles of `@fibrae/semi-icons-core`.
|
|
78
|
+
- Used by `@fibrae/semi-ui-svelte` and `@fibrae/semi-ai-svelte`.
|
|
63
79
|
- The equivalent package for each framework is `@fibrae/semi-icons-<framework>`.
|
|
64
80
|
|
|
65
81
|
## Development
|
|
66
82
|
|
|
67
|
-
- `src/icons` and
|
|
83
|
+
- `src/icons`, `src/lab` and `src/illustrations` are generated source, so do not edit them by hand. To add an icon or illustration, follow [Adding icons](../shared/semi-icons-core/README.md#adding-icons) or [Adding illustrations](../shared/semi-icons-core/README.md#adding-illustrations) in semi-icons-core and run `pnpm build:icon` at the repository root to regenerate.
|
|
68
84
|
- For build and test commands, see [CONTRIBUTING.md](../../CONTRIBUTING.md#常用命令) at the repository root.
|
package/README.zh-CN.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[English](README.md)
|
|
4
4
|
|
|
5
|
-
Semi Design Next 的 Svelte
|
|
5
|
+
Semi Design Next 的 Svelte 图标与插画组件,与其他框架的图标包共用 `@fibrae/semi-icons-core` 的数据和样式,供 Svelte 应用和 `@fibrae/semi-ui-svelte` 使用。
|
|
6
6
|
|
|
7
7
|
## 安装
|
|
8
8
|
|
|
@@ -23,7 +23,7 @@ peer 依赖:`svelte` ^5.57.0。`@fibrae/semi-icons-core` 是普通依赖,随
|
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
- 样式随组件引入,不需要单独引入。
|
|
26
|
-
- 单个图标没有自己的 props,所有属性透传给 `Icon`。`Icon` 的 props:`size`(`inherit`、`extra-small`、`small`、`default`、`large`、`extra-large`,默认 `default`)、`spin`、`rotate`、`
|
|
26
|
+
- 单个图标没有自己的 props,所有属性透传给 `Icon`。`Icon` 的 props:`size`(`inherit`、`extra-small`、`small`、`default`、`large`、`extra-large`,默认 `default`)、`spin`、`rotate`、`type`、`fill`(`string` 或 `string[]`);`style` 只接受字符串。
|
|
27
27
|
- 多色图标的 `fill` 按顺序给各部分上色;其他图标把 `fill` 传给根 `svg`。
|
|
28
28
|
- 图标默认是装饰性的(`aria-hidden`)。传 `aria-label`、`aria-labelledby` 或 `tabindex >= 0` 时改为 `role="img"` 且不隐藏。
|
|
29
29
|
- 自定义图标:默认导出的 `Icon` 用 `children` snippet 渲染自己的 `svg`,snippet 参数带上 `fill`。不支持 React 版的 `elementType` 与 ref。
|
|
@@ -46,23 +46,39 @@ peer 依赖:`svelte` ^5.57.0。`@fibrae/semi-icons-core` 是普通依赖,随
|
|
|
46
46
|
import { IconAnchor } from '@fibrae/semi-icons-svelte/lab';
|
|
47
47
|
```
|
|
48
48
|
|
|
49
|
+
### 插画
|
|
50
|
+
|
|
51
|
+
```svelte
|
|
52
|
+
<script lang="ts">
|
|
53
|
+
import { IllustrationIdle } from '@fibrae/semi-icons-svelte/illustrations';
|
|
54
|
+
</script>
|
|
55
|
+
|
|
56
|
+
<IllustrationIdle width="150" height="150" />
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
- 导出名为 `Illustration` 加插画名,暗色变体加 `Dark` 后缀。
|
|
60
|
+
- 每个插画是一个 `svg` 组件,属性透传给根 `svg`,默认宽高 200,默认装饰性(`aria-hidden`)。
|
|
61
|
+
- 渐变、mask、clipPath 的 id 按实例生成(`$props.id()`),同页多个实例互不影响,服务端与浏览器一致。
|
|
62
|
+
- 配色使用 `var(--semi-color-*)`,页面需要已加载 Semi 主题样式(由 `semi-ui-svelte` 的样式提供)。
|
|
63
|
+
|
|
49
64
|
### 入口
|
|
50
65
|
|
|
51
66
|
| 入口 | 内容 |
|
|
52
67
|
| ------------------------------------------------- | -------------------------------------------------------------------- |
|
|
53
68
|
| `@fibrae/semi-icons-svelte` | 默认导出 `Icon`,具名导出 `IconXxx`、类型 `IconProps`、`SvgProps` 等 |
|
|
54
69
|
| `@fibrae/semi-icons-svelte/lab` | 彩色图标 |
|
|
55
|
-
| `@fibrae/semi-icons-svelte/
|
|
70
|
+
| `@fibrae/semi-icons-svelte/illustrations` | 插画 `IllustrationXxx` 与 `IllustrationXxxDark` |
|
|
71
|
+
| `@fibrae/semi-icons-svelte/components/svg.svelte` | 把图标或插画数据渲染成不带外壳的 `svg` 的组件 |
|
|
56
72
|
|
|
57
|
-
组件文档见 [website/content/basic/icon](../../website/content/basic/icon)。
|
|
73
|
+
组件文档见 [website/content/basic/icon](../../website/content/basic/icon) 与 [website/content/show/empty](../../website/content/show/empty)。
|
|
58
74
|
|
|
59
75
|
## 与其他包的关系
|
|
60
76
|
|
|
61
|
-
- 依赖 `@fibrae/semi-icons-core`
|
|
62
|
-
- 被 `@fibrae/semi-ui-svelte` 与 `@fibrae/semi-
|
|
77
|
+
- 依赖 `@fibrae/semi-icons-core` 的图标与插画数据、图标样式。
|
|
78
|
+
- 被 `@fibrae/semi-ui-svelte` 与 `@fibrae/semi-ai-svelte` 使用。
|
|
63
79
|
- 各框架的对应包是 `@fibrae/semi-icons-<框架>`。
|
|
64
80
|
|
|
65
81
|
## 开发
|
|
66
82
|
|
|
67
|
-
- `src/icons`、`src/lab`
|
|
83
|
+
- `src/icons`、`src/lab`、`src/illustrations` 整个目录是生成源码,不要手改。新增图标或插画按 semi-icons-core 的[「新增图标」](../shared/semi-icons-core/README.zh-CN.md#新增图标)或[「新增插画」](../shared/semi-icons-core/README.zh-CN.md#新增插画)操作,在仓库根目录运行 `pnpm build:icon` 重新生成。
|
|
68
84
|
- 构建与测试命令见根目录 [CONTRIBUTING.md](../../CONTRIBUTING.md#常用命令)。
|
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
size?: IconSize;
|
|
9
9
|
spin?: boolean;
|
|
10
10
|
rotate?: number;
|
|
11
|
-
prefixCls?: string;
|
|
12
11
|
type?: string;
|
|
13
12
|
fill?: string | string[];
|
|
14
13
|
children?: Snippet<[{ fill?: string | string[] }]>;
|
|
@@ -19,9 +18,9 @@
|
|
|
19
18
|
import { BASE_CLASS_PREFIX } from '../env.js';
|
|
20
19
|
import '@fibrae/semi-icons-core/styles/icons.css';
|
|
21
20
|
|
|
22
|
-
let { size = 'default', spin = false, rotate,
|
|
21
|
+
let { size = 'default', spin = false, rotate, type, fill, children, ...rest }: IconProps = $props();
|
|
23
22
|
|
|
24
|
-
const prefix =
|
|
23
|
+
const prefix = `${BASE_CLASS_PREFIX}-icon`;
|
|
25
24
|
const exposed = $derived(Boolean(rest['aria-label'] || rest['aria-labelledby']) || Number(rest.tabindex) >= 0);
|
|
26
25
|
// The user's style comes last so it can override the rotation
|
|
27
26
|
const style = $derived([Number.isSafeInteger(rotate) ? `transform: rotate(${rotate}deg)` : undefined, rest.style].filter(Boolean).join(';') || undefined);
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type SvgProps } from '../components/svg.svelte';
|
|
2
|
+
declare const IllustrationConstructionDark: import("svelte").Component<SvgProps, {}, "">;
|
|
3
|
+
type IllustrationConstructionDark = ReturnType<typeof IllustrationConstructionDark>;
|
|
4
|
+
export default IllustrationConstructionDark;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { default as IllustrationConstruction } from './illustration-construction.svelte';
|
|
2
|
+
export { default as IllustrationConstructionDark } from './illustration-construction-dark.svelte';
|
|
3
|
+
export { default as IllustrationFailure } from './illustration-failure.svelte';
|
|
4
|
+
export { default as IllustrationFailureDark } from './illustration-failure-dark.svelte';
|
|
5
|
+
export { default as IllustrationIdle } from './illustration-idle.svelte';
|
|
6
|
+
export { default as IllustrationIdleDark } from './illustration-idle-dark.svelte';
|
|
7
|
+
export { default as IllustrationNoAccess } from './illustration-no-access.svelte';
|
|
8
|
+
export { default as IllustrationNoAccessDark } from './illustration-no-access-dark.svelte';
|
|
9
|
+
export { default as IllustrationNoContent } from './illustration-no-content.svelte';
|
|
10
|
+
export { default as IllustrationNoContentDark } from './illustration-no-content-dark.svelte';
|
|
11
|
+
export { default as IllustrationNoResult } from './illustration-no-result.svelte';
|
|
12
|
+
export { default as IllustrationNoResultDark } from './illustration-no-result-dark.svelte';
|
|
13
|
+
export { default as IllustrationNotFound } from './illustration-not-found.svelte';
|
|
14
|
+
export { default as IllustrationNotFoundDark } from './illustration-not-found-dark.svelte';
|
|
15
|
+
export { default as IllustrationSuccess } from './illustration-success.svelte';
|
|
16
|
+
export { default as IllustrationSuccessDark } from './illustration-success-dark.svelte';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export { default as IllustrationConstruction } from './illustration-construction.svelte';
|
|
2
|
+
export { default as IllustrationConstructionDark } from './illustration-construction-dark.svelte';
|
|
3
|
+
export { default as IllustrationFailure } from './illustration-failure.svelte';
|
|
4
|
+
export { default as IllustrationFailureDark } from './illustration-failure-dark.svelte';
|
|
5
|
+
export { default as IllustrationIdle } from './illustration-idle.svelte';
|
|
6
|
+
export { default as IllustrationIdleDark } from './illustration-idle-dark.svelte';
|
|
7
|
+
export { default as IllustrationNoAccess } from './illustration-no-access.svelte';
|
|
8
|
+
export { default as IllustrationNoAccessDark } from './illustration-no-access-dark.svelte';
|
|
9
|
+
export { default as IllustrationNoContent } from './illustration-no-content.svelte';
|
|
10
|
+
export { default as IllustrationNoContentDark } from './illustration-no-content-dark.svelte';
|
|
11
|
+
export { default as IllustrationNoResult } from './illustration-no-result.svelte';
|
|
12
|
+
export { default as IllustrationNoResultDark } from './illustration-no-result-dark.svelte';
|
|
13
|
+
export { default as IllustrationNotFound } from './illustration-not-found.svelte';
|
|
14
|
+
export { default as IllustrationNotFoundDark } from './illustration-not-found-dark.svelte';
|
|
15
|
+
export { default as IllustrationSuccess } from './illustration-success.svelte';
|
|
16
|
+
export { default as IllustrationSuccessDark } from './illustration-success-dark.svelte';
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibrae/semi-icons-svelte",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Semi icons as Svelte components",
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Semi icons as Svelte components; full-colour icons under @fibrae/semi-icons-svelte/lab, illustrations under @fibrae/semi-icons-svelte/illustrations",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://semi-design-next.pages.dev",
|
|
7
7
|
"repository": {
|
|
@@ -25,6 +25,11 @@
|
|
|
25
25
|
"svelte": "./dist/lab/index.js",
|
|
26
26
|
"default": "./dist/lab/index.js"
|
|
27
27
|
},
|
|
28
|
+
"./illustrations": {
|
|
29
|
+
"types": "./dist/illustrations/index.d.ts",
|
|
30
|
+
"svelte": "./dist/illustrations/index.js",
|
|
31
|
+
"default": "./dist/illustrations/index.js"
|
|
32
|
+
},
|
|
28
33
|
"./package.json": "./package.json",
|
|
29
34
|
"./*.svelte": {
|
|
30
35
|
"types": "./dist/*.svelte.d.ts",
|
|
@@ -45,17 +50,17 @@
|
|
|
45
50
|
"*.css"
|
|
46
51
|
],
|
|
47
52
|
"dependencies": {
|
|
48
|
-
"@fibrae/semi-icons-core": "0.
|
|
53
|
+
"@fibrae/semi-icons-core": "0.6.0"
|
|
49
54
|
},
|
|
50
55
|
"peerDependencies": {
|
|
51
56
|
"svelte": "^5.57.0"
|
|
52
57
|
},
|
|
53
58
|
"devDependencies": {
|
|
54
|
-
"@sveltejs/package": "^3.0.
|
|
59
|
+
"@sveltejs/package": "^3.0.2",
|
|
55
60
|
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
|
56
61
|
"@testing-library/svelte": "^5.4.2",
|
|
57
62
|
"svelte": "^5.57.3",
|
|
58
|
-
"svelte-check": "^4.7.
|
|
63
|
+
"svelte-check": "^4.7.8",
|
|
59
64
|
"typescript": "^6.0.3"
|
|
60
65
|
},
|
|
61
66
|
"scripts": {
|