New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

intact-react

Package Overview
Dependencies
Maintainers
6
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intact-react - npm Package Compare versions

Comparing version 1.1.29 to 1.1.30

37

dist/index.js

@@ -396,6 +396,10 @@ 'use strict';

// but the real element is inserted before the placeholder by React
dom = placeholder.previousSibling;
// dom = placeholder.previousSibling;
// @modify: look up child to get dom
dom = getDomFromFiber(placeholder._reactRootContainer._internalRoot.current);
}
placeholder._realElement = dom;
dom._placeholder = placeholder;
if (dom) {
dom._placeholder = placeholder;
}
resolve();

@@ -484,2 +488,12 @@ });

function getDomFromFiber(fiber) {
if (!fiber) return null;
switch (fiber.tag) {
case 5 /* HostComponent */:
return fiber.stateNode;
default:
return getDomFromFiber(fiber.child);
}
}
var _Intact$Vdt$miss$1 = Intact.Vdt.miss;

@@ -702,21 +716,2 @@ var h$1 = _Intact$Vdt$miss$1.h;

});
// let fiber;
// Object.defineProperty(this, '_reactInternalFiber', {
// get() {
// return fiber;
// },
// set(v) {
// let props;
// Object.defineProperty(v, 'memoizedProps', {
// get() {
// return {...props};
// },
// set(v) {
// props = v;
// }
// });
// fiber = v;
// },
// });
return possibleConstructorReturn(_this);

@@ -723,0 +718,0 @@ }

@@ -398,6 +398,10 @@ (function (global, factory) {

// but the real element is inserted before the placeholder by React
dom = placeholder.previousSibling;
// dom = placeholder.previousSibling;
// @modify: look up child to get dom
dom = getDomFromFiber(placeholder._reactRootContainer._internalRoot.current);
}
placeholder._realElement = dom;
dom._placeholder = placeholder;
if (dom) {
dom._placeholder = placeholder;
}
resolve();

@@ -486,2 +490,12 @@ });

function getDomFromFiber(fiber) {
if (!fiber) return null;
switch (fiber.tag) {
case 5 /* HostComponent */:
return fiber.stateNode;
default:
return getDomFromFiber(fiber.child);
}
}
var _Intact$Vdt$miss$1 = Intact.Vdt.miss;

@@ -704,21 +718,2 @@ var h$1 = _Intact$Vdt$miss$1.h;

});
// let fiber;
// Object.defineProperty(this, '_reactInternalFiber', {
// get() {
// return fiber;
// },
// set(v) {
// let props;
// Object.defineProperty(v, 'memoizedProps', {
// get() {
// return {...props};
// },
// set(v) {
// props = v;
// }
// });
// fiber = v;
// },
// });
return possibleConstructorReturn(_this);

@@ -725,0 +720,0 @@ }

@@ -1,1 +0,1 @@

