1 line
18 KiB
JSON
1 line
18 KiB
JSON
{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"component\", \"children\", \"onVisibleChanged\", \"onAllRemoved\"],\n _excluded2 = [\"status\"];\n/* eslint react/prop-types: 0 */\nimport * as React from 'react';\nimport OriginCSSMotion from \"./CSSMotion\";\nimport { diffKeys, parseKeys, STATUS_ADD, STATUS_KEEP, STATUS_REMOVE, STATUS_REMOVED } from \"./util/diff\";\nimport { supportTransition } from \"./util/motion\";\nvar MOTION_PROP_NAMES = ['eventProps', 'visible', 'children', 'motionName', 'motionAppear', 'motionEnter', 'motionLeave', 'motionLeaveImmediately', 'motionDeadline', 'removeOnLeave', 'leavedClassName', 'onAppearPrepare', 'onAppearStart', 'onAppearActive', 'onAppearEnd', 'onEnterStart', 'onEnterActive', 'onEnterEnd', 'onLeaveStart', 'onLeaveActive', 'onLeaveEnd'];\n/**\n * Generate a CSSMotionList component with config\n * @param transitionSupport No need since CSSMotionList no longer depends on transition support\n * @param CSSMotion CSSMotion component\n */\nexport function genCSSMotionList(transitionSupport) {\n var CSSMotion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : OriginCSSMotion;\n var CSSMotionList = /*#__PURE__*/function (_React$Component) {\n _inherits(CSSMotionList, _React$Component);\n var _super = _createSuper(CSSMotionList);\n function CSSMotionList() {\n var _this;\n _classCallCheck(this, CSSMotionList);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n keyEntities: []\n });\n // ZombieJ: Return the count of rest keys. It's safe to refactor if need more info.\n _defineProperty(_assertThisInitialized(_this), \"removeKey\", function (removeKey) {\n var keyEntities = _this.state.keyEntities;\n var nextKeyEntities = keyEntities.map(function (entity) {\n if (entity.key !== removeKey) return entity;\n return _objectSpread(_objectSpread({}, entity), {}, {\n status: STATUS_REMOVED\n });\n });\n _this.setState({\n keyEntities: nextKeyEntities\n });\n return nextKeyEntities.filter(function (_ref) {\n var status = _ref.status;\n return status !== STATUS_REMOVED;\n }).length;\n });\n return _this;\n }\n _createClass(CSSMotionList, [{\n key: \"render\",\n value: function render() {\n var _this2 = this;\n var keyEntities = this.state.keyEntities;\n var _this$props = this.props,\n component = _this$props.component,\n children = _this$props.children,\n _onVisibleChanged = _this$props.onVisibleChanged,\n onAllRemoved = _this$props.onAllRemoved,\n restProps = _objectWithoutProperties(_this$props, _excluded);\n var Component = component || React.Fragment;\n var motionProps = {};\n MOTION_PROP_NAMES.forEach(function (prop) {\n motionProps[prop] = restProps[prop];\n delete restProps[prop];\n });\n delete restProps.keys;\n return /*#__PURE__*/React.createElement(Component, restProps, keyEntities.map(function (_ref2, index) {\n var status = _ref2.status,\n eventProps = _objectWithoutProperties(_ref2, _excluded2);\n var visible = status === STATUS_ADD || status === STATUS_KEEP;\n return /*#__PURE__*/React.createElement(CSSMotion, _extends({}, motionProps, {\n key: eventProps.key,\n visible: visible,\n eventProps: eventProps,\n onVisibleChanged: function onVisibleChanged(changedVisible) {\n _onVisibleChanged === null || _onVisibleChanged === void 0 || _onVisibleChanged(changedVisible, {\n key: eventProps.key\n });\n if (!changedVisible) {\n var restKeysCount = _this2.removeKey(eventProps.key);\n if (restKeysCount === 0 && onAllRemoved) {\n onAllRemoved();\n }\n }\n }\n }), function (props, ref) {\n return children(_objectSpread(_objectSpread({}, props), {}, {\n index: index\n }), ref);\n });\n }));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(_ref3, _ref4) {\n var keys = _ref3.keys;\n var keyEntities = _ref4.keyEntities;\n var parsedKeyObjects = parseKeys(keys);\n var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);\n return {\n keyEntities: mixedKeyEntities.filter(function (entity) {\n var prevEntity = keyEntities.find(function (_ref5) {\n var key = _ref5.key;\n return entity.key === key;\n });\n\n // Remove if already mark as removed\n if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {\n return false;\n }\n return true;\n })\n };\n }\n }]);\n return CSSMotionList;\n }(React.Component);\n _defineProperty(CSSMotionList, \"defaultProps\", {\n component: 'div'\n });\n return CSSMotionList;\n}\nexport default genCSSMotionList(supportTransition);","map":{"version":3,"names":["_extends","_objectWithoutProperties","_objectSpread","_classCallCheck","_createClass","_assertThisInitialized","_inherits","_createSuper","_defineProperty","_excluded","_excluded2","React","OriginCSSMotion","diffKeys","parseKeys","STATUS_ADD","STATUS_KEEP","STATUS_REMOVE","STATUS_REMOVED","supportTransition","MOTION_PROP_NAMES","genCSSMotionList","transitionSupport","CSSMotion","arguments","length","undefined","CSSMotionList","_React$Component","_super","_this","_len","args","Array","_key","call","apply","concat","keyEntities","removeKey","state","nextKeyEntities","map","entity","key","status","setState","filter","_ref","value","render","_this2","_this$props","props","component","children","_onVisibleChanged","onVisibleChanged","onAllRemoved","restProps","Component","Fragment","motionProps","forEach","prop","keys","createElement","_ref2","index","eventProps","visible","changedVisible","restKeysCount","ref","getDerivedStateFromProps","_ref3","_ref4","parsedKeyObjects","mixedKeyEntities","prevEntity","find","_ref5"],"sources":["C:/Users/Аришина)/source/repos/PromoCursed/node_modules/rc-motion/es/CSSMotionList.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/esm/objectWithoutProperties\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _classCallCheck from \"@babel/runtime/helpers/esm/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/esm/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/esm/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/esm/inherits\";\nimport _createSuper from \"@babel/runtime/helpers/esm/createSuper\";\nimport _defineProperty from \"@babel/runtime/helpers/esm/defineProperty\";\nvar _excluded = [\"component\", \"children\", \"onVisibleChanged\", \"onAllRemoved\"],\n _excluded2 = [\"status\"];\n/* eslint react/prop-types: 0 */\nimport * as React from 'react';\nimport OriginCSSMotion from \"./CSSMotion\";\nimport { diffKeys, parseKeys, STATUS_ADD, STATUS_KEEP, STATUS_REMOVE, STATUS_REMOVED } from \"./util/diff\";\nimport { supportTransition } from \"./util/motion\";\nvar MOTION_PROP_NAMES = ['eventProps', 'visible', 'children', 'motionName', 'motionAppear', 'motionEnter', 'motionLeave', 'motionLeaveImmediately', 'motionDeadline', 'removeOnLeave', 'leavedClassName', 'onAppearPrepare', 'onAppearStart', 'onAppearActive', 'onAppearEnd', 'onEnterStart', 'onEnterActive', 'onEnterEnd', 'onLeaveStart', 'onLeaveActive', 'onLeaveEnd'];\n/**\n * Generate a CSSMotionList component with config\n * @param transitionSupport No need since CSSMotionList no longer depends on transition support\n * @param CSSMotion CSSMotion component\n */\nexport function genCSSMotionList(transitionSupport) {\n var CSSMotion = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : OriginCSSMotion;\n var CSSMotionList = /*#__PURE__*/function (_React$Component) {\n _inherits(CSSMotionList, _React$Component);\n var _super = _createSuper(CSSMotionList);\n function CSSMotionList() {\n var _this;\n _classCallCheck(this, CSSMotionList);\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n _this = _super.call.apply(_super, [this].concat(args));\n _defineProperty(_assertThisInitialized(_this), \"state\", {\n keyEntities: []\n });\n // ZombieJ: Return the count of rest keys. It's safe to refactor if need more info.\n _defineProperty(_assertThisInitialized(_this), \"removeKey\", function (removeKey) {\n var keyEntities = _this.state.keyEntities;\n var nextKeyEntities = keyEntities.map(function (entity) {\n if (entity.key !== removeKey) return entity;\n return _objectSpread(_objectSpread({}, entity), {}, {\n status: STATUS_REMOVED\n });\n });\n _this.setState({\n keyEntities: nextKeyEntities\n });\n return nextKeyEntities.filter(function (_ref) {\n var status = _ref.status;\n return status !== STATUS_REMOVED;\n }).length;\n });\n return _this;\n }\n _createClass(CSSMotionList, [{\n key: \"render\",\n value: function render() {\n var _this2 = this;\n var keyEntities = this.state.keyEntities;\n var _this$props = this.props,\n component = _this$props.component,\n children = _this$props.children,\n _onVisibleChanged = _this$props.onVisibleChanged,\n onAllRemoved = _this$props.onAllRemoved,\n restProps = _objectWithoutProperties(_this$props, _excluded);\n var Component = component || React.Fragment;\n var motionProps = {};\n MOTION_PROP_NAMES.forEach(function (prop) {\n motionProps[prop] = restProps[prop];\n delete restProps[prop];\n });\n delete restProps.keys;\n return /*#__PURE__*/React.createElement(Component, restProps, keyEntities.map(function (_ref2, index) {\n var status = _ref2.status,\n eventProps = _objectWithoutProperties(_ref2, _excluded2);\n var visible = status === STATUS_ADD || status === STATUS_KEEP;\n return /*#__PURE__*/React.createElement(CSSMotion, _extends({}, motionProps, {\n key: eventProps.key,\n visible: visible,\n eventProps: eventProps,\n onVisibleChanged: function onVisibleChanged(changedVisible) {\n _onVisibleChanged === null || _onVisibleChanged === void 0 || _onVisibleChanged(changedVisible, {\n key: eventProps.key\n });\n if (!changedVisible) {\n var restKeysCount = _this2.removeKey(eventProps.key);\n if (restKeysCount === 0 && onAllRemoved) {\n onAllRemoved();\n }\n }\n }\n }), function (props, ref) {\n return children(_objectSpread(_objectSpread({}, props), {}, {\n index: index\n }), ref);\n });\n }));\n }\n }], [{\n key: \"getDerivedStateFromProps\",\n value: function getDerivedStateFromProps(_ref3, _ref4) {\n var keys = _ref3.keys;\n var keyEntities = _ref4.keyEntities;\n var parsedKeyObjects = parseKeys(keys);\n var mixedKeyEntities = diffKeys(keyEntities, parsedKeyObjects);\n return {\n keyEntities: mixedKeyEntities.filter(function (entity) {\n var prevEntity = keyEntities.find(function (_ref5) {\n var key = _ref5.key;\n return entity.key === key;\n });\n\n // Remove if already mark as removed\n if (prevEntity && prevEntity.status === STATUS_REMOVED && entity.status === STATUS_REMOVE) {\n return false;\n }\n return true;\n })\n };\n }\n }]);\n return CSSMotionList;\n }(React.Component);\n _defineProperty(CSSMotionList, \"defaultProps\", {\n component: 'div'\n });\n return CSSMotionList;\n}\nexport default genCSSMotionList(supportTransition);"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,wBAAwB,MAAM,oDAAoD;AACzF,OAAOC,aAAa,MAAM,0CAA0C;AACpE,OAAOC,eAAe,MAAM,2CAA2C;AACvE,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,sBAAsB,MAAM,kDAAkD;AACrF,OAAOC,SAAS,MAAM,qCAAqC;AAC3D,OAAOC,YAAY,MAAM,wCAAwC;AACjE,OAAOC,eAAe,MAAM,2CAA2C;AACvE,IAAIC,SAAS,GAAG,CAAC,WAAW,EAAE,UAAU,EAAE,kBAAkB,EAAE,cAAc,CAAC;EAC3EC,UAAU,GAAG,CAAC,QAAQ,CAAC;AACzB;AACA,OAAO,KAAKC,KAAK,MAAM,OAAO;AAC9B,OAAOC,eAAe,MAAM,aAAa;AACzC,SAASC,QAAQ,EAAEC,SAAS,EAAEC,UAAU,EAAEC,WAAW,EAAEC,aAAa,EAAEC,cAAc,QAAQ,aAAa;AACzG,SAASC,iBAAiB,QAAQ,eAAe;AACjD,IAAIC,iBAAiB,GAAG,CAAC,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,wBAAwB,EAAE,gBAAgB,EAAE,eAAe,EAAE,iBAAiB,EA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