@lobehub/icons 1.0.0 → 1.1.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/es/ChatGLM/components/Avatar.d.ts +4 -0
- package/es/ChatGLM/components/Avatar.js +33 -0
- package/es/ChatGLM/components/Color.d.ts +3 -0
- package/es/ChatGLM/components/Color.js +47 -0
- package/es/ChatGLM/components/Combine.d.ts +8 -0
- package/es/ChatGLM/components/Combine.js +34 -0
- package/es/ChatGLM/components/Mono.d.ts +3 -0
- package/es/ChatGLM/components/Mono.js +31 -0
- package/es/ChatGLM/components/Text.d.ts +3 -0
- package/es/ChatGLM/components/Text.js +31 -0
- package/es/ChatGLM/index.d.ts +15 -0
- package/es/ChatGLM/index.js +13 -0
- package/es/ChatGLM/style.d.ts +3 -0
- package/es/ChatGLM/style.js +3 -0
- package/es/IconAvatar/index.d.ts +9 -0
- package/es/IconAvatar/index.js +27 -0
- package/es/Tongyi/components/Avatar.d.ts +4 -0
- package/es/Tongyi/components/Avatar.js +30 -0
- package/es/Tongyi/components/Color.d.ts +3 -0
- package/es/Tongyi/components/Color.js +49 -0
- package/es/Tongyi/components/Combine.d.ts +8 -0
- package/es/Tongyi/components/Combine.js +34 -0
- package/es/Tongyi/components/Mono.d.ts +3 -0
- package/es/Tongyi/components/Mono.js +31 -0
- package/es/Tongyi/components/Text.d.ts +3 -0
- package/es/Tongyi/components/Text.js +31 -0
- package/es/Tongyi/index.d.ts +15 -0
- package/es/Tongyi/index.js +13 -0
- package/es/Tongyi/style.d.ts +3 -0
- package/es/Tongyi/style.js +3 -0
- package/es/Wenxin/components/Avatar.d.ts +4 -0
- package/es/Wenxin/components/Avatar.js +30 -0
- package/es/Wenxin/components/Color.d.ts +3 -0
- package/es/Wenxin/components/Color.js +53 -0
- package/es/Wenxin/components/Combine.d.ts +8 -0
- package/es/Wenxin/components/Combine.js +34 -0
- package/es/Wenxin/components/Mono.d.ts +3 -0
- package/es/Wenxin/components/Mono.js +47 -0
- package/es/Wenxin/components/Text.d.ts +3 -0
- package/es/Wenxin/components/Text.js +31 -0
- package/es/Wenxin/index.d.ts +15 -0
- package/es/Wenxin/index.js +13 -0
- package/es/Wenxin/style.d.ts +3 -0
- package/es/Wenxin/style.js +3 -0
- package/es/Zhipu/components/Avatar.d.ts +2 -2
- package/es/Zhipu/components/Avatar.js +13 -11
- package/es/Zhipu/components/Combine.js +2 -2
- package/es/Zhipu/components/Text.js +2 -1
- package/es/Zhipu/index.d.ts +15 -6
- package/es/Zhipu/index.js +13 -6
- package/es/components/ColorPreview/index.js +40 -0
- package/es/{Editor/Preview.d.ts → components/Editor/Color.d.ts} +1 -2
- package/es/components/Editor/Color.js +47 -0
- package/es/components/Editor/Mono.d.ts +8 -0
- package/es/components/Editor/Mono.js +47 -0
- package/es/components/Editor/Preview.d.ts +8 -0
- package/es/components/Editor/Preview.js +57 -0
- package/es/components/Editor/index.js +122 -0
- package/es/components/Editor/useSvgo.d.ts +6 -0
- package/es/components/Editor/useSvgo.js +51 -0
- package/es/components/IconPreview/ColorPreview.d.ts +6 -0
- package/es/{IconPreview → components/IconPreview}/ColorPreview.js +1 -2
- package/es/index.d.ts +5 -4
- package/es/index.js +4 -5
- package/package.json +7 -9
- package/es/Editor/Preview.js +0 -93
- package/es/Editor/index.js +0 -67
- package/es/IconShowcase/index.d.ts +0 -11
- package/es/IconShowcase/index.js +0 -91
- /package/es/{IconPreview/ColorPreview.d.ts → components/ColorPreview/index.d.ts} +0 -0
- /package/es/{Editor → components/Editor}/data.d.ts +0 -0
- /package/es/{Editor → components/Editor}/data.js +0 -0
- /package/es/{Editor → components/Editor}/index.d.ts +0 -0
- /package/es/{Editor → components/Editor}/svgo.d.ts +0 -0
- /package/es/{Editor → components/Editor}/svgo.js +0 -0
- /package/es/{IconPreview → components/IconPreview}/index.d.ts +0 -0
- /package/es/{IconPreview → components/IconPreview}/index.js +0 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
+
var _templateObject;
|
|
5
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
6
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
7
|
+
import { StoryBook, useControls, useCreateStore } from '@lobehub/ui';
|
|
8
|
+
import { createStyles } from 'antd-style';
|
|
9
|
+
import { useEffect, useRef, useState } from 'react';
|
|
10
|
+
import { Flexbox } from 'react-layout-kit';
|
|
11
|
+
import { useSvgo } from "./useSvgo";
|
|
12
|
+
import Color from "./Color";
|
|
13
|
+
import Mono from "./Mono";
|
|
14
|
+
import Preview from "./Preview";
|
|
15
|
+
import { svgIcon } from "./data";
|
|
16
|
+
import { defaultPlugins } from "./svgo";
|
|
17
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
var useStyles = createStyles(function (_ref) {
|
|
20
|
+
var css = _ref.css,
|
|
21
|
+
token = _ref.token;
|
|
22
|
+
return {
|
|
23
|
+
container: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n border: 1px solid ", ";\n border-radius: ", "px;\n "])), token.colorBorder, token.borderRadius)
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
export default (function () {
|
|
27
|
+
var colorRef = useRef(null);
|
|
28
|
+
var monoRef = useRef(null);
|
|
29
|
+
var _useState = useState('0 0 24 24'),
|
|
30
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
31
|
+
viewbox = _useState2[0],
|
|
32
|
+
setViewbox = _useState2[1];
|
|
33
|
+
var _useState3 = useState(''),
|
|
34
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
|
+
colorSvg = _useState4[0],
|
|
36
|
+
setColorSvg = _useState4[1];
|
|
37
|
+
var _useState5 = useState(''),
|
|
38
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
39
|
+
monoSvg = _useState6[0],
|
|
40
|
+
setMonoSvg = _useState6[1];
|
|
41
|
+
var _useStyles = useStyles(),
|
|
42
|
+
styles = _useStyles.styles;
|
|
43
|
+
var levaStore = useCreateStore();
|
|
44
|
+
var _useControls = useControls({
|
|
45
|
+
svg: {
|
|
46
|
+
rows: true,
|
|
47
|
+
value: svgIcon
|
|
48
|
+
}
|
|
49
|
+
}, {
|
|
50
|
+
store: levaStore
|
|
51
|
+
}),
|
|
52
|
+
svg = _useControls.svg;
|
|
53
|
+
var config = useControls('Config', defaultPlugins, {
|
|
54
|
+
collapsed: true
|
|
55
|
+
}, {
|
|
56
|
+
store: levaStore
|
|
57
|
+
});
|
|
58
|
+
var removeColor = {
|
|
59
|
+
addAttributesToSVGElement: {
|
|
60
|
+
attribute: {
|
|
61
|
+
'fill': 'currentColor',
|
|
62
|
+
'fill-rule': 'evenodd'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
collapseGroups: true,
|
|
66
|
+
removeAttrs: {
|
|
67
|
+
attrs: ['fill', 'color', 'stroke', 'stroke-width', 'fill-rule']
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
var compression = useSvgo(svg, config);
|
|
71
|
+
var mono = useSvgo(svg, _objectSpread(_objectSpread({}, config), removeColor));
|
|
72
|
+
useEffect(function () {
|
|
73
|
+
var _monoRef$current;
|
|
74
|
+
if (mono.isLoading) return setMonoSvg('loading...');
|
|
75
|
+
setMonoSvg((monoRef === null || monoRef === void 0 || (_monoRef$current = monoRef.current) === null || _monoRef$current === void 0 || (_monoRef$current = _monoRef$current.querySelector('svg')) === null || _monoRef$current === void 0 ? void 0 : _monoRef$current.innerHTML) || '');
|
|
76
|
+
}, [mono]);
|
|
77
|
+
useEffect(function () {
|
|
78
|
+
var _colorRef$current, _colorRef$current2;
|
|
79
|
+
if (compression.isLoading) return setColorSvg('loading...');
|
|
80
|
+
setColorSvg((colorRef === null || colorRef === void 0 || (_colorRef$current = colorRef.current) === null || _colorRef$current === void 0 || (_colorRef$current = _colorRef$current.querySelector('svg')) === null || _colorRef$current === void 0 ? void 0 : _colorRef$current.innerHTML) || '');
|
|
81
|
+
var viewBox = colorRef === null || colorRef === void 0 || (_colorRef$current2 = colorRef.current) === null || _colorRef$current2 === void 0 || (_colorRef$current2 = _colorRef$current2.querySelector('svg')) === null || _colorRef$current2 === void 0 ? void 0 : _colorRef$current2.viewBox.baseVal;
|
|
82
|
+
if (viewBox) {
|
|
83
|
+
setViewbox("".concat(viewBox.x, " ").concat(viewBox.y, " ").concat(viewBox.width, " ").concat(viewBox.height));
|
|
84
|
+
}
|
|
85
|
+
}, [compression]);
|
|
86
|
+
return /*#__PURE__*/_jsx(StoryBook, {
|
|
87
|
+
className: styles.container,
|
|
88
|
+
levaStore: levaStore,
|
|
89
|
+
style: {
|
|
90
|
+
position: 'relative'
|
|
91
|
+
},
|
|
92
|
+
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
93
|
+
gap: 32,
|
|
94
|
+
style: {
|
|
95
|
+
overflow: 'hidden',
|
|
96
|
+
width: '100%'
|
|
97
|
+
},
|
|
98
|
+
children: [/*#__PURE__*/_jsx(Preview, {
|
|
99
|
+
svg: svg,
|
|
100
|
+
title: 'Original'
|
|
101
|
+
}), /*#__PURE__*/_jsx(Preview, {
|
|
102
|
+
precent: compression.precent,
|
|
103
|
+
ref: colorRef,
|
|
104
|
+
svg: compression.svg,
|
|
105
|
+
title: 'Compression'
|
|
106
|
+
}), /*#__PURE__*/_jsx(Preview, {
|
|
107
|
+
precent: mono.precent,
|
|
108
|
+
ref: monoRef,
|
|
109
|
+
svg: mono.svg,
|
|
110
|
+
title: 'Monochrome'
|
|
111
|
+
}), /*#__PURE__*/_jsx(Mono, {
|
|
112
|
+
svg: monoSvg,
|
|
113
|
+
title: 'Mono',
|
|
114
|
+
viewbox: viewbox
|
|
115
|
+
}), /*#__PURE__*/_jsx(Color, {
|
|
116
|
+
svg: colorSvg,
|
|
117
|
+
title: 'Color',
|
|
118
|
+
viewbox: viewbox
|
|
119
|
+
})]
|
|
120
|
+
})
|
|
121
|
+
});
|
|
122
|
+
});
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
+
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
+
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
5
|
+
import SvgoClient from "./svgo";
|
|
6
|
+
export var useSvgo = function useSvgo(svg, config) {
|
|
7
|
+
var svgoInstance = useRef();
|
|
8
|
+
var _useState = useState(true),
|
|
9
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
10
|
+
isLoading = _useState2[0],
|
|
11
|
+
setIsLoading = _useState2[1];
|
|
12
|
+
var _useState3 = useState(svg),
|
|
13
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
14
|
+
newSvg = _useState4[0],
|
|
15
|
+
setNewSvg = _useState4[1];
|
|
16
|
+
var compressionSvg = useCallback( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee() {
|
|
17
|
+
var data;
|
|
18
|
+
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
19
|
+
while (1) switch (_context.prev = _context.next) {
|
|
20
|
+
case 0:
|
|
21
|
+
if (svgoInstance.current) {
|
|
22
|
+
_context.next = 2;
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
return _context.abrupt("return");
|
|
26
|
+
case 2:
|
|
27
|
+
_context.next = 4;
|
|
28
|
+
return svgoInstance.current.optimize(svg);
|
|
29
|
+
case 4:
|
|
30
|
+
data = _context.sent;
|
|
31
|
+
setNewSvg(data);
|
|
32
|
+
setIsLoading(false);
|
|
33
|
+
case 7:
|
|
34
|
+
case "end":
|
|
35
|
+
return _context.stop();
|
|
36
|
+
}
|
|
37
|
+
}, _callee);
|
|
38
|
+
})), [svg]);
|
|
39
|
+
useEffect(function () {
|
|
40
|
+
svgoInstance.current = new SvgoClient(config);
|
|
41
|
+
}, [config]);
|
|
42
|
+
useEffect(function () {
|
|
43
|
+
setIsLoading(false);
|
|
44
|
+
compressionSvg();
|
|
45
|
+
}, [config, svg]);
|
|
46
|
+
return {
|
|
47
|
+
isLoading: isLoading,
|
|
48
|
+
precent: "".concat(-Math.floor((1 - newSvg.length / svg.length) * 100), "%"),
|
|
49
|
+
svg: newSvg
|
|
50
|
+
};
|
|
51
|
+
};
|
|
@@ -2,7 +2,6 @@ import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLit
|
|
|
2
2
|
var _templateObject, _templateObject2;
|
|
3
3
|
import { CopyButton } from '@lobehub/ui';
|
|
4
4
|
import { createStyles } from 'antd-style';
|
|
5
|
-
import { readableColor } from 'polished';
|
|
6
5
|
import { memo } from 'react';
|
|
7
6
|
import { Flexbox } from 'react-layout-kit';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -29,7 +28,7 @@ var IconPreview = /*#__PURE__*/memo(function (_ref2) {
|
|
|
29
28
|
},
|
|
30
29
|
children: [/*#__PURE__*/_jsx("div", {
|
|
31
30
|
style: {
|
|
32
|
-
color:
|
|
31
|
+
color: '#fff'
|
|
33
32
|
},
|
|
34
33
|
children: color
|
|
35
34
|
}), /*#__PURE__*/_jsx(CopyButton, {
|
package/es/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as
|
|
3
|
-
export {
|
|
4
|
-
export
|
|
1
|
+
export { default as ChatGLM } from './ChatGLM';
|
|
2
|
+
export { default as Tongyi } from './Tongyi';
|
|
3
|
+
export type { IconType } from './types';
|
|
4
|
+
export { default as Wenxin } from './Wenxin';
|
|
5
|
+
export { default as Zhipu } from './Zhipu';
|
package/es/index.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
export { default as
|
|
2
|
-
export { default as
|
|
3
|
-
export { default as
|
|
4
|
-
|
|
5
|
-
export { _Zhipu as Zhipu };
|
|
1
|
+
export { default as ChatGLM } from "./ChatGLM";
|
|
2
|
+
export { default as Tongyi } from "./Tongyi";
|
|
3
|
+
export { default as Wenxin } from "./Wenxin";
|
|
4
|
+
export { default as Zhipu } from "./Zhipu";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/icons",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Popular LLM model brand svg logo and icon collection",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"lobehub",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"lint:md": "remark . --quiet --frail --output",
|
|
41
41
|
"lint:style": "stylelint \"{src,tests}/**/*.{js,jsx,ts,tsx}\" --fix",
|
|
42
42
|
"prepare": "husky install && npm run setup",
|
|
43
|
-
"prepublishOnly": "
|
|
43
|
+
"prepublishOnly": "npm run build",
|
|
44
44
|
"prettier": "prettier -c --write --no-error-on-unmatched-pattern \"**/**\"",
|
|
45
45
|
"pull": "git pull",
|
|
46
46
|
"release": "semantic-release",
|
|
@@ -72,14 +72,12 @@
|
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"@babel/runtime": "^7",
|
|
75
|
-
"
|
|
76
|
-
"polished": "^4",
|
|
77
|
-
"react-layout-kit": "^1",
|
|
78
|
-
"svgo-browser": "^1"
|
|
75
|
+
"react-layout-kit": "^1"
|
|
79
76
|
},
|
|
80
77
|
"devDependencies": {
|
|
81
78
|
"@commitlint/cli": "^18",
|
|
82
79
|
"@lobehub/lint": "latest",
|
|
80
|
+
"@lobehub/ui": "^1",
|
|
83
81
|
"@testing-library/react": "^14",
|
|
84
82
|
"@types/pangu": "^4",
|
|
85
83
|
"@types/query-string": "^6",
|
|
@@ -105,15 +103,15 @@
|
|
|
105
103
|
"remark-cli": "^11",
|
|
106
104
|
"semantic-release": "^21",
|
|
107
105
|
"stylelint": "^15",
|
|
106
|
+
"svgo-browser": "^1",
|
|
108
107
|
"typescript": "^5",
|
|
109
108
|
"vitest": "latest"
|
|
110
109
|
},
|
|
111
110
|
"peerDependencies": {
|
|
112
|
-
"@lobehub/ui": ">=1",
|
|
113
|
-
"antd-style": ">=3",
|
|
114
111
|
"polished": ">=4",
|
|
115
112
|
"react": ">=18",
|
|
116
|
-
"react-dom": ">=18"
|
|
113
|
+
"react-dom": ">=18",
|
|
114
|
+
"react-layout-kit": ">=1"
|
|
117
115
|
},
|
|
118
116
|
"publishConfig": {
|
|
119
117
|
"access": "public",
|
package/es/Editor/Preview.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import _asyncToGenerator from "@babel/runtime/helpers/esm/asyncToGenerator";
|
|
2
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
3
|
-
import _taggedTemplateLiteral from "@babel/runtime/helpers/esm/taggedTemplateLiteral";
|
|
4
|
-
var _templateObject;
|
|
5
|
-
import _regeneratorRuntime from "@babel/runtime/regenerator";
|
|
6
|
-
import { Highlighter, Tag } from '@lobehub/ui';
|
|
7
|
-
import { createStyles } from 'antd-style';
|
|
8
|
-
import { memo, useCallback, useEffect, useState } from 'react';
|
|
9
|
-
import { Flexbox } from 'react-layout-kit';
|
|
10
|
-
import { IconPreview } from "./..";
|
|
11
|
-
import SvgoClient from "./svgo";
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var useStyles = createStyles(function (_ref) {
|
|
15
|
-
var css = _ref.css;
|
|
16
|
-
return {
|
|
17
|
-
code: css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n height: 96px;\n\n pre {\n padding: 8px !important;\n }\n\n code {\n font-size: 12px;\n text-wrap: initial;\n }\n "])))
|
|
18
|
-
};
|
|
19
|
-
});
|
|
20
|
-
var Preview = /*#__PURE__*/memo(function (_ref2) {
|
|
21
|
-
var svg = _ref2.svg,
|
|
22
|
-
config = _ref2.config,
|
|
23
|
-
title = _ref2.title;
|
|
24
|
-
var _useState = useState(),
|
|
25
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
26
|
-
newSvgIcon = _useState2[0],
|
|
27
|
-
setNewSvgIcon = _useState2[1];
|
|
28
|
-
var _useStyles = useStyles(),
|
|
29
|
-
styles = _useStyles.styles;
|
|
30
|
-
var newSvg = useCallback( /*#__PURE__*/function () {
|
|
31
|
-
var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(svgoInstance) {
|
|
32
|
-
var data;
|
|
33
|
-
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
34
|
-
while (1) switch (_context.prev = _context.next) {
|
|
35
|
-
case 0:
|
|
36
|
-
_context.next = 2;
|
|
37
|
-
return svgoInstance.optimize(svg);
|
|
38
|
-
case 2:
|
|
39
|
-
data = _context.sent;
|
|
40
|
-
setNewSvgIcon(data);
|
|
41
|
-
case 4:
|
|
42
|
-
case "end":
|
|
43
|
-
return _context.stop();
|
|
44
|
-
}
|
|
45
|
-
}, _callee);
|
|
46
|
-
}));
|
|
47
|
-
return function (_x) {
|
|
48
|
-
return _ref3.apply(this, arguments);
|
|
49
|
-
};
|
|
50
|
-
}(), [svg]);
|
|
51
|
-
useEffect(function () {
|
|
52
|
-
if (config) {
|
|
53
|
-
var svgoInstance = new SvgoClient(config);
|
|
54
|
-
newSvg(svgoInstance);
|
|
55
|
-
} else {
|
|
56
|
-
setNewSvgIcon(svg);
|
|
57
|
-
}
|
|
58
|
-
}, [config, svg]);
|
|
59
|
-
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
60
|
-
flex: 1,
|
|
61
|
-
gap: 16,
|
|
62
|
-
style: {
|
|
63
|
-
position: 'relative',
|
|
64
|
-
width: '100%'
|
|
65
|
-
},
|
|
66
|
-
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
67
|
-
align: 'center',
|
|
68
|
-
gap: 8,
|
|
69
|
-
horizontal: true,
|
|
70
|
-
children: [/*#__PURE__*/_jsx("h2", {
|
|
71
|
-
style: {
|
|
72
|
-
lineHeight: 1,
|
|
73
|
-
margin: 0
|
|
74
|
-
},
|
|
75
|
-
children: title
|
|
76
|
-
}), config && newSvgIcon && /*#__PURE__*/_jsxs(Tag, {
|
|
77
|
-
children: [-Math.floor((1 - newSvgIcon.length / svg.length) * 100), "%"]
|
|
78
|
-
})]
|
|
79
|
-
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
80
|
-
gap: 8,
|
|
81
|
-
horizontal: true,
|
|
82
|
-
children: [/*#__PURE__*/_jsx(IconPreview, {
|
|
83
|
-
children: newSvgIcon
|
|
84
|
-
}), /*#__PURE__*/_jsx(Highlighter, {
|
|
85
|
-
className: styles.code,
|
|
86
|
-
language: 'html',
|
|
87
|
-
type: 'ghost',
|
|
88
|
-
children: newSvgIcon || ''
|
|
89
|
-
})]
|
|
90
|
-
})]
|
|
91
|
-
});
|
|
92
|
-
});
|
|
93
|
-
export default Preview;
|
package/es/Editor/index.js
DELETED
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3
|
-
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
4
|
-
import { StoryBook, useControls, useCreateStore } from '@lobehub/ui';
|
|
5
|
-
import { Flexbox } from 'react-layout-kit';
|
|
6
|
-
import Preview from "./Preview";
|
|
7
|
-
import { svgIcon } from "./data";
|
|
8
|
-
import { defaultPlugins } from "./svgo";
|
|
9
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
-
export default (function () {
|
|
12
|
-
var levaStore = useCreateStore();
|
|
13
|
-
var _useControls = useControls({
|
|
14
|
-
svg: {
|
|
15
|
-
rows: true,
|
|
16
|
-
value: svgIcon
|
|
17
|
-
}
|
|
18
|
-
}, {
|
|
19
|
-
store: levaStore
|
|
20
|
-
}),
|
|
21
|
-
svg = _useControls.svg;
|
|
22
|
-
var config = useControls('Config', defaultPlugins, {
|
|
23
|
-
collapsed: true
|
|
24
|
-
}, {
|
|
25
|
-
store: levaStore
|
|
26
|
-
});
|
|
27
|
-
var removeColor = {
|
|
28
|
-
addAttributesToSVGElement: {
|
|
29
|
-
attribute: {
|
|
30
|
-
'fill': 'currentColor',
|
|
31
|
-
'fill-rule': 'evenodd'
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
collapseGroups: true,
|
|
35
|
-
removeAttrs: {
|
|
36
|
-
attrs: ['fill', 'color', 'stroke', 'stroke-width', 'fill-rule']
|
|
37
|
-
}
|
|
38
|
-
};
|
|
39
|
-
return /*#__PURE__*/_jsx(StoryBook, {
|
|
40
|
-
levaStore: levaStore,
|
|
41
|
-
style: {
|
|
42
|
-
position: 'relative'
|
|
43
|
-
},
|
|
44
|
-
children: /*#__PURE__*/_jsxs(Flexbox, {
|
|
45
|
-
gap: 32,
|
|
46
|
-
style: {
|
|
47
|
-
flexWrap: 'wrap',
|
|
48
|
-
height: '100%',
|
|
49
|
-
overflow: 'hidden',
|
|
50
|
-
position: 'relative',
|
|
51
|
-
width: '100%'
|
|
52
|
-
},
|
|
53
|
-
children: [/*#__PURE__*/_jsx(Preview, {
|
|
54
|
-
svg: svg,
|
|
55
|
-
title: 'Original'
|
|
56
|
-
}), /*#__PURE__*/_jsx(Preview, {
|
|
57
|
-
config: config,
|
|
58
|
-
svg: svg,
|
|
59
|
-
title: 'Compression'
|
|
60
|
-
}), /*#__PURE__*/_jsx(Preview, {
|
|
61
|
-
config: _objectSpread(_objectSpread({}, config), removeColor),
|
|
62
|
-
svg: svg,
|
|
63
|
-
title: 'Monochrome'
|
|
64
|
-
})]
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
});
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { ReactNode } from 'react';
|
|
2
|
-
interface IconShowcaseProps {
|
|
3
|
-
avatar: ReactNode;
|
|
4
|
-
color: ReactNode;
|
|
5
|
-
combine?: ReactNode;
|
|
6
|
-
mono: ReactNode;
|
|
7
|
-
primaryColor: string;
|
|
8
|
-
text?: ReactNode;
|
|
9
|
-
}
|
|
10
|
-
declare const IconShowcase: import("react").NamedExoticComponent<IconShowcaseProps>;
|
|
11
|
-
export default IconShowcase;
|
package/es/IconShowcase/index.js
DELETED
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import { memo } from 'react';
|
|
2
|
-
import { Flexbox } from 'react-layout-kit';
|
|
3
|
-
import IconPreview from "../IconPreview";
|
|
4
|
-
import ColorPreview from "../IconPreview/ColorPreview";
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
var IconShowcase = /*#__PURE__*/memo(function (_ref) {
|
|
8
|
-
var color = _ref.color,
|
|
9
|
-
mono = _ref.mono,
|
|
10
|
-
combine = _ref.combine,
|
|
11
|
-
text = _ref.text,
|
|
12
|
-
primaryColor = _ref.primaryColor,
|
|
13
|
-
avatar = _ref.avatar;
|
|
14
|
-
return /*#__PURE__*/_jsxs(Flexbox, {
|
|
15
|
-
gap: 32,
|
|
16
|
-
style: {
|
|
17
|
-
flexWrap: 'wrap'
|
|
18
|
-
},
|
|
19
|
-
children: [/*#__PURE__*/_jsxs(Flexbox, {
|
|
20
|
-
align: 'flex-start',
|
|
21
|
-
gap: 16,
|
|
22
|
-
children: [/*#__PURE__*/_jsx("h2", {
|
|
23
|
-
style: {
|
|
24
|
-
lineHeight: 1,
|
|
25
|
-
margin: 0
|
|
26
|
-
},
|
|
27
|
-
children: "Icons"
|
|
28
|
-
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
29
|
-
gap: 16,
|
|
30
|
-
horizontal: true,
|
|
31
|
-
style: {
|
|
32
|
-
flexWrap: 'wrap'
|
|
33
|
-
},
|
|
34
|
-
children: [/*#__PURE__*/_jsx(IconPreview, {
|
|
35
|
-
children: color
|
|
36
|
-
}), /*#__PURE__*/_jsx(IconPreview, {
|
|
37
|
-
children: mono
|
|
38
|
-
}), avatar]
|
|
39
|
-
})]
|
|
40
|
-
}), text && /*#__PURE__*/_jsxs(Flexbox, {
|
|
41
|
-
align: 'flex-start',
|
|
42
|
-
gap: 16,
|
|
43
|
-
children: [/*#__PURE__*/_jsx("h2", {
|
|
44
|
-
style: {
|
|
45
|
-
lineHeight: 1,
|
|
46
|
-
margin: 0
|
|
47
|
-
},
|
|
48
|
-
children: "Texts"
|
|
49
|
-
}), /*#__PURE__*/_jsx(IconPreview, {
|
|
50
|
-
children: text
|
|
51
|
-
})]
|
|
52
|
-
}), combine && /*#__PURE__*/_jsxs(Flexbox, {
|
|
53
|
-
align: 'flex-start',
|
|
54
|
-
gap: 16,
|
|
55
|
-
children: [/*#__PURE__*/_jsx("h2", {
|
|
56
|
-
style: {
|
|
57
|
-
lineHeight: 1,
|
|
58
|
-
margin: 0
|
|
59
|
-
},
|
|
60
|
-
children: "Combines"
|
|
61
|
-
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
62
|
-
gap: 16,
|
|
63
|
-
horizontal: true,
|
|
64
|
-
style: {
|
|
65
|
-
flexWrap: 'wrap'
|
|
66
|
-
},
|
|
67
|
-
children: combine
|
|
68
|
-
})]
|
|
69
|
-
}), /*#__PURE__*/_jsxs(Flexbox, {
|
|
70
|
-
align: 'flex-start',
|
|
71
|
-
gap: 16,
|
|
72
|
-
children: [/*#__PURE__*/_jsx("h2", {
|
|
73
|
-
style: {
|
|
74
|
-
lineHeight: 1,
|
|
75
|
-
margin: 0
|
|
76
|
-
},
|
|
77
|
-
children: "Colors"
|
|
78
|
-
}), /*#__PURE__*/_jsx(Flexbox, {
|
|
79
|
-
gap: 16,
|
|
80
|
-
horizontal: true,
|
|
81
|
-
style: {
|
|
82
|
-
flexWrap: 'wrap'
|
|
83
|
-
},
|
|
84
|
-
children: /*#__PURE__*/_jsx(ColorPreview, {
|
|
85
|
-
color: primaryColor
|
|
86
|
-
})
|
|
87
|
-
})]
|
|
88
|
-
})]
|
|
89
|
-
});
|
|
90
|
-
});
|
|
91
|
-
export default IconShowcase;
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|