@fibrae/semi-icons-svelte 0.2.0 → 0.3.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/LICENSE +0 -62
- package/README.md +26 -24
- package/README.zh-CN.md +68 -0
- package/dist/components/icon.svelte +0 -2
- package/dist/components/icon.svelte.d.ts +0 -1
- package/package.json +2 -2
package/LICENSE
CHANGED
|
@@ -20,65 +20,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
|
20
20
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
21
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
22
|
SOFTWARE.
|
|
23
|
-
|
|
24
|
-
The code implementation of the external library is referenced by DouyinFe are:
|
|
25
|
-
|
|
26
|
-
- animate.css
|
|
27
|
-
|
|
28
|
-
The MIT License (MIT)
|
|
29
|
-
|
|
30
|
-
Copyright (c) 2020 Daniel Eden
|
|
31
|
-
|
|
32
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
33
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
34
|
-
in the Software without restriction, including without limitation the rights
|
|
35
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
36
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
37
|
-
furnished to do so, subject to the following conditions:
|
|
38
|
-
|
|
39
|
-
The above copyright notice and this permission notice shall be included in all
|
|
40
|
-
copies or substantial portions of the Software.
|
|
41
|
-
|
|
42
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
43
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
44
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
45
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
46
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
47
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
48
|
-
SOFTWARE.
|
|
49
|
-
|
|
50
|
-
- Ant Design
|
|
51
|
-
MIT LICENSE
|
|
52
|
-
|
|
53
|
-
Copyright (c) 2015-present Ant UED, https://xtech.antfin.com/
|
|
54
|
-
|
|
55
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
|
56
|
-
a copy of this software and associated documentation files (the
|
|
57
|
-
"Software"), to deal in the Software without restriction, including
|
|
58
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
|
59
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
|
60
|
-
permit persons to whom the Software is furnished to do so, subject to
|
|
61
|
-
the following conditions:
|
|
62
|
-
|
|
63
|
-
The above copyright notice and this permission notice shall be
|
|
64
|
-
included in all copies or substantial portions of the Software.
|
|
65
|
-
|
|
66
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
67
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
68
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
69
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
70
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
71
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
72
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
73
|
-
|
|
74
|
-
- rc-tree
|
|
75
|
-
|
|
76
|
-
MIT LICENSE
|
|
77
|
-
|
|
78
|
-
Copyright (c) 2015-present Alipay.com, https://www.alipay.com/
|
|
79
|
-
|
|
80
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
81
|
-
|
|
82
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
83
|
-
|
|
84
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
# @fibrae/semi-icons-svelte
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[简体中文](README.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
|
|
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`.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
6
8
|
|
|
7
9
|
```shell
|
|
8
10
|
pnpm add @fibrae/semi-icons-svelte
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
|
|
13
|
+
Peer dependency: `svelte` ^5.57.0. `@fibrae/semi-icons-core` is a regular dependency and installs with the package. Ships `.svelte` source, compiled through the `svelte` condition by `@sveltejs/vite-plugin-svelte` (built into SvelteKit).
|
|
12
14
|
|
|
13
|
-
##
|
|
15
|
+
## Usage
|
|
14
16
|
|
|
15
17
|
```svelte
|
|
16
18
|
<script lang="ts">
|
|
@@ -20,11 +22,11 @@ peer 依赖:`svelte` ^5.57.0。`@fibrae/semi-icons-core` 是普通依赖,随
|
|
|
20
22
|
<IconSend size="large" spin />
|
|
21
23
|
```
|
|
22
24
|
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
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`, `prefixCls`, `type` and `fill` (`string` or `string[]`). `style` accepts strings only.
|
|
27
|
+
- On multi-color icons, `fill` colors each part in order. Other icons pass `fill` to the root `svg`.
|
|
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
|
+
- 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.
|
|
28
30
|
|
|
29
31
|
```svelte
|
|
30
32
|
<script lang="ts">
|
|
@@ -38,29 +40,29 @@ peer 依赖:`svelte` ^5.57.0。`@fibrae/semi-icons-core` 是普通依赖,随
|
|
|
38
40
|
</Icon>
|
|
39
41
|
```
|
|
40
42
|
|
|
41
|
-
###
|
|
43
|
+
### Color icons
|
|
42
44
|
|
|
43
45
|
```ts
|
|
44
46
|
import { IconAnchor } from '@fibrae/semi-icons-svelte/lab';
|
|
45
47
|
```
|
|
46
48
|
|
|
47
|
-
###
|
|
49
|
+
### Entry points
|
|
48
50
|
|
|
49
|
-
|
|
|
50
|
-
| ------------------------------------------------- |
|
|
51
|
-
| `@fibrae/semi-icons-svelte` |
|
|
52
|
-
| `@fibrae/semi-icons-svelte/lab` |
|
|
53
|
-
| `@fibrae/semi-icons-svelte/components/svg.svelte` |
|
|
51
|
+
| Entry | Contents |
|
|
52
|
+
| ------------------------------------------------- | -------------------------------------------------------------------------------------------- |
|
|
53
|
+
| `@fibrae/semi-icons-svelte` | Default export `Icon`, named exports `IconXxx`, the types `IconProps`, `SvgProps` and others |
|
|
54
|
+
| `@fibrae/semi-icons-svelte/lab` | Color icons |
|
|
55
|
+
| `@fibrae/semi-icons-svelte/components/svg.svelte` | Component that renders an `svg` from icon data, used by the illustration package |
|
|
54
56
|
|
|
55
|
-
|
|
57
|
+
Component docs are in [website/content/basic/icon](../../website/content/basic/icon).
|
|
56
58
|
|
|
57
|
-
##
|
|
59
|
+
## Related packages
|
|
58
60
|
|
|
59
|
-
-
|
|
60
|
-
-
|
|
61
|
-
-
|
|
61
|
+
- Depends on the icon data and styles of `@fibrae/semi-icons-core`.
|
|
62
|
+
- Used by `@fibrae/semi-ui-svelte` and `@fibrae/semi-illustrations-svelte`.
|
|
63
|
+
- The equivalent package for each framework is `@fibrae/semi-icons-<framework>`.
|
|
62
64
|
|
|
63
|
-
##
|
|
65
|
+
## Development
|
|
64
66
|
|
|
65
|
-
- `src/icons
|
|
66
|
-
-
|
|
67
|
+
- `src/icons` and all of `src/lab` are generated source, so do not edit them by hand. To add an icon, follow [Adding icons in semi-icons-core](../semi-icons-core/README.md#adding-icons) and run `pnpm build:icon` at the repository root to regenerate.
|
|
68
|
+
- For build and test commands, see [CONTRIBUTING.md](../../CONTRIBUTING.md#常用命令) at the repository root.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# @fibrae/semi-icons-svelte
|
|
2
|
+
|
|
3
|
+
[English](README.md)
|
|
4
|
+
|
|
5
|
+
Semi Design Next 的 Svelte 图标组件,与其他框架的图标包共用 `@fibrae/semi-icons-core` 的数据和样式,供 Svelte 应用和 `@fibrae/semi-ui-svelte` 使用。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
```shell
|
|
10
|
+
pnpm add @fibrae/semi-icons-svelte
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
peer 依赖:`svelte` ^5.57.0。`@fibrae/semi-icons-core` 是普通依赖,随包安装。发布 `.svelte` 源码,由 `@sveltejs/vite-plugin-svelte`(SvelteKit 已内置)经 `svelte` 条件编译。
|
|
14
|
+
|
|
15
|
+
## 使用
|
|
16
|
+
|
|
17
|
+
```svelte
|
|
18
|
+
<script lang="ts">
|
|
19
|
+
import { IconSend } from '@fibrae/semi-icons-svelte';
|
|
20
|
+
</script>
|
|
21
|
+
|
|
22
|
+
<IconSend size="large" spin />
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- 样式随组件引入,不需要单独引入。
|
|
26
|
+
- 单个图标没有自己的 props,所有属性透传给 `Icon`。`Icon` 的 props:`size`(`inherit`、`extra-small`、`small`、`default`、`large`、`extra-large`,默认 `default`)、`spin`、`rotate`、`prefixCls`、`type`、`fill`(`string` 或 `string[]`);`style` 只接受字符串。
|
|
27
|
+
- 多色图标的 `fill` 按顺序给各部分上色;其他图标把 `fill` 传给根 `svg`。
|
|
28
|
+
- 图标默认是装饰性的(`aria-hidden`)。传 `aria-label`、`aria-labelledby` 或 `tabindex >= 0` 时改为 `role="img"` 且不隐藏。
|
|
29
|
+
- 自定义图标:默认导出的 `Icon` 用 `children` snippet 渲染自己的 `svg`,snippet 参数带上 `fill`。不支持 React 版的 `elementType` 与 ref。
|
|
30
|
+
|
|
31
|
+
```svelte
|
|
32
|
+
<script lang="ts">
|
|
33
|
+
import Icon from '@fibrae/semi-icons-svelte';
|
|
34
|
+
</script>
|
|
35
|
+
|
|
36
|
+
<Icon size="large">
|
|
37
|
+
{#snippet children({ fill })}
|
|
38
|
+
<svg viewBox="0 0 24 24" {fill}><circle cx="12" cy="12" r="10" /></svg>
|
|
39
|
+
{/snippet}
|
|
40
|
+
</Icon>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 彩色图标
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
import { IconAnchor } from '@fibrae/semi-icons-svelte/lab';
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### 入口
|
|
50
|
+
|
|
51
|
+
| 入口 | 内容 |
|
|
52
|
+
| ------------------------------------------------- | -------------------------------------------------------------------- |
|
|
53
|
+
| `@fibrae/semi-icons-svelte` | 默认导出 `Icon`,具名导出 `IconXxx`、类型 `IconProps`、`SvgProps` 等 |
|
|
54
|
+
| `@fibrae/semi-icons-svelte/lab` | 彩色图标 |
|
|
55
|
+
| `@fibrae/semi-icons-svelte/components/svg.svelte` | 按图标数据渲染 `svg` 的组件,供插画包使用 |
|
|
56
|
+
|
|
57
|
+
组件文档见 [website/content/basic/icon](../../website/content/basic/icon)。
|
|
58
|
+
|
|
59
|
+
## 与其他包的关系
|
|
60
|
+
|
|
61
|
+
- 依赖 `@fibrae/semi-icons-core` 的图标数据与样式。
|
|
62
|
+
- 被 `@fibrae/semi-ui-svelte` 与 `@fibrae/semi-illustrations-svelte` 使用。
|
|
63
|
+
- 各框架的对应包是 `@fibrae/semi-icons-<框架>`。
|
|
64
|
+
|
|
65
|
+
## 开发
|
|
66
|
+
|
|
67
|
+
- `src/icons`、`src/lab` 整个目录是生成源码,不要手改。新增图标按 [semi-icons-core 的「新增图标」](../semi-icons-core/README.zh-CN.md#新增图标)操作,在仓库根目录运行 `pnpm build:icon` 重新生成。
|
|
68
|
+
- 构建与测试命令见根目录 [CONTRIBUTING.md](../../CONTRIBUTING.md#常用命令)。
|
|
@@ -11,7 +11,6 @@
|
|
|
11
11
|
prefixCls?: string;
|
|
12
12
|
type?: string;
|
|
13
13
|
fill?: string | string[];
|
|
14
|
-
/** Receives the `fill` prop, so a custom svg can apply it */
|
|
15
14
|
children?: Snippet<[{ fill?: string | string[] }]>;
|
|
16
15
|
}
|
|
17
16
|
</script>
|
|
@@ -23,7 +22,6 @@
|
|
|
23
22
|
let { size = 'default', spin = false, rotate, prefixCls = BASE_CLASS_PREFIX, type, fill, children, ...rest }: IconProps = $props();
|
|
24
23
|
|
|
25
24
|
const prefix = $derived(`${prefixCls}-icon`);
|
|
26
|
-
// An icon with a name or in the tab order is content; otherwise it is decoration
|
|
27
25
|
const exposed = $derived(Boolean(rest['aria-label'] || rest['aria-labelledby']) || Number(rest.tabindex) >= 0);
|
|
28
26
|
// The user's style comes last so it can override the rotation
|
|
29
27
|
const style = $derived([Number.isSafeInteger(rotate) ? `transform: rotate(${rotate}deg)` : undefined, rest.style].filter(Boolean).join(';') || undefined);
|
|
@@ -8,7 +8,6 @@ export interface IconProps extends Omit<HTMLAttributes<HTMLSpanElement>, 'childr
|
|
|
8
8
|
prefixCls?: string;
|
|
9
9
|
type?: string;
|
|
10
10
|
fill?: string | string[];
|
|
11
|
-
/** Receives the `fill` prop, so a custom svg can apply it */
|
|
12
11
|
children?: Snippet<[{
|
|
13
12
|
fill?: string | string[];
|
|
14
13
|
}]>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fibrae/semi-icons-svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "Semi icons as Svelte components",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://semi-design-next.pages.dev",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"*.css"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@fibrae/semi-icons-core": "0.
|
|
48
|
+
"@fibrae/semi-icons-core": "0.3.1"
|
|
49
49
|
},
|
|
50
50
|
"peerDependencies": {
|
|
51
51
|
"svelte": "^5.57.0"
|