1 | function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? Object(arguments[i]) : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
|
2 |
|
3 | function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
4 |
|
5 | import { nextTick, h } from 'vue';
|
6 | import { generate as generateColor } from '@ant-design/colors';
|
7 | import insertCss from './insert-css';
|
8 | export function warn(valid, message) {
|
9 |
|
10 | if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
11 | console.error("Warning: ".concat(message));
|
12 | }
|
13 | }
|
14 | export function warning(valid, message) {
|
15 | warn(valid, "[@ant-design/icons-vue] ".concat(message));
|
16 | }
|
17 |
|
18 | export function isIconDefinition(target) {
|
19 | return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
|
20 | }
|
21 | export function normalizeAttrs() {
|
22 | var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
23 | return Object.keys(attrs).reduce(function (acc, key) {
|
24 | var val = attrs[key];
|
25 |
|
26 | switch (key) {
|
27 | case 'class':
|
28 | acc.className = val;
|
29 | delete acc["class"];
|
30 | break;
|
31 |
|
32 | default:
|
33 | acc[key] = val;
|
34 | }
|
35 |
|
36 | return acc;
|
37 | }, {});
|
38 | }
|
39 | export function generate(node, key, rootProps) {
|
40 | if (!rootProps) {
|
41 | return h(node.tag, _objectSpread({
|
42 | key: key
|
43 | }, node.attrs), (node.children || []).map(function (child, index) {
|
44 | return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
45 | }));
|
46 | }
|
47 |
|
48 | return h(node.tag, _objectSpread({
|
49 | key: key
|
50 | }, rootProps, node.attrs), (node.children || []).map(function (child, index) {
|
51 | return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
52 | }));
|
53 | }
|
54 | export function getSecondaryColor(primaryColor) {
|
55 |
|
56 | return generateColor(primaryColor)[0];
|
57 | }
|
58 | export function normalizeTwoToneColors(twoToneColor) {
|
59 | if (!twoToneColor) {
|
60 | return [];
|
61 | }
|
62 |
|
63 | return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
64 | }
|
65 |
|
66 |
|
67 | export var svgBaseProps = {
|
68 | width: '1em',
|
69 | height: '1em',
|
70 | fill: 'currentColor',
|
71 | 'aria-hidden': 'true',
|
72 | focusable: 'false'
|
73 | };
|
74 | export var iconStyles = "\n.anticon {\n display: inline-block;\n color: inherit;\n font-style: normal;\n line-height: 0;\n text-align: center;\n text-transform: none;\n vertical-align: -0.125em;\n text-rendering: optimizeLegibility;\n -webkit-font-smoothing: antialiased;\n -moz-osx-font-smoothing: grayscale;\n}\n\n.anticon > * {\n line-height: 1;\n}\n\n.anticon svg {\n display: inline-block;\n}\n\n.anticon::before {\n display: none;\n}\n\n.anticon .anticon-icon {\n display: block;\n}\n\n.anticon[tabindex] {\n cursor: pointer;\n}\n\n.anticon-spin::before,\n.anticon-spin {\n display: inline-block;\n -webkit-animation: loadingCircle 1s infinite linear;\n animation: loadingCircle 1s infinite linear;\n}\n\n@-webkit-keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n\n@keyframes loadingCircle {\n 100% {\n -webkit-transform: rotate(360deg);\n transform: rotate(360deg);\n }\n}\n";
|
75 | var cssInjectedFlag = false;
|
76 | export var useInsertStyles = function useInsertStyles() {
|
77 | var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
78 | nextTick(function () {
|
79 | if (!cssInjectedFlag) {
|
80 | if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
|
81 | insertCss(styleStr, {
|
82 | prepend: true
|
83 | });
|
84 | }
|
85 |
|
86 | cssInjectedFlag = true;
|
87 | }
|
88 | });
|
89 | }; |
\ | No newline at end of file |