1 line
10 KiB
JSON
1 line
10 KiB
JSON
{"ast":null,"code":"\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.useComposeRef = exports.supportRef = exports.supportNodeRef = exports.getNodeRef = exports.fillRef = exports.composeRef = void 0;\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\nvar _react = require(\"react\");\nvar _reactIs = require(\"react-is\");\nvar _useMemo = _interopRequireDefault(require(\"./hooks/useMemo\"));\nvar fillRef = exports.fillRef = function fillRef(ref, node) {\n if (typeof ref === 'function') {\n ref(node);\n } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) {\n ref.current = node;\n }\n};\n\n/**\n * Merge refs into one ref function to support ref passing.\n */\nvar composeRef = exports.composeRef = function composeRef() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n var refList = refs.filter(Boolean);\n if (refList.length <= 1) {\n return refList[0];\n }\n return function (node) {\n refs.forEach(function (ref) {\n fillRef(ref, node);\n });\n };\n};\nvar useComposeRef = exports.useComposeRef = function useComposeRef() {\n for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n refs[_key2] = arguments[_key2];\n }\n return (0, _useMemo.default)(function () {\n return composeRef.apply(void 0, refs);\n }, refs, function (prev, next) {\n return prev.length !== next.length || prev.every(function (ref, i) {\n return ref !== next[i];\n });\n });\n};\nvar supportRef = exports.supportRef = function supportRef(nodeOrComponent) {\n var _type$prototype, _nodeOrComponent$prot;\n var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;\n\n // Function component node\n if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== _reactIs.ForwardRef) {\n return false;\n }\n\n // Class component\n if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== _reactIs.ForwardRef) {\n return false;\n }\n return true;\n};\nfunction isReactElement(node) {\n return /*#__PURE__*/(0, _react.isValidElement)(node) && !(0, _reactIs.isFragment)(node);\n}\nvar supportNodeRef = exports.supportNodeRef = function supportNodeRef(node) {\n return isReactElement(node) && supportRef(node);\n};\n\n/**\n * In React 19. `ref` is not a property from node.\n * But a property from `props.ref`.\n * To check if `props.ref` exist or fallback to `ref`.\n */\nvar getNodeRef = exports.getNodeRef = Number(_react.version.split('.')[0]) >= 19 ?\n// >= React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.props.ref;\n }\n return null;\n} :\n// < React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.ref;\n }\n return null;\n};","map":{"version":3,"names":["_interopRequireDefault","require","default","Object","defineProperty","exports","value","useComposeRef","supportRef","supportNodeRef","getNodeRef","fillRef","composeRef","_typeof2","_react","_reactIs","_useMemo","ref","node","current","_len","arguments","length","refs","Array","_key","refList","filter","Boolean","forEach","_len2","_key2","apply","prev","next","every","i","nodeOrComponent","_type$prototype","_nodeOrComponent$prot","type","isMemo","prototype","render","$$typeof","ForwardRef","isReactElement","isValidElement","isFragment","Number","version","split","props"],"sources":["C:/Users/Аришина)/Desktop/promo/node_modules/rc-util/lib/ref.js"],"sourcesContent":["\"use strict\";\n\nvar _interopRequireDefault = require(\"@babel/runtime/helpers/interopRequireDefault\").default;\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.useComposeRef = exports.supportRef = exports.supportNodeRef = exports.getNodeRef = exports.fillRef = exports.composeRef = void 0;\nvar _typeof2 = _interopRequireDefault(require(\"@babel/runtime/helpers/typeof\"));\nvar _react = require(\"react\");\nvar _reactIs = require(\"react-is\");\nvar _useMemo = _interopRequireDefault(require(\"./hooks/useMemo\"));\nvar fillRef = exports.fillRef = function fillRef(ref, node) {\n if (typeof ref === 'function') {\n ref(node);\n } else if ((0, _typeof2.default)(ref) === 'object' && ref && 'current' in ref) {\n ref.current = node;\n }\n};\n\n/**\n * Merge refs into one ref function to support ref passing.\n */\nvar composeRef = exports.composeRef = function composeRef() {\n for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {\n refs[_key] = arguments[_key];\n }\n var refList = refs.filter(Boolean);\n if (refList.length <= 1) {\n return refList[0];\n }\n return function (node) {\n refs.forEach(function (ref) {\n fillRef(ref, node);\n });\n };\n};\nvar useComposeRef = exports.useComposeRef = function useComposeRef() {\n for (var _len2 = arguments.length, refs = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n refs[_key2] = arguments[_key2];\n }\n return (0, _useMemo.default)(function () {\n return composeRef.apply(void 0, refs);\n }, refs, function (prev, next) {\n return prev.length !== next.length || prev.every(function (ref, i) {\n return ref !== next[i];\n });\n });\n};\nvar supportRef = exports.supportRef = function supportRef(nodeOrComponent) {\n var _type$prototype, _nodeOrComponent$prot;\n var type = (0, _reactIs.isMemo)(nodeOrComponent) ? nodeOrComponent.type.type : nodeOrComponent.type;\n\n // Function component node\n if (typeof type === 'function' && !((_type$prototype = type.prototype) !== null && _type$prototype !== void 0 && _type$prototype.render) && type.$$typeof !== _reactIs.ForwardRef) {\n return false;\n }\n\n // Class component\n if (typeof nodeOrComponent === 'function' && !((_nodeOrComponent$prot = nodeOrComponent.prototype) !== null && _nodeOrComponent$prot !== void 0 && _nodeOrComponent$prot.render) && nodeOrComponent.$$typeof !== _reactIs.ForwardRef) {\n return false;\n }\n return true;\n};\nfunction isReactElement(node) {\n return /*#__PURE__*/(0, _react.isValidElement)(node) && !(0, _reactIs.isFragment)(node);\n}\nvar supportNodeRef = exports.supportNodeRef = function supportNodeRef(node) {\n return isReactElement(node) && supportRef(node);\n};\n\n/**\n * In React 19. `ref` is not a property from node.\n * But a property from `props.ref`.\n * To check if `props.ref` exist or fallback to `ref`.\n */\nvar getNodeRef = exports.getNodeRef = Number(_react.version.split('.')[0]) >= 19 ?\n// >= React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.props.ref;\n }\n return null;\n} :\n// < React 19\nfunction (node) {\n if (isReactElement(node)) {\n return node.ref;\n }\n return null;\n};"],"mappings":"AAAA,YAAY;;AAEZ,IAAIA,sBAAsB,GAAGC,OAAO,CAAC,8CAA8C,CAAC,CAACC,OAAO;AAC5FC,MAAM,CAACC,cAAc,CAACC,OAAO,EAAE,YAAY,EAAE;EAC3CC,KAAK,EAAE;AACT,CAAC,CAAC;AACFD,OAAO,CAACE,aAAa,GAAGF,OAAO,CAACG,UAAU,GAAGH,OAAO,CAACI,cAAc,GAAGJ,OAAO,CAACK,UAAU,GAAGL,OAAO,CAACM,OAAO,GAAGN,OAAO,CAACO,UAAU,GAAG,KAAK,CAAC;AACxI,IAAIC,QAAQ,GAAGb,sBAAsB,CAACC,OAAO,CAAC,+BAA+B,CAAC,CAAC;AAC/E,IAAIa,MAAM,GAAGb,OAAO,CAAC,OAAO,CAAC;AAC7B,IAAIc,QAAQ,GAAGd,OAAO,CAAC,UAAU,CAAC;AAClC,IAAIe,QAAQ,GAAGhB,sBAAsB,CAACC,OAAO,CAAC,iBAAiB,CAAC,CAAC;AACjE,IAAIU,OAAO,GAAGN,OAAO,CAACM,OAAO,GAAG,SAASA,OAAOA,CAACM,GAAG,EAAEC,IAAI,EAAE;EAC1D,IAAI,OAAOD,GAAG,KAAK,UAAU,EAAE;IAC7BA,GAAG,CAACC,IAAI,CAAC;EACX,CAAC,MAAM,IAAI,CAAC,CAAC,EAAEL,QAAQ,CAACX,OAAO,EAAEe,GAAG,CAAC,KAAK,QAAQ,IAAIA,GAAG,IAAI,SAAS,IAAIA,GAAG,EAAE;IAC7EA,GAAG,CAACE,OAAO,GAAGD,IAAI;EACpB;AACF,CAAC;;AAED;AACA;AACA;AACA,IAAIN,UAAU,GAAGP,OAAO,CAACO,UAAU,GAAG,SAASA,UAAUA,CAAA,EAA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