@clutch-creator/bridge
Advanced tools
Comparing version 1.0.2 to 2.0.0-beta.0
@@ -1,1 +0,1 @@ | ||
module.exports=function(n){var o={};function r(e){if(o[e])return o[e].exports;var t=o[e]={i:e,l:!1,exports:{}};return n[e].call(t.exports,t,t.exports,r),t.l=!0,t.exports}return r.m=n,r.c=o,r.d=function(e,t,n){if(!r.o(e,t))Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){if("undefined"!=typeof Symbol&&Symbol.toStringTag)Object.defineProperty(e,Symbol.toStringTag,{value:"Module"});Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(t,e){if(1&e)t=r(t);if(8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)r.d(n,o,function(e){return t[e]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=11)}([function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t){e.exports=require("lodash/get")},function(e,t){e.exports=require("@babel/runtime/helpers/toConsumableArray")},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("lodash/find")},function(e,t){e.exports=require("@babel/runtime/helpers/typeof")},function(e,t){e.exports=require("classnames")},function(e,t){e.exports=require("@babel/runtime/helpers/objectWithoutProperties")},function(e,t){e.exports=require("lodash/findIndex")},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,(e.exports=n).id=10},function(e,t,s){"use strict";s.r(t);var n=s(8),i=s.n(n),o=s(3),c=s.n(o),r=s(4),u=s.n(r),a=s(0),f=s.n(a),l=s(6),p=s.n(l),d=s(2),h=s.n(d),g=s(9),v=s.n(g),y=s(5),m=s.n(y),b=s(7),C=s.n(b),O=s(1),P=s.n(O),w=Object.prototype.hasOwnProperty;function k(e,t,n){if(e===t)return!0;if(e&&!t||t&&!e)return!1;var o=0,r=0;for(var i in e){if(w.call(e,i)&&(n?!n(e[i],t[i]):e[i]!==t[i]))return!1;o+=1}for(var s in t)if(w.call(t,s))r+=1;return o===r}function S(e){var t=e||{},n=t.keys,o=t.rootInstances,r="".concat(t.id);if(n&&n.length)r+=".".concat(n.map(function(e){return e.key}).join("."));if(o&&o.length)r+=".".concat(o.join("."));return r}function j(e,t,n){if(!e||!t)return!1;else return e.id===t.id&&function(e,t){if(e===t||!e&&!t)return!0;var n=e||[],o=t||[];if(n.length!==o.length)return!1;else return k(n,o)}(e.rootInstances,t.rootInstances)&&(n||function(e,t){if(e===t||!e&&!t)return!0;var n=e||[],o=t||[];if(n.length!==o.length)return!1;else return n.map(function(e){return e.key}).join()===o.map(function(e){return e.key}).join()}(e.keys,t.keys))}function E(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);if(e)o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable});n.push.apply(n,o)}return n}var M=function(){function i(e,t,n,o){var r=this;c()(this,i),f()(this,"onMouseOver",function(e){if(r.clutchBridge.editing)e.stopPropagation(),r.clutchBridge.overComponent(r.selection)}),f()(this,"onMouseOut",function(){if(r.clutchBridge.editing)r.clutchBridge.outComponent(r.selection)}),f()(this,"onContextMenu",function(e){if(r.clutchBridge.editing)e.stopPropagation(),e.preventDefault(),r.clutchBridge.openComponentContextMenu(r.selection,e)}),f()(this,"onClick",function(e){if(r.clutchBridge.editing)e.stopPropagation(),e.preventDefault(),r.clutchBridge.selectComponent(r.selection)}),f()(this,"onDoubleClick",function(){if(r.clutchBridge.editing)r.clutchBridge.unlockComponent(r.selection)}),this.selection=t,this.clutchBridge=e,this.reference=void 0,this.childReferences=[],this.masterProps=o,this.outboundProps=null,this.inboundProps={},this.parentSelection=n}return u()(i,[{key:"setReference",value:function(e){if(this.reference=e,this.parentSelection)this.clutchBridge.registerComponentChildReference(this.parentSelection,this.selection,this.reference);e.addEventListener("mouseover",this.onMouseOver),e.addEventListener("mouseout",this.onMouseOut),e.addEventListener("click",this.onClick),e.addEventListener("doubleclick",this.onDoubleClick),e.addEventListener("contextmenu",this.onContextMenu)}},{key:"setChildReference",value:function(e,t){if(!this.reference){var n=S(e),o=m()(this.childReferences,function(e){return e.id===n});if(o)o.reference=t;else this.childReferences.push({id:n,reference:t});if(this.parentSelection)this.clutchBridge.registerComponentChildReference(this.parentSelection,e,t)}}},{key:"getElementRect",value:function(e){var t={};try{var n=e.getBoundingClientRect();t={top:n.top,right:n.right,bottom:n.bottom,left:n.left,width:n.width,height:n.height}}catch(e){}return t}},{key:"getElementBoxLayout",value:function(e){var t={};try{t={paddingLeft:e.getStyle("padding-left"),paddingRight:e.getStyle("padding-right"),paddingTop:e.getStyle("padding-top"),paddingBottom:e.getStyle("padding-bottom"),marginLeft:e.getStyle("margin-left"),marginRight:e.getStyle("margin-right"),marginTop:e.getStyle("margin-top"),marginBottom:e.getStyle("margin-bottom")}}catch(e){}return t}},{key:"updateRect",value:function(){var o=this,r={};if(this.reference)r=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};if(e%2)E(Object(n),!0).forEach(function(e){f()(t,e,n[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(t,Object.getOwnPropertyDescriptors(n));else E(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},this.getElementRect(this.reference),{},this.getElementBoxLayout(this.reference));else{this.childReferences.forEach(function(e,t){var n=o.getElementRect(e.reference);if(0===t)r=n;else r.top=Math.min(n.top,r.top),r.bottom=Math.max(n.bottom,r.bottom),r.left=Math.min(n.left,r.left),r.right=Math.max(n.right,r.right),r.width=r.right-r.left,r.height=r.bottom-r.top})}if(!k(this.calculatedRect,r))this.calculatedRect=r,this.clutchBridge.updateComponentRect(this.selection,r)}},{key:"updateOutboundProps",value:function(e,t){this.outboundProps=this.outboundProps||{},this.outboundProps[e]=t}},{key:"updateInboundProps",value:function(e){this.inboundProps=e}},{key:"updateMasterProps",value:function(e){this.masterProps=e}},{key:"matchesSelection",value:function(e,t){var n=1<arguments.length&&void 0!==t?t:!1;return j(e,this.selection,n)}}]),i}();function B(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);if(e)o=o.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable});n.push.apply(n,o)}return n}s.d(t,"classnames",function(){return R}),s.d(t,"getUniqueClassName",function(){return x}),s.d(t,"mergeProperty",function(){return L}),s.d(t,"mergeVariants",function(){return _}),s.d(t,"mergeProperties",function(){return A}),s.d(t,"mergeOverrides",function(){return D}),s.d(t,"getOverrides",function(){return I}),s.d(t,"getClutchProps",function(){return q}),s.d(t,"hasVariant",function(){return N}),s.d(t,"propertyBind",function(){return U});var R=C.a;function x(e,t){var n;if("undefined"!=typeof window&&window.CLUTCH_CLASSES_MAP){var o=S(e);if(void 0===window.CLUTCH_CLASSES_MAP["".concat(o).concat(t)])n="-clutch-identifier".concat(Object.keys(window.CLUTCH_CLASSES_MAP).length),window.CLUTCH_CLASSES_MAP["".concat(o).concat(t)]=n;else n=window.CLUTCH_CLASSES_MAP["".concat(o).concat(t)]}return n}function L(e){for(var t=e,n=arguments.length,o=new Array(1<n?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return o.forEach(function(e){if(void 0!==e)if(e&&e.className&&e.style)t={className:C()(t&&t.className,e&&e.className),style:Object.assign({},t&&t.style,e&&e.style)};else t=e}),t}function _(e){for(var n=Object.assign({},e),t=arguments.length,o=new Array(1<t?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];if(o&&o.length)o.forEach(function(e){n=Object.assign({},n,e)});return Object.keys(n).reduce(function(e,t){if(n[t])return[].concat(h()(e),[t]);else return e},[])}function A(e){for(var i=Object.assign({},e),t=arguments.length,n=new Array(1<t?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];if(n&&n.length)n.forEach(function(r){if(r&&"object"===p()(r))Object.keys(r).forEach(function(e){var t=i[e],n=r[e];if("variants"===e){if(n&&n.length)i.variants=h()(t||[]),n.forEach(function(e){if(e&&"string"==typeof e&&!i.variants.includes(e))i.variants.push(e)})}else if("clutchProps"===e)if(t&&n&&n.overrides){var o=t.overrides||{};Object.keys(n.overrides).forEach(function(e){o[e]=A(o[e],n.overrides[e])}),i[e]=Object.assign({},t,n,{overrides:o})}else i[e]=Object.assign({},t,n);else i[e]=L(t,n)})});return i}function D(e){for(var n=Object.assign({},e),t=arguments.length,o=new Array(1<t?t-1:0),r=1;r<t;r++)o[r-1]=arguments[r];return o.forEach(function(t){if(t)Object.keys(t).forEach(function(e){n[e]=A(n[e],t[e])})}),n}function I(e){var t,n=P()(e,["clutchProps","selection"]),o=P()(e,["clutchProps","overrides"]);if(n&&o){var r=n.rootInstances||[];t=o["".concat(r.join("."),".").concat(n.id)]}return t}function q(e,t,n,o,r,i){var s=P()(t,["clutchProps","selection"],{});if(!r)console.log("Missing parentSelection, this might happen when you dont use useClutch to get properties");var c=r&&r.keys||[];if(void 0!==o&&r)c=[].concat(h()(c),[{componentId:r.id,key:o}]);var u=s.rootInstances||[];if(!s.rootInstances)u=[];else u=[].concat(h()(u),[s.id]);var a=P()(t,["clutchProps","overrides"]);if(i){a=Object.assign({},a);var f=u&&u.length;Object.keys(i).forEach(function(e){var t=e;if(f)t="".concat(u.join("."),".").concat(e);if(a[t])a[t]=A(i[e],a[t]);else a[t]=i[e]})}return{selection:{id:e,rootInstances:u,keys:c},parentSelection:r,masterProps:t,flowProps:n,overrides:a}}function N(e,t){return e&&Array.isArray(e)&&e.includes(t)?!0:void 0}function U(e,t){var n;try{if(void 0!==(n=P()(this,e))&&t)n+=t}catch(e){}return n}var T=function(){function e(){var r=this;if(c()(this,e),f()(this,"shallowEqual",k),f()(this,"getSelectionUID",S),f()(this,"onReceivedMessage",function(e){if("string"==typeof e.data&&"development"===process.env.NODE_ENV)try{var t=JSON.parse(e.data),n=t.type,o=i()(t,["type"]);switch(n){case"setEditing":r.setEditing(o.editing);break;case"request-binds-resolve":r.resolveBinds(o.selection,o.binds)}}catch(e){console.log("Error processing incoming message",e)}}),f()(this,"setEditing",function(e){r.editing=e}),f()(this,"checkComponentsRects",function(){if("undefined"!=typeof window)r.registeredComponents.forEach(function(e){return e.updateRect()}),window.requestAnimationFrame(r.checkComponentsRects)}),this.registeredComponents=[],this.editing=!1,"undefined"!=typeof window)window.addEventListener("message",this.onReceivedMessage,!1),window.requestAnimationFrame(this.checkComponentsRects),this.sendMessage({type:"getEditing"})}return u()(e,[{key:"sendMessage",value:function(e){if("development"===process.env.NODE_ENV&&"undefined"!=typeof window){var t=JSON.stringify(e,(n=new WeakSet,function(e,t){if("object"===p()(t)&&null!==t){if(n.has(t))return;n.add(t)}if("function"==typeof t)return t.toString();if("object"===p()(t)&&null!=t&&t.constructor&&t.constructor.name.includes("HTML"))return"<".concat(t.constructor.name,">");else return t}));if(window.opener)window.opener.postMessage(t,"*");else window.parent.postMessage(t,"*")}var n}},{key:"removeWindowListener",value:function(){if("undefined"!=typeof window)window.removeEventListener("resize",this.checkComponentsRects)}},{key:"unlistenStructure",value:function(){if(this.observerBody)this.observerBody.disconnect(),delete this.observerBody}},{key:"destroy",value:function(){this.unlistenStructure()}},{key:"propertyBind",value:function(e,t){var n;try{if(void 0!==(n=P()(this,e))&&t)n+=t}catch(e){}return n}},{key:"resolveBinds",value:function(e,t){var n=this,o=this.findComponentBySelection(e);if(o){var r=t.map(function(e){return function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};if(e%2)B(Object(n),!0).forEach(function(e){f()(t,e,n[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(t,Object.getOwnPropertyDescriptors(n));else B(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}({},e,{bind:n.processBind(e.bind,o.inboundProps,o.masterProps)})}),i={type:"return-binds-resolve",id:this.getSelectionUID(e),binds:r};this.sendMessage(i)}}},{key:"processBind",value:function(e,t,n){var o=e;try{if("PROP"===e.type){if(void 0!==(o=P()({flowProps:t,masterProps:n},e.value))&&e.suffix)o+=e.suffix}else if("EXPRESSION"===e.type){var r="(function () {\n return ".concat(e.value,";\n })");o=window.eval(r).call({flowProps:t,masterProps:n})}else if("MODULE"===e.type){var i=s(10)(e.path).default;o=window.eval(i).call({flowProps:t,masterProps:n})}}catch(e){o={type:"__CLUTCH_ERROR__",message:e.message}}return o}},{key:"registerComponent",value:function(e,t,n){var o=this.findComponentIndexBySelection(e),r=new M(this,e,t,n);if(-1!==o)this.registeredComponents.splice(o,1),r.prevUnregistered=!0;this.registeredComponents.unshift(r),this.sendMessage({type:"registerComponent",selection:e})}},{key:"unregisterComponent",value:function(e){var t=this.findComponentIndexBySelection(e);if(-1!==t){var n=this.registeredComponents[t];if(!n.prevUnregistered)this.registeredComponents.splice(t,1);else delete n.prevUnregistered}this.sendMessage({type:"unregisterComponent",selection:e})}},{key:"findComponentIndexBySelection",value:function(t){return v()(this.registeredComponents,function(e){return e.matchesSelection(t)})}},{key:"findComponentBySelection",value:function(t){return m()(this.registeredComponents,function(e){return e.matchesSelection(t)})}},{key:"findComponentsBySelection",value:function(t,e){var n=1<arguments.length&&void 0!==e?e:!1;return this.registeredComponents.filter(function(e){return e.matchesSelection(t,n)})}},{key:"changeComponentProp",value:function(e,t,n){this.sendMessage({type:"changeComponentProp",selection:e,propName:t,value:n})}},{key:"overComponent",value:function(e){this.sendMessage({type:"overComponent",selection:e})}},{key:"outComponent",value:function(e){this.sendMessage({type:"outComponent",selection:e})}},{key:"selectComponent",value:function(e){this.sendMessage({type:"selectComponent",selection:e})}},{key:"unlockComponent",value:function(e){this.sendMessage({type:"unlockComponent",selection:e})}},{key:"registerComponentReference",value:function(e,t){var n=this.findComponentBySelection(e);if(n&&null!==t)n.setReference(t)}},{key:"registerComponentChildReference",value:function(e,t,n){var o=this.findComponentBySelection(e);if(o)o.setChildReference(t,n)}},{key:"openComponentContextMenu",value:function(e,t){this.sendMessage({type:"openComponentContextMenu",selection:e,eventX:t.clientX,eventY:t.clientY})}},{key:"updateComponentOutboundProps",value:function(e,t,n){this.sendMessage({type:"updateComponentOutboundProps",selection:e,area:t,outboundProps:n})}},{key:"updateComponentInboundProps",value:function(e,t){var n=this.findComponentBySelection(e);if(n)n.updateInboundProps(t);this.sendMessage({type:"updateComponentInboundProps",selection:e,inboundProps:t})}},{key:"updateComponentMasterProps",value:function(e,t){var n=this.findComponentBySelection(e);if(n)n.updateMasterProps(t)}},{key:"updateComponentRect",value:function(e,t){this.sendMessage({type:"updateComponentRect",selection:e,rect:t})}},{key:"setCanvasError",value:function(e){if(this.sendMessage({type:"setCanvasError",err:e}),e)console.error(e)}}]),e}();t.default=new T}]); | ||
module.exports=function(r){var t={};function o(e){if(t[e])return t[e].exports;var n=t[e]={i:e,l:!1,exports:{}};return r[e].call(n.exports,n,n.exports,o),n.l=!0,n.exports}return o.m=r,o.c=t,o.d=function(e,n,r){if(!o.o(e,n))Object.defineProperty(e,n,{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(n,e){if(1&e)n=o(n);if(8&e)return n;if(4&e&&"object"==typeof n&&n&&n.__esModule)return n;var r=Object.create(null);if(o.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:n}),2&e&&"string"!=typeof n)for(var t in n)o.d(r,t,function(e){return n[e]}.bind(null,t));return r},o.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(n,"a",n),n},o.o=function(e,n){return Object.prototype.hasOwnProperty.call(e,n)},o.p="",o(o.s=6)}([function(e,n){e.exports=require("lodash/get")},function(e,n){e.exports=require("@babel/runtime/helpers/typeof")},function(e,n){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,n){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,n){e.exports=require("@babel/runtime/helpers/slicedToArray")},function(e,n){e.exports=require("classnames")},function(e,n,r){"use strict";r.r(n);var t=r(2),l=r.n(t),o=r(4),p=r.n(o),i=r(1),c=r.n(i),s=r(3),d=r.n(s),u=r(5),a=r.n(u),f=r(0),y=r.n(f),v=function(){var r=new WeakSet;return function(e,n){if("object"===c()(n)&&null!==n){if(r.has(n))return;r.add(n)}if("function"==typeof n)return n.toString();if("object"===c()(n)&&null!=n&&n.constructor&&n.constructor.name.includes("HTML"))return"<".concat(n.constructor.name,">");else return n}};function b(n,e){var r=Object.keys(n);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(n);if(e)t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable});r.push.apply(r,t)}return r}function g(n){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};if(e%2)b(Object(r),!0).forEach(function(e){l()(n,e,r[e])});else if(Object.getOwnPropertyDescriptors)Object.defineProperties(n,Object.getOwnPropertyDescriptors(r));else b(Object(r)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(r,e))})}return n}r.d(n,"classnames",function(){return h}),r.d(n,"getUniqueClassName",function(){return O}),r.d(n,"mergeProperty",function(){return j}),r.d(n,"mergeVariants",function(){return m}),r.d(n,"mergeProperties",function(){return P}),r.d(n,"mergeOverrides",function(){return w}),r.d(n,"getOverrides",function(){return S}),r.d(n,"getClutchProps",function(){return C}),r.d(n,"hasVariant",function(){return E}),r.d(n,"propertyBind",function(){return A}),r.d(n,"renderChildren",function(){return _}),r.d(n,"getFlowProps",function(){return k}),r.d(n,"calculateProperties",function(){return M}),r.d(n,"changeComponentProp",function(){return N});var h=a.a;function O(e,n){var r;if("undefined"!=typeof window&&window.CLUTCH_CLASSES_MAP){var t=function(e){var n=e||{},r=n.keys,t=n.rootInstances,o="".concat(n.id);if(r&&r.length)o+=".".concat(r.map(function(e){return e.key}).join("."));if(t&&t.length)o+=".".concat(t.join("."));return o}(e);if(void 0===window.CLUTCH_CLASSES_MAP["".concat(t).concat(n)])r="-clutch-identifier".concat(Object.keys(window.CLUTCH_CLASSES_MAP).length),window.CLUTCH_CLASSES_MAP["".concat(t).concat(n)]=r;else r=window.CLUTCH_CLASSES_MAP["".concat(t).concat(n)]}return r}function j(e){for(var n=e,r=arguments.length,t=new Array(1<r?r-1:0),o=1;o<r;o++)t[o-1]=arguments[o];return t.forEach(function(e){if(void 0!==e)if(e&&e.className&&e.style)n={className:a()(n&&n.className,e&&e.className),style:Object.assign({},n&&n.style,e&&e.style)};else n=e}),n}function m(e){for(var r=Object.assign({},e),n=arguments.length,t=new Array(1<n?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];if(t&&t.length)t.forEach(function(e){r=Object.assign({},r,e)});return Object.keys(r).reduce(function(e,n){if(r[n])return[].concat(d()(e),[n]);else return e},[])}function P(e){for(var i=Object.assign({},e),n=arguments.length,r=new Array(1<n?n-1:0),t=1;t<n;t++)r[t-1]=arguments[t];if(r&&r.length)r.forEach(function(o){if(o&&"object"===c()(o))Object.keys(o).forEach(function(e){var n=i[e],r=o[e];if("variants"===e){if(r&&r.length)i.variants=d()(n||[]),r.forEach(function(e){if(e&&"string"==typeof e&&!i.variants.includes(e))i.variants.push(e)})}else if("clutchProps"===e)if(n&&r&&r.overrides){var t=n.overrides||{};Object.keys(r.overrides).forEach(function(e){t[e]=P(t[e],r.overrides[e])}),i[e]=Object.assign({},n,r,{overrides:t})}else i[e]=Object.assign({},n,r);else i[e]=j(n,r)})});return i}function w(e){for(var r=Object.assign({},e),n=arguments.length,t=new Array(1<n?n-1:0),o=1;o<n;o++)t[o-1]=arguments[o];return t.forEach(function(n){if(n)Object.keys(n).forEach(function(e){r[e]=P(r[e],n[e])})}),r}function S(e){var n,r=y()(e,["clutchProps","selection"]),t=y()(e,["clutchProps","overrides"]);if(r&&t){var o=r.rootInstances||[];n=t["".concat(o.join("."),".").concat(r.id)]}return n}function C(e,n,r,t,o,i,c){var s=y()(r,["selection"],{});if(!i)console.log("Missing parentSelection, this might happen when you dont use useClutch to get properties");var u=i&&i.keys||[];if(void 0!==o&&i)u=[].concat(d()(u),[{componentId:i.id,key:o}]);var a=s.rootInstances||[];if(!s.rootInstances)a=[];else a=[].concat(d()(a),[s.id]);var f=y()(r,["overrides"]);if(c){f=Object.assign({},f);var l=a&&a.length;Object.keys(c).forEach(function(e){var n=e;if(l)n="".concat(a.join("."),".").concat(e);if(f[n])f[n]=P(c[e],f[n]);else f[n]=c[e]})}return{selection:{id:e,rootInstances:a,keys:u},masterProps:n,flowProps:t,overrides:f}}function E(e,n){return e&&Array.isArray(e)&&e.includes(n)?!0:void 0}function A(e,n){var r;try{if(void 0!==(r=y()(this,e))&&n)r+=n}catch(e){}return r}function _(e,n,r,t,o,i){var c=t,s=n||{};if(o)s=Object.assign({},s,o);if("function"==typeof t)c=t(s,i,e);else if(void 0===t)c=null;return c}function k(e){return y()(e,["clutchProps","flowProps"],{})}function M(e){var s=this,n=e.defaultSelection,r=e.propsTypes,t=e.privateProps,o=e.props,u=P(t,o,S(o)),i=u&&u.clutchProps||{},c=i.masterProps,a=i.flowProps,f=n||i.selection;return u=Object.entries(r).reduce(function(e,n){var r=p()(n,2),t=r[0],o=r[1],i=u[t];if("Children"===o)return g({},e,l()({},t,_.bind(s,f,a,t,i)));if("Styles"!==o||"production"===process.env.NODE_ENV)return e;var c=O(f,t);return g({},e,l()({},t,{className:h(i&&i.className,c),style:i&&i.style||{}}))},u),{masterProps:u=Object.entries(u).reduce(function(e,n){var r=p()(n,2),t=r[0],o=r[1];if(!("function"!=typeof o||o.prototype&&o.prototype.isReactComponent))return g({},e,l()({},t,o.bind({masterProps:c,flowProps:a})));else return e},u),clutchProps:i}}function N(e,n,r){!function(e){if("development"===process.env.NODE_ENV&&"undefined"!=typeof window){var n=JSON.stringify(e,v());if(window.opener)window.opener.postMessage(n,"*");else window.parent.postMessage(n,"*")}}({type:"changeComponentProp",selection:e,propName:n,value:r})}}]); |
{ | ||
"name": "@clutch-creator/bridge", | ||
"version": "1.0.2", | ||
"version": "2.0.0-beta.0", | ||
"description": "Clutch Bridge", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
8984
3