PromoCursed/node_modules/.cache/babel-loader/aa188f1d73af81062e10e0a80a994bc9cadce5ea332e296bc282dc8d60859c86.json

1 line
5.8 KiB
JSON
Raw Normal View History

2024-08-20 23:25:37 +04:00
{"ast":null,"code":"import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport React from 'react';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport findDOMNode from \"rc-util/es/Dom/findDOMNode\";\nimport useEvent from \"rc-util/es/hooks/useEvent\";\nimport DomWrapper from \"./wrapper\";\nimport useMutateObserver from \"./useMutateObserver\";\nvar MutateObserver = function MutateObserver(props) {\n var children = props.children,\n options = props.options,\n _props$onMutate = props.onMutate,\n onMutate = _props$onMutate === void 0 ? function () {} : _props$onMutate;\n var callback = useEvent(onMutate);\n var wrapperRef = React.useRef(null);\n var elementRef = React.useRef(null);\n var canRef = /*#__PURE__*/React.isValidElement(children) && supportRef(children);\n var mergedRef = useComposeRef(elementRef, canRef ? children.ref : null);\n var _React$useState = React.useState(null),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n target = _React$useState2[0],\n setTarget = _React$useState2[1];\n useMutateObserver(target, callback, options);\n\n // =========================== Effect ===========================\n // Bind target\n useLayoutEffect(function () {\n setTarget(findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current));\n });\n\n // =========================== Render ===========================\n if (!children) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('MutationObserver need children props');\n }\n return null;\n }\n return /*#__PURE__*/React.createElement(DomWrapper, {\n ref: wrapperRef\n }, canRef ? /*#__PURE__*/React.cloneElement(children, {\n ref: mergedRef\n }) : children);\n};\nexport default MutateObserver;","map":{"version":3,"names":["_slicedToArray","React","useLayoutEffect","supportRef","useComposeRef","findDOMNode","useEvent","DomWrapper","useMutateObserver","MutateObserver","props","children","options","_props$onMutate","onMutate","callback","wrapperRef","useRef","elementRef","canRef","isValidElement","mergedRef","ref","_React$useState","useState","_React$useState2","target","setTarget","current","process","env","NODE_ENV","console","error","createElement","cloneElement"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/@rc-component/mutate-observer/es/MutateObserver.js"],"sourcesContent":["import _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport React from 'react';\nimport useLayoutEffect from \"rc-util/es/hooks/useLayoutEffect\";\nimport { supportRef, useComposeRef } from \"rc-util/es/ref\";\nimport findDOMNode from \"rc-util/es/Dom/findDOMNode\";\nimport useEvent from \"rc-util/es/hooks/useEvent\";\nimport DomWrapper from \"./wrapper\";\nimport useMutateObserver from \"./useMutateObserver\";\nvar MutateObserver = function MutateObserver(props) {\n var children = props.children,\n options = props.options,\n _props$onMutate = props.onMutate,\n onMutate = _props$onMutate === void 0 ? function () {} : _props$onMutate;\n var callback = useEvent(onMutate);\n var wrapperRef = React.useRef(null);\n var elementRef = React.useRef(null);\n var canRef = /*#__PURE__*/React.isValidElement(children) && supportRef(children);\n var mergedRef = useComposeRef(elementRef, canRef ? children.ref : null);\n var _React$useState = React.useState(null),\n _React$useState2 = _slicedToArray(_React$useState, 2),\n target = _React$useState2[0],\n setTarget = _React$useState2[1];\n useMutateObserver(target, callback, options);\n\n // =========================== Effect ===========================\n // Bind target\n useLayoutEffect(function () {\n setTarget(findDOMNode(elementRef.current) || findDOMNode(wrapperRef.current));\n });\n\n // =========================== Render ===========================\n if (!children) {\n if (process.env.NODE_ENV !== 'production') {\n console.error('MutationObserver need children props');\n }\n return null