@egjs/children-differ
Advanced tools
Comparing version 1.0.0 to 1.0.1
import { ChildrenDiffResult } from "./types"; | ||
export declare function diff<T extends Element = Element>(prevList: T[], list: T[]): ChildrenDiffResult; | ||
export declare function diff<T extends Element = Element>(prevList: T[], list: T[]): ChildrenDiffResult<T>; |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-children-differ | ||
version: 1.0.0 | ||
version: 1.0.1 | ||
*/ | ||
@@ -10,0 +10,0 @@ import ListDiffer, { diff as diff$1 } from '@egjs/list-differ'; |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-children-differ | ||
version: 1.0.0 | ||
version: 1.0.1 | ||
*/ | ||
@@ -10,0 +10,0 @@ (function (global, factory) { |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-children-differ | ||
version: 1.0.0 | ||
version: 1.0.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("@egjs/list-differ")):"function"==typeof define&&define.amd?define(["@egjs/list-differ"],e):((t=t||self).eg=t.eg||{},t.eg.ChildrenDiffer=e(t.eg.ListDiffer))}(this,function(n){"use strict";var o=function(t,e){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var e,r="function"==typeof Map?void 0:(e=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++e)}),t=function(e){function t(t){return void 0===t&&(t=[]),e.call(this,t,r)||this}return function(t,e){function n(){this.constructor=t}o(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,e),t}(n);return t.diff=function(t,e){return n.diff(t,e,r)},t}); | ||
//# sourceMappingURL=children-differ.min.js.map |
@@ -7,3 +7,3 @@ /* | ||
repository: https://github.com/naver/egjs-children-differ | ||
version: 1.0.0 | ||
version: 1.0.1 | ||
*/ | ||
@@ -10,0 +10,0 @@ (function (global, factory) { |
@@ -7,5 +7,5 @@ /* | ||
repository: https://github.com/naver/egjs-children-differ | ||
version: 1.0.0 | ||
version: 1.0.1 | ||
*/ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):((t=t||self).eg=t.eg||{},t.eg.ChildrenDiffer=e())}(this,function(){"use strict";var r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};var _=function(){function t(){this.keys=[],this.values=[]}var e=t.prototype;return e.get=function(t){return this.values[this.keys.indexOf(t)]},e.set=function(t,e){var n=this.keys,r=this.values,i=n.indexOf(t),o=-1===i?n.length:i;n[o]=t,r[o]=e},t}(),b=function(){function t(){this.object={}}var e=t.prototype;return e.get=function(t){return this.object[t]},e.set=function(t,e){this.object[t]=e},t}(),x="function"==typeof Map,i=function(){function t(){}var e=t.prototype;return e.connect=function(t,e){this.prev=t,this.next=e,t&&(t.next=this),e&&(e.prev=this)},e.disconnect=function(){var t=this.prev,e=this.next;t&&(t.next=e),e&&(e.prev=t)},e.getIndex=function(){for(var t=this,e=-1;t;)t=t.prev,++e;return e},t}();var O=function(){function t(t,e,n,r,i,o,c,u){this.prevList=t,this.list=e,this.added=n,this.removed=r,this.changed=i,this.maintained=o,this.changedBeforeAdded=c,this.fixed=u}var e=t.prototype;return Object.defineProperty(e,"ordered",{get:function(){return this.cacheOrdered||this.caculateOrdered(),this.cacheOrdered},enumerable:!0,configurable:!0}),Object.defineProperty(e,"pureChanged",{get:function(){return this.cachePureChanged||this.caculateOrdered(),this.cachePureChanged},enumerable:!0,configurable:!0}),e.caculateOrdered=function(){var t=function(t,n){var u=[],f=[];return t.forEach(function(t){var e=t[0],n=t[1],r=new i;u[e]=r,f[n]=r}),u.forEach(function(t,e){t.connect(u[e-1])}),t.filter(function(t,e){return!n[e]}).map(function(t,e){var n=t[0],r=t[1];if(n===r)return[0,0];var i=u[n],o=f[r-1],c=i.getIndex();return i.disconnect(),o?i.connect(o,o.next):i.connect(void 0,u[0]),[c,i.getIndex()]})}(this.changedBeforeAdded,this.fixed),u=this.changed,f=[];this.cacheOrdered=t.filter(function(t,e){var n=t[0],r=t[1],i=u[e],o=i[0],c=i[1];if(n!==r)return f.push([o,c]),!0}),this.cachePureChanged=f},t}();function o(t,e,n){var r=x?Map:n?b:_,i=n||function(t){return t},o=[],c=[],u=[],f=t.map(i),s=e.map(i),a=new r,h=new r,d=[],p=[],v={},l=[],g=0,y=0;return f.forEach(function(t,e){a.set(t,e)}),s.forEach(function(t,e){h.set(t,e)}),f.forEach(function(t,e){var n=h.get(t);void 0===n?(++y,c.push(e)):v[n]=y}),s.forEach(function(t,e){var n=a.get(t);void 0===n?(o.push(e),++g):(u.push([n,e]),y=v[e]||0,d.push([n-y,e-g]),p.push(e===n),n!==e&&l.push([n,e]))}),c.reverse(),new O(t,e,o,c,l,u,d,p)}var e,n="function"==typeof Map?void 0:(e=0,function(t){return t.__DIFF_KEY__||(t.__DIFF_KEY__=++e)}),t=function(e){function t(t){return void 0===t&&(t=[]),e.call(this,t,n)||this}return function(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}(t,e),t}(function(){function t(t,e){void 0===t&&(t=[]),this.findKeyCallback=e,this.list=[].slice.call(t)}return t.prototype.update=function(t){var e=[].slice.call(t),n=o(this.list,e,this.findKeyCallback);return this.list=e,n},t}());return t.diff=function(t,e){return o(t,e,n)},t}); | ||
//# sourceMappingURL=children-differ.pkgd.min.js.map |
{ | ||
"name": "@egjs/children-differ", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "A module that checks diff when child elements are added, removed, or changed", | ||
@@ -25,3 +25,7 @@ "main": "./dist/children-differ.js", | ||
"demo:deploy": "npm run build && npm run jsdoc && npm run demo:prebuild-version && npm run demo:prebuild-latest && gh-pages -d demo/ --add --remote upstream", | ||
"release": "release-helper upstream" | ||
"release": "release-helper upstream", | ||
"packages": "npm run packages:update && npm run packages:build && npm run packages:publish", | ||
"packages:update": "pvu --update=react-children-differ,ngx-children-differ/projects/ngx-children-differ,vue-children-differ", | ||
"packages:build": "pvu --build=react-children-differ,ngx-children-differ,vue-children-differ", | ||
"packages:publish": "pvu --publish=react-children-differ,ngx-children-differ/dist/ngx-children-differ,vue-children-differ" | ||
}, | ||
@@ -64,2 +68,3 @@ "repository": { | ||
"print-sizes": "0.0.4", | ||
"pvu": "^0.4.1", | ||
"sinon": "^7.3.1", | ||
@@ -66,0 +71,0 @@ "ts-jest": "^24.0.1", |
@@ -51,4 +51,4 @@ /* | ||
list: T[], | ||
): ChildrenDiffResult { | ||
return listdiff(prevList, list, findKeyCallback); | ||
): ChildrenDiffResult<T> { | ||
return listdiff<T>(prevList, list, findKeyCallback); | ||
} |
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
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
109956
17