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

tusk

Package Overview
Dependencies
Maintainers
1
Versions
97
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tusk - npm Package Compare versions

Comparing version 0.7.5 to 0.7.6

bin/tusk.js.map

3

bin/tusk.js

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

!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.tusk=e()}}(function(){return function e(t,n,i){function r(s,u){if(!n[s]){if(!t[s]){var l="function"==typeof require&&require;if(!u&&l)return l(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=n[s]={exports:{}};t[s][0].call(h.exports,function(e){var n=t[s][1][e];return r(n?n:e)},h,h.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){t.exports={NODE:"__node__",NAMESPACES:{HTML:"http://www.w3.org/1999/xhtml",MATH_ML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg"},SELF_CLOSING:["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],EVENTS:["animationend","animationiteration","animationstart","beforeunload","blur","canplay","canplaythrough","change","click","contextmenu","copy","cut","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","focus","fullscreenchange","input","keydown","keypress","keyup","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","paste","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","touchcancel","touchend","touchmove","touchstart","transitionend","visibilitychange","volumechange","waiting","wheel"]}},{}],2:[function(e,t,n){var i,r,o,s;s=e(1),r=s.NODE,i=s.EVENTS,o=function(e){var t,n,i,o,s,u;if(s=e.target,u=e.type,u=u.toLowerCase(),e.bubbles)for(e.stopPropagation=function(){return e.cancelBubble=!0},Object.defineProperty(e,"currentTarget",{value:s,writable:!0});s&&(e.currentTarget=s,i=s[r],s=s.parentNode,null!=i&&"function"==typeof(n=i.events)[u]&&n[u](e),!e.cancelBubble););else null!=(o=s[r])&&"function"==typeof(t=o.events)[u]&&t[u](e)},t.exports={dispatch:function(e,t,n){var i;null==n&&(n=!1),i=document.createEvent("Event"),i.initEvent(e,n,!1),Object.defineProperties(i,{target:{value:t},srcElement:{value:t}}),o(i)},init:function(){var e,t,n;if(!document.__tusk){for(e=0,t=i.length;t>e;e++)n=i[e],document.addEventListener(n,o,!0);document.__tusk=!0}}}},{1:1}],3:[function(e,t,n){var i,r,o,s,u,l,a,h,c;r=e(5),u=e(2),i=e(1).NODE,h=e(4),l=h.flatten,a=h.getDiff,o=void 0,s=void 0,c=function(e,t){var n,i,u,a;switch(u=arguments.length-2,i=function(){if(0>=u)return[];for(n=new Array(arguments.length-2);u--;)n[u]=arguments[u+2];return l(n)}.apply(this,arguments),typeof e){case"string":return new r(e,s,t,i);case"function":return s=e,a=e(t,i,o),s=void 0,a;default:throw new TypeError("Tusk: Invalid virtual node type.")}},c.createElement=c,c.render=function(e,t){var n,r,o,s,l,h;if("undefined"==typeof window)throw new Error("Tusk: Cannot render on the server (use toString).");if(!(e instanceof window.Node))throw new Error("Tusk: Container must be a DOM element.");if(!(null!=t?t.isTusk:void 0))throw new Error("Tusk: Can only render a virtual node.");(null!=(s=e[i])?s.update(t):void 0)||(o=e.outerHTML,r=t.toString(),r===o?t.mount(e):(e[i]=t,e.parentNode.replaceChild(t.create(),e),null!=o&&(l=a(o,r),h=l[0],n=l[1])),u.init())},c.with=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Tusk: renderer should be a function.");return o=e,n=t(e),o=void 0,n},t.exports=c.default=c},{1:1,2:2,4:4,5:5}],4:[function(e,t,n){var i;t.exports={escapeHTML:function(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},flatten:i=function(e,t){var n,r,o;for(null==t&&(t=[]),r=0,o=e.length;o>r;r++)n=e[r],(null!=n?n.constructor:void 0)===Array?i(n,t):t.push(n);return t},getDiff:function(e,t){var n,i,r,o,s,u;for(r=o=0,s=e.length;s>o&&(n=e[r],n===t[r]);r=++o);return u=Math.max(0,r-20),i=u+80,[e.slice(u,Math.min(i,e.length)),t.slice(u,Math.min(i,t.length))]},setAttrs:function(e,t,n){var i,r;if(t!==n){for(i in n)r=n[i],r!==t[i]&&e.setAttribute(i,r);for(i in t)i in n||e.removeAttribute(i)}},setChildren:function(e,t,n){var i,r,o;if(t!==n){for(r in n){if(i=n[r],r in t){if((o=t[r]).update(i),o.index===i.index)continue}else i.create();e.insertBefore(i._elem,e.childNodes[i.index])}for(r in t)i=t[r],r in n||i.remove()}}}},{}],5:[function(e,t,n){var i,r,o,s,u,l,a,h,c,f,d,p,m=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};c=e(1),s=c.SELF_CLOSING,r=c.NODE,i=c.NAMESPACES,f=e(4),a=f.escapeHTML,d=f.setAttrs,p=f.setChildren,l=e(2).dispatch,u=e(6),h=function(e,t,n){var i,r,o,s;if(null==t&&(t=" "),null==n&&(n=0),t.constructor===Array)for(r=o=0,s=t.length;s>o;r=++o)i=t[r],h(e,i,n+r);else t.isTusk||(t=new u(t)),null==t.namespaceURI&&(t.namespaceURI=e.namespaceURI),t.index=n,e.children[t.key||n]=t},o=function(e,t,n,r){var o,u,l;if(this.type=e,this.owner=t,this.namespaceURI="svg"===this.type?i.SVG:"math"===this.type?i.MATH_ML:void 0,this.attrs={},this.events={},this.children={},null!=n){this.key=n.key,delete n.key,this.ignore="ignore"in n&&n.ignore!==!1,delete n.ignore,this.innerHTML=n.innerHTML,delete n.innerHTML;for(o in n)l=n[o],"on"===o.slice(0,2)?this.events[o.slice(2).toLowerCase()]=l:null!=l&&l!==!1&&(this.attrs[o]=l)}null!=this.innerHTML||(u=this.type,m.call(s,u)>=0)||h(this,r)},o.prototype.isTusk=!0,o.prototype.mount=function(e){var t,n,i,o;if(this._elem=(n=e.childNodes,e),e[r]=this,null==this.innerHTML){o=this.children;for(i in o)t=o[i],t.mount(n[t.index||i])}l("mount",e)},o.prototype.dismount=function(){var e,t,n;l("dismount",this._elem),n=this.children;for(t in n)e=n[t],"function"==typeof e.dismount&&e.dismount()},o.prototype.create=function(){var e,t,n,o;return n=null!=this._elem?this._elem:this._elem=document.createElementNS(this.namespaceURI||i.HTML,this.type),o=n[r],n[r]=this,o?(e=o.attrs,t=o.children):e=t={},d(n,e,this.attrs),null!=this.innerHTML?n.innerHTML=this.innerHTML:p(n,t,this.children),l("mount",n),n},o.prototype.update=function(e){var t;if(this===e||this.ignore)return this;if(this.type!==e.type)this._elem.parentNode.insertBefore(e.create(),this._elem),this.remove();else{if(t=this.owner!==e.owner,t&&l("dismount",this._elem),this._elem[r]=e,e._elem=this._elem,d(this._elem,this.attrs,e.attrs),null!=e.innerHTML)this.innerHTML!==e.innerHTML&&(this._elem.innerHTML=e.innerHTML);else{if(null!=this.innerHTML)for(;this._elem.firstChild;)this._elem.removeChild(this._elem.firstChild);p(this._elem,this.children,e.children)}t&&l("mount",this._elem)}return e},o.prototype.remove=function(){return this.dismount(),this._elem.parentNode.removeChild(this._elem)},o.prototype.toString=function(){var e,t,n,i,r,o,u,l;e=n="",r=this.attrs;for(i in r)l=r[i],e+=" "+i+'="'+a(l)+'"';if(null!=this.innerHTML)n=this.innerHTML;else{o=this.children;for(i in o)t=o[i],n+=t}return u=this.type,m.call(s,u)>=0?"<"+(this.type+e)+">":"<"+(this.type+e)+">"+n+"</"+this.type+">"},t.exports=o},{1:1,2:2,4:4,6:6}],6:[function(e,t,n){var i,r;r=e(4).escapeHTML,i=function(e){this.value=String(e)},i.prototype.isTusk=!0,i.prototype.mount=function(e){var t;this._elem=(t=e.nodeValue,e),this.value!==t&&e.splitText(t.indexOf(this.value)+this.value.length)},i.prototype.create=function(){return null==this._elem&&(this._elem=document.createTextNode(this.value)),this._elem.nodeValue!==this.value&&(this._elem.nodeValue=this.value),this._elem},i.prototype.update=function(e){return this===e?this:(e.constructor===i?(e._elem=this._elem,this.value!==e.value&&(this._elem.nodeValue=e.value)):this._elem.parentNode.replaceChild(e.create(),this._elem),e)},i.prototype.remove=function(){return this._elem.parentNode.removeChild(this._elem)},i.prototype.toString=function(){return r(this.value)},t.exports=i},{4:4}]},{},[3])(3)});
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.tusk=e()}}(function(){return function e(t,n,i){function r(s,u){if(!n[s]){if(!t[s]){var l="function"==typeof require&&require;if(!u&&l)return l(s,!0);if(o)return o(s,!0);var a=new Error("Cannot find module '"+s+"'");throw a.code="MODULE_NOT_FOUND",a}var h=n[s]={exports:{}};t[s][0].call(h.exports,function(e){var n=t[s][1][e];return r(n?n:e)},h,h.exports,e,t,n,i)}return n[s].exports}for(var o="function"==typeof require&&require,s=0;s<i.length;s++)r(i[s]);return r}({1:[function(e,t,n){t.exports={NODE:"__node__",NAMESPACES:{HTML:"http://www.w3.org/1999/xhtml",MATH_ML:"http://www.w3.org/1998/Math/MathML",SVG:"http://www.w3.org/2000/svg"},SELF_CLOSING:["area","base","br","col","command","embed","hr","img","input","keygen","link","meta","param","source","track","wbr"],EVENTS:["animationend","animationiteration","animationstart","beforeunload","blur","canplay","canplaythrough","change","click","contextmenu","copy","cut","dblclick","drag","dragend","dragenter","dragexit","dragleave","dragover","dragstart","drop","durationchange","emptied","ended","focus","fullscreenchange","input","keydown","keypress","keyup","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","paste","pause","play","playing","progress","ratechange","reset","scroll","seeked","seeking","select","stalled","submit","suspend","timeupdate","touchcancel","touchend","touchmove","touchstart","transitionend","visibilitychange","volumechange","waiting","wheel"]}},{}],2:[function(e,t,n){var i,r,o,s;s=e(1),r=s.NODE,i=s.EVENTS,o=function(e){var t,n,i,o,s,u;if(s=e.target,u=e.type,u=u.toLowerCase(),e.bubbles)for(e.stopPropagation=function(){return e.cancelBubble=!0},Object.defineProperty(e,"currentTarget",{value:s,writable:!0});s&&(e.currentTarget=s,i=s[r],s=s.parentNode,null!=i&&"function"==typeof(n=i.events)[u]&&n[u](e),!e.cancelBubble););else null!=(o=s[r])&&"function"==typeof(t=o.events)[u]&&t[u](e)},t.exports={dispatch:function(e,t,n){var i;null==n&&(n=!1),i=document.createEvent("Event"),i.initEvent(e,n,!1),Object.defineProperties(i,{target:{value:t},srcElement:{value:t}}),o(i)},init:function(){var e,t,n;if(!document.__tusk){for(e=0,t=i.length;t>e;e++)n=i[e],document.addEventListener(n,o,!0);document.__tusk=!0}}}},{1:1}],3:[function(e,t,n){var i,r,o,s,u,l,a,h,c;r=e(5),u=e(2),i=e(1).NODE,h=e(4),l=h.flatten,a=h.getDiff,o=void 0,s=void 0,c=function(e,t){var n,i,u,a;switch(u=arguments.length-2,i=function(){if(0>=u)return[];for(n=new Array(arguments.length-2);u--;)n[u]=arguments[u+2];return l(n)}.apply(this,arguments),typeof e){case"string":return new r(e,s,t,i);case"function":return s=e,a=e(t,i,o),s=void 0,a;default:throw new TypeError("Tusk: Invalid virtual node type.")}},c.createElement=c,c.render=function(e,t){var n,r,o,s,l,h;if("undefined"==typeof window)throw new Error("Tusk: Cannot render on the server (use toString).");if(!(e instanceof window.Node))throw new Error("Tusk: Container must be a DOM element.");if(!(null!=t?t.isTusk:void 0))throw new Error("Tusk: Can only render a virtual node.");(null!=(s=e[i])?s.update(t):void 0)||(o=e.outerHTML,r=t.toString(),r===o?t.mount(e):(e[i]=t,e.parentNode.replaceChild(t.create(),e),null!=o&&(l=a(o,r),h=l[0],n=l[1])),u.init())},c.with=function(e,t){var n;if("function"!=typeof t)throw new TypeError("Tusk: renderer should be a function.");return o=e,n=t(e),o=void 0,n},t.exports=c.default=c},{1:1,2:2,4:4,5:5}],4:[function(e,t,n){var i;t.exports={escapeHTML:function(e){return String(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")},flatten:i=function(e,t){var n,r,o;for(null==t&&(t=[]),r=0,o=e.length;o>r;r++)n=e[r],(null!=n?n.constructor:void 0)===Array?i(n,t):t.push(n);return t},getDiff:function(e,t){var n,i,r,o,s,u;for(r=o=0,s=e.length;s>o&&(n=e[r],n===t[r]);r=++o);return u=Math.max(0,r-20),i=u+80,[e.slice(u,Math.min(i,e.length)),t.slice(u,Math.min(i,t.length))]},setAttrs:function(e,t,n){var i,r;if(t!==n){for(i in n)r=n[i],r!==t[i]&&e.setAttribute(i,r);for(i in t)i in n||e.removeAttribute(i)}},setChildren:function(e,t,n){var i,r,o;if(t!==n){for(r in n){if(i=n[r],r in t){if((o=t[r]).update(i),o.index===i.index)continue}else i.create();e.insertBefore(i._elem,e.childNodes[i.index])}for(r in t)i=t[r],r in n||i.remove()}}}},{}],5:[function(e,t,n){var i,r,o,s,u,l,a,h,c,f,d,p,m=[].indexOf||function(e){for(var t=0,n=this.length;n>t;t++)if(t in this&&this[t]===e)return t;return-1};c=e(1),s=c.SELF_CLOSING,r=c.NODE,i=c.NAMESPACES,f=e(4),a=f.escapeHTML,d=f.setAttrs,p=f.setChildren,l=e(2).dispatch,u=e(6),h=function(e,t,n){var i,r,o,s;if(null==t&&(t=" "),null==n&&(n=0),t.constructor===Array)for(r=o=0,s=t.length;s>o;r=++o)i=t[r],h(e,i,n+r);else t.isTusk||(t=new u(t)),null==t.namespaceURI&&(t.namespaceURI=e.namespaceURI),t.index=n,e.children[t.key||n]=t},o=function(e,t,n,r){var o,u,l;if(this.type=e,this.owner=t,this.namespaceURI="svg"===this.type?i.SVG:"math"===this.type?i.MATH_ML:void 0,this.attrs={},this.events={},this.children={},null!=n){this.key=n.key,delete n.key,this.ignore="ignore"in n&&n.ignore!==!1,delete n.ignore,this.innerHTML=n.innerHTML,delete n.innerHTML;for(o in n)l=n[o],"on"===o.slice(0,2)?this.events[o.slice(2).toLowerCase()]=l:null!=l&&l!==!1&&(this.attrs[o]=l)}null!=this.innerHTML||(u=this.type,m.call(s,u)>=0)||h(this,r)},o.prototype.isTusk=!0,o.prototype.mount=function(e){var t,n,i,o;if(this._elem=(n=e.childNodes,e),e[r]=this,null==this.innerHTML){o=this.children;for(i in o)t=o[i],t.mount(n[t.index||i])}l("mount",e)},o.prototype.dismount=function(){var e,t,n;l("dismount",this._elem),n=this.children;for(t in n)e=n[t],"function"==typeof e.dismount&&e.dismount()},o.prototype.create=function(){var e,t,n,o;return n=null!=this._elem?this._elem:this._elem=document.createElementNS(this.namespaceURI||i.HTML,this.type),o=n[r],n[r]=this,o?(e=o.attrs,t=o.children):e=t={},d(n,e,this.attrs),null!=this.innerHTML?n.innerHTML=this.innerHTML:p(n,t,this.children),l("mount",n),n},o.prototype.update=function(e){var t;if(this===e)return this;if(this.ignore&&e.ignore)return this;if(this.type!==e.type)this._elem.parentNode.insertBefore(e.create(),this._elem),this.remove();else{if(t=this.owner!==e.owner,t&&l("dismount",this._elem),this._elem[r]=e,e._elem=this._elem,d(this._elem,this.attrs,e.attrs),null!=e.innerHTML)this.innerHTML!==e.innerHTML&&(this._elem.innerHTML=e.innerHTML);else{if(null!=this.innerHTML)for(;this._elem.firstChild;)this._elem.removeChild(this._elem.firstChild);p(this._elem,this.children,e.children)}t&&l("mount",this._elem)}return e},o.prototype.remove=function(){return this.dismount(),this._elem.parentNode.removeChild(this._elem)},o.prototype.toString=function(){var e,t,n,i,r,o,u,l;e=n="",r=this.attrs;for(i in r)l=r[i],e+=" "+i+'="'+a(l)+'"';if(null!=this.innerHTML)n=this.innerHTML;else{o=this.children;for(i in o)t=o[i],n+=t}return u=this.type,m.call(s,u)>=0?"<"+(this.type+e)+">":"<"+(this.type+e)+">"+n+"</"+this.type+">"},t.exports=o},{1:1,2:2,4:4,6:6}],6:[function(e,t,n){var i,r;r=e(4).escapeHTML,i=function(e){this.value=String(e)},i.prototype.isTusk=!0,i.prototype.mount=function(e){var t;this._elem=(t=e.nodeValue,e),this.value!==t&&e.splitText(t.indexOf(this.value)+this.value.length)},i.prototype.create=function(){return null==this._elem&&(this._elem=document.createTextNode(this.value)),this._elem.nodeValue!==this.value&&(this._elem.nodeValue=this.value),this._elem},i.prototype.update=function(e){return this===e?this:(e.constructor===i?(e._elem=this._elem,this.value!==e.value&&(this._elem.nodeValue=e.value)):this._elem.parentNode.replaceChild(e.create(),this._elem),e)},i.prototype.remove=function(){return this._elem.parentNode.removeChild(this._elem)},i.prototype.toString=function(){return r(this.value)},t.exports=i},{4:4}]},{},[3])(3)});
//# sourceMappingURL=tusk.js.map

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

/** tusk v0.7.5 https://www.npmjs.com/package/tusk */
/** tusk v0.7.6 https://www.npmjs.com/package/tusk */
"use strict";

@@ -3,0 +3,0 @@ module.exports = {

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

/** tusk v0.7.5 https://www.npmjs.com/package/tusk */
/** tusk v0.7.6 https://www.npmjs.com/package/tusk */
"use strict";

@@ -3,0 +3,0 @@ var EVENTS, NODE, handleEvent, ref;

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

/** tusk v0.7.5 https://www.npmjs.com/package/tusk */
/** tusk v0.7.6 https://www.npmjs.com/package/tusk */
"use strict";

@@ -3,0 +3,0 @@ var NODE, Node, _context, _owner, delegator, flatten, getDiff, ref, tusk;

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

/** tusk v0.7.5 https://www.npmjs.com/package/tusk */
/** tusk v0.7.6 https://www.npmjs.com/package/tusk */
"use strict";

@@ -3,0 +3,0 @@ var flatten;

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

/** tusk v0.7.5 https://www.npmjs.com/package/tusk */
/** tusk v0.7.6 https://www.npmjs.com/package/tusk */
"use strict";

@@ -186,5 +186,8 @@ var NAMESPACES, NODE, Node, SELF_CLOSING, Text, dispatch, escapeHTML, normalizeChildren, ref, ref1, setAttrs, setChildren,

var newOwner;
if (this === updated || this.ignore) {
if (this === updated) {
return this;
}
if (this.ignore && updated.ignore) {
return this;
}
if (this.type !== updated.type) {

@@ -191,0 +194,0 @@ this._elem.parentNode.insertBefore(updated.create(), this._elem);

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

/** tusk v0.7.5 https://www.npmjs.com/package/tusk */
/** tusk v0.7.6 https://www.npmjs.com/package/tusk */
"use strict";

@@ -3,0 +3,0 @@ var Text, escapeHTML;

{
"name": "tusk",
"version": "0.7.5",
"version": "0.7.6",
"description": "A slim virtual dom implementation for immutable structures.",

@@ -37,2 +37,3 @@ "author": "Dylan Piercey <pierceydylan@gmail.com>",

"gulp-mocha": "^2.1.3",
"gulp-sourcemaps": "^1.5.2",
"gulp-uglify": "^1.4.1",

@@ -39,0 +40,0 @@ "husky": "^0.10.1",

@@ -163,3 +163,3 @@ # TUSK

## Stateful Nodes
Sometimes it makes sense to have full control over the DOM for certain types of components. In Tusk the framework won't fight you and instead provides an attribute for these types of nodes; "ignore".
Sometimes it makes sense to have full control over the DOM for certain types of components. In Tusk the framework won't fight you and instead provides an attribute for these types of nodes; "ignore". An ignored node will skip updates if the new node also has an "ignore" attribute.

@@ -166,0 +166,0 @@ ```javascript

Sorry, the diff of this file is not supported yet

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