amis-rpc-design/node_modules/dom-align/dist-web/index.js.map

1 line
77 KiB
Plaintext
Raw Normal View History

2023-10-07 19:42:30 +08:00
{"version":3,"file":"index.js","sources":["../../src/propertyUtils.js","../../src/utils.js","../../src/getOffsetParent.js","../../src/isAncestorFixed.js","../../src/getVisibleRectForElement.js","../../src/adjustForViewport.js","../../src/getRegion.js","../../src/getAlignOffset.js","../../src/getElFuturePos.js","../../src/align/align.js","../../src/align/alignElement.js","../../src/align/alignPoint.js"],"sourcesContent":["let vendorPrefix;\n\nconst jsCssMap = {\n Webkit: '-webkit-',\n Moz: '-moz-',\n // IE did it wrong again ...\n ms: '-ms-',\n O: '-o-',\n};\n\nfunction getVendorPrefix() {\n if (vendorPrefix !== undefined) {\n return vendorPrefix;\n }\n vendorPrefix = '';\n const style = document.createElement('p').style;\n const testProp = 'Transform';\n for (const key in jsCssMap) {\n if (key + testProp in style) {\n vendorPrefix = key;\n }\n }\n return vendorPrefix;\n}\n\nfunction getTransitionName() {\n return getVendorPrefix()\n ? `${getVendorPrefix()}TransitionProperty`\n : 'transitionProperty';\n}\n\nexport function getTransformName() {\n return getVendorPrefix() ? `${getVendorPrefix()}Transform` : 'transform';\n}\n\nexport function setTransitionProperty(node, value) {\n const name = getTransitionName();\n if (name) {\n node.style[name] = value;\n if (name !== 'transitionProperty') {\n node.style.transitionProperty = value;\n }\n }\n}\n\nfunction setTransform(node, value) {\n const name = getTransformName();\n if (name) {\n node.style[name] = value;\n if (name !== 'transform') {\n node.style.transform = value;\n }\n }\n}\n\nexport function getTransitionProperty(node) {\n return node.style.transitionProperty || node.style[getTransitionName()];\n}\n\nexport function getTransformXY(node) {\n const style = window.getComputedStyle(node, null);\n const transform =\n style.getPropertyValue('transform') ||\n style.getPropertyValue(getTransformName());\n if (transform && transform !== 'none') {\n const matrix = transform.replace(/[^0-9\\-.,]/g, '').split(',');\n return {\n x: parseFloat(matrix[12] || matrix[4], 0),\n y: parseFloat(matrix[13] || matrix[5], 0),\n };\n }\n return {\n x: 0,\n y: 0,\n };\n}\n\nconst matrix2d = /matrix\\((.*)\\)/;\nconst matrix3d = /matrix3d\\((.*)\\)/;\n\nexport function setTransformXY(node, xy) {\n const style = window.getComputedStyle(node, null);\n const transform =\n style.getPropertyValue('transform') ||\n style.getPropertyValue(getTransformName());\n if (transform && transform !== 'none') {\n let arr;\n let match2d = transform.match(matrix2d);\n if (match2d) {\n match2d = match2d[1];\n arr = match2d.split(',').map(item => {\n return parseFloat(item, 10);\n });\n arr[4] = xy.x;\n arr[5] = xy.y;\n setTransform(node, `matrix(${arr.join(',')})`);\n } else {\n const match3d = transform.match(matrix3d)[1];\n arr = match3d.split(',').map(item => {\n return parseFloat(item, 10);\n });\n arr[12] = xy.x;\n arr[13] = xy.y;\n setTransform(node, `matrix3d(${arr.join(',')})`);\n }\n } else {\n setTransform(\n node,\n `translateX(${xy.x}px) translateY(${xy.y}px) translateZ(0)`,\n );\n }\n}\n","import {\n setTransitionProperty,\n getTransitionProperty,\n getTransformXY,\n setTransformXY,\n getTransformName,\n} from './propertyUtils';\n\nconst RE_NUM = /[\\-+]?(?:\\d*\\.|)\\d+(?:[eE][\\-+]?\\d+|)/.source;\n\nlet getComputedStyleX;\n\n// https://stackoverflow.com/a/3485654/3040605\nfunction forceRelayout(elem) {\n const originalStyle = elem.style.display;\n elem.style.display = 'none';\n elem.offsetHeight; // eslint-disable-line\n elem.style.display = originalStyle;\n}\n\nfunction css(el, name, v) {\n let value = v;\n if (typeof name === 'object') {\n for (const i in name) {\n if (name.hasOwnProperty(i)) {\n css(el, i, name[i]);\n }\n }\n return undefined;\n }\n if (typeof value !== 'undefined') {\n if (typeof value === 'number') {\n value =