1 line
6.8 KiB
JSON
1 line
6.8 KiB
JSON
|
|
{"ast":null,"code":"import _objectWithoutProperties from \"/Users/apple/Documents/cursor/Web\\u8BFE\\u4EF6/AI\\u8BFE/education_web_\\u591AAgent\\u534F\\u4F5C\\u7CFB\\u7EDF/node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js\";\nconst _excluded = [\"attrX\", \"attrY\", \"attrScale\", \"pathLength\", \"pathSpacing\", \"pathOffset\"];\nimport { buildHTMLStyles } from '../../html/utils/build-styles.mjs';\nimport { buildSVGPath } from './path.mjs';\n\n/**\n * Build SVG visual attributes, like cx and style.transform\n */\nfunction buildSVGAttrs(state, _ref, isSVGTag, transformTemplate, styleProp) {\n let {\n attrX,\n attrY,\n attrScale,\n pathLength,\n pathSpacing = 1,\n pathOffset = 0\n // This is object creation, which we try to avoid per-frame.\n } = _ref,\n latest = _objectWithoutProperties(_ref, _excluded);\n buildHTMLStyles(state, latest, transformTemplate);\n /**\n * For svg tags we just want to make sure viewBox is animatable and treat all the styles\n * as normal HTML tags.\n */\n if (isSVGTag) {\n if (state.style.viewBox) {\n state.attrs.viewBox = state.style.viewBox;\n }\n return;\n }\n state.attrs = state.style;\n state.style = {};\n const {\n attrs,\n style\n } = state;\n /**\n * However, we apply transforms as CSS transforms.\n * So if we detect a transform, transformOrigin we take it from attrs and copy it into style.\n */\n if (attrs.transform) {\n style.transform = attrs.transform;\n delete attrs.transform;\n }\n if (style.transform || attrs.transformOrigin) {\n var _attrs$transformOrigi;\n style.transformOrigin = (_attrs$transformOrigi = attrs.transformOrigin) !== null && _attrs$transformOrigi !== void 0 ? _attrs$transformOrigi : \"50% 50%\";\n delete attrs.transformOrigin;\n }\n if (style.transform) {\n var _styleProp$transformB;\n /**\n * SVG's element transform-origin uses its own median as a reference.\n * Therefore, transformBox becomes a fill-box\n */\n style.transformBox = (_styleProp$transformB = styleProp === null || styleProp === void 0 ? void 0 : styleProp.transformBox) !== null && _styleProp$transformB !== void 0 ? _styleProp$transformB : \"fill-box\";\n delete attrs.transformBox;\n }\n // Render attrX/attrY/attrScale as attributes\n if (attrX !== undefined) attrs.x = attrX;\n if (attrY !== undefined) attrs.y = attrY;\n if (attrScale !== undefined) attrs.scale = attrScale;\n // Build SVG path if one has been defined\n if (pathLength !== undefined) {\n buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);\n }\n}\nexport { buildSVGAttrs };","map":{"version":3,"names":["buildHTMLStyles","buildSVGPath","buildSVGAttrs","state","_ref","isSVGTag","transformTemplate","styleProp","attrX","attrY","attrScale","pathLength","pathSpacing","pathOffset","latest","_objectWithoutProperties","_excluded","style","viewBox","attrs","transform","transformOrigin","_attrs$transformOrigi","_styleProp$transformB","transformBox","undefined","x","y","scale"],"sources":["/Users/apple/Documents/cursor/Web课件/AI课/education_web_多Agent协作系统/node_modules/framer-motion/dist/es/render/svg/utils/build-attrs.mjs"],"sourcesContent":["import { buildHTMLStyles } from '../../html/utils/build-styles.mjs';\nimport { buildSVGPath } from './path.mjs';\n\n/**\n * Build SVG visual attributes, like cx and style.transform\n */\nfunction buildSVGAttrs(state, { attrX, attrY, attrScale, pathLength, pathSpacing = 1, pathOffset = 0, \n// This is object creation, which we try to avoid per-frame.\n...latest }, isSVGTag, transformTemplate, styleProp) {\n buildHTMLStyles(state, latest, transformTemplate);\n /**\n * For svg tags we just want to make sure viewBox is animatable and treat all the styles\n * as normal HTML tags.\n */\n if (isSVGTag) {\n if (state.style.viewBox) {\n state.attrs.viewBox = state.style.viewBox;\n }\n return;\n }\n state.attrs = state.style;\n state.style = {};\n const { attrs, style } = state
|