create-dan
Version:
Dan frameworks
1 lines • 5.75 kB
JSON
{"ast":null,"code":"\"use strict\";\n\nvar _classCallCheck = require(\"@babel/runtime-corejs2/helpers/classCallCheck\");\n\nvar _possibleConstructorReturn = require(\"@babel/runtime-corejs2/helpers/possibleConstructorReturn\");\n\nvar _getPrototypeOf = require(\"@babel/runtime-corejs2/helpers/getPrototypeOf\");\n\nvar _assertThisInitialized = require(\"@babel/runtime-corejs2/helpers/assertThisInitialized\");\n\nvar _createClass = require(\"@babel/runtime-corejs2/helpers/createClass\");\n\nvar _inherits = require(\"@babel/runtime-corejs2/helpers/inherits\");\n\nvar _toConsumableArray = require(\"@babel/runtime-corejs2/helpers/toConsumableArray\");\n\nvar _Set = require(\"@babel/runtime-corejs2/core-js/set\");\n\nvar _Object$defineProperty = require(\"@babel/runtime-corejs2/core-js/object/define-property\");\n\n_Object$defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar react_1 = require(\"react\");\n\nvar isServer = false;\n\nexports[\"default\"] = function () {\n var mountedInstances = new _Set();\n var state;\n\n function emitChange(component) {\n state = component.props.reduceComponentsToState(_toConsumableArray(mountedInstances), component.props);\n\n if (component.props.handleStateChange) {\n component.props.handleStateChange(state);\n }\n }\n\n return (\n /*#__PURE__*/\n function (_react_1$Component) {\n _inherits(_class, _react_1$Component);\n\n _createClass(_class, null, [{\n key: \"rewind\",\n // Used when server rendering\n value: function rewind() {\n var recordedState = state;\n state = undefined;\n mountedInstances.clear();\n return recordedState;\n }\n }]);\n\n function _class(props) {\n var _this;\n\n _classCallCheck(this, _class);\n\n _this = _possibleConstructorReturn(this, _getPrototypeOf(_class).call(this, props));\n\n if (isServer) {\n mountedInstances.add(_assertThisInitialized(_this));\n emitChange(_assertThisInitialized(_this));\n }\n\n return _this;\n }\n\n _createClass(_class, [{\n key: \"componentDidMount\",\n value: function componentDidMount() {\n mountedInstances.add(this);\n emitChange(this);\n }\n }, {\n key: \"componentDidUpdate\",\n value: function componentDidUpdate() {\n emitChange(this);\n }\n }, {\n key: \"componentWillUnmount\",\n value: function componentWillUnmount() {\n mountedInstances[\"delete\"](this);\n emitChange(this);\n }\n }, {\n key: \"render\",\n value: function render() {\n return null;\n }\n }]);\n\n return _class;\n }(react_1.Component)\n );\n};","map":{"version":3,"sources":["/Users/sbourgal/Documents/Projets/DAN/dan-framework/template/node_modules/next/dist/next-server/lib/side-effect.js"],"names":["exports","value","react_1","require","isServer","mountedInstances","state","emitChange","component","props","reduceComponentsToState","handleStateChange","recordedState","undefined","clear","add","Component"],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;AACA,uBAAsBA,OAAtB,EAA+B,YAA/B,EAA6C;AAAEC,EAAAA,KAAK,EAAE;AAAT,CAA7C;;AACA,IAAMC,OAAO,GAAGC,OAAO,CAAC,OAAD,CAAvB;;AACA,IAAMC,QAAQ,QAAd;;AACAJ,OAAO,WAAP,GAAkB,YAAM;AACpB,MAAMK,gBAAgB,GAAG,UAAzB;AACA,MAAIC,KAAJ;;AACA,WAASC,UAAT,CAAoBC,SAApB,EAA+B;AAC3BF,IAAAA,KAAK,GAAGE,SAAS,CAACC,KAAV,CAAgBC,uBAAhB,oBAA4CL,gBAA5C,GAA+DG,SAAS,CAACC,KAAzE,CAAR;;AACA,QAAID,SAAS,CAACC,KAAV,CAAgBE,iBAApB,EAAuC;AACnCH,MAAAA,SAAS,CAACC,KAAV,CAAgBE,iBAAhB,CAAkCL,KAAlC;AACH;AACJ;;AACD;AAAA;AAAA;AAAA;;AAAA;AAAA;AACI;AADJ,iCAEoB;AACZ,cAAMM,aAAa,GAAGN,KAAtB;AACAA,UAAAA,KAAK,GAAGO,SAAR;AACAR,UAAAA,gBAAgB,CAACS,KAAjB;AACA,iBAAOF,aAAP;AACH;AAPL;;AAQI,sBAAYH,KAAZ,EAAmB;AAAA;;AAAA;;AACf,oFAAMA,KAAN;;AACA,YAAIL,QAAJ,EAAc;AACVC,UAAAA,gBAAgB,CAACU,GAAjB;AACAR,UAAAA,UAAU,+BAAV;AACH;;AALc;AAMlB;;AAdL;AAAA;AAAA,4CAewB;AAChBF,UAAAA,gBAAgB,CAACU,GAAjB,CAAqB,IAArB;AACAR,UAAAA,UAAU,CAAC,IAAD,CAAV;AACH;AAlBL;AAAA;AAAA,6CAmByB;AACjBA,UAAAA,UAAU,CAAC,IAAD,CAAV;AACH;AArBL;AAAA;AAAA,+CAsB2B;AACnBF,UAAAA,gBAAgB,UAAhB,CAAwB,IAAxB;AACAE,UAAAA,UAAU,CAAC,IAAD,CAAV;AACH;AAzBL;AAAA;AAAA,iCA0Ba;AACL,iBAAO,IAAP;AACH;AA5BL;;AAAA;AAAA,MAAqBL,OAAO,CAACc,SAA7B;AAAA;AA8BH,CAvCD","sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst react_1 = require(\"react\");\nconst isServer = typeof window === 'undefined';\nexports.default = () => {\n const mountedInstances = new Set();\n let state;\n function emitChange(component) {\n state = component.props.reduceComponentsToState([...mountedInstances], component.props);\n if (component.props.handleStateChange) {\n component.props.handleStateChange(state);\n }\n }\n return class extends react_1.Component {\n // Used when server rendering\n static rewind() {\n const recordedState = state;\n state = undefined;\n mountedInstances.clear();\n return recordedState;\n }\n constructor(props) {\n super(props);\n if (isServer) {\n mountedInstances.add(this);\n emitChange(this);\n }\n }\n componentDidMount() {\n mountedInstances.add(this);\n emitChange(this);\n }\n componentDidUpdate() {\n emitChange(this);\n }\n componentWillUnmount() {\n mountedInstances.delete(this);\n emitChange(this);\n }\n render() {\n return null;\n }\n };\n};\n"]},"metadata":{},"sourceType":"script"}