qauMaWeb/node_modules/.cache/babel-loader/73c404b77445e33a686549c716f...

1 line
49 KiB
JSON
Raw Normal View History

2024-10-13 18:02:27 +08:00
{"ast":null,"code":"import \"core-js/modules/es.array.join.js\";\nimport \"core-js/modules/es.regexp.exec.js\";\nimport \"core-js/modules/es.string.match.js\";\nimport \"core-js/modules/es.array.filter.js\";\nimport \"core-js/modules/es.object.to-string.js\";\nimport { adjustTextY, getIdURL, getMatrixStr, getPathPrecision, getShadowKey, getSRTTransformString, hasShadow, isAroundZero, isGradient, isImagePattern, isLinearGradient, isPattern, isRadialGradient, normalizeColor, round4, TEXT_ALIGN_TO_ANCHOR } from './helper.js';\nimport Path from '../graphic/Path.js';\nimport ZRImage from '../graphic/Image.js';\nimport { getLineHeight } from '../contain/text.js';\nimport TSpan from '../graphic/TSpan.js';\nimport SVGPathRebuilder from './SVGPathRebuilder.js';\nimport mapStyleToAttrs from './mapStyleToAttrs.js';\nimport { createVNode, vNodeToString } from './core.js';\nimport { assert, clone, isFunction, isString, logError, map, retrieve2 } from '../core/util.js';\nimport { createOrUpdateImage } from '../graphic/helper/image.js';\nimport { createCSSAnimation } from './cssAnimation.js';\nimport { hasSeparateFont, parseFontSize } from '../graphic/Text.js';\nimport { DEFAULT_FONT, DEFAULT_FONT_FAMILY } from '../core/platform.js';\nvar round = Math.round;\n\nfunction isImageLike(val) {\n return val && isString(val.src);\n}\n\nfunction isCanvasLike(val) {\n return val && isFunction(val.toDataURL);\n}\n\nfunction setStyleAttrs(attrs, style, el, scope) {\n mapStyleToAttrs(function (key, val) {\n var isFillStroke = key === 'fill' || key === 'stroke';\n\n if (isFillStroke && isGradient(val)) {\n setGradient(style, attrs, key, scope);\n } else if (isFillStroke && isPattern(val)) {\n setPattern(el, attrs, key, scope);\n } else {\n attrs[key] = val;\n }\n }, style, el, false);\n setShadow(el, attrs, scope);\n}\n\nfunction noRotateScale(m) {\n return isAroundZero(m[0] - 1) && isAroundZero(m[1]) && isAroundZero(m[2]) && isAroundZero(m[3] - 1);\n}\n\nfunction noTranslate(m) {\n return isAroundZero(m[4]) && isAroundZero(m[5]);\n}\n\nfunction setTransform(attrs, m, compress) {\n if (m && !(noTranslate(m) && noRotateScale(m))) {\n var mul = compress ? 10 : 1e4;\n attrs.transform = noRotateScale(m) ? \"translate(\" + round(m[4] * mul) / mul + \" \" + round(m[5] * mul) / mul + \")\" : getMatrixStr(m);\n }\n}\n\nfunction convertPolyShape(shape, attrs, mul) {\n var points = shape.points;\n var strArr = [];\n\n for (var i = 0; i < points.length; i++) {\n strArr.push(round(points[i][0] * mul) / mul);\n strArr.push(round(points[i][1] * mul) / mul);\n }\n\n attrs.points = strArr.join(' ');\n}\n\nfunction validatePolyShape(shape) {\n return !shape.smooth;\n}\n\nfunction createAttrsConvert(desc) {\n var normalizedDesc = map(desc, function (item) {\n return typeof item === 'string' ? [item, item] : item;\n });\n return function (shape, attrs, mul) {\n for (var i = 0; i < normalizedDesc.length; i++) {\n var item = normalizedDesc[i];\n var val = shape[item[0]];\n\n if (val != null) {\n attrs[item[1]] = round(val * mul) / mul;\n }\n }\n };\n}\n\nvar buitinShapesDef = {\n circle: [createAttrsConvert(['cx', 'cy', 'r'])],\n polyline: [convertPolyShape, validatePolyShape],\n polygon: [convertPolyShape, validatePolyShape]\n};\n\nfunction hasShapeAnimation(el) {\n var animators = el.animators;\n\n for (var i = 0; i < animators.length; i++) {\n if (animators[i].targetName === 'shape') {\n return true;\n }\n }\n\n return false;\n}\n\nexport function brushSVGPath(el, scope) {\n var style = el.style;\n var shape = el.shape;\n var builtinShpDef = buitinShapesDef[el.type];\n var attrs = {};\n var needsAnimate = scope.animation;\n var svgElType = 'path';\n var strokePercent = el.style.strokePercent;\n var precision = scope.compress && getPathPrecision(el) || 4;\n\n if (builtinShpDef && !scope.willUpdate && !(builtinShpDef[1] && !builtinShpDef[1](shape)) && !(needsAnimate && hasShapeAnimation(el)) && !(strokePercent < 1)) {\n svgElType = el.type;\n