Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

preact

Package Overview
Dependencies
Maintainers
1
Versions
246
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

preact - npm Package Compare versions

Comparing version 2.7.3 to 2.8.0

28

dist/preact.js

@@ -134,7 +134,6 @@ (function (global, factory) {

*/
// shouldComponentUpdate() {
// return true;
// }
Component.prototype.shouldComponentUpdate = function shouldComponentUpdate(props, state) {
return true;
};
/** Returns a function that sets a state property when called.

@@ -624,3 +623,3 @@ * Calling linkState() repeatedly with the same arguments returns a cached link function.

var prev = getAccessor(out, _name2, old[_name2]);
if (value !== prev) {
if (value != prev) {
setAccessor(out, _name2, value, prev);

@@ -875,5 +874,7 @@ }

function getAccessor(node, name, value) {
var key = '' + ATTR_PREFIX + name;
if (name !== 'type' && name in node) return node[name];
if (hop.call(node, key)) return node[key];
if (name === 'class') return node.className;
if (name === 'style') return node.style.cssText;
if (name !== 'type' && name in node) return node[name];
return value;

@@ -885,7 +886,8 @@ }

* @private
* @param {Element} node Element to mutate
* @param {String} name prop to set
* @param {Any} value new value to apply
* @param {Any} old old value (not currently used)
*/
function setAccessor(node, name, value, old) {
var key = '' + ATTR_PREFIX + name;
if (node[key] === value) return;
node[key] = value;
function setAccessor(node, name, value) {
if (name === 'class') {

@@ -898,4 +900,6 @@ node.className = value;

} else {
setComplexAccessor(node, name, value, old);
setComplexAccessor(node, name, value);
}
node['' + ATTR_PREFIX + name] = getAccessor(node, name, value);
}

@@ -906,3 +910,3 @@

*/
function setComplexAccessor(node, name, value, old) {
function setComplexAccessor(node, name, value) {
if (name.substring(0, 2) === 'on') {

@@ -909,0 +913,0 @@ var _type = normalizeEventName(name),

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

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.preact={})}(this,function(e){"use strict";function n(e,n){var t=arguments.length<=2||void 0===arguments[2]?null:arguments[2],o=t&&t._component&&t._componentConstructor===e.nodeName,i=h(t,e),a=!o&&i._component;return a&&r(a,"componentWillMount"),h.parentNode!==n&&n.appendChild(i),a&&r(a,"componentDidMount"),i}function t(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),c=2;t>c;c++)r[c-2]=arguments[c];var s=void 0,l=[],u=r.length,d=void 0,p=void 0;if(u){s=[];for(var f=0;u>f;f++){var m=r[f];if(!a(m)){m.join?d=m:(d=l,d[0]=m);for(var v=0;v<d.length;v++){var h=d[v],y=!a(h)&&!i(h);y&&(h=String(h)),y&&p?s[s.length-1]+=h:a(h)||s.push(h),p=y}}}}n&&n.children&&delete n.children;var g=new H(e,n||void 0,s||void 0);return o($,"vnode",g),g}function o(e,n){for(var t=e[n],o=arguments.length,r=Array(o>2?o-2:0),i=2;o>i;i++)r[i-2]=arguments[i];return t&&"function"==typeof t?t.apply(e,r):void 0}function r(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];do o.apply(void 0,[e].concat(t));while(e=e._component)}function i(e){return e&&e.__isVNode===!0}function a(e){return null===e||void 0===e}function c(e,n){if(3===e.nodeType)return"string"==typeof n;if(s(n))return!0;var t=n.nodeName;return"function"==typeof t?e._componentConstructor===t:e.nodeName.toLowerCase()===t}function s(e){var n=e.nodeName;return"function"==typeof n&&!n.prototype.render}function l(e){return e.nodeName(w(e))||M}function u(e){e._dirty||(e._dirty=!0,Z.add(e))}function d(e,n){var t=arguments.length<=2||void 0===arguments[2]?W:arguments[2],r=e._disableRendering;e._disableRendering=!0,o(e,"componentWillReceiveProps",n,e.props),e.nextProps=n,e._disableRendering=r,t.render!==!1&&(t.renderSync||G.syncComponentUpdates?p(e):u(e))}function p(e,n){if(!e._disableRendering){e._dirty=!1;var t=e.nextProps,i=e.state;if(e.base){if(o(e,"shouldComponentUpdate",t,i)===!1)return void(e.props=t);o(e,"componentWillUpdate",t,i)}e.props=t;var a=o(e,"render",t,i),c=a&&a.nodeName,s=void 0;if("function"==typeof c&&c.prototype.render){var l=e._component;l&&l.constructor!==c&&(v(l.base,l,!1),l=null);var u=w(a);l?d(l,u,R):(l=K.create(c,u),l._parentComponent=e,e._component=l,e.base&&r(l,"componentWillMount"),d(l,u,A),p(l,z),e.base&&r(l,"componentDidMount")),s=l.base}else e._component&&v(e.base,e._component),e._component=null,(e.base||n&&n.build)&&(s=h(e.base,a||M,e));if(e.base&&s!==e.base){var f=e.base.parentNode;f&&f.replaceChild(s,e.base)}return e.base=s,s&&(s._component=e,s._componentConstructor=e.constructor),o(e,"componentDidUpdate",t,i),a}}function f(e,n){var t=e&&e._component;if(s(n)){var o=h(e,l(n));return o._componentConstructor=n.nodeName,o}for(var r=t&&e._componentConstructor===n.nodeName;t&&!r&&(t=t._parentComponent);)r=t.constructor===n.nodeName;return r?d(t,w(n),R):(t&&v(e,t),e=m(n)),e}function m(e){var n=w(e),t=K.create(e.nodeName,n);return d(t,n,A),p(t,z),t.base}function v(e,n,t){if(o(n,"componentWillUnmount"),t!==!1){e._component===n&&(delete e._component,delete e._componentConstructor);var r=n.base;r&&r.parentNode&&r.parentNode.removeChild(r)}n._parentComponent=null,o(n,"componentDidUnmount"),K.collect(n)}function h(e,n){var t=e,i=n.nodeName;if("function"!=typeof i||i.prototype.render||(n=l(n),i=n.nodeName),"function"==typeof i)return f(e,n);if("string"==typeof n){if(e){if(3===e.nodeType)return e[L]=n,e;1===e.nodeType&&J.collect(e)}return document.createTextNode(n)}(null===i||void 0===i)&&(i="x-undefined-element"),e?e.nodeName.toLowerCase()!==i&&(t=J.create(i),g(t,V(e.childNodes)),1===e.nodeType&&J.collect(e)):t=J.create(i);var a=x(t)||W,s=n.attributes||W;if(a!==W)for(var u in a)if(E.call(a,u)){var d=s[u];(void 0===d||null===d)&&b(t,u,null,a[u])}if(s!==W)for(var p in s)if(E.call(s,p)){var m=s[p];if(void 0!==m&&null!==m){var v=_(t,p,a[p]);m!==v&&b(t,p,m,v)}}for(var y=V(t.childNodes),C={},N=y.length;N--;){var k=y[N].nodeType,w=void 0;if(3===k)w=k.key;else{if(1!==k)continue;w=y[N].getAttribute("key")}w&&(C[w]=y.splice(N,1)[0])}var T=[];if(n.children)for(var N=0,U=n.children.length;U>N;N++){var S=n.children[N],D=S.attributes,w=void 0,O=void 0;if(D&&(w=D.key,O=w&&C[w]),!O){var P=y.length;if(y.length)for(var A=0;P>A;A++)if(c(y[A],S)){O=y.splice(A,1)[0];break}}T.push(h(O,S))}for(var N=0,P=T.length;P>N;N++)if(t.childNodes[N]!==T[N]){var O=T[N],R=O._component,z=t.childNodes[N+1];R&&r(R,"componentWillMount"),z?t.insertBefore(O,z):t.appendChild(O),R&&r(R,"componentDidMount")}for(var N=0,P=y.length;P>N;N++){var O=y[N],R=O._component;R&&o(R,"componentWillUnmount"),O.parentNode.removeChild(O),R?(o(R,"componentDidUnmount"),K.collect(R)):1===O.nodeType&&J.collect(O)}return t}function y(e,n,t){var o=n.split("."),r=o[0];return function(n){var i,c=this,s=e.state,l=void 0,u=void 0;for("string"==typeof t?(l=I(n,t),a(l)&&(c=c._component)&&(l=I(c,t))):l=(c.nodeName+c.type).match(/^input(checkbox|radio)$/i)?c.checked:c.value,"function"==typeof l&&(l=l.call(c)),u=0;u<o.length-1;u++)s=s[o[u]]||{};s[o[u]]=l,e.setState((i={},i[r]=e.state[r],i))}}function g(e,n){var t=n.length;if(2>=t)return e.appendChild(n[0]),void(2===t&&e.appendChild(n[1]));for(var o=document.createDocumentFragment(),r=0;t>r;r++)o.appendChild(n[r]);e.appendChild(o)}function _(e,n,t){return"class"===n?e.className:"style"===n?e.style.cssText:"type"!==n&&n in e?e[n]:t}function b(e,n,t,o){var r=""+O+n;e[r]!==t&&(e[r]=t,"class"===n?e.className=t:"style"===n?e.style.cssText=t:n in e&&"type"!==n?e[n]=t:C(e,n,t,o))}function C(e,n,t,o){if("on"===n.substring(0,2)){var r=Q(n),i=e._listeners||(e._listeners={});return i[r]||e.addEventListener(r,N),void(i[r]=t)}var a=typeof t;null===t?e.removeAttribute(n):"function"!==a&&"object"!==a&&e.setAttribute(n,t)}function N(e){var n=this._listeners[Q(e.type)];return n?n.call(this,o($,"event",e)||e):void 0}function x(e){var n=e.attributes;return n&&n.getNamedItem?n.length?k(n):void 0:n}function k(e){for(var n={},t=e.length;t--;){var o=e[t];n[o.name]=o.value}return n}function w(e){var n=S({},e.attributes);return e.children&&(n.children=e.children),n}function T(e){var n="",t=": ",o="; ";for(var r in e)if(E.call(e,r)){var i=e[r];n+=X(r),n+=t,n+=i,"number"!=typeof i||E.call(j,r)||(n+="px"),n+=o}return n}function U(e){var n="";for(var t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function S(e,n){for(var t in n)E.call(n,t)&&(e[t]=n[t]);return e}var D={};D.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")};var O="__preactattr_",P="undefined"!=typeof document,W={},A={render:!1},R={renderSync:!0},z={build:!0},M="",L=!P||"textContent"in document?"textContent":"nodeValue",j={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},V=function(e){for(var n=[],t=e.length;t--;)n[t]=e[t];return n},E=Object.prototype.hasOwnProperty,F=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return function(t){return E.call(n,t)?n[t]:n[t]=e(t)}},I=function(e,n){return n.split(".").map(function(n){return e=e&&e[n]}),e},G={syncComponentUpdates:!0},$={vnode:function(e){var n=e.attributes;if(n){var t=n.style;t&&!t.substring&&(n.style=T(t));var o=n["class"];E.call(n,"className")&&(o=n["class"]=n.className,delete n.className),o&&!o.substring&&(n["class"]=U(o))}}},B=function(){function e(){D.classCallCheck(this,e),this._dirty=this._disableRendering=!1,this._linkedStates={},this.nextProps=this.base=null,this.props=o(this,"getDefaultProps")||{},this.state=o(this,"getInitialState")||{},o(this,"initialize")}return e.prototype.shouldComponentUpdate=function(e,n){return!0},e.prototype.linkState=function(e,n){var t=this._linkedStates,o=e+"|"+(n||"");return t[o]||(t[o]=y(this,e,n))},e.prototype.setState=function(e){S(this.state,e),u(this)},e.prototype.setProps=function(e,n){return d(this,e,n)},e.prototype.render=function(e){return t("div",null,e.children)},e}(),H=function ee(e,n,t){D.classCallCheck(this,ee),this.nodeName=e,this.attributes=n,this.children=t};H.prototype.__isVNode=!0;var Z={items:[],itemsOffline:[],add:function(e){if(1===Z.items.push(e)){var n=$.debounceRendering;n?n(Z.process):setTimeout(Z.process,0)}},process:function(){var e=Z.items,n=e.length;if(n)for(Z.items=Z.itemsOffline,Z.items.length=0,Z.itemsOffline=e;n--;)e[n]._dirty&&p(e[n])}},q=Z.process,J={nodes:{},normalizeName:F(function(e){return e.toUpperCase()}),collect:function(e){J.clean(e);var n=J.normalizeName(e.nodeName),t=J.nodes[n];t?t.push(e):J.nodes[n]=[e]},create:function(e){var n=J.normalizeName(e),t=J.nodes[n];return t&&t.pop()||document.createElement(e)},clean:function(e){if(e.parentNode&&e.parentNode.removeChild(e),3!==e.nodeType){delete e._component,delete e._componentConstructor;var n=O.length;for(var t in e)0===t.indexOf(O)&&b(e,t.substring(n),null,e[t])}}},K={components:{},collect:function(e){var n=e.constructor.name,t=K.components[n];t?t.push(e):K.components[n]=[e]},create:function(e,n){var t=K.components[e.name];if(t&&t.length)for(var o=t.length;o--;)if(t[o].constructor===e)return t.splice(o,1)[0];return new e(n)}},Q=F(function(e){return e.replace(/^on/i,"").toLowerCase()}),X=F(function(e){return e.replace(/([A-Z])/,"-$1").toLowerCase()}),Y={options:G,hooks:$,render:n,rerender:q,h:t,Component:B};e.render=n,e.h=t,e.Component=B,e.VNode=H,e.options=G,e.hooks=$,e.rerender=q,e["default"]=Y});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.preact={})}(this,function(e){"use strict";function n(e,n){var t=arguments.length<=2||void 0===arguments[2]?null:arguments[2],o=t&&t._component&&t._componentConstructor===e.nodeName,i=h(t,e),a=!o&&i._component;return a&&r(a,"componentWillMount"),h.parentNode!==n&&n.appendChild(i),a&&r(a,"componentDidMount"),i}function t(e,n){for(var t=arguments.length,r=Array(t>2?t-2:0),c=2;t>c;c++)r[c-2]=arguments[c];var s=void 0,l=[],u=r.length,d=void 0,p=void 0;if(u){s=[];for(var f=0;u>f;f++){var m=r[f];if(!a(m)){m.join?d=m:(d=l,d[0]=m);for(var v=0;v<d.length;v++){var h=d[v],y=!a(h)&&!i(h);y&&(h=String(h)),y&&p?s[s.length-1]+=h:a(h)||s.push(h),p=y}}}}n&&n.children&&delete n.children;var g=new H(e,n||void 0,s||void 0);return o($,"vnode",g),g}function o(e,n){for(var t=e[n],o=arguments.length,r=Array(o>2?o-2:0),i=2;o>i;i++)r[i-2]=arguments[i];return t&&"function"==typeof t?t.apply(e,r):void 0}function r(e){for(var n=arguments.length,t=Array(n>1?n-1:0),r=1;n>r;r++)t[r-1]=arguments[r];do o.apply(void 0,[e].concat(t));while(e=e._component)}function i(e){return e&&e.__isVNode===!0}function a(e){return null===e||void 0===e}function c(e,n){if(3===e.nodeType)return"string"==typeof n;if(s(n))return!0;var t=n.nodeName;return"function"==typeof t?e._componentConstructor===t:e.nodeName.toLowerCase()===t}function s(e){var n=e.nodeName;return"function"==typeof n&&!n.prototype.render}function l(e){return e.nodeName(w(e))||M}function u(e){e._dirty||(e._dirty=!0,Z.add(e))}function d(e,n){var t=arguments.length<=2||void 0===arguments[2]?W:arguments[2],r=e._disableRendering;e._disableRendering=!0,o(e,"componentWillReceiveProps",n,e.props),e.nextProps=n,e._disableRendering=r,t.render!==!1&&(t.renderSync||G.syncComponentUpdates?p(e):u(e))}function p(e,n){if(!e._disableRendering){e._dirty=!1;var t=e.nextProps,i=e.state;if(e.base){if(o(e,"shouldComponentUpdate",t,i)===!1)return void(e.props=t);o(e,"componentWillUpdate",t,i)}e.props=t;var a=o(e,"render",t,i),c=a&&a.nodeName,s=void 0;if("function"==typeof c&&c.prototype.render){var l=e._component;l&&l.constructor!==c&&(v(l.base,l,!1),l=null);var u=w(a);l?d(l,u,R):(l=K.create(c,u),l._parentComponent=e,e._component=l,e.base&&r(l,"componentWillMount"),d(l,u,A),p(l,z),e.base&&r(l,"componentDidMount")),s=l.base}else e._component&&v(e.base,e._component),e._component=null,(e.base||n&&n.build)&&(s=h(e.base,a||M,e));if(e.base&&s!==e.base){var f=e.base.parentNode;f&&f.replaceChild(s,e.base)}return e.base=s,s&&(s._component=e,s._componentConstructor=e.constructor),o(e,"componentDidUpdate",t,i),a}}function f(e,n){var t=e&&e._component;if(s(n)){var o=h(e,l(n));return o._componentConstructor=n.nodeName,o}for(var r=t&&e._componentConstructor===n.nodeName;t&&!r&&(t=t._parentComponent);)r=t.constructor===n.nodeName;return r?d(t,w(n),R):(t&&v(e,t),e=m(n)),e}function m(e){var n=w(e),t=K.create(e.nodeName,n);return d(t,n,A),p(t,z),t.base}function v(e,n,t){if(o(n,"componentWillUnmount"),t!==!1){e._component===n&&(delete e._component,delete e._componentConstructor);var r=n.base;r&&r.parentNode&&r.parentNode.removeChild(r)}n._parentComponent=null,o(n,"componentDidUnmount"),K.collect(n)}function h(e,n){var t=e,i=n.nodeName;if("function"!=typeof i||i.prototype.render||(n=l(n),i=n.nodeName),"function"==typeof i)return f(e,n);if("string"==typeof n){if(e){if(3===e.nodeType)return e[L]=n,e;1===e.nodeType&&J.collect(e)}return document.createTextNode(n)}(null===i||void 0===i)&&(i="x-undefined-element"),e?e.nodeName.toLowerCase()!==i&&(t=J.create(i),g(t,V(e.childNodes)),1===e.nodeType&&J.collect(e)):t=J.create(i);var a=x(t)||W,s=n.attributes||W;if(a!==W)for(var u in a)if(E.call(a,u)){var d=s[u];(void 0===d||null===d)&&b(t,u,null,a[u])}if(s!==W)for(var p in s)if(E.call(s,p)){var m=s[p];if(void 0!==m&&null!==m){var v=_(t,p,a[p]);m!=v&&b(t,p,m,v)}}for(var y=V(t.childNodes),C={},N=y.length;N--;){var k=y[N].nodeType,w=void 0;if(3===k)w=k.key;else{if(1!==k)continue;w=y[N].getAttribute("key")}w&&(C[w]=y.splice(N,1)[0])}var T=[];if(n.children)for(var N=0,S=n.children.length;S>N;N++){var U=n.children[N],D=U.attributes,w=void 0,O=void 0;if(D&&(w=D.key,O=w&&C[w]),!O){var P=y.length;if(y.length)for(var A=0;P>A;A++)if(c(y[A],U)){O=y.splice(A,1)[0];break}}T.push(h(O,U))}for(var N=0,P=T.length;P>N;N++)if(t.childNodes[N]!==T[N]){var O=T[N],R=O._component,z=t.childNodes[N+1];R&&r(R,"componentWillMount"),z?t.insertBefore(O,z):t.appendChild(O),R&&r(R,"componentDidMount")}for(var N=0,P=y.length;P>N;N++){var O=y[N],R=O._component;R&&o(R,"componentWillUnmount"),O.parentNode.removeChild(O),R?(o(R,"componentDidUnmount"),K.collect(R)):1===O.nodeType&&J.collect(O)}return t}function y(e,n,t){var o=n.split("."),r=o[0];return function(n){var i,c=this,s=e.state,l=void 0,u=void 0;for("string"==typeof t?(l=I(n,t),a(l)&&(c=c._component)&&(l=I(c,t))):l=(c.nodeName+c.type).match(/^input(checkbox|radio)$/i)?c.checked:c.value,"function"==typeof l&&(l=l.call(c)),u=0;u<o.length-1;u++)s=s[o[u]]||{};s[o[u]]=l,e.setState((i={},i[r]=e.state[r],i))}}function g(e,n){var t=n.length;if(2>=t)return e.appendChild(n[0]),void(2===t&&e.appendChild(n[1]));for(var o=document.createDocumentFragment(),r=0;t>r;r++)o.appendChild(n[r]);e.appendChild(o)}function _(e,n,t){var o=""+O+n;return"type"!==n&&n in e?e[n]:E.call(e,o)?e[o]:"class"===n?e.className:"style"===n?e.style.cssText:t}function b(e,n,t){"class"===n?e.className=t:"style"===n?e.style.cssText=t:n in e&&"type"!==n?e[n]=t:C(e,n,t),e[""+O+n]=_(e,n,t)}function C(e,n,t){if("on"===n.substring(0,2)){var o=Q(n),r=e._listeners||(e._listeners={});return r[o]||e.addEventListener(o,N),void(r[o]=t)}var i=typeof t;null===t?e.removeAttribute(n):"function"!==i&&"object"!==i&&e.setAttribute(n,t)}function N(e){var n=this._listeners[Q(e.type)];return n?n.call(this,o($,"event",e)||e):void 0}function x(e){var n=e.attributes;return n&&n.getNamedItem?n.length?k(n):void 0:n}function k(e){for(var n={},t=e.length;t--;){var o=e[t];n[o.name]=o.value}return n}function w(e){var n=U({},e.attributes);return e.children&&(n.children=e.children),n}function T(e){var n="",t=": ",o="; ";for(var r in e)if(E.call(e,r)){var i=e[r];n+=X(r),n+=t,n+=i,"number"!=typeof i||E.call(j,r)||(n+="px"),n+=o}return n}function S(e){var n="";for(var t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function U(e,n){for(var t in n)E.call(n,t)&&(e[t]=n[t]);return e}var D={};D.classCallCheck=function(e,n){if(!(e instanceof n))throw new TypeError("Cannot call a class as a function")};var O="__preactattr_",P="undefined"!=typeof document,W={},A={render:!1},R={renderSync:!0},z={build:!0},M="",L=!P||"textContent"in document?"textContent":"nodeValue",j={boxFlex:1,boxFlexGroup:1,columnCount:1,fillOpacity:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,fontWeight:1,lineClamp:1,lineHeight:1,opacity:1,order:1,orphans:1,strokeOpacity:1,widows:1,zIndex:1,zoom:1},V=function(e){for(var n=[],t=e.length;t--;)n[t]=e[t];return n},E=Object.prototype.hasOwnProperty,F=function(e){var n=arguments.length<=1||void 0===arguments[1]?{}:arguments[1];return function(t){return E.call(n,t)?n[t]:n[t]=e(t)}},I=function(e,n){return n.split(".").map(function(n){return e=e&&e[n]}),e},G={syncComponentUpdates:!0},$={vnode:function(e){var n=e.attributes;if(n){var t=n.style;t&&!t.substring&&(n.style=T(t));var o=n["class"];E.call(n,"className")&&(o=n["class"]=n.className,delete n.className),o&&!o.substring&&(n["class"]=S(o))}}},B=function(){function e(){D.classCallCheck(this,e),this._dirty=this._disableRendering=!1,this._linkedStates={},this.nextProps=this.base=null,this.props=o(this,"getDefaultProps")||{},this.state=o(this,"getInitialState")||{},o(this,"initialize")}return e.prototype.linkState=function(e,n){var t=this._linkedStates,o=e+"|"+(n||"");return t[o]||(t[o]=y(this,e,n))},e.prototype.setState=function(e){U(this.state,e),u(this)},e.prototype.setProps=function(e,n){return d(this,e,n)},e.prototype.render=function(e){return t("div",null,e.children)},e}(),H=function ee(e,n,t){D.classCallCheck(this,ee),this.nodeName=e,this.attributes=n,this.children=t};H.prototype.__isVNode=!0;var Z={items:[],itemsOffline:[],add:function(e){if(1===Z.items.push(e)){var n=$.debounceRendering;n?n(Z.process):setTimeout(Z.process,0)}},process:function(){var e=Z.items,n=e.length;if(n)for(Z.items=Z.itemsOffline,Z.items.length=0,Z.itemsOffline=e;n--;)e[n]._dirty&&p(e[n])}},q=Z.process,J={nodes:{},normalizeName:F(function(e){return e.toUpperCase()}),collect:function(e){J.clean(e);var n=J.normalizeName(e.nodeName),t=J.nodes[n];t?t.push(e):J.nodes[n]=[e]},create:function(e){var n=J.normalizeName(e),t=J.nodes[n];return t&&t.pop()||document.createElement(e)},clean:function(e){if(e.parentNode&&e.parentNode.removeChild(e),3!==e.nodeType){delete e._component,delete e._componentConstructor;var n=O.length;for(var t in e)0===t.indexOf(O)&&b(e,t.substring(n),null,e[t])}}},K={components:{},collect:function(e){var n=e.constructor.name,t=K.components[n];t?t.push(e):K.components[n]=[e]},create:function(e,n){var t=K.components[e.name];if(t&&t.length)for(var o=t.length;o--;)if(t[o].constructor===e)return t.splice(o,1)[0];return new e(n)}},Q=F(function(e){return e.replace(/^on/i,"").toLowerCase()}),X=F(function(e){return e.replace(/([A-Z])/,"-$1").toLowerCase()}),Y={options:G,hooks:$,render:n,rerender:q,h:t,Component:B};e.render=n,e.h=t,e.Component=B,e.VNode=H,e.options=G,e.hooks=$,e.rerender=q,e["default"]=Y});
//# sourceMappingURL=preact.min.js.map
{
"name": "preact",
"amdName": "preact",
"version": "2.7.3",
"version": "2.8.0",
"description": "Tiny & fast Component-based virtual DOM framework.",

@@ -15,3 +15,3 @@ "main": "dist/preact.js",

"size": "size=$(gzip-size $npm_package_minified_main) && echo \"gzip size: $size / $(pretty-bytes $size)\"",
"test": "eslint src test && npm run test:mocha && npm run test:karma",
"test": "eslint src test && npm-run-all --parallel test:mocha test:karma",
"test:mocha": "mocha --recursive --compilers js:babel/register test/shared test/node",

@@ -55,5 +55,5 @@ "test:karma": "karma start --single-run",

"phantomjs": "^1.9.18",
"pretty-bytes": "^2.0.1",
"rimraf": "2.4.4",
"rollup": "^0.24.0",
"pretty-bytes-cli": "^1.0.0",
"rimraf": "^2.5.1",
"rollup": "^0.25.1",
"rollup-plugin-babel": "^1.0.0",

@@ -60,0 +60,0 @@ "sinon": "^1.17.2",

# Preact
[![npm](https://img.shields.io/npm/v/preact.svg)](http://npm.im/preact)
[![travis](https://travis-ci.org/developit/preact.svg)](https://travis-ci.org/developit/preact)
[![travis](https://travis-ci.org/developit/preact.svg?branch=master)](https://travis-ci.org/developit/preact)
[![gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/developit/preact)

@@ -12,12 +12,17 @@

> :information_desk_person: **Documentation is available in the [Preact Wiki](https://github.com/developit/preact/wiki).**
## Demos
- [ESBench](http://esbench.com) is built using Preact.
- [Documentation Viewer](https://documentation-viewer.firebaseapp.com) _([Github Project](https://github.com/developit/documentation-viewer))_
- [TodoMVC](http://developit.github.io/preact-todomvc/) _([Github Project](https://github.com/developit/preact-todomvc))_
- [Flickr Browser](http://codepen.io/developit/full/VvMZwK/) (@ CodePen)
- [Animating Text](http://codepen.io/developit/full/LpNOdm/) (@ CodePen)
- [60FPS Rainbow Spiral](http://codepen.io/developit/full/xGoagz/) (@ CodePen)
- [Simple Clock](http://jsfiddle.net/developit/u9m5x0L7/embedded/result,js/) (@ JSFiddle)
- [**ESBench**](http://esbench.com) is built using Preact.
- [**Nectarine.rocks**](http://nectarine.rocks) _([Github Project](https://github.com/developit/nectarine))_ :peach:
- [**Documentation Viewer**](https://documentation-viewer.firebaseapp.com) _([Github Project](https://github.com/developit/documentation-viewer))_
- [**TodoMVC**](http://developit.github.io/preact-todomvc/) _([Github Project](https://github.com/developit/preact-todomvc))_
- [**Hacker News Minimal**](https://developit.github.io/hn_minimal/) _([Github Project](https://github.com/developit/hn_minimal))_
- [**Preact Boilerplate**](https://preact-boilerplate.surge.sh) _([Github Project](https://github.com/developit/preact-boilerplate))_ :zap:
- [**Flickr Browser**](http://codepen.io/developit/full/VvMZwK/) (@ CodePen)
- [**Animating Text**](http://codepen.io/developit/full/LpNOdm/) (@ CodePen)
- [**60FPS Rainbow Spiral**](http://codepen.io/developit/full/xGoagz/) (@ CodePen)
- [**Simple Clock**](http://jsfiddle.net/developit/u9m5x0L7/embedded/result,js/) (@ JSFiddle)
- [**3D + ThreeJS**](http://codepen.io/developit/pen/PPMNjd?editors=0010) (@ CodePen)
- [**Create your Own!**](https://jsfiddle.net/developit/rs6zrh5f/embedded/result/) (@ JSFiddle)

@@ -28,7 +33,10 @@

- :earth_americas: [**preact-router**](http://git.io/preact-router): URL routing for your components.
- :tulip: [**preact-svg**](http://git.io/preact-svg): Use inline `<svg>` in Preact.
- :page_facing_up: [**preact-render-to-string**](http://git.io/preact-render-to-string): Universal rendering.
- :raised_hands: [**preact-compat**](http://git.io/preact-compat): use any React library with Preact. *([full example](http://git.io/preact-compat-example))*
- :rocket: [**preact-photon**](http://git.io/preact-photon): build beautiful desktop UI with [photon](http://photonkit.com).
- :earth_americas: [**preact-router**](https://git.io/preact-router): URL routing for your components.
- :tulip: [**preact-svg**](https://git.io/preact-svg): Use inline `<svg>` in Preact.
- :page_facing_up: [**preact-render-to-string**](https://git.io/preact-render-to-string): Universal rendering.
- :raised_hands: [**preact-compat**](https://git.io/preact-compat): use any React library with Preact. *([full example](http://git.io/preact-compat-example))*
- :rocket: [**preact-photon**](https://git.io/preact-photon): build beautiful desktop UI with [photon](http://photonkit.com).
- :microscope: [**preact-jsx-chai**](https://git.io/preact-jsx-chai): JSX assertion testing _(no DOM or phantomjs!)_
- :bookmark_tabs: [**preact-markup**](https://git.io/preact-markup): Render HTML & Custom Elements as JSX & Components
- :pencil: [**preact-richtextarea**](https://git.io/preact-richtextarea): Simple HTML editor component

@@ -40,3 +48,3 @@

The following guide assumes you have some sort of ES2015 build set up using babel and/or webpack/browserify/gulp/grunt/etc. If you don't, start with [preact-boilerplate] or a [CodePen Template](http://codepen.io/developit/pen/PPMNjd?editors=001).
The following guide assumes you have some sort of ES2015 build set up using babel and/or webpack/browserify/gulp/grunt/etc. If you don't, start with [preact-boilerplate] or a [CodePen Template](http://codepen.io/developit/pen/pgaROe?editors=0010).

@@ -212,3 +220,3 @@

render({ }, { text }) {
return <input value={text} inInput={this.linkState('text')} />;
return <input value={text} onInput={this.linkState('text')} />;
}

@@ -215,0 +223,0 @@ }

@@ -110,5 +110,5 @@ const ATTR_PREFIX = '__preactattr_';

*/
shouldComponentUpdate(props, state) {
return true;
}
// shouldComponentUpdate() {
// return true;
// }

@@ -613,3 +613,3 @@ /** Returns a function that sets a state property when called.

let prev = getAccessor(out, name, old[name]);
if (value!==prev) {
if (value!=prev) {
setAccessor(out, name, value, prev);

@@ -880,5 +880,7 @@ }

function getAccessor(node, name, value) {
let key = `${ATTR_PREFIX}${name}`;
if (name!=='type' && name in node) return node[name];
if (hop.call(node, key)) return node[key];
if (name==='class') return node.className;
if (name==='style') return node.style.cssText;
if (name!=='type' && name in node) return node[name];
return value;

@@ -892,7 +894,8 @@ }

* @private
* @param {Element} node Element to mutate
* @param {String} name prop to set
* @param {Any} value new value to apply
* @param {Any} old old value (not currently used)
*/
function setAccessor(node, name, value, old) {
let key = `${ATTR_PREFIX}${name}`;
if (node[key]===value) return;
node[key] = value;
function setAccessor(node, name, value) {
if (name==='class') {

@@ -908,4 +911,6 @@ node.className = value;

else {
setComplexAccessor(node, name, value, old);
setComplexAccessor(node, name, value);
}
node[`${ATTR_PREFIX}${name}`] = getAccessor(node, name, value);
}

@@ -917,3 +922,3 @@

*/
function setComplexAccessor(node, name, value, old) {
function setComplexAccessor(node, name, value) {
if (name.substring(0,2)==='on') {

@@ -920,0 +925,0 @@ let type = normalizeEventName(name),

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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