(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t(require("react"),require("intact/dist"),require("react-dom")):typeof define==="function"&&define.amd?define(["react","intact/dist","react-dom"],t):e.Intact=t(e.React,e.Intact,e.ReactDOM)})(this,function(p,e,c){"use strict";p=p&&p.hasOwnProperty("default")?p["default"]:p;e=e&&e.hasOwnProperty("default")?e["default"]:e;c=c&&c.hasOwnProperty("default")?c["default"]:c;var r=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var s=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}};var t=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(e,t,r){if(t)n(e.prototype,t);if(r)n(e,r);return e}}();var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){e[n]=r[n]}}}return e};var n=function(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t};var f=function(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e};var h=function(){function r(e){var t=this;s(this,r);this.resolved=false;this.callbacks=[];e.call(this,function(){return t.resolve()})}r.prototype.resolve=function e(){this.resolved=true;var t=void 0;while(t=this.callbacks.shift()){t()}};r.prototype.then=function e(t){this.callbacks.push(t);if(this.resolved){this.resolve()}};return r}();h.all=function(r){var e=0;var n=r.callbacks||(r.callbacks=[]);var i=false;var t=false;r.forEach(function(e){if(e._hasRewrite)return;e._hasRewrite=true;e.then(s)});if(!r._hasRewrite){var o=r.push;r.push=function(e){e.then(s);o.call(r,e)};r.push.push=o;r._hasRewrite=true}function a(){r.length=0;r.push=r.push.push;r._hasRewrite=false;r.callbacks=[];var e=void 0;while(e=n.shift()){e()}}function s(){e++;if(r.length===e){i=true;if(t){return console.error("promise has done")}if(n.length){t=true;a()}}}return{then:function e(t){n.push(t);if(!r.length||i){a()}}}};var a=p.createElement;function i(e,t,r){var n=e.$$cid==="IntactReact";var i=e.propTypes;if(n&&i){e.propTypes=undefined}var o=a.apply(this,arguments);if(n&&i){e.propTypes=i}return o}p.createElement=i;var o=c.findDOMNode;c.findDOMNode=function(e){if(e instanceof Y){return e.element}return o.call(c,e)};var u=e.Vdt.miss;var d=u.h;u.h=function e(t){if(t&&t.$$cid==="IntactFunction"){t=t.$$type}for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++){n[i-1]=arguments[i]}return d.call.apply(d,[this,t].concat(n))};var _=e.utils;var v=_.isStringOrNumber;var y=_.isArray;var g=_.noop;function m(n){function r(e,t){if(t){var r=n(F(e,t,{instance:t.__parent}),true);if(y(r)){return r.map(function(e,t){return b(e,t)})}return b(r)}else{return n(e)}}r.contextTypes={_context:g,__parent:g};var e=p.forwardRef(function(e,t){if(t)e=l({},e,{forwardRef:t});return i(r,e)});e.$$cid="IntactFunction";e.$$type=r;return e}function b(e,t){if(v(e)){return e}else if(e){return i(e.tag,l({key:t},e.props),e.props.children||e.children)}}var C=/_ev[A-Z]/;var x=" react-mount-point-unstable ";var w=function(){function e(){s(this,e)}e.prototype.init=function e(t,r){this.destroyed=true;var n=this.placeholder=document.createComment(x);var i=this.parentDom;if(!i){var o=this.parentVNode;while(o){if(o.dom){i=o.dom;break}o=o.parentVNode}}if(i){i.appendChild(n);R(i)}this._render(r);return n};e.prototype.update=function e(t,r){this._render(r);return this.placeholder};e.prototype.destroy=function e(t,r,n){var i=this.placeholder;var o=i.parentNode;Object.defineProperty(i,"parentNode",{value:o});c.render(null,i,function(){o.removeChild(i)});i._unmount=g;if(i._realElement){i._realElement._unmount=g}};e.prototype._render=function e(t){var r=this._addProps(t);var n=this.placeholder;var i=t.props._parentRef.instance;if(i){if(!i._reactInternalFiber){i=i.get("_parentRef").instance}}else{var o=t.parentVNode;while(o){var a=o.children;if(a&&a._reactInternalFiber!==undefined){i=a;break}o=o.parentVNode}}var s=i.__providers;s.forEach(function(e,t){r=p.createElement(t,{value:e},r)});var u=new h(function(t){c.unstable_renderSubtreeIntoContainer(i,r,n,function(){var e=void 0;if(this){e=this.nodeType===3?this:c.findDOMNode(this)}else{e=n.previousSibling}n._realElement=e;e._placeholder=n;t()})});i.__promises.push(u)};e.prototype._addProps=function e(t){this.vdt={vNode:t};var r=t.props;var n=void 0;var i=void 0;for(var o in r){if(o==="reactVNode"||o==="_parentRef")continue;if(C.test(o))continue;if(!n){n=l({},r.reactVNode);i=n.props=l({},n.props)}var a=r[o];if(o.substr(0,3)==="ev-"){i[N[o]]=a}else{i[o]=a}}return n||r.reactVNode};return e}();var N={"ev-click":"onClick","ev-mouseenter":"onMouseEnter","ev-mouseleave":"onMouseLeave"};function R(e){if(!e._hasRewrite){var t=e.removeChild;e.removeChild=function(e){e=e._realElement||e;if(e.__intactIsRemoved)return;t.call(this,e);e.__intactIsRemoved=true;O(e)};var r=e.insertBefore;e.insertBefore=function(e,t){r.call(this,e,t&&t._realElement||t)};e._hasRewrite=true}}function O(e){var t=void 0;if(t=e._realElement){delete e._realElement;delete t._placeholder}else if(t=e._placeholder){delete e._placeholder;delete t._realElement}}var k=e.Vdt.miss;var E=k.h;var M=k.VNode;var V=k.Types;var j=e.utils;var I=j.isFunction;var Q=j.isArray;var T=j.isStringOrNumber;var P=j.set;var $=j.get;function S(e,t){if(e==null)return e;if(T(e)){return new M(V.Text,null,null,e)}if(e instanceof M){if(I(e.tag)){e.props._parentRef=t}return e}var r=void 0;if((r=e.type)&&(r=r.$$cid)&&(r==="IntactReact"||r==="IntactFunction")){return E(e.type,F(l({},e.props,{_parentRef:t}),{_context:e._owner&&e._owner.stateNode},t,e.key),null,null,e.key,U(e.ref))}if(e.type===p.Fragment){return D(e.props.children,t)}return E(w,{reactVNode:e,_parentRef:t},null,e.props.className,e.key)}function D(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(Q(e)){var r=[];e.forEach(function(e){if(Q(e)){r.push.apply(r,D(e,t))}else{r.push(S(e,t))}});return r}return S(e,t)}function F(e,t,r,n){if(!e)return;var i={};var o=i._blocks={};var a=void 0;for(var s in e){if(s==="children"){i.children=D(e.children,r)}else if(a=q(s)){i[a]=e[s]}else if(s.substring(0,2)==="b-"){o[s.substring(2)]=G(e[s])}else if(s==="forwardRef"){i.ref=e[s]}else{i[s]=e[s]}}i._context=A(t);if(n!=null){i.key=n}return i}function U(t){return(typeof t==="undefined"?"undefined":r(t))==="object"&&t!==null?function(e){t.current=e}:t}function A(e){var i=e._context;return{data:{get:function e(t){if(t!=null){return $(i.state||{},t)}else{return i.state||{}}},set:function e(t,r){var n=l({},i.state);P(n,t,r);i.setState(n)}}}}function G(i){if(I(i)){return function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}return D(i.apply(this,r),{instance:this.data})}}else{return function(){return D(i,{instance:this.data})}}}function q(e){var t=e[0],r=e[1],n=e[2];if(!n)return;var i=void 0;if(t==="o"&&r==="n"){if(n==="$"){return"ev-$"+e.substring(3).replace(/\-/g,":")}else if((i=n.charCodeAt(0))&&i>=65&&i<=90){return"ev-"+e.substring(2).toLowerCase().replace(/\-/g,":")}}}var B=e.utils;var L=B.isObject;var W=B.extend;var z=e.Vdt.miss;var Z=z.h;var H=z.config;if(H){H.disableDelegate=true}var J=void 0;var K=void 0;var X=[];var Y=function(u){n(a,u);function a(e,t){s(this,a);if(t){var r={};var n=F(e,t,r);var i=f(this,u.call(this,n));r.instance=i;i.__promises=t.__promises||X;i.mountedQueue=t.__parent&&t.__parent.mountedQueue;i.vNode=Z(i.constructor,n);i.vNode.children=i;i._props=i.props;delete i.props;i._isReact=true}else{var i=f(this,u.call(this,e))}i._triggerFlagStack=[];var o=void 0;Object.defineProperty(i,"element",{get:function e(){if(!this.__isUpdating&&o&&o.nodeType===8&&o.nodeValue===x){return o._realElement||o}return o},set:function e(t){o=t},configurable:true,enumerable:true});return f(i)}a.prototype._update=function e(t,r){if(this.destroyed)return;u.prototype._update.call(this,t,r)};a.prototype.getChildContext=function e(){return{__parent:this,__promises:this.__promises}};a.prototype.get=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++){r[n]=arguments[n]}if(this._isReact){var i;var o=this.props;this.props=this._props;var a=(i=u.prototype.get).call.apply(i,[this].concat(r));this.props=o;return a}else{var s;return(s=u.prototype.get).call.apply(s,[this].concat(r))}};a.prototype.set=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++){r[n]=arguments[n]}if(this._isReact){var i;var o=this.props;this.props=this._props;var a=(i=u.prototype.set).call.apply(i,[this].concat(r));this.props=o;return a}else{var s;return(s=u.prototype.set).call.apply(s,[this].concat(r))}};a.prototype.init=function e(t,r){var n=this.__isUpdating;this.__isUpdating=true;this.refs=this.vdt.widgets||{};this.__pushGetChildContext(r);var i=u.prototype.init.call(this,t,r);this.__popGetChildContext();this.__isUpdating=n;return i};a.prototype.update=function e(i,o,a){var s=this;var e=function e(){var t=s.__isUpdating;s.__isUpdating=true;var r=!t&&!s.__getChildContext;if(r){s.__pushGetChildContext(o||s.vNode)}var n=u.prototype.update.call(s,i,o,a);if(r){s.__popGetChildContext()}s.__isUpdating=t;return n};if(!this._isReact)return e();this.__initMountedQueue();var t=e();this.__triggerMountedQueue();return t};a.prototype.__pushGetChildContext=function e(t){var r=t&&t.props._parentRef;var n=r&&r.instance;if(n){var i=this;this.__getChildContext=n.getChildContext;n.getChildContext=function(){var e=i.__getChildContext.call(this);return l({},e,{__parent:i})}}this.__parentInstance=n};a.prototype.__popGetChildContext=function e(){if(this.__parentInstance){this.__parentInstance.getChildContext=this.__getChildContext;this.__getChildContext=null}};a.prototype.componentDidMount=function e(){var t=this;this.__initMountedQueue();this.inited=true;this.parentVNode=this.vNode.parentVNode=this.context.__parent&&this.context.__parent.vNode;var r=this.init(null,this.vNode);var n=this._placeholder;var i=n.parentElement;this.parentDom=i;r[J]=n[J];r[K]=n[K];Object.defineProperty(n,"parentNode",{value:i});i.replaceChild(r,n);n._realElement=r;R(i);this.mountedQueue.push(function(){t.mount()});this.__triggerMountedQueue()};a.prototype.componentWillUnmount=function e(){this.destroy()};a.prototype.componentDidUpdate=function e(){this.__initMountedQueue();var t=Z(this.constructor,F(this.props,this.context,{instance:this}));var r=this.vNode;t.children=this;this.vNode=t;this.parentVNode=t.parentVNode=this.context.__parent&&this.context.__parent.vNode;this.update(r,t);this.__triggerMountedQueue()};a.prototype.__ref=function e(t){this._placeholder=t;if(!J){var r=Object.keys(t);J=r[0];K=r[1]}};a.prototype.render=function e(){this.__providers=new Map;var t=this._reactInternalFiber;while(t=t.return){var r=t.tag;if(r===10){var n=t.type;this.__providers.set(n,n._context._currentValue)}else if(r===3){var i=t.stateNode;if(!i.__intactReactDefinedProperty){(function(){var r=void 0;Object.defineProperty(i,"pendingContext",{get:function e(){return r||(t.context?l({},t.context):Object.create(null))},set:function e(t){r=t}});i.__intactReactDefinedProperty=true})()}break}}return p.createElement("i",{ref:this.__ref})};a.prototype.__initMountedQueue=function e(){this._triggerFlagStack.push(this._shouldTrigger);this._shouldTrigger=false;if(!this.mountedQueue||this.mountedQueue.done){var t=void 0;if((t=this.context)&&(t=t.__parent)&&(t=t.mountedQueue)){if(!t.done){this.mountedQueue=t;return}}this._shouldTrigger=true;this._initMountedQueue()}};a.prototype.__triggerMountedQueue=function e(){var t=this;if(this._shouldTrigger){h.all(this.__promises).then(function(){X=[];t._triggerMountedQueue()})}this._shouldTrigger=this._triggerFlagStack.pop()};t(a,[{key:"isMounted",get:function e(){return this.mounted}}]);return a}(e);Y.functionalWrapper=m;Y.normalize=D;Y.$$cid="IntactReact";Y.prototype.isReactComponent={};Y.contextTypes={_context:g,__parent:g,__promises:g,router:g};Y.childContextTypes={__parent:g,__promises:g};if(!Object.setPrototypeOf){W(Y,e);if(!Y.template){Y.template=e.template}}return Y});
(function(e,t){typeof exports==="object"&&typeof module!=="undefined"?module.exports=t(require("react"),require("intact/dist"),require("react-dom")):typeof define==="function"&&define.amd?define(["react","intact/dist","react-dom"],t):e.Intact=t(e.React,e.Intact,e.ReactDOM)})(this,function(p,e,c){"use strict";p=p&&p.hasOwnProperty("default")?p["default"]:p;e=e&&e.hasOwnProperty("default")?e["default"]:e;c=c&&c.hasOwnProperty("default")?c["default"]:c;var r=typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"?function(e){return typeof e}:function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e};var s=function(e,t){if(!(e instanceof t)){throw new TypeError("Cannot call a class as a function")}};var t=function(){function n(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||false;n.configurable=true;if("value"in n)n.writable=true;Object.defineProperty(e,n.key,n)}}return function(e,t,r){if(t)n(e.prototype,t);if(r)n(e,r);return e}}();var l=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r){if(Object.prototype.hasOwnProperty.call(r,n)){e[n]=r[n]}}}return e};var n=function(e,t){if(typeof t!=="function"&&t!==null){throw new TypeError("Super expression must either be null or a function, not "+typeof t)}e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}});if(t)Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t};var f=function(e,t){if(!e){throw new ReferenceError("this hasn't been initialised - super() hasn't been called")}return t&&(typeof t==="object"||typeof t==="function")?t:e};var h=function(){function r(e){var t=this;s(this,r);this.resolved=false;this.callbacks=[];e.call(this,function(){return t.resolve()})}r.prototype.resolve=function e(){this.resolved=true;var t=void 0;while(t=this.callbacks.shift()){t()}};r.prototype.then=function e(t){this.callbacks.push(t);if(this.resolved){this.resolve()}};return r}();h.all=function(r){var e=0;var n=r.callbacks||(r.callbacks=[]);var i=false;var t=false;r.forEach(function(e){if(e._hasRewrite)return;e._hasRewrite=true;e.then(s)});if(!r._hasRewrite){var o=r.push;r.push=function(e){e.then(s);o.call(r,e)};r.push.push=o;r._hasRewrite=true}function a(){r.length=0;r.push=r.push.push;r._hasRewrite=false;r.callbacks=[];var e=void 0;while(e=n.shift()){e()}}function s(){e++;if(r.length===e){i=true;if(t){return console.error("promise has done")}if(n.length){t=true;a()}}}return{then:function e(t){n.push(t);if(!r.length||i){a()}}}};var a=p.createElement;function i(e,t,r){var n=e.$$cid==="IntactReact";var i=e.propTypes;if(n&&i){e.propTypes=undefined}var o=a.apply(this,arguments);if(n&&i){e.propTypes=i}return o}p.createElement=i;var o=c.findDOMNode;c.findDOMNode=function(e){if(e instanceof ee){return e.element}return o.call(c,e)};var u=e.Vdt.miss;var d=u.h;u.h=function e(t){if(t&&t.$$cid==="IntactFunction"){t=t.$$type}for(var r=arguments.length,n=Array(r>1?r-1:0),i=1;i<r;i++){n[i-1]=arguments[i]}return d.call.apply(d,[this,t].concat(n))};var _=e.utils;var v=_.isStringOrNumber;var y=_.isArray;var g=_.noop;function m(n){function r(e,t){if(t){var r=n(U(e,t,{instance:t.__parent}),true);if(y(r)){return r.map(function(e,t){return b(e,t)})}return b(r)}else{return n(e)}}r.contextTypes={_context:g,__parent:g};var e=p.forwardRef(function(e,t){if(t)e=l({},e,{forwardRef:t});return i(r,e)});e.$$cid="IntactFunction";e.$$type=r;return e}function b(e,t){if(v(e)){return e}else if(e){return i(e.tag,l({key:t},e.props),e.props.children||e.children)}}var C=/_ev[A-Z]/;var x=" react-mount-point-unstable ";var w=function(){function e(){s(this,e)}e.prototype.init=function e(t,r){this.destroyed=true;var n=this.placeholder=document.createComment(x);var i=this.parentDom;if(!i){var o=this.parentVNode;while(o){if(o.dom){i=o.dom;break}o=o.parentVNode}}if(i){i.appendChild(n);R(i)}this._render(r);return n};e.prototype.update=function e(t,r){this._render(r);return this.placeholder};e.prototype.destroy=function e(t,r,n){var i=this.placeholder;var o=i.parentNode;Object.defineProperty(i,"parentNode",{value:o});c.render(null,i,function(){o.removeChild(i)});i._unmount=g;if(i._realElement){i._realElement._unmount=g}};e.prototype._render=function e(t){var r=this._addProps(t);var n=this.placeholder;var i=t.props._parentRef.instance;if(i){if(!i._reactInternalFiber){i=i.get("_parentRef").instance}}else{var o=t.parentVNode;while(o){var a=o.children;if(a&&a._reactInternalFiber!==undefined){i=a;break}o=o.parentVNode}}var s=i.__providers;s.forEach(function(e,t){r=p.createElement(t,{value:e},r)});var u=new h(function(t){c.unstable_renderSubtreeIntoContainer(i,r,n,function(){var e=void 0;if(this){e=this.nodeType===3?this:c.findDOMNode(this)}else{e=k(n._reactRootContainer._internalRoot.current)}n._realElement=e;if(e){e._placeholder=n}t()})});i.__promises.push(u)};e.prototype._addProps=function e(t){this.vdt={vNode:t};var r=t.props;var n=void 0;var i=void 0;for(var o in r){if(o==="reactVNode"||o==="_parentRef")continue;if(C.test(o))continue;if(!n){n=l({},r.reactVNode);i=n.props=l({},n.props)}var a=r[o];if(o.substr(0,3)==="ev-"){i[N[o]]=a}else{i[o]=a}}return n||r.reactVNode};return e}();var N={"ev-click":"onClick","ev-mouseenter":"onMouseEnter","ev-mouseleave":"onMouseLeave"};function R(e){if(!e._hasRewrite){var t=e.removeChild;e.removeChild=function(e){e=e._realElement||e;if(e.__intactIsRemoved)return;t.call(this,e);e.__intactIsRemoved=true;O(e)};var r=e.insertBefore;e.insertBefore=function(e,t){r.call(this,e,t&&t._realElement||t)};e._hasRewrite=true}}function O(e){var t=void 0;if(t=e._realElement){delete e._realElement;delete t._placeholder}else if(t=e._placeholder){delete e._placeholder;delete t._realElement}}function k(e){if(!e)return null;switch(e.tag){case 5:return e.stateNode;default:return k(e.child)}}var E=e.Vdt.miss;var M=E.h;var V=E.VNode;var j=E.Types;var I=e.utils;var Q=I.isFunction;var T=I.isArray;var P=I.isStringOrNumber;var $=I.set;var S=I.get;function D(e,t){if(e==null)return e;if(P(e)){return new V(j.Text,null,null,e)}if(e instanceof V){if(Q(e.tag)){e.props._parentRef=t}return e}var r=void 0;if((r=e.type)&&(r=r.$$cid)&&(r==="IntactReact"||r==="IntactFunction")){return M(e.type,U(l({},e.props,{_parentRef:t}),{_context:e._owner&&e._owner.stateNode},t,e.key),null,null,e.key,A(e.ref))}if(e.type===p.Fragment){return F(e.props.children,t)}return M(w,{reactVNode:e,_parentRef:t},null,e.props.className,e.key)}function F(e){var t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};if(T(e)){var r=[];e.forEach(function(e){if(T(e)){r.push.apply(r,F(e,t))}else{r.push(D(e,t))}});return r}return D(e,t)}function U(e,t,r,n){if(!e)return;var i={};var o=i._blocks={};var a=void 0;for(var s in e){if(s==="children"){i.children=F(e.children,r)}else if(a=B(s)){i[a]=e[s]}else if(s.substring(0,2)==="b-"){o[s.substring(2)]=q(e[s])}else if(s==="forwardRef"){i.ref=e[s]}else{i[s]=e[s]}}i._context=G(t);if(n!=null){i.key=n}return i}function A(t){return(typeof t==="undefined"?"undefined":r(t))==="object"&&t!==null?function(e){t.current=e}:t}function G(e){var i=e._context;return{data:{get:function e(t){if(t!=null){return S(i.state||{},t)}else{return i.state||{}}},set:function e(t,r){var n=l({},i.state);$(n,t,r);i.setState(n)}}}}function q(i){if(Q(i)){return function(e){for(var t=arguments.length,r=Array(t>1?t-1:0),n=1;n<t;n++){r[n-1]=arguments[n]}return F(i.apply(this,r),{instance:this.data})}}else{return function(){return F(i,{instance:this.data})}}}function B(e){var t=e[0],r=e[1],n=e[2];if(!n)return;var i=void 0;if(t==="o"&&r==="n"){if(n==="$"){return"ev-$"+e.substring(3).replace(/\-/g,":")}else if((i=n.charCodeAt(0))&&i>=65&&i<=90){return"ev-"+e.substring(2).toLowerCase().replace(/\-/g,":")}}}var L=e.utils;var W=L.isObject;var z=L.extend;var Z=e.Vdt.miss;var H=Z.h;var J=Z.config;if(J){J.disableDelegate=true}var K=void 0;var X=void 0;var Y=[];var ee=function(u){n(a,u);function a(e,t){s(this,a);if(t){var r={};var n=U(e,t,r);var i=f(this,u.call(this,n));r.instance=i;i.__promises=t.__promises||Y;i.mountedQueue=t.__parent&&t.__parent.mountedQueue;i.vNode=H(i.constructor,n);i.vNode.children=i;i._props=i.props;delete i.props;i._isReact=true}else{var i=f(this,u.call(this,e))}i._triggerFlagStack=[];var o=void 0;Object.defineProperty(i,"element",{get:function e(){if(!this.__isUpdating&&o&&o.nodeType===8&&o.nodeValue===x){return o._realElement||o}return o},set:function e(t){o=t},configurable:true,enumerable:true});return f(i)}a.prototype._update=function e(t,r){if(this.destroyed)return;u.prototype._update.call(this,t,r)};a.prototype.getChildContext=function e(){return{__parent:this,__promises:this.__promises}};a.prototype.get=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++){r[n]=arguments[n]}if(this._isReact){var i;var o=this.props;this.props=this._props;var a=(i=u.prototype.get).call.apply(i,[this].concat(r));this.props=o;return a}else{var s;return(s=u.prototype.get).call.apply(s,[this].concat(r))}};a.prototype.set=function e(){for(var t=arguments.length,r=Array(t),n=0;n<t;n++){r[n]=arguments[n]}if(this._isReact){var i;var o=this.props;this.props=this._props;var a=(i=u.prototype.set).call.apply(i,[this].concat(r));this.props=o;return a}else{var s;return(s=u.prototype.set).call.apply(s,[this].concat(r))}};a.prototype.init=function e(t,r){var n=this.__isUpdating;this.__isUpdating=true;this.refs=this.vdt.widgets||{};this.__pushGetChildContext(r);var i=u.prototype.init.call(this,t,r);this.__popGetChildContext();this.__isUpdating=n;return i};a.prototype.update=function e(i,o,a){var s=this;var e=function e(){var t=s.__isUpdating;s.__isUpdating=true;var r=!t&&!s.__getChildContext;if(r){s.__pushGetChildContext(o||s.vNode)}var n=u.prototype.update.call(s,i,o,a);if(r){s.__popGetChildContext()}s.__isUpdating=t;return n};if(!this._isReact)return e();this.__initMountedQueue();var t=e();this.__triggerMountedQueue();return t};a.prototype.__pushGetChildContext=function e(t){var r=t&&t.props._parentRef;var n=r&&r.instance;if(n){var i=this;this.__getChildContext=n.getChildContext;n.getChildContext=function(){var e=i.__getChildContext.call(this);return l({},e,{__parent:i})}}this.__parentInstance=n};a.prototype.__popGetChildContext=function e(){if(this.__parentInstance){this.__parentInstance.getChildContext=this.__getChildContext;this.__getChildContext=null}};a.prototype.componentDidMount=function e(){var t=this;this.__initMountedQueue();this.inited=true;this.parentVNode=this.vNode.parentVNode=this.context.__parent&&this.context.__parent.vNode;var r=this.init(null,this.vNode);var n=this._placeholder;var i=n.parentElement;this.parentDom=i;r[K]=n[K];r[X]=n[X];Object.defineProperty(n,"parentNode",{value:i});i.replaceChild(r,n);n._realElement=r;R(i);this.mountedQueue.push(function(){t.mount()});this.__triggerMountedQueue()};a.prototype.componentWillUnmount=function e(){this.destroy()};a.prototype.componentDidUpdate=function e(){this.__initMountedQueue();var t=H(this.constructor,U(this.props,this.context,{instance:this}));var r=this.vNode;t.children=this;this.vNode=t;this.parentVNode=t.parentVNode=this.context.__parent&&this.context.__parent.vNode;this.update(r,t);this.__triggerMountedQueue()};a.prototype.__ref=function e(t){this._placeholder=t;if(!K){var r=Object.keys(t);K=r[0];X=r[1]}};a.prototype.render=function e(){this.__providers=new Map;var t=this._reactInternalFiber;while(t=t.return){var r=t.tag;if(r===10){var n=t.type;this.__providers.set(n,n._context._currentValue)}else if(r===3){var i=t.stateNode;if(!i.__intactReactDefinedProperty){(function(){var r=void 0;Object.defineProperty(i,"pendingContext",{get:function e(){return r||(t.context?l({},t.context):Object.create(null))},set:function e(t){r=t}});i.__intactReactDefinedProperty=true})()}break}}return p.createElement("i",{ref:this.__ref})};a.prototype.__initMountedQueue=function e(){this._triggerFlagStack.push(this._shouldTrigger);this._shouldTrigger=false;if(!this.mountedQueue||this.mountedQueue.done){var t=void 0;if((t=this.context)&&(t=t.__parent)&&(t=t.mountedQueue)){if(!t.done){this.mountedQueue=t;return}}this._shouldTrigger=true;this._initMountedQueue()}};a.prototype.__triggerMountedQueue=function e(){var t=this;if(this._shouldTrigger){h.all(this.__promises).then(function(){Y=[];t._triggerMountedQueue()})}this._shouldTrigger=this._triggerFlagStack.pop()};t(a,[{key:"isMounted",get:function e(){return this.mounted}}]);return a}(e);ee.functionalWrapper=m;ee.normalize=F;ee.$$cid="IntactReact";ee.prototype.isReactComponent={};ee.contextTypes={_context:g,__parent:g,__promises:g,router:g};ee.childContextTypes={__parent:g,__promises:g};if(!Object.setPrototypeOf){z(ee,e);if(!ee.template){ee.template=e.template}}return ee});
{
"name": "intact-react",
"version": "1.1.29",
"version": "1.1.30",
"description": "A compatibility layer for running intact component in react v16",

@@ -5,0 +5,0 @@ "main": "dist/index.js",

@@ -69,21 +69,2 @@ import React from 'react';

});
// let fiber;
// Object.defineProperty(this, '_reactInternalFiber', {
// get() {
// return fiber;
// },
// set(v) {
// let props;
// Object.defineProperty(v, 'memoizedProps', {
// get() {
// return {...props};
// },
// set(v) {
// props = v;
// }
// });
// fiber = v;
// },
// });
}

