1 line
8.6 KiB
JSON
1 line
8.6 KiB
JSON
|
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"type\", \"children\"];\nimport * as React from 'react';\nimport Icon from \"./Icon\";\nvar customCache = new Set();\nfunction isValidCustomScriptUrl(scriptUrl) {\n return Boolean(typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl));\n}\nfunction createScriptUrlElements(scriptUrls) {\n var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var currentScriptUrl = scriptUrls[index];\n if (isValidCustomScriptUrl(currentScriptUrl)) {\n var script = document.createElement('script');\n script.setAttribute('src', currentScriptUrl);\n script.setAttribute('data-namespace', currentScriptUrl);\n if (scriptUrls.length > index + 1) {\n script.onload = function () {\n createScriptUrlElements(scriptUrls, index + 1);\n };\n script.onerror = function () {\n createScriptUrlElements(scriptUrls, index + 1);\n };\n }\n customCache.add(currentScriptUrl);\n document.body.appendChild(script);\n }\n}\nexport default function create() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var scriptUrl = options.scriptUrl,\n _options$extraCommonP = options.extraCommonProps,\n extraCommonProps = _options$extraCommonP === void 0 ? {} : _options$extraCommonP;\n\n /**\n * DOM API required.\n * Make sure in browser environment.\n * The Custom Icon will create a <script/>\n * that loads SVG symbols and insert the SVG Element into the document body.\n */\n if (scriptUrl && typeof document !== 'undefined' && typeof window !== 'undefined' && typeof document.createElement === 'function') {\n if (Array.isArray(scriptUrl)) {\n // 因为iconfont资源会把svg插入before,所以前加载相同type会覆盖后加载,为了数组覆盖顺序,倒叙插入\n createScriptUrlElements(scriptUrl.reverse());\n } else {\n createScriptUrlElements([scriptUrl]);\n }\n }\n var Iconfont = /*#__PURE__*/React.forwardRef(function (props, ref) {\n var type = props.type,\n children = props.children,\n restProps = _objectWithoutProperties(props, _excluded);\n\n // children > type\n var content = null;\n if (props.type) {\n content = /*#__PURE__*/React.createElement(\"use\", {\n xlinkHref: \"#\".concat(type)\n });\n }\n if (children) {\n content = children;\n }\n return /*#__PURE__*/React.createElement(Icon, _extends({}, extraCommonProps, restProps, {\n ref: ref\n }), content);\n });\n Iconfont.displayName = 'Iconfont';\n return Iconfont;\n}","map":{"version":3,"names":["_extends","_objectWithoutProperties","_excluded","React","Icon","customCache","Set","isValidCustomScriptUrl","scriptUrl","Boolean","length","has","createScriptUrlElements","scriptUrls","index","arguments","undefined","currentScriptUrl","script","document","createElement","setAttribute","onload","onerror","add","body","appendChild","create","options","_options$extraCommonP","extraCommonProps","window","Array","isArray","reverse","Iconfont","forwardRef","props","ref","type","children","restProps","content","xlinkHref","concat","displayName"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/@ant-design/icons/es/components/IconFont.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nvar _excluded = [\"type\", \"children\"];\nimport * as React from 'react';\nimport Icon from \"./Icon\";\nvar customCache = new Set();\nfunction isValidCustomScriptUrl(scriptUrl) {\n return Boolean(typeof scriptUrl === 'string' && scriptUrl.length && !customCache.has(scriptUrl));\n}\nfunction createScriptUrlElements(scriptUrls) {\n var index = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var curre
|