@clutch-creator/react-extension
Advanced tools
Comparing version 0.0.4 to 0.0.5
@@ -1,1 +0,1 @@ | ||
module.exports=function(t){var n={};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=n,o.d=function(e,r,t){if(!o.o(e,r))Object.defineProperty(e,r,{enumerable:!0,get:t})},o.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(r,e){if(1&e)r=o(r);if(8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)o.d(t,n,function(e){return r[e]}.bind(null,n));return t},o.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(r,"a",r),r},o.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},o.p="",o(o.s=21)}([function(e,r){e.exports=require("@clutch-creator/bridge")},function(e,r){e.exports=require("react")},,function(e,r){e.exports=require("@babel/runtime/helpers/getPrototypeOf")},,function(e,r){e.exports=require("@babel/runtime/regenerator")},,function(e,r){e.exports=require("react-dom")},,,function(e,r){e.exports=require("@babel/runtime/helpers/classCallCheck")},function(e,r){e.exports=require("@babel/runtime/helpers/createClass")},function(e,r){e.exports=require("@babel/runtime/helpers/possibleConstructorReturn")},function(e,r){e.exports=require("@babel/runtime/helpers/inherits")},function(e,r){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},,,function(e,r){e.exports=require("react-hot-loader")},,,,function(e,r,t){"use strict";t.r(r);var n=t(5),f=t.n(n),o=t(14),u=t.n(o),p=t(17),a=t(1),d=t.n(a),i=t(7),b=t.n(i),c=t(10),l=t.n(c),s=t(11),m=t.n(s),h=t(12),v=t.n(h),x=t(3),y=t.n(x),g=t(13),k=t.n(g),q=t(0),C=t.n(q),E=function(e){function t(e){var r;return l()(this,t),(r=v()(this,y()(t).call(this,e))).state={error:!1},r}return k()(t,e),m()(t,[{key:"componentDidMount",value:function(){C.a.setCanvasError(!1)}},{key:"componentDidCatch",value:function(e){C.a.setCanvasError(e)}},{key:"render",value:function(){var e=this.props.children;return this.state.error?null:e}}],[{key:"getDerivedStateFromError",value:function(e){return{error:e}}}]),t}(d.a.Component);t.d(r,"default",function(){return j});var O="development"===process.env.NODE_ENV;function j(){return _.apply(this,arguments)}function _(){return(_=u()(f.a.mark(function e(){var r,t,n,o,u,a,i,c,l,s=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(r=0<s.length&&void 0!==s[0]?s[0]:{}).element,n=r.hooks,e.prev=2,o=t||null,O)o=d.a.createElement(p.AppContainer,null,d.a.createElement(E,null,o));u={element:o},a=0;case 7:if(!(a<n.length)){e.next=16;break}if((i=n[a]||{}).preRender)return e.next=12,i.preRender(u);e.next=13;break;case 12:u.element=e.sent;case 13:a+=1,e.next=7;break;case 16:if(O)b.a.render(u.element,document.getElementById("root"));else b.a.hydrate(u.element,document.getElementById("root"));c=0;case 18:if(!(c<n.length)){e.next=27;break}if((l=n[c]||{}).postRender)return e.next=23,l.postRender(u);e.next=24;break;case 23:o=e.sent;case 24:c+=1,e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(2),console.error(e.t0);case 32:return e.abrupt("return",void 0);case 33:case"end":return e.stop()}},e,null,[[2,29]])}))).apply(this,arguments)}}]); | ||
module.exports=function(t){var n={};function o(e){if(n[e])return n[e].exports;var r=n[e]={i:e,l:!1,exports:{}};return t[e].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=t,o.c=n,o.d=function(e,r,t){if(!o.o(e,r))Object.defineProperty(e,r,{enumerable:!0,get:t})},o.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(r,e){if(1&e)r=o(r);if(8&e)return r;if(4&e&&"object"==typeof r&&r&&r.__esModule)return r;var t=Object.create(null);if(o.r(t),Object.defineProperty(t,"default",{enumerable:!0,value:r}),2&e&&"string"!=typeof r)for(var n in r)o.d(t,n,function(e){return r[e]}.bind(null,n));return t},o.n=function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(r,"a",r),r},o.o=function(e,r){return Object.prototype.hasOwnProperty.call(e,r)},o.p="",o(o.s=21)}([function(e,r){e.exports=require("@clutch-creator/bridge")},,function(e,r){e.exports=require("react")},function(e,r){e.exports=require("@babel/runtime/helpers/getPrototypeOf")},function(e,r){e.exports=require("react-dom")},,function(e,r){e.exports=require("@babel/runtime/regenerator")},,,,function(e,r){e.exports=require("@babel/runtime/helpers/classCallCheck")},function(e,r){e.exports=require("@babel/runtime/helpers/createClass")},function(e,r){e.exports=require("@babel/runtime/helpers/possibleConstructorReturn")},function(e,r){e.exports=require("@babel/runtime/helpers/inherits")},function(e,r){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},,,function(e,r){e.exports=require("react-hot-loader")},,,,function(e,r,t){"use strict";t.r(r);var n=t(6),f=t.n(n),o=t(14),u=t.n(o),p=t(17),a=t(2),d=t.n(a),i=t(4),b=t.n(i),c=t(10),l=t.n(c),s=t(11),m=t.n(s),h=t(12),v=t.n(h),x=t(3),y=t.n(x),g=t(13),k=t.n(g),q=t(0),C=t.n(q),E=function(e){function t(e){var r;return l()(this,t),(r=v()(this,y()(t).call(this,e))).state={error:!1},r}return k()(t,e),m()(t,[{key:"componentDidMount",value:function(){C.a.setCanvasError(!1)}},{key:"componentDidCatch",value:function(e){C.a.setCanvasError(e)}},{key:"render",value:function(){var e=this.props.children;return this.state.error?null:e}}],[{key:"getDerivedStateFromError",value:function(e){return{error:e}}}]),t}(d.a.Component);t.d(r,"default",function(){return j});var O="development"===process.env.NODE_ENV;function j(){return _.apply(this,arguments)}function _(){return(_=u()(f.a.mark(function e(){var r,t,n,o,u,a,i,c,l,s=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=(r=0<s.length&&void 0!==s[0]?s[0]:{}).element,n=r.hooks,e.prev=2,o=t||null,O)o=d.a.createElement(p.AppContainer,null,d.a.createElement(E,null,o));u={element:o},a=0;case 7:if(!(a<n.length)){e.next=16;break}if((i=n[a]||{}).preRender)return e.next=12,i.preRender(u);e.next=13;break;case 12:u.element=e.sent;case 13:a+=1,e.next=7;break;case 16:if(O)b.a.render(u.element,document.getElementById("root"));else b.a.hydrate(u.element,document.getElementById("root"));c=0;case 18:if(!(c<n.length)){e.next=27;break}if((l=n[c]||{}).postRender)return e.next=23,l.postRender(u);e.next=24;break;case 23:o=e.sent;case 24:c+=1,e.next=18;break;case 27:e.next=32;break;case 29:e.prev=29,e.t0=e.catch(2),console.error(e.t0);case 32:return e.abrupt("return",void 0);case 33:case"end":return e.stop()}},e,null,[[2,29]])}))).apply(this,arguments)}}]); |
@@ -1,1 +0,1 @@ | ||
module.exports=function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){if(!o.o(e,t))Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e)t=o(t);if(8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=20)}([function(e,t){e.exports=require("@clutch-creator/bridge")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t){e.exports=require("@babel/runtime/helpers/getPrototypeOf")},function(e,t){e.exports=require("@babel/runtime/helpers/slicedToArray")},,function(e,t){e.exports=require("lodash/get")},function(e,t){e.exports=require("react-dom")},function(e,t){e.exports=require("@babel/runtime/helpers/get")},,function(e,t){e.exports=require("@babel/runtime/helpers/classCallCheck")},function(e,t){e.exports=require("@babel/runtime/helpers/createClass")},function(e,t){e.exports=require("@babel/runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("@babel/runtime/helpers/inherits")},,function(e,t){e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},function(e,t){e.exports=require("@babel/runtime/helpers/assertThisInitialized")},,,,function(e,t,r){"use strict";r.r(t);var n=r(4),l=r.n(n),o=r(15),a=r.n(o),i=r(10),u=r.n(i),c=r(11),s=r.n(c),p=r(12),f=r.n(p),h=r(16),d=r.n(h),b=r(3),O=r.n(b),v=r(8),m=r.n(v),y=r(13),P=r.n(y),j=r(2),g=r.n(j),C=r(7),S=r(6),w=r.n(S),x=r(0),q=r.n(x),k=Object.prototype.hasOwnProperty;function D(e,t,r){if(e===t)return 1;if(!(e&&!t||t&&!e)){var n=0,o=0;for(var i in e){if(k.call(e,i)&&(r?!r(e[i],t[i]):e[i]!==t[i]))return;n+=1}for(var u in t)if(k.call(t,u))o+=1;return n===o}}var E=r(1);function N(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e)n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable});r.push.apply(r,n)}return r}function R(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};if(e%2)N(Object(r),!0).forEach(function(e){g()(t,e,r[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(t,Object.getOwnPropertyDescriptors(r));else N(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var U=function(e){var t=e.clutchProps;return t&&t.selection||{}},_=function(e,t,r){var n=R({},q.a.getComponentState(r)||{},g()({},t,e));q.a.updateComponentState(r,n)};var M=function(e,t,r,n,o){var i=e.selection,u=r,c=e.flowProps||{};if(n)c=Object.assign({},c,n),q.a.updateComponentOutboundProps(i,t,n);if("function"==typeof r)u=r(c,o,i);else if(void 0===r)u=null;return u};function T(e,t){var u=this,c=e(t),r=w()(c,["clutchProps","propsTypes"],{}),s=c&&c.clutchProps||{},i=s.masterProps,p=s.flowProps;return Object.entries(r).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if("Children"===o)return R({},e,g()({},n,M.bind(u,s,n,c[n])));if("Styles"!==o||"production"===process.env.NODE_ENV)return e;var i=c[n];return R({},e,g()({},n,{className:Object(x.classnames)(i&&i.className,Object(x.getUniqueClassName)(u.getClutchSelection(c),n))}))},c),Object.entries(c).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if(!("function"!=typeof o||o.prototype&&o.prototype.isReactComponent))return R({},e,g()({},n,o.bind({masterProps:i,flowProps:p})));else return e},c),c}function I(e,t){var r=T(e,t);return{useRef:function(e,t){var r=U(e),n=Object(E.useRef)(t);return Object(E.useEffect)(function(){if(n)q.a.registerComponentReference(r,n.current)},[n]),n}.bind(void 0,r),useState:function(t,r,e){if(void 0===r)throw new Error("No key provided for useClutchState");var n=Object(E.useState)(e),o=l()(n,2),i=o[0],u=o[1];return Object(E.useEffect)(function(){var e=U(t);_(i,r,e)},[i]),[i,u]}.bind(void 0,r),useReducer:function(t,r,e,n){if(void 0===r)throw new Error("No key provided for useClutchReducer");var o=Object(E.useReducer)(e,n),i=l()(o,2),u=i[0],c=i[1];return Object(E.useEffect)(function(){var e=U(t);_(u,r,e)},[u]),[u,c]}.bind(void 0,r)}}function W(e,t){var r,n=T(e,t),o=U(n),i=(r=n.clutchProps)&&r.parentSelection||{},u=Object(E.useState)(),c=l()(u,2)[1],s=Object(E.useCallback)(function(){return c({})},[]),p=o.clutchProps;return Object(E.useEffect)(function(){return q.a.registerComponent(o,i,s,c),q.a.updateComponentInboundProps(o,p&&p.flowProps),function(){q.a.unregisterComponent(o)}},[]),n}function V(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e)n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable});r.push.apply(r,n)}return r}function z(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};if(e%2)V(Object(r),!0).forEach(function(e){g()(t,e,r[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(t,Object.getOwnPropertyDescriptors(r));else V(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function A(e){return function(e){function i(e,t){var r;u()(this,i),r=f()(this,O()(i).call(this,e,t)),g()(d()(r),"clutchUpdateRef",function(e){var t=!e||e.tagName?e:Object(C.findDOMNode)(e);if(r.node!==t)r.node=t,q.a.registerComponentReference(r.getClutchSelection(),r.node)}),r.state=Object.assign({},r.state);var n=(r.props.clutchProps||{}).flowProps;return r.flowProps=n||{},r}return P()(i,e),s()(i,[{key:"shouldComponentUpdate",value:function(e,t){var r=this.props,n=r.clutchProps,o=void 0===n?{}:n,i=a()(r,["clutchProps"]),u=e.clutchProps,c=void 0===u?{}:u,s=a()(e,["clutchProps"]),p=(c||{}).flowProps;return this.flowProps=p||{},!D(i,s)||!D(t,this.state)||!D(o.flowProps,c.flowProps)}},{key:"componentDidUpdate",value:function(e,t,r){if(m()(O()(i.prototype),"componentDidUpdate",this))m()(O()(i.prototype),"componentDidUpdate",this).call(this,e,t,r);var n=this.props.clutchProps,o=this.getClutchSelection();if(q.a.updateComponentMasterProps(o,this.masterProps),q.a.updateComponentInboundProps(o,n&&n.flowProps),!D(t,this.state))q.a.updateComponentState(o,this.state)}},{key:"componentWillUnmount",value:function(){if(m()(O()(i.prototype),"componentWillUnmount",this))m()(O()(i.prototype),"componentWillUnmount",this).call(this);q.a.unregisterComponent(this.getClutchSelection())}},{key:"getClutchSelection",value:function(e){var t=(0<arguments.length&&void 0!==e?e:this.props).clutchProps;return t&&t.selection||w()(this.masterProps,["clutchProps","defaultSelection"])||t&&t.defaultSelection}},{key:"useClutch",value:function(e,t){var c=this;if("function"!=typeof e)return console.error("First argument of useClutch must be a function."),t;var s=e(t),r=w()(s,["clutchProps","propsTypes"],{});if(s=Object.entries(r).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if("Children"===o)return z({},e,g()({},n,c.renderClutchChildren.bind(c,n,s[n])));if("Styles"!==o||"production"===process.env.NODE_ENV)return e;var i=s[n],u=Object(x.getUniqueClassName)(c.getClutchSelection(s),n);return z({},e,g()({},n,{className:Object(x.classnames)(i&&i.className,u),style:i&&i.style||{}}))},s),s=Object.entries(s).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if(!("function"!=typeof o||o.prototype&&o.prototype.isReactComponent))return z({},e,g()({},n,o.bind(c)));else return e},s),this.masterProps=Object.assign({},s),!this.clutchRegistered)if(this.clutchRegistered=!0,q.a.registerComponent(this.getClutchSelection(),w()(this.props,["clutchProps","parentSelection"]),w()(this.props,["clutchProps","masterProps"]),this.forceUpdate.bind(this),this.setState.bind(this)),q.a.updateComponentInboundProps(this.getClutchSelection(),this.flowProps),this.state)q.a.updateComponentState(this.getClutchSelection(),this.state);return s}},{key:"render",value:function(){return m()(O()(i.prototype),"render",this).call(this)}},{key:"renderClutchChildren",value:function(e,t,r,n){var o=this.getClutchSelection(),i=t,u=(this.props.clutchProps||{}).flowProps||{};if(r)u=Object.assign({},u,r),q.a.updateComponentOutboundProps(o,e,r);if("function"==typeof t)i=t(u,n,o);else if(void 0===t)i=null;return i}}]),i}(e)}r.d(t,"default",function(){return A}),r.d(t,"useClutch",function(){return W}),r.d(t,"useClutchHooks",function(){return I})}]); | ||
module.exports=function(r){var n={};function o(e){if(n[e])return n[e].exports;var t=n[e]={i:e,l:!1,exports:{}};return r[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=r,o.c=n,o.d=function(e,t,r){if(!o.o(e,t))Object.defineProperty(e,t,{enumerable:!0,get:r})},o.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e)t=o(t);if(8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)o.d(r,n,function(e){return t[e]}.bind(null,n));return r},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=20)}([function(e,t){e.exports=require("@clutch-creator/bridge")},function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t){e.exports=require("react")},function(e,t){e.exports=require("@babel/runtime/helpers/getPrototypeOf")},function(e,t){e.exports=require("react-dom")},function(e,t){e.exports=require("lodash/get")},,function(e,t){e.exports=require("@babel/runtime/helpers/slicedToArray")},function(e,t){e.exports=require("@babel/runtime/helpers/get")},,function(e,t){e.exports=require("@babel/runtime/helpers/classCallCheck")},function(e,t){e.exports=require("@babel/runtime/helpers/createClass")},function(e,t){e.exports=require("@babel/runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("@babel/runtime/helpers/inherits")},,function(e,t){e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},function(e,t){e.exports=require("@babel/runtime/helpers/assertThisInitialized")},,,,function(e,t,r){"use strict";r.r(t);var n=r(7),l=r.n(n),o=r(15),f=r.n(o),i=r(10),c=r.n(i),u=r(11),s=r.n(u),p=r(12),a=r.n(p),h=r(16),b=r.n(h),d=r(3),m=r.n(d),y=r(8),P=r.n(y),O=r(13),v=r.n(O),g=r(1),j=r.n(g),C=r(4),w=r(5),S=r.n(w),x=r(0),q=r.n(x),D=Object.prototype.hasOwnProperty;function N(e,t,r){if(e===t)return 1;if(!(e&&!t||t&&!e)){var n=0,o=0;for(var i in e){if(D.call(e,i)&&(r?!r(e[i],t[i]):e[i]!==t[i]))return;n+=1}for(var c in t)if(D.call(t,c))o+=1;return n===o}}var R=r(2);function U(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e)n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable});r.push.apply(r,n)}return r}function k(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};if(e%2)U(Object(r),!0).forEach(function(e){j()(t,e,r[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(t,Object.getOwnPropertyDescriptors(r));else U(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}var E=function(e,t,r,n,o){var i=e.selection,c=r,u=e.flowProps||{};if(n)u=Object.assign({},u,n),q.a.updateComponentOutboundProps(i,t,n);if("function"==typeof r)c=r(u,o,i);else if(void 0===r)c=null;return c};function _(e,t){var r,n,o=function(e,t){var u=this;if("function"!=typeof e)return console.error("First argument of useClutch must be a function."),t;var s=e(t),r=S()(s,["clutchProps","propsTypes"],{}),p=s&&s.clutchProps||{},i=p.masterProps,c=p.flowProps;return Object.entries(r).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if("Children"===o)return k({},e,j()({},n,E.bind(u,p,n,s[n])));if("Styles"!==o||"production"===process.env.NODE_ENV)return e;var i=s[n],c=Object(x.getUniqueClassName)(u.getClutchSelection(s),n);return k({},e,j()({},n,{className:Object(x.classnames)(i&&i.className,c),style:i&&i.style||{}}))},s),Object.entries(s).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if(!("function"!=typeof o||o.prototype&&o.prototype.isReactComponent))return k({},e,j()({},n,o.bind({masterProps:i,flowProps:c})));else return e},s),s.ref=function(e){var t=!e||e.tagName?e:Object(C.findDOMNode)(e);if(u.node!==t)u.node=t,q.a.registerComponentReference(u.getClutchSelection(),u.node)},s}(e,t),i=(r=o.clutchProps)&&r.selection||{},c=(n=o.clutchProps)&&n.parentSelection||{},u=S()(this.props,["clutchProps","masterProps"]),s=i.clutchProps,p=Object(R.useRef)(null);return Object(R.useEffect)(function(){if(p)q.a.registerComponentReference(i,p.current)},[p]),o.ref=p,Object(R.useEffect)(function(){return q.a.registerComponent(i,c,u),q.a.updateComponentInboundProps(i,s&&s.flowProps),function(){q.a.unregisterComponent(i)}},[]),o}function M(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);if(e)n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable});r.push.apply(r,n)}return r}function T(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};if(e%2)M(Object(r),!0).forEach(function(e){j()(t,e,r[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(t,Object.getOwnPropertyDescriptors(r));else M(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function I(e){return function(e){function i(e,t){var r;c()(this,i),r=a()(this,m()(i).call(this,e,t)),j()(b()(r),"clutchUpdateRef",function(e){var t=!e||e.tagName?e:Object(C.findDOMNode)(e);if(r.node!==t)r.node=t,q.a.registerComponentReference(r.getClutchSelection(),r.node)});var n=(r.props.clutchProps||{}).flowProps;return r.flowProps=n||{},r}return v()(i,e),s()(i,[{key:"shouldComponentUpdate",value:function(e,t){var r=this.props,n=r.clutchProps,o=void 0===n?{}:n,i=f()(r,["clutchProps"]),c=e.clutchProps,u=void 0===c?{}:c,s=f()(e,["clutchProps"]),p=(u||{}).flowProps;return this.flowProps=p||{},!N(i,s)||!N(t,this.state)||!N(o.flowProps,u.flowProps)}},{key:"componentDidUpdate",value:function(e,t,r){if(P()(m()(i.prototype),"componentDidUpdate",this))P()(m()(i.prototype),"componentDidUpdate",this).call(this,e,t,r);var n=this.props.clutchProps,o=this.getClutchSelection();q.a.updateComponentMasterProps(o,this.masterProps),q.a.updateComponentInboundProps(o,n&&n.flowProps)}},{key:"componentWillUnmount",value:function(){if(P()(m()(i.prototype),"componentWillUnmount",this))P()(m()(i.prototype),"componentWillUnmount",this).call(this);q.a.unregisterComponent(this.getClutchSelection())}},{key:"getClutchSelection",value:function(e){var t=(0<arguments.length&&void 0!==e?e:this.props).clutchProps;return t&&t.selection||S()(this.masterProps,["clutchProps","defaultSelection"])||t&&t.defaultSelection}},{key:"useClutch",value:function(e,t){var u=this;if("function"!=typeof e)return console.error("First argument of useClutch must be a function."),t;var s=e(t),r=S()(s,["clutchProps","propsTypes"],{});if(s=Object.entries(r).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if("Children"===o)return T({},e,j()({},n,u.renderClutchChildren.bind(u,n,s[n])));if("Styles"!==o||"production"===process.env.NODE_ENV)return e;var i=s[n],c=Object(x.getUniqueClassName)(u.getClutchSelection(s),n);return T({},e,j()({},n,{className:Object(x.classnames)(i&&i.className,c),style:i&&i.style||{}}))},s),s=Object.entries(s).reduce(function(e,t){var r=l()(t,2),n=r[0],o=r[1];if(!("function"!=typeof o||o.prototype&&o.prototype.isReactComponent))return T({},e,j()({},n,o.bind(u)));else return e},s),this.masterProps=Object.assign({},s),s.ref=this.clutchUpdateRef,!this.clutchRegistered)this.clutchRegistered=!0,q.a.registerComponent(this.getClutchSelection(),S()(this.props,["clutchProps","parentSelection"]),S()(this.props,["clutchProps","masterProps"])),q.a.updateComponentInboundProps(this.getClutchSelection(),this.flowProps);return s}},{key:"render",value:function(){return P()(m()(i.prototype),"render",this).call(this)}},{key:"renderClutchChildren",value:function(e,t,r,n){var o=this.getClutchSelection(),i=t,c=(this.props.clutchProps||{}).flowProps||{};if(r)c=Object.assign({},c,r),q.a.updateComponentOutboundProps(o,e,r);if("function"==typeof t)i=t(c,n,o);else if(void 0===t)i=null;return i}}]),i}(e)}r.d(t,"default",function(){return I}),r.d(t,"useClutch",function(){return _})}]); |
{ | ||
"name": "@clutch-creator/react-extension", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "Clutch extension for react components", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -1,1 +0,1 @@ | ||
module.exports=function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){if(!o.o(e,t))Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e)t=o(t);if(8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=22)}({14:function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},18:function(e,t){e.exports=require("react-dom/server")},19:function(e,t){e.exports=require("@babel/runtime/helpers/typeof")},22:function(e,t,n){"use strict";n.r(t);function c(n){var e="";if(n)if(Array.isArray(n))e=n.map(function(e){var t="";if("string"==typeof e)t=e;else t="".concat(e.name,'="').concat(e.value,'"');return t}).join(" ");else if("object"===f()(n))e=Object.keys(n).map(function(e){var t=n[e];return"".concat(e,'="').concat(t,'"')}).join(" ");return e}function u(e){var t="";if(e&&e.length)t=e.map(function(e){var t="";if("string"==typeof e)t=e;else if(t="<".concat(e.tag," ").concat(c(e.attributes),">"),"meta"!==e.tag&&"link"!==e.tag)t+="".concat(e.content||"","</").concat(e.tag,">");return t}).join("\n");return t}var r=n(5),k=n.n(r),o=n(9),O=n.n(o),a=n(14),i=n.n(a),s=n(18),S=n.n(s),l=n(19),f=n.n(l),P=function(e){var t=e.htmlAttributes,n=e.headElements,r=e.footerElements,o=e.bodyAttributes,a=e.bodyContent;return"<!DOCTYPE html>\n<html ".concat(c(t),'>\n <head>\n <meta charset="UTF-8">\n ').concat(u(n),"\n </head>\n <body ").concat(c(o),">\n <div id='root'>\n ").concat(a,"\n </div>\n ").concat(u(r),"\n </body>\n</html>\n")};function b(){return p.apply(this,arguments)}function p(){return(p=i()(k.a.mark(function e(){var t,n,r,o,a,c,u,i,s,l,f,b,p,d,m,y,h,g,v,x,j,A,E=arguments;return k.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=(t=0<E.length&&void 0!==E[0]?E[0]:{}).element,r=t.pathname,o=t.hooks,a=t.headElements,c=t.footerElements,u=t.bodyAttributes,i=t.htmlAttributes,s=O()(a||[]),l=O()(c||[]),f=Object.assign({},u),b=Object.assign({},i),e.prev=6,p=n||null,d={element:n,pathname:r||"/",headElements:s,footerElements:l,bodyAttributes:f,htmlAttributes:b,addHeadElements:function(e){return s.push.apply(s,O()(e))},addFooterElements:function(e){return l.push.apply(l,O()(e))},addBodyAttributes:function(e){Object.assign(f,e)},addHtmlAttributes:function(e){Object.assign(b,e)}},m=0;case 10:if(!(m<o.length)){e.next=19;break}if((y=o[m]||{}).preRender)return e.next=15,y.preRender(p,d);e.next=16;break;case 15:p=e.sent;case 16:m+=1,e.next=10;break;case 19:h=S.a.renderToString(p),g=0;case 21:if(!(g<o.length)){e.next=30;break}if((v=o[g]||{}).postRender)return e.next=26,v.postRender(d);e.next=27;break;case 26:p=e.sent;case 27:g+=1,e.next=21;break;case 30:return x=P({htmlAttributes:b,headElements:s,footerElements:l,bodyAttributes:f,bodyContent:h}),e.abrupt("return",x);case 34:return e.prev=34,e.t0=e.catch(6),j=e.t0&&e.t0.message&&e.t0.message.replace(/(\r\n|\n|\r)/gm,""),A=e.t0&&e.t0.stack&&e.t0.stack.replace(/(\r\n|\n|\r)/gm,""),e.abrupt("return",P({htmlAttributes:[],headElements:s,footerElements:[].concat(O()(l),[{tag:"script",attributes:{type:"text/javascript"},content:'\n console.warn("Error on SSR: '.concat(j,'");\n console.warn("ssr error stack trace: ').concat(A,'");\n ')}]),bodyAttributes:[],bodyContent:""}));case 39:case"end":return e.stop()}},e,null,[[6,34]])}))).apply(this,arguments)}n.d(t,"default",function(){return b})},5:function(e,t){e.exports=require("@babel/runtime/regenerator")},9:function(e,t){e.exports=require("@babel/runtime/helpers/toConsumableArray")}}); | ||
module.exports=function(n){var r={};function o(e){if(r[e])return r[e].exports;var t=r[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,o),t.l=!0,t.exports}return o.m=n,o.c=r,o.d=function(e,t,n){if(!o.o(e,t))Object.defineProperty(e,t,{enumerable:!0,get:n})},o.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},o.t=function(t,e){if(1&e)t=o(t);if(8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(o.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var r in t)o.d(n,r,function(e){return t[e]}.bind(null,r));return n},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="",o(o.s=22)}({14:function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},18:function(e,t){e.exports=require("react-dom/server")},19:function(e,t){e.exports=require("@babel/runtime/helpers/typeof")},22:function(e,t,n){"use strict";n.r(t);function c(n){var e="";if(n)if(Array.isArray(n))e=n.map(function(e){var t="";if("string"==typeof e)t=e;else t="".concat(e.name,'="').concat(e.value,'"');return t}).join(" ");else if("object"===f()(n))e=Object.keys(n).map(function(e){var t=n[e];return"".concat(e,'="').concat(t,'"')}).join(" ");return e}function u(e){var t="";if(e&&e.length)t=e.map(function(e){var t="";if("string"==typeof e)t=e;else if(t="<".concat(e.tag," ").concat(c(e.attributes),">"),"meta"!==e.tag&&"link"!==e.tag)t+="".concat(e.content||"","</").concat(e.tag,">");return t}).join("\n");return t}var r=n(6),k=n.n(r),o=n(9),O=n.n(o),a=n(14),i=n.n(a),s=n(18),S=n.n(s),l=n(19),f=n.n(l),P=function(e){var t=e.htmlAttributes,n=e.headElements,r=e.footerElements,o=e.bodyAttributes,a=e.bodyContent;return"<!DOCTYPE html>\n<html ".concat(c(t),'>\n <head>\n <meta charset="UTF-8">\n ').concat(u(n),"\n </head>\n <body ").concat(c(o),">\n <div id='root'>\n ").concat(a,"\n </div>\n ").concat(u(r),"\n </body>\n</html>\n")};function b(){return p.apply(this,arguments)}function p(){return(p=i()(k.a.mark(function e(){var t,n,r,o,a,c,u,i,s,l,f,b,p,d,m,y,h,g,v,x,j,A,E=arguments;return k.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:n=(t=0<E.length&&void 0!==E[0]?E[0]:{}).element,r=t.pathname,o=t.hooks,a=t.headElements,c=t.footerElements,u=t.bodyAttributes,i=t.htmlAttributes,s=O()(a||[]),l=O()(c||[]),f=Object.assign({},u),b=Object.assign({},i),e.prev=6,p=n||null,d={element:n,pathname:r||"/",headElements:s,footerElements:l,bodyAttributes:f,htmlAttributes:b,addHeadElements:function(e){return s.push.apply(s,O()(e))},addFooterElements:function(e){return l.push.apply(l,O()(e))},addBodyAttributes:function(e){Object.assign(f,e)},addHtmlAttributes:function(e){Object.assign(b,e)}},m=0;case 10:if(!(m<o.length)){e.next=19;break}if((y=o[m]||{}).preRender)return e.next=15,y.preRender(p,d);e.next=16;break;case 15:p=e.sent;case 16:m+=1,e.next=10;break;case 19:h=S.a.renderToString(p),g=0;case 21:if(!(g<o.length)){e.next=30;break}if((v=o[g]||{}).postRender)return e.next=26,v.postRender(d);e.next=27;break;case 26:p=e.sent;case 27:g+=1,e.next=21;break;case 30:return x=P({htmlAttributes:b,headElements:s,footerElements:l,bodyAttributes:f,bodyContent:h}),e.abrupt("return",x);case 34:return e.prev=34,e.t0=e.catch(6),j=e.t0&&e.t0.message&&e.t0.message.replace(/(\r\n|\n|\r)/gm,""),A=e.t0&&e.t0.stack&&e.t0.stack.replace(/(\r\n|\n|\r)/gm,""),e.abrupt("return",P({htmlAttributes:[],headElements:s,footerElements:[].concat(O()(l),[{tag:"script",attributes:{type:"text/javascript"},content:'\n console.warn("Error on SSR: '.concat(j,'");\n console.warn("ssr error stack trace: ').concat(A,'");\n ')}]),bodyAttributes:[],bodyContent:""}));case 39:case"end":return e.stop()}},e,null,[[6,34]])}))).apply(this,arguments)}n.d(t,"default",function(){return b})},6:function(e,t){e.exports=require("@babel/runtime/regenerator")},9:function(e,t){e.exports=require("@babel/runtime/helpers/toConsumableArray")}}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
18008