@@ -90,0 +71,0 @@

@@ -115,6 +115,10 @@ import ReactDOM from 'react-dom';

// but the real element is inserted before the placeholder by React
dom = placeholder.previousSibling;
// dom = placeholder.previousSibling;
// @modify: look up child to get dom
dom = getDomFromFiber(placeholder._reactRootContainer._internalRoot.current);
}
placeholder._realElement = dom;
dom._placeholder = placeholder;
if (dom) {
dom._placeholder = placeholder;
}
resolve();

@@ -199,1 +203,11 @@ }

}
function getDomFromFiber(fiber) {
if (!fiber) return null;
switch (fiber.tag) {
case 5 /* HostComponent */:
return fiber.stateNode;
default:
return getDomFromFiber(fiber.child);
}
}

@@ -132,2 +132,24 @@ import Intact from '../index';

it('render react component which return null', () => {
function Null() {
return null;
}
function NotNull() {
return <div>test</div>
}
render(
<ChildrenIntactComponent>
<Null />
<NotNull />
</ChildrenIntactComponent>
);
ReactDOM.render(
<ChildrenIntactComponent>
<NotNull />
</ChildrenIntactComponent>,
container
);
expect(container.innerHTML).to.eql('<div><div>test</div></div>');
});
describe('Normalize', () => {

@@ -370,6 +392,6 @@ it('normalize events', () => {

ref.setState({show: false});
// expect(container.innerHTML).to.eql('<div><div>b</div></div>');
expect(container.innerHTML).to.eql('<div><div>b</div></div>');
// ref.setState({show: true});
// expect(container.innerHTML).to.eql('<div><div>a</div></div>');
ref.setState({show: true});
expect(container.innerHTML).to.eql('<div><div>a</div></div>');
});

@@ -376,0 +398,0 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc