@endorphinjs/template-runtime
Advanced tools
Comparing version 0.1.14 to 0.1.15
@@ -850,2 +850,3 @@ 'use strict'; | ||
dispose: null, | ||
prev: null, | ||
get, | ||
@@ -893,2 +894,9 @@ body, | ||
// Do some tricks for better Virtual Scroll lists: | ||
// for example, when we transition from [1, 2, 3] list to [2, 3, 4], | ||
// default algorithm will cause 2 and 3 to be moved before 1, which leads to | ||
// lots of unnecessary DOM operations. By manually controlling `.ptr`, we can | ||
// keyed iterator to update 2 and 3 (if required), add 4 and remove 1 | ||
injector.ptr = null; | ||
const collection = block.get(host, block.scope); | ||
@@ -899,3 +907,9 @@ if (collection && typeof collection.forEach === 'function') { | ||
trimIteratorItems(block); | ||
const { rendered } = block; | ||
for (let p in rendered) { | ||
for (let i = 0, items = rendered[p]; i < items.length; i++) { | ||
disposeBlock(items[i]); | ||
} | ||
} | ||
block.rendered = block.used; | ||
@@ -917,3 +931,6 @@ } | ||
// Update existing block | ||
move(injector, entry, injector.ptr); | ||
if (injector.ptr) { | ||
move(injector, entry, injector.ptr); | ||
} | ||
if (entry.update) { | ||
@@ -928,2 +945,6 @@ setScope(host, assign(entry.scope, localScope)); | ||
// Create & render new block | ||
if (!injector.ptr) { | ||
injector.ptr = this.start; | ||
} | ||
/** @type {IteratorItemBlock} */ | ||
@@ -930,0 +951,0 @@ entry = injectBlock(injector, { |
@@ -846,2 +846,3 @@ /** | ||
dispose: null, | ||
prev: null, | ||
get, | ||
@@ -889,2 +890,9 @@ body, | ||
// Do some tricks for better Virtual Scroll lists: | ||
// for example, when we transition from [1, 2, 3] list to [2, 3, 4], | ||
// default algorithm will cause 2 and 3 to be moved before 1, which leads to | ||
// lots of unnecessary DOM operations. By manually controlling `.ptr`, we can | ||
// keyed iterator to update 2 and 3 (if required), add 4 and remove 1 | ||
injector.ptr = null; | ||
const collection = block.get(host, block.scope); | ||
@@ -895,3 +903,9 @@ if (collection && typeof collection.forEach === 'function') { | ||
trimIteratorItems(block); | ||
const { rendered } = block; | ||
for (let p in rendered) { | ||
for (let i = 0, items = rendered[p]; i < items.length; i++) { | ||
disposeBlock(items[i]); | ||
} | ||
} | ||
block.rendered = block.used; | ||
@@ -913,3 +927,6 @@ } | ||
// Update existing block | ||
move(injector, entry, injector.ptr); | ||
if (injector.ptr) { | ||
move(injector, entry, injector.ptr); | ||
} | ||
if (entry.update) { | ||
@@ -924,2 +941,6 @@ setScope(host, assign(entry.scope, localScope)); | ||
// Create & render new block | ||
if (!injector.ptr) { | ||
injector.ptr = this.start; | ||
} | ||
/** @type {IteratorItemBlock} */ | ||
@@ -926,0 +947,0 @@ entry = injectBlock(injector, { |
{ | ||
"name": "@endorphinjs/template-runtime", | ||
"version": "0.1.14", | ||
"version": "0.1.15", | ||
"description": "EndorphinJS template runtime, embedded with template bundles", | ||
@@ -12,3 +12,3 @@ "main": "./dist/runtime.cjs.js", | ||
"test": "mocha", | ||
"prepare": "npm run build" | ||
"prepare": "npm test && npm run build" | ||
}, | ||
@@ -15,0 +15,0 @@ "keywords": [ |
@@ -369,3 +369,3 @@ import { Store } from './lib/store'; | ||
injector: Injector; | ||
scope: Object; | ||
scope: any; | ||
@@ -372,0 +372,0 @@ /** A function to dispose block contents */ |
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
364318
10
5908