@test-icons/svg 0.0.3

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.
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file ACane 拐杖
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ declare const _default: import("../runtime").Icon;
6
+ export default _default;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @file ACane 拐杖
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ /* tslint:disable: max-line-length */
6
+ /* eslint-disable max-len */
7
+ import { IconWrapper } from '../runtime';
8
+ export default IconWrapper('a-cane', (props) => ('<?xml version="1.0" encoding="UTF-8"?>'
9
+ + '<svg width="' + props.size + '" height="' + props.size + '" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">'
10
+ + '<path d="M19.5576 44.7684C19.5576 44.7684 32.468 20.4873 33.6417 18.28C34.8154 16.0726 37.4535 8.98102 30.3899 5.22524C23.3263 1.46947 19.1571 7.18063 17.7486 9.82948" stroke="' + props.colors[0] + '" stroke-width="' + props.strokeWidth + '" stroke-linecap="' + props.strokeLinecap + '" stroke-linejoin="' + props.strokeLinejoin + '"/>'
11
+ + '</svg>'));
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file Abdominal 腹部
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ declare const _default: import("../runtime").Icon;
6
+ export default _default;
@@ -0,0 +1,14 @@
1
+ /**
2
+ * @file Abdominal 腹部
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ /* tslint:disable: max-line-length */
6
+ /* eslint-disable max-len */
7
+ import { IconWrapper } from '../runtime';
8
+ export default IconWrapper('abdominal', (props) => ('<?xml version="1.0" encoding="UTF-8"?>'
9
+ + '<svg width="' + props.size + '" height="' + props.size + '" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">'
10
+ + '<path d="M7.89926 5C10.7371 8.01931 12.156 11.9408 12.156 16.7645C12.156 24 5.9995 29.5382 4.969 33.5C4.282 36.1412 3.95884 39.3078 3.9995 43" stroke="' + props.colors[0] + '" stroke-width="' + props.strokeWidth + '" stroke-linecap="' + props.strokeLinecap + '"/>'
11
+ + '<path d="M39.256 5C36.4182 8.01931 34.9992 11.9408 34.9992 16.7645C34.9992 24 41.1558 29.5382 42.1863 33.5C42.8733 36.1412 43.1964 39.3078 43.1558 43" stroke="' + props.colors[0] + '" stroke-width="' + props.strokeWidth + '" stroke-linecap="' + props.strokeLinecap + '"/>'
12
+ + '<path d="M6.24414 30.8369C12.7693 34.9668 18.6949 37.0317 24.0211 37.0317C29.3472 37.0317 34.9799 34.9668 40.9192 30.8369" stroke="' + props.colors[0] + '" stroke-width="' + props.strokeWidth + '" stroke-linecap="' + props.strokeLinecap + '"/>'
13
+ + '<path d="M24 31C25.3807 31 26.5 29.8807 26.5 28.5C26.5 27.1193 25.3807 26 24 26C22.6193 26 21.5 27.1193 21.5 28.5C21.5 29.8807 22.6193 31 24 31Z" fill="' + props.colors[0] + '"/>'
14
+ + '</svg>'));
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file index 引用出口
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ export { default as ACane } from './icons/ACane';
6
+ export { default as Abdominal } from './icons/Abdominal';
package/dist/index.js ADDED
@@ -0,0 +1,6 @@
1
+ /**
2
+ * @file index 引用出口
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ export { default as ACane } from './icons/ACane';
6
+ export { default as Abdominal } from './icons/Abdominal';
@@ -0,0 +1,60 @@
1
+ /**
2
+ * @file runtime 运行时
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ export type StrokeLinejoin = 'miter' | 'round' | 'bevel';
6
+ export type StrokeLinecap = 'butt' | 'round' | 'square';
7
+ export type Theme = 'outline' | 'filled' | 'two-tone' | 'multi-color';
8
+ export interface ISvgIconProps {
9
+ id: string;
10
+ size: number | string;
11
+ strokeWidth: number;
12
+ strokeLinecap: StrokeLinecap;
13
+ strokeLinejoin: StrokeLinejoin;
14
+ colors: string[];
15
+ }
16
+ export interface IIconConfig {
17
+ size: number | string;
18
+ strokeWidth: number;
19
+ strokeLinecap: StrokeLinecap;
20
+ strokeLinejoin: StrokeLinejoin;
21
+ prefix: string;
22
+ theme: Theme;
23
+ colors: {
24
+ outline: {
25
+ fill: string;
26
+ background: string;
27
+ };
28
+ filled: {
29
+ fill: string;
30
+ background: string;
31
+ };
32
+ twoTone: {
33
+ fill: string;
34
+ twoTone: string;
35
+ };
36
+ multiColor: {
37
+ outStrokeColor: string;
38
+ outFillColor: string;
39
+ innerStrokeColor: string;
40
+ innerFillColor: string;
41
+ };
42
+ };
43
+ }
44
+ export interface IIconBase {
45
+ size?: number | string;
46
+ strokeWidth?: number;
47
+ strokeLinecap?: StrokeLinecap;
48
+ strokeLinejoin?: StrokeLinejoin;
49
+ theme?: Theme;
50
+ fill?: string | string[];
51
+ }
52
+ export type IIcon = IIconBase;
53
+ export type IIconProps = IIconBase;
54
+ export type IconRender = (props: ISvgIconProps) => string;
55
+ export type Icon = (props: IIconProps) => string;
56
+ export declare const DEFAULT_ICON_CONFIGS: IIconConfig;
57
+ export declare function IconConverter(id: string, icon: IIconBase, config: IIconConfig): ISvgIconProps;
58
+ export declare function setConfig(config: IIconConfig): void;
59
+ export declare function getConfig(): IIconConfig;
60
+ export declare function IconWrapper(name: string, render: IconRender): Icon;
@@ -0,0 +1,92 @@
1
+ /**
2
+ * @file runtime 运行时
3
+ * @author Auto Generated by HaierIcons
4
+ */
5
+ // 默认属性
6
+ export const DEFAULT_ICON_CONFIGS = {
7
+ size: '1em',
8
+ strokeWidth: 4,
9
+ strokeLinecap: 'round',
10
+ strokeLinejoin: 'round',
11
+ theme: 'outline',
12
+ colors: {
13
+ outline: {
14
+ fill: '#333',
15
+ background: 'transparent'
16
+ },
17
+ filled: {
18
+ fill: '#333',
19
+ background: '#FFF'
20
+ },
21
+ twoTone: {
22
+ fill: '#333',
23
+ twoTone: '#2F88FF'
24
+ },
25
+ multiColor: {
26
+ outStrokeColor: '#333',
27
+ outFillColor: '#2F88FF',
28
+ innerStrokeColor: '#FFF',
29
+ innerFillColor: '#43CCF8'
30
+ }
31
+ },
32
+ prefix: 'hi'
33
+ };
34
+ function guid() {
35
+ return 'icon-' + (((1 + Math.random()) * 0x100000000) | 0).toString(16).substring(1);
36
+ }
37
+ // 属性转换函数
38
+ export function IconConverter(id, icon, config) {
39
+ const fill = typeof icon.fill === 'string' ? [icon.fill] : icon.fill || [];
40
+ const colors = [];
41
+ const theme = icon.theme || config.theme;
42
+ switch (theme) {
43
+ case 'outline':
44
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
45
+ colors.push('transparent');
46
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
47
+ colors.push('transparent');
48
+ break;
49
+ case 'filled':
50
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
51
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
52
+ colors.push('#FFF');
53
+ colors.push('#FFF');
54
+ break;
55
+ case 'two-tone':
56
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
57
+ colors.push(typeof fill[1] === 'string' ? fill[1] : config.colors.twoTone.twoTone);
58
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
59
+ colors.push(typeof fill[1] === 'string' ? fill[1] : config.colors.twoTone.twoTone);
60
+ break;
61
+ case 'multi-color':
62
+ colors.push(typeof fill[0] === 'string' ? fill[0] : 'currentColor');
63
+ colors.push(typeof fill[1] === 'string' ? fill[1] : config.colors.multiColor.outFillColor);
64
+ colors.push(typeof fill[2] === 'string' ? fill[2] : config.colors.multiColor.innerStrokeColor);
65
+ colors.push(typeof fill[3] === 'string' ? fill[3] : config.colors.multiColor.innerFillColor);
66
+ break;
67
+ }
68
+ return {
69
+ size: icon.size || config.size,
70
+ strokeWidth: icon.strokeWidth || config.strokeWidth,
71
+ strokeLinecap: icon.strokeLinecap || config.strokeLinecap,
72
+ strokeLinejoin: icon.strokeLinejoin || config.strokeLinejoin,
73
+ colors,
74
+ id
75
+ };
76
+ }
77
+ // 图标配置
78
+ let currentConfig = DEFAULT_ICON_CONFIGS;
79
+ export function setConfig(config) {
80
+ currentConfig = config;
81
+ }
82
+ export function getConfig() {
83
+ return currentConfig;
84
+ }
85
+ // 图标Wrapper
86
+ export function IconWrapper(name, render) {
87
+ return (props) => {
88
+ const config = getConfig();
89
+ const svgProps = IconConverter(guid(), props, config);
90
+ return render(svgProps);
91
+ };
92
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@test-icons/svg",
3
+ "version": "0.0.3",
4
+ "description": "Test icon library - svg components",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "files": [
9
+ "dist"
10
+ ],
11
+ "style": "dist/runtime/index.css",
12
+ "sideEffects": [
13
+ "*.css",
14
+ "*.less"
15
+ ],
16
+ "license": "MIT",
17
+ "peerDependencies": {},
18
+ "publishConfig": {
19
+ "access": "public"
20
+ }
21
+ }