@thi.ng/hdom
Advanced tools
Comparing version 5.2.0 to 5.2.1
@@ -6,2 +6,10 @@ # Change Log | ||
## [5.2.1](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@5.2.0...@thi.ng/hdom@5.2.1) (2018-12-08) | ||
**Note:** Version bump only for package @thi.ng/hdom | ||
# [5.2.0](https://github.com/thi-ng/umbrella/compare/@thi.ng/hdom@5.1.0...@thi.ng/hdom@5.2.0) (2018-11-07) | ||
@@ -8,0 +16,0 @@ |
40
diff.js
@@ -49,3 +49,3 @@ "use strict"; | ||
} | ||
const delta = array_1.diffArray(prev, curr, exports.equiv, true); | ||
const delta = array_1.diffArray(prev, curr, 1 /* ONLY_DISTANCE_LINEAR */, exports.equiv); | ||
if (delta.distance === 0) { | ||
@@ -57,2 +57,3 @@ return; | ||
let i; | ||
let ii; | ||
let j; | ||
@@ -62,6 +63,5 @@ let idx; | ||
let eq; | ||
let e; | ||
let status; | ||
let val; | ||
if (edits[0][0] !== 0 || prev[1].key !== attribs.key) { | ||
if (edits[0] !== 0 || prev[1].key !== attribs.key) { | ||
// DEBUG && console.log("replace:", prev, curr); | ||
@@ -75,3 +75,3 @@ exports.releaseTree(prev); | ||
} | ||
if (edits[1][0] !== 0) { | ||
if (edits[3] !== 0) { | ||
exports.diffAttributes(impl, el, prev[1], curr[1]); | ||
@@ -87,8 +87,7 @@ // if attribs changed & distance == 2 then we're done here... | ||
const offsets = buildIndex(prevLength + 1); | ||
for (i = 2; i < numEdits; i++) { | ||
e = edits[i]; | ||
status = e[0]; | ||
for (i = 2, ii = 6; ii < numEdits; i++, ii += 3) { | ||
status = edits[ii]; | ||
if (status === -1) { | ||
// element removed / edited? | ||
val = e[2]; | ||
val = edits[ii + 2]; | ||
if (isArray(val)) { | ||
@@ -103,3 +102,3 @@ k = val[1].key; | ||
else { | ||
idx = e[1]; | ||
idx = edits[ii + 1]; | ||
// DEBUG && console.log("remove @", offsets[idx], val); | ||
@@ -119,3 +118,3 @@ exports.releaseTree(val); | ||
// element added/inserted? | ||
val = e[2]; | ||
val = edits[ii + 2]; | ||
if (typeof val === "string") { | ||
@@ -127,3 +126,3 @@ impl.setContent(el, val); | ||
if (k === undefined || equivKeys[k][0] === undefined) { | ||
idx = e[1]; | ||
idx = edits[ii + 1]; | ||
// DEBUG && console.log("insert @", offsets[idx], val); | ||
@@ -153,9 +152,8 @@ impl.createTree(opts, el, val, offsets[idx]); | ||
exports.diffAttributes = (impl, el, prev, curr) => { | ||
const delta = object_1.diffObject(prev, curr, equiv_1.equiv); | ||
const delta = object_1.diffObject(prev, curr, 2 /* FULL */, equiv_1.equiv); | ||
impl.removeAttribs(el, delta.dels, prev); | ||
let val = api_1.SEMAPHORE; | ||
let i, e, edits; | ||
for (edits = delta.edits, i = edits.length; --i >= 0;) { | ||
e = edits[i]; | ||
const a = e[0]; | ||
for (edits = delta.edits, i = edits.length; (i -= 2) >= 0;) { | ||
const a = edits[i]; | ||
if (a.indexOf("on") === 0) { | ||
@@ -165,6 +163,6 @@ impl.removeAttribs(el, [a], prev); | ||
if (a !== "value") { | ||
impl.setAttrib(el, a, e[1], curr); | ||
impl.setAttrib(el, a, edits[i + 1], curr); | ||
} | ||
else { | ||
val = e[1]; | ||
val = edits[i + 1]; | ||
} | ||
@@ -213,12 +211,10 @@ } | ||
let val; | ||
let e; | ||
let ek; | ||
const equiv = {}; | ||
for (let i = edits.length; --i >= 0;) { | ||
e = edits[i]; | ||
val = e[2]; | ||
for (let i = edits.length; (i -= 3) >= 0;) { | ||
val = edits[i + 2]; | ||
if (isArray(val) && (k = val[1].key) !== undefined) { | ||
ek = equiv[k]; | ||
!ek && (equiv[k] = ek = [, ,]); | ||
ek[e[0] + 1] = e[1]; | ||
ek[edits[i] + 1] = edits[i + 1]; | ||
} | ||
@@ -225,0 +221,0 @@ } |
{ | ||
"name": "@thi.ng/hdom", | ||
"version": "5.2.0", | ||
"version": "5.2.1", | ||
"description": "Lightweight vanilla ES6 UI component trees with customizable branch-local behaviors", | ||
@@ -23,3 +23,3 @@ "main": "./index.js", | ||
"devDependencies": { | ||
"@thi.ng/atom": "^1.5.6", | ||
"@thi.ng/atom": "^1.5.7", | ||
"@types/mocha": "^5.2.5", | ||
@@ -35,5 +35,5 @@ "@types/node": "^10.12.0", | ||
"@thi.ng/checks": "^1.5.13", | ||
"@thi.ng/diff": "^1.1.4", | ||
"@thi.ng/equiv": "^0.1.13", | ||
"@thi.ng/hiccup": "^2.6.0" | ||
"@thi.ng/diff": "^2.0.0", | ||
"@thi.ng/equiv": "^0.1.14", | ||
"@thi.ng/hiccup": "^2.6.1" | ||
}, | ||
@@ -55,3 +55,3 @@ "keywords": [ | ||
}, | ||
"gitHead": "6eaa5f5f5108fba3d24027ebbde65eccf2271208" | ||
"gitHead": "6e361d62fff19dbda467c13f375b0ebcb5d6d8a2" | ||
} |
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
129617
1396
+ Added@thi.ng/diff@2.0.2(transitive)
- Removed@thi.ng/diff@1.1.4(transitive)
Updated@thi.ng/diff@^2.0.0
Updated@thi.ng/equiv@^0.1.14
Updated@thi.ng/hiccup@^2.6.1