| var _ = require('../util'); | ||
| var dconst = require('../const').DIFF | ||
| var ADD_ALL = dconst.ADD_ALL | ||
| var REMOVE_ALL = dconst.REMOVE_ALL | ||
| // tracked 与 ls不同, 我们要确保所有被tracked的数据对应的节点是存在的,不能有任何损失 | ||
| function diffTrack( newArr, oldArr, keyOf ){ | ||
| var olen = oldArr.length; | ||
| var nlen = newArr.length; | ||
| var steps = []; | ||
| var ret = { | ||
| isTrack: true, | ||
| steps: steps | ||
| } | ||
| // 确保当存在无法被keyOf的item时,不会死循环 | ||
| if( !_.simpleDiff(newArr, oldArr) ) return ret; | ||
| if( olen && !nlen ) { // 直接删除所有 | ||
| createStep( steps, 0,0,olen ); | ||
| return ret | ||
| } | ||
| if(nlen && !olen){ //直接添加所有 | ||
| createStep(steps, 1,0,nlen); | ||
| return ret | ||
| } | ||
| // 模拟被真实操作的groups获得真实的下标 | ||
| var substitute = _.slice( oldArr ); | ||
| var newTrack = getTrackInfo( newArr, keyOf ); | ||
| var oldTrack = getTrackInfo( oldArr, keyOf ); | ||
| var newTrackMap = newTrack.trackMap; | ||
| var oldTrackMap = oldTrack.trackMap; | ||
| var oldRemoved = {}; | ||
| // 使用替身数组完成对应操作,模拟DOM操作 | ||
| // i 老数据下标, | ||
| // j 新数组下标 | ||
| var untrackIndex = 0, | ||
| oldUntracked = oldTrack.untrack, | ||
| oldUntrackedLength = oldUntracked.length; | ||
| // @FIXIT, 当数组对应的key发生改变,而缓存key其实是一种错误开销 | ||
| // 暂时将所有untraked的东西都进行删除,实际这是用户的一种错误使用, 可以引发性能开销 | ||
| if(oldUntrackedLength){ | ||
| while(oldUntrackedLength--){ | ||
| var oidx = oldUntracked[oldUntrackedLength]; | ||
| remove( substitute, steps, oldUntracked[ oldUntrackedLength ] ); | ||
| } | ||
| } | ||
| var len = substitute.length; | ||
| for(var i =0; i<len ;i++){ | ||
| var oldItem = substitute[i]; | ||
| var oldKey = keyOf( oldItem); | ||
| // 将所有其它不存在与 | ||
| if( !newTrackMap.hasOwnProperty(oldKey) ){ | ||
| oldRemoved[ oldKey ] = oldTrackMap[ oldKey ] | ||
| remove( substitute, steps, i ); | ||
| i--; | ||
| len--; | ||
| } | ||
| } | ||
| var jlen = newArr.length; | ||
| // i old index | ||
| // j new index | ||
| var i = 0, j = 0; | ||
| while( j < jlen ){ | ||
| //@TODO 大量重复key的计算 | ||
| if(i >= substitute.length){ | ||
| insert( substitute, steps, i, 1 ); | ||
| i++; | ||
| j++; | ||
| continue | ||
| } | ||
| var oldKey = keyOf( substitute[i] ); | ||
| var item = newArr[ j ]; | ||
| var key = keyOf( item ); | ||
| if( key === oldKey ){ | ||
| i++; j++; | ||
| continue; | ||
| }else{ | ||
| //先插入一个节点 | ||
| insert( substitute, steps, i, 1 ); | ||
| i++; | ||
| j++; | ||
| continue; | ||
| } | ||
| } | ||
| // 说明还未完全处理完毕,因为j条件短了 | ||
| var slen = substitute.length; | ||
| if( j < slen ){ | ||
| createStep(steps, 0, j, slen - j ) | ||
| for(var k = j; k < slen; k++ ){ | ||
| var oldKey = keyOf( substitute[k]); | ||
| oldRemoved[oldKey] = oldTrackMap[oldKey]; | ||
| } | ||
| } | ||
| // 这些将在apply到前台时,被复用 | ||
| ret.oldKeyMap = oldRemoved; | ||
| return ret; | ||
| } | ||
| function createStep(steps ,mode, index, len, oldIndex){ | ||
| len = len || 1; | ||
| var last = steps[steps.length-1]; | ||
| if(last && last.mode === mode ){ | ||
| if( (mode === 0 && last.index === index) || | ||
| (mode === 1 && last.index + last.len === index) | ||
| ){ | ||
| last.len++; | ||
| return steps; | ||
| } | ||
| } | ||
| steps.push( { | ||
| mode: mode, | ||
| index:index, | ||
| len: len | ||
| } ); | ||
| return steps; | ||
| } | ||
| function insert( substitute, steps ,index, len){ | ||
| createStep(steps, 1, index, len, steps) | ||
| substitute.splice(index, 0, null) | ||
| } | ||
| function remove( substitute, steps ,index, len ){ | ||
| createStep(steps, 0, index, len) | ||
| substitute.splice(index, 1); | ||
| } | ||
| // convert <Array>list to | ||
| // <Object>{ trackMap: <Map> trackMap, unmark: <Array> indextrackPair} | ||
| function getTrackInfo( list, keyOf ){ | ||
| var untrack = [], trackMap = {}; | ||
| for(var i = 0, len = list.length; i < len ; i++){ | ||
| var item = list[i]; | ||
| var trackKey = keyOf(list[i]); | ||
| // can be stringify | ||
| if( !trackMap.hasOwnProperty(trackKey) ){ | ||
| trackMap[ trackKey ] = i | ||
| }else{ | ||
| untrack.push( i ) | ||
| } | ||
| } | ||
| return { | ||
| untrack: untrack, | ||
| trackMap: trackMap | ||
| } | ||
| } | ||
| function isTrackable( key ){ | ||
| var type = typeof key; | ||
| return type !== 'object' && type !== 'undefined'; | ||
| } | ||
| module.exports = diffTrack |
+1
-1
@@ -62,3 +62,3 @@ { | ||
| "iterator" : false, // Allow usage of __iterator__ property. | ||
| "lastsemic" : false, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block. | ||
| "lastsemic" : true, // Tolerat missing semicolons when the it is omitted for the last statement in a one-line block. | ||
| "laxbreak" : false, // Tolerate unsafe line breaks e.g. `return [\n] x` without semicolons. | ||
@@ -65,0 +65,0 @@ "laxcomma" : false, // Suppress warnings about comma-first coding style. |
+1
-1
@@ -9,2 +9,2 @@ language: node_js | ||
| before_install: | ||
| - npm install -g puppeteer gulp | ||
| - npm install -g casperjs phantomjs gulp |
+4
-0
@@ -21,3 +21,7 @@ module.exports = { | ||
| 'FORCE': { force: !0 } | ||
| }, | ||
| 'DIFF': { | ||
| 'REMOVE_ALL': 1, | ||
| 'ADD_ALL': 0 | ||
| } | ||
| } |
@@ -78,8 +78,8 @@ // Regular | ||
| } | ||
| var isChanging = true | ||
| elem.__change = function(){ | ||
| if(isChanging) return; | ||
| isChanging = true; | ||
| setTimeout(handler,0) | ||
| } | ||
| // var isChanging = true | ||
| // var __change = function(){ | ||
| // if(isChanging) return; | ||
| // isChanging = true; | ||
| // setTimeout(handler,0) | ||
| // } | ||
@@ -94,4 +94,4 @@ dom.on( elem, "change", handler ); | ||
| dom.off(elem, "change", handler); | ||
| // remove __change function | ||
| delete elem.__change; | ||
| // @TODO remove __change function | ||
| // elem.__change = null; | ||
| } | ||
@@ -98,0 +98,0 @@ } |
+13
-22
| var _ = require('../util'); | ||
| var diffTrack = require('./diffTrack'); | ||
| function simpleDiff(now, old){ | ||
| var nlen = now.length; | ||
| var olen = old.length; | ||
| if(nlen !== olen){ | ||
| return true; | ||
| } | ||
| for(var i = 0; i < nlen ; i++){ | ||
| if(now[i] !== old[i]) return true; | ||
| } | ||
| return false | ||
| } | ||
| function equals(a,b){ | ||
@@ -50,3 +39,3 @@ return a === b; | ||
| function diffArray(arr2, arr1, diff, diffFn) { | ||
| if(!diff) return simpleDiff(arr2, arr1); | ||
| if(!diff) return _.simpleDiff(arr2, arr1); | ||
| var matrix = ld(arr1, arr2, diffFn) | ||
@@ -148,5 +137,4 @@ var n = arr1.length; | ||
| // test if obj1 deepEqual obj2 | ||
| function diffObject( now, last, diff ){ | ||
| function diffObject( now, last, diff, keyOf, lastTrackInfo ){ | ||
| if(!diff){ | ||
@@ -164,4 +152,4 @@ | ||
| var nKeys = _.keys(now); | ||
| var lKeys = _.keys(last); | ||
| var nValues = _.values( now ); | ||
| var lValues = _.values( last ); | ||
@@ -174,5 +162,6 @@ /** | ||
| */ | ||
| return diffArray(nKeys, lKeys, diff, function(a, b){ | ||
| return now[b] === last[a]; | ||
| }); | ||
| if(typeof keyOf === 'function'){ | ||
| return diffTrack( nValues, lValues, keyOf, lastTrackInfo); | ||
| } | ||
| return diffArray( nValues, lValues, diff); | ||
@@ -182,9 +171,11 @@ } | ||
| return false; | ||
| } | ||
| } | ||
| module.exports = { | ||
| diffArray: diffArray, | ||
| diffObject: diffObject | ||
| diffObject: diffObject, | ||
| diffTrack: diffTrack | ||
| } |
| var _ = require('../util'); | ||
| var parseExpression = require('./parse').expression; | ||
| var diff = require('./diff'); | ||
| var diffTrack = require('./diffTrack'); | ||
| var diffArray = diff.diffArray; | ||
@@ -61,5 +62,7 @@ var diffObject = diff.diffObject; | ||
| diff: options.diff, | ||
| keyOf: options.keyOf, | ||
| test: test, | ||
| deep: options.deep, | ||
| last: options.sync? get(this): options.last | ||
| // cache the trackInfo for list tarck. | ||
| } | ||
@@ -182,3 +185,5 @@ | ||
| var now, last, tlast, tnow, eq, diff; | ||
| var now, last, tlast, tnow, | ||
| eq, diff, keyOf, trackDiff | ||
@@ -189,2 +194,3 @@ if(!watcher.test){ | ||
| last = watcher.last; | ||
| keyOf = watcher.keyOf | ||
@@ -200,3 +206,9 @@ if(now !== last || watcher.force){ | ||
| if( tnow === 'array' && ( tlast=='undefined' || tlast === 'array') ){ | ||
| diff = diffArray(now, watcher.last || [], watcher.diff) | ||
| if(typeof keyOf === 'function'){ | ||
| trackDiff = diffTrack(now, watcher.last || [], keyOf ) | ||
| diff = trackDiff.steps; | ||
| }else{ | ||
| diff = diffArray(now, watcher.last || [], watcher.diff) | ||
| } | ||
| if( tlast !== 'array' || diff === true || diff.length ) dirty = true; | ||
@@ -211,3 +223,7 @@ }else{ | ||
| }else{ | ||
| diff = diffObject( now, last, watcher.diff ); | ||
| diff = diffObject( now, last, watcher.diff, keyOf ); | ||
| if(diff.isTrack){ | ||
| trackDiff = diff; | ||
| diff = trackDiff.steps; | ||
| } | ||
| if( diff === true || diff.length ) dirty = true; | ||
@@ -231,3 +247,3 @@ } | ||
| } | ||
| watcher.fn.call(this, now, last, diff) | ||
| watcher.fn.call(this, now, last, diff, trackDiff && trackDiff.oldKeyMap) | ||
| if(watcher.once) this.$unwatch(watcher) | ||
@@ -234,0 +250,0 @@ } |
@@ -31,3 +31,3 @@ var _ = require("../util"); | ||
| this.input = (input||"").trim(); | ||
| this.input = input||""; | ||
| this.opts = opts || {}; | ||
@@ -46,8 +46,10 @@ this.map = this.opts.mode !== 2? map1: map2; | ||
| lo.lex = function(str){ | ||
| str = (str || this.input).trim(); | ||
| str = str || this.input | ||
| var leadingWhitespaces = /^\s*/.exec(str) | ||
| str = str.trim(); | ||
| var tokens = [], split, test,mlen, token, state; | ||
| this.input = str, | ||
| this.marks = 0; | ||
| // init the pos index | ||
| this.index=0; | ||
| // fix the pos offset caused by trim | ||
| this.index=leadingWhitespaces ? leadingWhitespaces[0].length : 0; | ||
| var i = 0; | ||
@@ -54,0 +56,0 @@ while(str){ |
@@ -303,2 +303,5 @@ var _ = require("../util"); | ||
| if(this.eat('IDENT', 'by')){ | ||
| if(this.eat('IDENT', variable+'_key')){ | ||
| this.error('can not track by ' + variable + '_key in list statement'); | ||
| } | ||
| if(this.eat('IDENT',variable + '_index')){ | ||
@@ -305,0 +308,0 @@ track = true; |
@@ -602,3 +602,2 @@ /** | ||
| if(computedProperty.set) return computedProperty.set(this, value); | ||
| else _.log("the computed '" + path + "' don't define the set function, assign data."+path + " altnately", "warn" ) | ||
| } | ||
@@ -605,0 +604,0 @@ data[path] = value; |
+46
-10
@@ -30,2 +30,3 @@ require('./helper/shim')(); | ||
| _.keys = Object.keys? Object.keys: function(obj){ | ||
@@ -39,2 +40,10 @@ var res = []; | ||
| _.values = Object.values? Object.values: function(obj){ | ||
| var res = []; | ||
| for(var i in obj) if(obj.hasOwnProperty(i)){ | ||
| res.push(obj[i]); | ||
| } | ||
| return res; | ||
| } | ||
| _.some = function(list, fn){ | ||
@@ -130,3 +139,3 @@ for(var i =0,len = list.length; i < len; i++){ | ||
| var lb = /\r\n|[\n\r\u2028\u2029]/g; | ||
| var minRange = 20, maxRange = 20; | ||
| var minRange = 50, maxRange = 20; | ||
| function findLine(lines, pos){ | ||
@@ -138,24 +147,38 @@ var tmpLen = 0; | ||
| if(tmpLen + lineLen > pos) { | ||
| return {num: i, line: lines[i], start: pos - i - tmpLen , prev:lines[i-1], next: lines[i+1] }; | ||
| return {num: i, line: lines[i], start: pos - tmpLen , prev:lines[i-1], next: lines[i+1] }; | ||
| } | ||
| // 1 is for the linebreak | ||
| tmpLen = tmpLen + lineLen ; | ||
| tmpLen = tmpLen + lineLen + 1; | ||
| } | ||
| } | ||
| function formatLine(str, start, num, target){ | ||
| function formatLine(str, column, row, target){ | ||
| var len = str.length; | ||
| var min = start - minRange; | ||
| var min = column - minRange; | ||
| if(min < 0) min = 0; | ||
| var max = start + maxRange; | ||
| var max = column + maxRange; | ||
| if(max > len) max = len; | ||
| var remain = str.slice(min, max); | ||
| var prefix = "[" +(num+1) + "] " + (min > 0? ".." : "") | ||
| var prefix = "[" +(row+1) + "] " + (min > 0? ".." : "") | ||
| var postfix = max < len ? "..": ""; | ||
| var res = prefix + remain + postfix; | ||
| if(target) res += "\n" + new Array(start-min + prefix.length + 1).join(" ") + "^^^"; | ||
| var res = prefix + leadingTabsToSpaces(remain) + postfix; | ||
| if(target) { | ||
| res += "\n" + spaces( | ||
| leadingTabsToSpaces(str.slice(min,column)).length + | ||
| prefix.length | ||
| ) + "^"; | ||
| } | ||
| return res; | ||
| } | ||
| function spaces(n) { | ||
| return new Array(n+1).join(" ") | ||
| } | ||
| function leadingTabsToSpaces(str) { | ||
| return str.replace( /^\t+/, function(match) { | ||
| return match.split('\t').join(' '); | ||
| } ) | ||
| } | ||
| return function(input, pos){ | ||
| if(pos > input.length-1) pos = input.length-1; | ||
| if( pos > input.length-1 ) pos = input.length-1; | ||
| lb.lastIndex = 0; | ||
@@ -586,3 +609,14 @@ var lines = input.split(lb); | ||
| _.simpleDiff = function (now, old){ | ||
| var nlen = now.length; | ||
| var olen = old.length; | ||
| if(nlen !== olen){ | ||
| return true; | ||
| } | ||
| for(var i = 0; i < nlen ; i++){ | ||
| if(now[i] !== old[i]) return true; | ||
| } | ||
| return false | ||
| } | ||
@@ -593,1 +627,3 @@ | ||
+139
-74
@@ -16,2 +16,3 @@ var diffArray = require('./helper/diff').diffArray; | ||
| var shared = require('./render/shared'); | ||
| var dconst = require('./const').DIFF | ||
@@ -26,9 +27,2 @@ | ||
| // remove block in group | ||
| function removeRange(index, rlen, children){ | ||
| for(var j = 1; j <= rlen; j++){ //removed | ||
| var removed = children[ index + j ]; | ||
| if(removed) removed.destroy(true); | ||
| } | ||
| children.splice(index+1, rlen); | ||
| } | ||
@@ -63,3 +57,2 @@ | ||
| extraObj[ variable ] = item; | ||
| extraObj[ indexName ] = index; | ||
| // @FIX keyName | ||
@@ -70,21 +63,57 @@ return track.get( self, extraObj ); | ||
| function addRange(index, end, newList, rawNewValue){ | ||
| function removeRange(index, rlen, children, oldKeyMap){ | ||
| for(var j = 1; j <= rlen; j++){ //removed | ||
| var removed = children[ index + j ]; | ||
| if( oldKeyMap ){ | ||
| var mayBeReuse = keyOf(removed.data[variable]); | ||
| // 将被复用 | ||
| if(typeof oldKeyMap[mayBeReuse] !== 'undefined') { | ||
| if(oldKeyMap[mayBeReuse]!==null){//hasn't already moved | ||
| removed.inject(false); | ||
| } | ||
| continue; | ||
| } | ||
| } | ||
| removed.destroy(true); | ||
| } | ||
| children.splice(index+1, rlen); | ||
| } | ||
| function addRange(index, end, newList, rawNewValue, oldKeyMap){ | ||
| for(var o = index; o < end; o++){ //add | ||
| // prototype inherit | ||
| var item = newList[o]; | ||
| var data = _.createObject(extra); | ||
| updateTarget(data, o, item, rawNewValue); | ||
| var section = null; | ||
| var section = self.$compile(ast.body, { | ||
| extra: data, | ||
| namespace:namespace, | ||
| record: true, | ||
| outer: options.outer, | ||
| cursor: cursor | ||
| }) | ||
| section.data = data; | ||
| if(oldKeyMap){ | ||
| var key = keyOf( item ); | ||
| section = oldKeyMap[key]; | ||
| // 只能复用一次 | ||
| if(section) oldKeyMap[key] = null; | ||
| // 如果在原来的节点中可以找到,则复用原节点 | ||
| } | ||
| var hasReusedSection = !!section; | ||
| if(!hasReusedSection){ | ||
| var data = _.createObject(extra); | ||
| updateTarget(data, o, item, rawNewValue); | ||
| section = self.$compile(ast.body, { | ||
| extra: data, | ||
| namespace:namespace, | ||
| record: true, | ||
| outer: options.outer, | ||
| cursor: cursor | ||
| }) | ||
| section.data = data; | ||
| }else{ | ||
| // means track reused section | ||
| updateTarget(section.data, o, item) | ||
| } | ||
| // autolink | ||
| var insert = combine.last(group.get(o)); | ||
| if(insert.parentNode && !cursor ){ | ||
| animate.inject(combine.node(section),insert, 'after'); | ||
| if(insert.parentNode && !(cursor && cursor.node) ){ | ||
| // hasReusedSection | ||
| (hasReusedSection?dom:animate).inject(combine.node(section),insert, 'after'); | ||
| } | ||
@@ -97,10 +126,10 @@ // insert.parentNode.insertBefore(combine.node(section), insert.nextSibling); | ||
| function updateTarget(target, index, item, rawNewValue){ | ||
| target[ indexName ] = index; | ||
| if( rawNewValue ){ | ||
| target[ keyName ] = item; | ||
| target[ variable ] = rawNewValue[ item ]; | ||
| }else{ | ||
| target[ variable ] = item; | ||
| target[keyName] = null | ||
| } | ||
| target[ indexName ] = index; | ||
| if( rawNewValue ){ | ||
| target[ keyName ] = item; | ||
| target[ variable ] = rawNewValue[ item ]; | ||
| }else{ | ||
| target[ variable ] = item; | ||
| target[keyName] = null | ||
| } | ||
| } | ||
@@ -116,3 +145,3 @@ | ||
| function updateLD(newList, oldList, splices , rawNewValue ){ | ||
| function updateLD(newList, oldList, steps, rawNewValue ){ | ||
@@ -122,10 +151,11 @@ var cur = placeholder; | ||
| if(!splices && (len !==0 || oldList.length !==0) ){ | ||
| splices = diffArray(newList, oldList, true); | ||
| if(!steps && (len !==0 || oldList.length !==0) ){ | ||
| steps = diffArray(newList, oldList, true); | ||
| } | ||
| if(!splices || !splices.length) return; | ||
| if(!steps || !steps.length) return; | ||
| for(var i = 0; i < steps.length; i++){ //init | ||
| for(var i = 0; i < splices.length; i++){ //init | ||
| var splice = splices[i]; | ||
| var splice = steps[i]; | ||
| var index = splice.index; // beacuse we use a comment for placeholder | ||
@@ -135,18 +165,2 @@ var removed = splice.removed; | ||
| var rlen = removed.length; | ||
| // for track | ||
| if( track && rlen && add ){ | ||
| var minar = Math.min(rlen, add); | ||
| var tIndex = 0; | ||
| while(tIndex < minar){ | ||
| if( keyOf(newList[index], index) !== keyOf( removed[0], index ) ){ | ||
| removeRange(index, 1, children) | ||
| addRange(index, index+1, newList, rawNewValue) | ||
| } | ||
| removed.shift(); | ||
| add--; | ||
| index++; | ||
| tIndex++; | ||
| } | ||
| rlen = removed.length; | ||
| } | ||
| // update | ||
@@ -187,4 +201,31 @@ updateRange(m, index, newList, rawNewValue); | ||
| function update(newValue, oldValue, splices){ | ||
| // oldKeyMap: 复用原来的节点 | ||
| function updateTrack( newList, oldList, steps, rawNewValue, oldKeyMap ){ | ||
| for(var i =0, slen = steps.length; i < slen ;i++){ | ||
| var step = steps[i]; | ||
| switch( step.mode){ | ||
| case 0 : //remove | ||
| removeRange(step.index, step.len, group.children, oldKeyMap); | ||
| break; | ||
| case 1 : //insert | ||
| addRange(step.index, step.index + step.len, newList, rawNewValue, oldKeyMap ) | ||
| break; | ||
| } | ||
| } | ||
| var children = group.children; | ||
| for(var j=1, len = children.length; j < len; j++){ | ||
| var child = children[j]; | ||
| if( child ){ | ||
| child.data[indexName] = j-1 | ||
| } | ||
| } | ||
| } | ||
| function update(newValue, oldValue, steps, oldKeyMap){ | ||
| var nType = _.typeOf( newValue ); | ||
@@ -196,2 +237,3 @@ var oType = _.typeOf( oldValue ); | ||
| var rawNewValue; | ||
@@ -204,33 +246,56 @@ | ||
| // if previous list has , we need to remove the altnated section. | ||
| if( !olen && nlen && group.get(1) ){ | ||
| var altGroup = children.pop(); | ||
| if(altGroup.destroy) altGroup.destroy(true); | ||
| } | ||
| if( nType === 'object' ) rawNewValue = newValue; | ||
| if(track === true){ | ||
| updateSimple( newList, oldList, rawNewValue ); | ||
| }else{ | ||
| updateLD( newList, oldList, splices, rawNewValue ); | ||
| if(!olen && nlen){ | ||
| if(group.get(1)){ | ||
| var altGroup = children.pop(); | ||
| if(altGroup.destroy) altGroup.destroy(true); | ||
| } | ||
| return addRange(0, nlen, newList, rawNewValue ) | ||
| } | ||
| // @ {#list} {#else} | ||
| if( !nlen && alternate && alternate.length){ | ||
| var section = self.$compile(alternate, { | ||
| extra: extra, | ||
| record: true, | ||
| outer: options.outer, | ||
| namespace: namespace | ||
| }) | ||
| children.push(section); | ||
| if(placeholder.parentNode){ | ||
| animate.inject(combine.node(section), placeholder, 'after'); | ||
| if( !nlen ){ | ||
| if(olen){ | ||
| removeRange(0, olen, group.children) | ||
| } | ||
| if(alternate && alternate.length){ | ||
| var section = self.$compile(alternate, { | ||
| extra: extra, | ||
| record: true, | ||
| outer: options.outer, | ||
| namespace: namespace | ||
| }) | ||
| children.push(section); | ||
| if(placeholder.parentNode){ | ||
| animate.inject(combine.node(section), placeholder, 'after'); | ||
| } | ||
| } | ||
| return; | ||
| } | ||
| if(track){ | ||
| if( track === true ){ // | ||
| updateSimple( newList, oldList, rawNewValue ); | ||
| }else{ | ||
| if(oldKeyMap){ | ||
| for(var i in oldKeyMap){ | ||
| var index= oldKeyMap[i]; | ||
| if(children[index + 1]) oldKeyMap[i]= children[index + 1]; | ||
| } | ||
| } | ||
| updateTrack( newList, oldList , steps, rawNewValue, oldKeyMap); | ||
| } | ||
| }else{ | ||
| updateLD( newList, oldList, steps, rawNewValue ); | ||
| } | ||
| } | ||
| this.$watch(ast.sequence, update, { | ||
| init: true, | ||
| diff: track !== true , | ||
| this.$watch(ast.sequence, update, { | ||
| init: true, | ||
| keyOf: keyOf, | ||
| diff: track!==true, | ||
| deep: true | ||
@@ -237,0 +302,0 @@ }); |
+7
-14
| { | ||
| "name": "regularjs", | ||
| "version": "0.6.0-beta.8", | ||
| "version": "0.6.0-beta.9", | ||
| "author": { | ||
@@ -23,4 +23,4 @@ "name": "leeluolee" | ||
| "watch": "gulp watch", | ||
| "test": "gulp travis --chromeHeadless", | ||
| "prepublish": "gulp build --production" | ||
| "test": "gulp travis --phantomjs", | ||
| "prepublish": "gulp build" | ||
| }, | ||
@@ -33,3 +33,2 @@ "bin": { | ||
| "gulp": "3.6.x", | ||
| "gulp-better-rollup": "^2.0.0", | ||
| "gulp-bump": "^1.0.0", | ||
@@ -44,4 +43,5 @@ "gulp-git": "^1.4.0", | ||
| "gulp-util": "~2.2.14", | ||
| "karma": "^1.7.1", | ||
| "karma-chrome-launcher": "^2.2.0", | ||
| "gulp-webpack": "^1.0.0", | ||
| "karma": "^1.3.0", | ||
| "karma-chrome-launcher": "~0.1.4", | ||
| "karma-coverage": "~0.2.4", | ||
@@ -51,15 +51,8 @@ "karma-firefox-launcher": "~0.1.3", | ||
| "karma-mocha": "~0.1.3", | ||
| "karma-phantomjs-launcher": "~0.1.4", | ||
| "mocha": "~1.18.2", | ||
| "puppeteer": "^0.12.0", | ||
| "rollup-plugin-commonjs": "^8.2.6", | ||
| "rollup-plugin-node-resolve": "^3.0.0", | ||
| "rollup-plugin-replace": "^2.0.0", | ||
| "rollup-stream": "^1.24.1", | ||
| "run-sequence": "^1.2.2", | ||
| "through2": "~0.4.1", | ||
| "vinyl-buffer": "^1.0.0", | ||
| "vinyl-source-stream": "^1.1.0", | ||
| "webpack-stream": "^4.0.0", | ||
| "yargs": "^3.26.0" | ||
| } | ||
| } |
+0
-2
@@ -14,4 +14,2 @@ <a href="http://regularjs.github.io"> | ||
| * __[✨中文指南 ](http://regularjs.github.io/guide/zh/index.html)__ | ||
@@ -18,0 +16,0 @@ * __[✨中文API ](http://regularjs.github.io/reference/?api-zh)__ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
455738
11.15%23
-23.33%11742
9.83%208
-0.95%63
85.29%12
20%