1 | "use strict";
|
2 |
|
3 | Object.defineProperty(exports, "__esModule", {
|
4 | value: true
|
5 | });
|
6 | exports.warn = warn;
|
7 | exports.warning = warning;
|
8 | exports.isIconDefinition = isIconDefinition;
|
9 | exports.normalizeAttrs = normalizeAttrs;
|
10 | exports.generate = generate;
|
11 | exports.getSecondaryColor = getSecondaryColor;
|
12 | exports.normalizeTwoToneColors = normalizeTwoToneColors;
|
13 | exports.useInsertStyles = exports.iconStyles = exports.svgBaseProps = void 0;
|
14 |
|
15 | var _vue = require("vue");
|
16 |
|
17 | var _colors = require("@ant-design/colors");
|
18 |
|
19 | var _insertCss = _interopRequireDefault(require("./insert-css"));
|
20 |
|
21 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
22 |
|
23 | 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; }
|
24 |
|
25 | 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; }
|
26 |
|
27 | function warn(valid, message) {
|
28 |
|
29 | if (process.env.NODE_ENV !== 'production' && !valid && console !== undefined) {
|
30 | console.error("Warning: ".concat(message));
|
31 | }
|
32 | }
|
33 |
|
34 | function warning(valid, message) {
|
35 | warn(valid, "[@ant-design/icons-vue] ".concat(message));
|
36 | }
|
37 |
|
38 |
|
39 | function isIconDefinition(target) {
|
40 | return typeof target === 'object' && typeof target.name === 'string' && typeof target.theme === 'string' && (typeof target.icon === 'object' || typeof target.icon === 'function');
|
41 | }
|
42 |
|
43 | function normalizeAttrs() {
|
44 | var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
45 | return Object.keys(attrs).reduce(function (acc, key) {
|
46 | var val = attrs[key];
|
47 |
|
48 | switch (key) {
|
49 | case 'class':
|
50 | acc.className = val;
|
51 | delete acc["class"];
|
52 | break;
|
53 |
|
54 | default:
|
55 | acc[key] = val;
|
56 | }
|
57 |
|
58 | return acc;
|
59 | }, {});
|
60 | }
|
61 |
|
62 | function generate(node, key, rootProps) {
|
63 | if (!rootProps) {
|
64 | return (0, _vue.h)(node.tag, _objectSpread({
|
65 | key: key
|
66 | }, node.attrs), (node.children || []).map(function (child, index) {
|
67 | return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
68 | }));
|
69 | }
|
70 |
|
71 | return (0, _vue.h)(node.tag, _objectSpread({
|
72 | key: key
|
73 | }, rootProps, node.attrs), (node.children || []).map(function (child, index) {
|
74 | return generate(child, "".concat(key, "-").concat(node.tag, "-").concat(index));
|
75 | }));
|
76 | }
|
77 |
|
78 | function getSecondaryColor(primaryColor) {
|
79 |
|
80 | return (0, _colors.generate)(primaryColor)[0];
|
81 | }
|
82 |
|
83 | function normalizeTwoToneColors(twoToneColor) {
|
84 | if (!twoToneColor) {
|
85 | return [];
|
86 | }
|
87 |
|
88 | return Array.isArray(twoToneColor) ? twoToneColor : [twoToneColor];
|
89 | }
|
90 |
|
91 |
|
92 |
|
93 | var svgBaseProps = {
|
94 | width: '1em',
|
95 | height: '1em',
|
96 | fill: 'currentColor',
|
97 | 'aria-hidden': 'true',
|
98 | focusable: 'false'
|
99 | };
|
100 | exports.svgBaseProps = svgBaseProps;
|
101 | 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";
|
102 | exports.iconStyles = iconStyles;
|
103 | var cssInjectedFlag = false;
|
104 |
|
105 | var useInsertStyles = function useInsertStyles() {
|
106 | var styleStr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : iconStyles;
|
107 | (0, _vue.nextTick)(function () {
|
108 | if (!cssInjectedFlag) {
|
109 | if (typeof window !== 'undefined' && window.document && window.document.documentElement) {
|
110 | (0, _insertCss["default"])(styleStr, {
|
111 | prepend: true
|
112 | });
|
113 | }
|
114 |
|
115 | cssInjectedFlag = true;
|
116 | }
|
117 | });
|
118 | };
|
119 |
|
120 | exports.useInsertStyles = useInsertStyles; |
\ | No newline at end of file |