chore: editorconfig + checker

pull/455/head
Shahar Or (mightyiam) 5 years ago
parent 8b66f53bc1
commit a907828f12

@ -0,0 +1,11 @@
root = true
[*]
end_of_line = lf
insert_final_newline = true
charset = utf-8
indent_style = space
indent_size = 2
[*.min.js.map]
insert_final_newline = false

@ -31,4 +31,4 @@ vnode.js
vnode.js.map vnode.js.map
modules modules
helpers helpers
es es

@ -30,4 +30,4 @@ build/Release
node_modules node_modules
# Vim # Vim
*.swp *.swp

@ -601,12 +601,12 @@ significant computational time to generate.
## Virtual Node ## Virtual Node
**Properties** **Properties**
- [sel](#sel--string) - [sel](#sel--string)
- [data](#data--object) - [data](#data--object)
- [children](#children--array) - [children](#children--array)
- [text](#text--string) - [text](#text--string)
- [elm](#elm--element) - [elm](#elm--element)
- [key](#key--string--number) - [key](#key--string--number)
#### sel : String #### sel : String
@ -646,14 +646,14 @@ create a virtual node with
```js ```js
[ [
{ {
sel: 'h1', sel: 'h1',
data: {}, data: {},
children: undefined, children: undefined,
text: 'Hello, World', text: 'Hello, World',
elm: Element, elm: Element,
key: undefined, key: undefined,
} }
] ]
``` ```

@ -513,54 +513,54 @@ var h = require('../../h.js');
var vnode; var vnode;
var data = { var data = {
degRotation: 0 degRotation: 0
}; };
function gRotation() { function gRotation() {
//console.log("gRotation: %s", data.degRotation); //console.log("gRotation: %s", data.degRotation);
return "rotate(" + data.degRotation + "deg)"; return "rotate(" + data.degRotation + "deg)";
} }
function triangleClick(id) { function triangleClick(id) {
console.log("triangleClick: %s", id); console.log("triangleClick: %s", id);
render(); render();
} }
function handleRotate(degs) { function handleRotate(degs) {
data.degRotation += degs; data.degRotation += degs;
console.log("handleRotate: %s, %s", degs, data.degRotation); console.log("handleRotate: %s, %s", degs, data.degRotation);
render(); render();
} }
function handleReset(degs) { function handleReset(degs) {
data.degRotation = degs; data.degRotation = degs;
console.log("handleReset: %s", degs); console.log("handleReset: %s", degs);
render(); render();
} }
function render() { function render() {
vnode = patch(vnode, view(data)); vnode = patch(vnode, view(data));
} }
var hTriangle = function hTriangle(id, degRotation) { var hTriangle = function hTriangle(id, degRotation) {
return h("polygon#" + id, { return h("polygon#" + id, {
attrs: { attrs: {
points: "-50,-88 0,-175 50,-88", points: "-50,-88 0,-175 50,-88",
transform: "rotate(" + degRotation + ")", transform: "rotate(" + degRotation + ")",
"stroke-width": 3 "stroke-width": 3
}, },
on: { click: [triangleClick, id] } on: { click: [triangleClick, id] }
}); });
}; };
var view = function view(data) { var view = function view(data) {
return h("div.view", [h("h1", "Snabbdom SVG Carousel"), h("svg", { attrs: { width: 380, height: 380, viewBox: [-190, -190, 380, 380] } }, [h("g#carousel", { style: { "-webkit-transform": gRotation(), transform: gRotation() } }, [hTriangle("yellow", 0), hTriangle("green", 60), hTriangle("magenta", 120), hTriangle("red", 180), hTriangle("cyan", 240), hTriangle("blue", 300)])]), h("button", { on: { click: [handleRotate, 60] } }, "Rotate Clockwise"), h("button", { on: { click: [handleRotate, -60] } }, "Rotate Anticlockwise"), h("button", { on: { click: [handleReset, 0] } }, "Reset")]); return h("div.view", [h("h1", "Snabbdom SVG Carousel"), h("svg", { attrs: { width: 380, height: 380, viewBox: [-190, -190, 380, 380] } }, [h("g#carousel", { style: { "-webkit-transform": gRotation(), transform: gRotation() } }, [hTriangle("yellow", 0), hTriangle("green", 60), hTriangle("magenta", 120), hTriangle("red", 180), hTriangle("cyan", 240), hTriangle("blue", 300)])]), h("button", { on: { click: [handleRotate, 60] } }, "Rotate Clockwise"), h("button", { on: { click: [handleRotate, -60] } }, "Rotate Anticlockwise"), h("button", { on: { click: [handleReset, 0] } }, "Reset")]);
}; };
window.addEventListener("DOMContentLoaded", function () { window.addEventListener("DOMContentLoaded", function () {
var container = document.getElementById("container"); var container = document.getElementById("container");
vnode = patch(container, view(data)); vnode = patch(container, view(data));
render(); render();
}); });
},{"../../h.js":1,"../../modules/attributes":3,"../../modules/eventlisteners":4,"../../modules/style":5,"../../snabbdom.js":6}]},{},[8]); },{"../../h.js":1,"../../modules/attributes":3,"../../modules/eventlisteners":4,"../../modules/style":5,"../../snabbdom.js":6}]},{},[8]);

@ -1,74 +1,74 @@
<!DOCTYPE html> <!DOCTYPE html>
<html> <html>
<head> <head>
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" /> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<meta charset="utf-8"> <meta charset="utf-8">
<title>Carousel</title> <title>Carousel</title>
<script type="text/javascript" src="build.js"></script> <script type="text/javascript" src="build.js"></script>
<style type="text/css"> <style type="text/css">
div.view { div.view {
margin: 10px; margin: 10px;
} }
h1 { h1 {
font-size: 24px; font-size: 24px;
color: #505000; color: #505000;
} }
svg { svg {
display: block; display: block;
margin-bottom: 10px; margin-bottom: 10px;
border: 1px solid gray; border: 1px solid gray;
} }
g#carousel { g#carousel {
-webkit-transition: -webkit-transform 1s ease; -webkit-transition: -webkit-transform 1s ease;
transition: transform 1s ease; transition: transform 1s ease;
} }
polygon { polygon {
stroke: #808000; stroke: #808000;
transition: fill 0.5s linear; transition: fill 0.5s linear;
} }
polygon#yellow { polygon#yellow {
fill: rgba(255,255,0,0.4); fill: rgba(255,255,0,0.4);
} }
polygon#yellow:hover, polygon#yellow:active { polygon#yellow:hover, polygon#yellow:active {
fill: yellow; fill: yellow;
} }
polygon#green { polygon#green {
fill: rgba(0,128,0,0.4); fill: rgba(0,128,0,0.4);
} }
polygon#green:hover, polygon#green:active { polygon#green:hover, polygon#green:active {
fill: green; fill: green;
} }
polygon#magenta { polygon#magenta {
fill: rgba(255,0,255,0.4); fill: rgba(255,0,255,0.4);
} }
polygon#magenta:hover, polygon#magenta:active { polygon#magenta:hover, polygon#magenta:active {
fill: magenta; fill: magenta;
} }
polygon#red { polygon#red {
fill: rgba(255,0,0,0.4); fill: rgba(255,0,0,0.4);
} }
polygon#red:hover, polygon#red:active { polygon#red:hover, polygon#red:active {
fill: red; fill: red;
} }
polygon#cyan { polygon#cyan {
fill: rgba(0,255,255,0.4); fill: rgba(0,255,255,0.4);
} }
polygon#cyan:hover, polygon#cyan:active { polygon#cyan:hover, polygon#cyan:active {
fill: cyan; fill: cyan;
} }
polygon#blue { polygon#blue {
fill: rgba(0,0,255,0.4); fill: rgba(0,0,255,0.4);
} }
polygon#blue:hover, polygon#blue:active { polygon#blue:hover, polygon#blue:active {
fill: blue; fill: blue;
} }
button { button {
font-size: 15px; font-size: 15px;
margin: 0 0.7em 0.7em 0; margin: 0 0.7em 0.7em 0;
} }
</style> </style>
</head> </head>
<body> <body>
<div id="container"></div> <div id="container"></div>
</body> </body>
</html> </html>

@ -67,8 +67,13 @@ const detailView = (movie) =>
h('div.desc', { h('div.desc', {
style: {opacity: '0', transform: 'translateX(3em)', style: {opacity: '0', transform: 'translateX(3em)',
delayed: {opacity: '1', transform: 'translate(0)'}, delayed: {opacity: '1', transform: 'translate(0)'},
remove: {opacity: '0', position: 'absolute', top: '0', left: '0', remove: {
transform: 'translateX(3em)'} opacity: '0',
position: 'absolute',
top: '0',
left: '0',
transform: 'translateX(3em)'
}
} }
}, [ }, [
h('h2', 'Description:'), h('h2', 'Description:'),

357
package-lock.json generated

@ -482,6 +482,15 @@
"integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==", "integrity": "sha512-wGUIVQXuehL5TCqQun8OW81jGzAWycqzFF8lFp+GOM5BXLYj3bKNsYC4daB7n6XjCqxQA/qgTJ+8ANR3acjrog==",
"dev": true "dev": true
}, },
"asn1": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
"integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==",
"dev": true,
"requires": {
"safer-buffer": "~2.1.0"
}
},
"asn1.js": { "asn1.js": {
"version": "4.10.1", "version": "4.10.1",
"resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz", "resolved": "https://registry.npmjs.org/asn1.js/-/asn1.js-4.10.1.tgz",
@ -519,6 +528,12 @@
} }
} }
}, },
"assert-plus": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz",
"integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=",
"dev": true
},
"assign-symbols": { "assign-symbols": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz", "resolved": "https://registry.npmjs.org/assign-symbols/-/assign-symbols-1.0.0.tgz",
@ -552,12 +567,30 @@
"integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==", "integrity": "sha512-jp/uFnooOiO+L211eZOoSyzpOITMXx1rBITauYykG3BRYPu8h0UcxsPNB04RR5vo4Tyz3+ay17tR6JVf9qzYWg==",
"dev": true "dev": true
}, },
"asynckit": {
"version": "0.4.0",
"resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
"integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k=",
"dev": true
},
"atob": { "atob": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz", "resolved": "https://registry.npmjs.org/atob/-/atob-2.1.2.tgz",
"integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==", "integrity": "sha512-Wm6ukoaOGJi/73p/cl2GvLjTI5JM1k/O14isD73YML8StrH/7/lRFgmg8nICZgD3bZZvjwCGxtMOD3wWNAu8cg==",
"dev": true "dev": true
}, },
"aws-sign2": {
"version": "0.7.0",
"resolved": "https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.7.0.tgz",
"integrity": "sha1-tG6JCTSpWR8tL2+G1+ap8bP+dqg=",
"dev": true
},
"aws4": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/aws4/-/aws4-1.8.0.tgz",
"integrity": "sha512-ReZxvNHIOv88FlT7rxcXIIC0fPt4KZqZbOlivyWtXLt8ESx84zd3kMC6iK5jVeS2qt+g7ftS7ye4fi06X5rtRQ==",
"dev": true
},
"backo2": { "backo2": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz", "resolved": "https://registry.npmjs.org/backo2/-/backo2-1.0.2.tgz",
@ -643,6 +676,15 @@
"integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=", "integrity": "sha1-R2iMuZu2gE8OBtPnY7HDLlfY5rY=",
"dev": true "dev": true
}, },
"bcrypt-pbkdf": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz",
"integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=",
"dev": true,
"requires": {
"tweetnacl": "^0.14.3"
}
},
"beeper": { "beeper": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz", "resolved": "https://registry.npmjs.org/beeper/-/beeper-1.1.1.tgz",
@ -1098,6 +1140,12 @@
"map-obj": "^1.0.0" "map-obj": "^1.0.0"
} }
}, },
"caseless": {
"version": "0.12.0",
"resolved": "https://registry.npmjs.org/caseless/-/caseless-0.12.0.tgz",
"integrity": "sha1-G2gcIf+EAzyCZUMJBolCDRhxUdw=",
"dev": true
},
"chainsaw": { "chainsaw": {
"version": "0.1.0", "version": "0.1.0",
"resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz", "resolved": "https://registry.npmjs.org/chainsaw/-/chainsaw-0.1.0.tgz",
@ -1163,6 +1211,12 @@
} }
} }
}, },
"chownr": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/chownr/-/chownr-1.1.3.tgz",
"integrity": "sha512-i70fVHhmV3DtTl6nqvZOnIjbY0Pe4kAUjwHj8z0zAdgBtYrJyYwLKCCuRBQ5ppkyL0AkN7HKRnETdmdp1zqNXw==",
"dev": true
},
"ci-info": { "ci-info": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz",
@ -1293,6 +1347,15 @@
"source-map": "~0.5.3" "source-map": "~0.5.3"
} }
}, },
"combined-stream": {
"version": "1.0.8",
"resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
"integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
"dev": true,
"requires": {
"delayed-stream": "~1.0.0"
}
},
"commander": { "commander": {
"version": "2.19.0", "version": "2.19.0",
"resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.19.0.tgz",
@ -1614,6 +1677,15 @@
"integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==", "integrity": "sha512-Vy4dx7gquTeMcQR/hDkYLGUnwVil6vk4FOOct+djUnHOUWt+zJPJAaRIXaAFkPXtJjvlY7o3rfRu0/3hpnwoUA==",
"dev": true "dev": true
}, },
"dashdash": {
"version": "1.14.1",
"resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz",
"integrity": "sha1-hTz6D3y+L+1d4gMmuN1YEDX24vA=",
"dev": true,
"requires": {
"assert-plus": "^1.0.0"
}
},
"date-format": { "date-format": {
"version": "1.2.0", "version": "1.2.0",
"resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz", "resolved": "https://registry.npmjs.org/date-format/-/date-format-1.2.0.tgz",
@ -1766,6 +1838,12 @@
"integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=", "integrity": "sha1-yY2bzvdWdBiOEQlpFRGZ45sfppM=",
"dev": true "dev": true
}, },
"delayed-stream": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
"integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
"dev": true
},
"depd": { "depd": {
"version": "1.1.2", "version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
@ -1889,6 +1967,26 @@
"readable-stream": "^2.0.2" "readable-stream": "^2.0.2"
} }
}, },
"ecc-jsbn": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/ecc-jsbn/-/ecc-jsbn-0.1.2.tgz",
"integrity": "sha1-OoOpBOVDUyh4dMVkt1SThoSamMk=",
"dev": true,
"requires": {
"jsbn": "~0.1.0",
"safer-buffer": "^2.1.0"
}
},
"editorconfig-checker": {
"version": "3.0.3",
"resolved": "https://registry.npmjs.org/editorconfig-checker/-/editorconfig-checker-3.0.3.tgz",
"integrity": "sha512-5ol7xt2+BCK0y/KgBoi4olyU51zmd/8/vYtRxO8RYLpNVelAhAq9l8kiNjaLGhxW7LC95BfhPl9skrygyG2hJw==",
"dev": true,
"requires": {
"request": "^2.88.0",
"tar": "^4.4.10"
}
},
"ee-first": { "ee-first": {
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
@ -2898,6 +2996,12 @@
} }
} }
}, },
"extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
"integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=",
"dev": true
},
"fake-raf": { "fake-raf": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/fake-raf/-/fake-raf-1.0.1.tgz", "resolved": "https://registry.npmjs.org/fake-raf/-/fake-raf-1.0.1.tgz",
@ -3109,6 +3213,23 @@
"for-in": "^1.0.1" "for-in": "^1.0.1"
} }
}, },
"forever-agent": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz",
"integrity": "sha1-+8cfDEGt6zf5bFd60e1C2P2sypE=",
"dev": true
},
"form-data": {
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
"dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
},
"fragment-cache": { "fragment-cache": {
"version": "0.2.1", "version": "0.2.1",
"resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz", "resolved": "https://registry.npmjs.org/fragment-cache/-/fragment-cache-0.2.1.tgz",
@ -3127,6 +3248,15 @@
"null-check": "^1.0.0" "null-check": "^1.0.0"
} }
}, },
"fs-minipass": {
"version": "1.2.7",
"resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-1.2.7.tgz",
"integrity": "sha512-GWSSJGFy4e9GUeCcbIkED+bgAoFyj7XF1mV8rma3QW4NIqX9Kyx79N/PF61H5udOV3aY1IaMLs6pGbH71nlCTA==",
"dev": true,
"requires": {
"minipass": "^2.6.0"
}
},
"fs.realpath": { "fs.realpath": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@ -3749,6 +3879,15 @@
"integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=", "integrity": "sha1-3BXKHGcjh8p2vTesCjlbogQqLCg=",
"dev": true "dev": true
}, },
"getpass": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/getpass/-/getpass-0.1.7.tgz",
"integrity": "sha1-Xv+OPmhNVprkyysSgmBOi6YhSfo=",
"dev": true,
"requires": {
"assert-plus": "^1.0.0"
}
},
"glob": { "glob": {
"version": "7.1.3", "version": "7.1.3",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz", "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.3.tgz",
@ -4326,6 +4465,22 @@
} }
} }
}, },
"har-schema": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/har-schema/-/har-schema-2.0.0.tgz",
"integrity": "sha1-qUwiJOvKwEeCoNkDVSHyRzW37JI=",
"dev": true
},
"har-validator": {
"version": "5.1.3",
"resolved": "https://registry.npmjs.org/har-validator/-/har-validator-5.1.3.tgz",
"integrity": "sha512-sNvOCzEQNr/qrvJgc3UG/kD4QtlHycrzwS+6mfTrrSq97BvaYcPZZI1ZSqGSPR73Cxn4LKTD4PttRwfU7jWq5g==",
"dev": true,
"requires": {
"ajv": "^6.5.5",
"har-schema": "^2.0.0"
}
},
"has": { "has": {
"version": "1.0.3", "version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
@ -4501,6 +4656,17 @@
"requires-port": "^1.0.0" "requires-port": "^1.0.0"
} }
}, },
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
"integrity": "sha1-muzZJRFHcvPZW2WmCruPfBj7rOE=",
"dev": true,
"requires": {
"assert-plus": "^1.0.0",
"jsprim": "^1.2.2",
"sshpk": "^1.7.0"
}
},
"https-browserify": { "https-browserify": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz", "resolved": "https://registry.npmjs.org/https-browserify/-/https-browserify-1.0.0.tgz",
@ -5099,6 +5265,12 @@
"has-symbols": "^1.0.0" "has-symbols": "^1.0.0"
} }
}, },
"is-typedarray": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz",
"integrity": "sha1-5HnICFjfDBsR3dppQPlgEfzaSpo=",
"dev": true
},
"is-unc-path": { "is-unc-path": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz", "resolved": "https://registry.npmjs.org/is-unc-path/-/is-unc-path-1.0.0.tgz",
@ -5153,6 +5325,12 @@
"integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=", "integrity": "sha1-TkMekrEalzFjaqH5yNHMvP2reN8=",
"dev": true "dev": true
}, },
"isstream": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=",
"dev": true
},
"istanbul": { "istanbul": {
"version": "0.4.5", "version": "0.4.5",
"resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz", "resolved": "https://registry.npmjs.org/istanbul/-/istanbul-0.4.5.tgz",
@ -5241,12 +5419,24 @@
} }
} }
}, },
"jsbn": {
"version": "0.1.1",
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
"integrity": "sha1-peZUwuWi3rXyAdls77yoDA7y9RM=",
"dev": true
},
"json-parse-better-errors": { "json-parse-better-errors": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz", "resolved": "https://registry.npmjs.org/json-parse-better-errors/-/json-parse-better-errors-1.0.2.tgz",
"integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==", "integrity": "sha512-mrqyZKfX5EhL7hvqcV6WG1yYjnjeuYDzDhhcAAUrq8Po85NBQBJP+ZDUT75qZQ98IkUoBqdkExkukOU7Ts2wrw==",
"dev": true "dev": true
}, },
"json-schema": {
"version": "0.2.3",
"resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.2.3.tgz",
"integrity": "sha1-tIDIkuWaLwWVTOcnvT8qTogvnhM=",
"dev": true
},
"json-schema-traverse": { "json-schema-traverse": {
"version": "0.4.1", "version": "0.4.1",
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
@ -5286,6 +5476,18 @@
"integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=", "integrity": "sha1-P02uSpH6wxX3EGL4UhzCOfE2YoA=",
"dev": true "dev": true
}, },
"jsprim": {
"version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
"integrity": "sha1-MT5mvB5cwG5Di8G3SZwuXFastqI=",
"dev": true,
"requires": {
"assert-plus": "1.0.0",
"extsprintf": "1.3.0",
"json-schema": "0.2.3",
"verror": "1.10.0"
}
},
"karma": { "karma": {
"version": "3.1.4", "version": "3.1.4",
"resolved": "https://registry.npmjs.org/karma/-/karma-3.1.4.tgz", "resolved": "https://registry.npmjs.org/karma/-/karma-3.1.4.tgz",
@ -6191,6 +6393,33 @@
"integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=",
"dev": true "dev": true
}, },
"minipass": {
"version": "2.9.0",
"resolved": "https://registry.npmjs.org/minipass/-/minipass-2.9.0.tgz",
"integrity": "sha512-wxfUjg9WebH+CUDX/CdbRlh5SmfZiy/hpkxaRI16Y9W56Pa75sWgd/rvFilSgrauD9NyFymP/+JFV3KwzIsJeg==",
"dev": true,
"requires": {
"safe-buffer": "^5.1.2",
"yallist": "^3.0.0"
},
"dependencies": {
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"dev": true
}
}
},
"minizlib": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/minizlib/-/minizlib-1.3.3.tgz",
"integrity": "sha512-6ZYMOEnmVsdCeTJVE0W9ZD+pVnE8h9Hma/iOwwRDsdQoePpoX56/8B6z3P9VNwppJuBKNRuFDRNRqRWexT9G9Q==",
"dev": true,
"requires": {
"minipass": "^2.9.0"
}
},
"mixin-deep": { "mixin-deep": {
"version": "1.3.1", "version": "1.3.1",
"resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz",
@ -6600,6 +6829,12 @@
"integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=", "integrity": "sha1-CXtgK1NCKlIsGvuHkDGDNpQaAR0=",
"dev": true "dev": true
}, },
"oauth-sign": {
"version": "0.9.0",
"resolved": "https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.9.0.tgz",
"integrity": "sha512-fexhUFFPTGV8ybAtSIGbV6gOkSv8UtRbDBnAyLQw4QPKkgNlsH2ByPGtMUqdWkos6YCRmAqViwgZrJc/mRDzZQ==",
"dev": true
},
"object-assign": { "object-assign": {
"version": "3.0.0", "version": "3.0.0",
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz", "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-3.0.0.tgz",
@ -7046,6 +7281,12 @@
"sha.js": "^2.4.8" "sha.js": "^2.4.8"
} }
}, },
"performance-now": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz",
"integrity": "sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns=",
"dev": true
},
"pidtree": { "pidtree": {
"version": "0.3.0", "version": "0.3.0",
"resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz", "resolved": "https://registry.npmjs.org/pidtree/-/pidtree-0.3.0.tgz",
@ -7202,6 +7443,12 @@
"integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=", "integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"dev": true "dev": true
}, },
"psl": {
"version": "1.4.0",
"resolved": "https://registry.npmjs.org/psl/-/psl-1.4.0.tgz",
"integrity": "sha512-HZzqCGPecFLyoRj5HLfuDSKYTJkAfB5thKBIkRHtGjWwY7p1dAyveIbXIq4tO0KYfDF2tHqPUgY9SDnGm00uFw==",
"dev": true
},
"public-encrypt": { "public-encrypt": {
"version": "4.0.3", "version": "4.0.3",
"resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz", "resolved": "https://registry.npmjs.org/public-encrypt/-/public-encrypt-4.0.3.tgz",
@ -7511,6 +7758,34 @@
"integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=", "integrity": "sha1-KbvZIHinOfC8zitO5B6DeVNSKSQ=",
"dev": true "dev": true
}, },
"request": {
"version": "2.88.0",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz",
"integrity": "sha512-NAqBSrijGLZdM0WZNsInLJpkJokL72XYjUpnB0iwsRgxh7dB6COrHnTBNwN0E+lHDAJzu7kLAkDeY08z2/A0hg==",
"dev": true,
"requires": {
"aws-sign2": "~0.7.0",
"aws4": "^1.8.0",
"caseless": "~0.12.0",
"combined-stream": "~1.0.6",
"extend": "~3.0.2",
"forever-agent": "~0.6.1",
"form-data": "~2.3.2",
"har-validator": "~5.1.0",
"http-signature": "~1.2.0",
"is-typedarray": "~1.0.0",
"isstream": "~0.1.2",
"json-stringify-safe": "~5.0.1",
"mime-types": "~2.1.19",
"oauth-sign": "~0.9.0",
"performance-now": "^2.1.0",
"qs": "~6.5.2",
"safe-buffer": "^5.1.2",
"tough-cookie": "~2.4.3",
"tunnel-agent": "^0.6.0",
"uuid": "^3.3.2"
}
},
"requires-port": { "requires-port": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz", "resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
@ -8063,6 +8338,23 @@
"integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=",
"dev": true "dev": true
}, },
"sshpk": {
"version": "1.16.1",
"resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.16.1.tgz",
"integrity": "sha512-HXXqVUq7+pcKeLqqZj6mHFUMvXtOJt1uoUx09pFW6011inTMxqI8BA8PM95myrIyyKwdnzjdFjLiE6KBPVtJIg==",
"dev": true,
"requires": {
"asn1": "~0.2.3",
"assert-plus": "^1.0.0",
"bcrypt-pbkdf": "^1.0.0",
"dashdash": "^1.12.0",
"ecc-jsbn": "~0.1.1",
"getpass": "^0.1.1",
"jsbn": "~0.1.0",
"safer-buffer": "^2.0.2",
"tweetnacl": "~0.14.0"
}
},
"static-extend": { "static-extend": {
"version": "0.1.2", "version": "0.1.2",
"resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz", "resolved": "https://registry.npmjs.org/static-extend/-/static-extend-0.1.2.tgz",
@ -8364,6 +8656,29 @@
} }
} }
}, },
"tar": {
"version": "4.4.13",
"resolved": "https://registry.npmjs.org/tar/-/tar-4.4.13.tgz",
"integrity": "sha512-w2VwSrBoHa5BsSyH+KxEqeQBAllHhccyMFVHtGtdMpF4W7IRWfZjFiQceJPChOeTsSDVUpER2T8FA93pr0L+QA==",
"dev": true,
"requires": {
"chownr": "^1.1.1",
"fs-minipass": "^1.2.5",
"minipass": "^2.8.6",
"minizlib": "^1.2.1",
"mkdirp": "^0.5.0",
"safe-buffer": "^5.1.2",
"yallist": "^3.0.3"
},
"dependencies": {
"yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
"integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==",
"dev": true
}
}
},
"text-table": { "text-table": {
"version": "0.2.0", "version": "0.2.0",
"resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz", "resolved": "https://registry.npmjs.org/text-table/-/text-table-0.2.0.tgz",
@ -8483,6 +8798,16 @@
"repeat-string": "^1.6.1" "repeat-string": "^1.6.1"
} }
}, },
"tough-cookie": {
"version": "2.4.3",
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz",
"integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==",
"dev": true,
"requires": {
"psl": "^1.1.24",
"punycode": "^1.4.1"
}
},
"traverse": { "traverse": {
"version": "0.3.9", "version": "0.3.9",
"resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz", "resolved": "https://registry.npmjs.org/traverse/-/traverse-0.3.9.tgz",
@ -8516,6 +8841,21 @@
"integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==", "integrity": "sha512-C3TaO7K81YvjCgQH9Q1S3R3P3BtN3RIM8n+OvX4il1K1zgE8ZhI0op7kClgkxtutIE8hQrcrHBXvIheqKUUCxw==",
"dev": true "dev": true
}, },
"tunnel-agent": {
"version": "0.6.0",
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
"integrity": "sha1-J6XeoGs2sEoKmWZ3SykIaPD8QP0=",
"dev": true,
"requires": {
"safe-buffer": "^5.0.1"
}
},
"tweetnacl": {
"version": "0.14.5",
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
"integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=",
"dev": true
},
"type-check": { "type-check": {
"version": "0.3.2", "version": "0.3.2",
"resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz", "resolved": "https://registry.npmjs.org/type-check/-/type-check-0.3.2.tgz",
@ -8816,6 +9156,12 @@
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=", "integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
"dev": true "dev": true
}, },
"uuid": {
"version": "3.3.3",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.3.3.tgz",
"integrity": "sha512-pW0No1RGHgzlpHJO1nsVrHKpOEIxkGg1xB+v0ZmdNH5OAeAwzAVrCnI2/6Mtx+Uys6iaylxa+D3g4j63IKKjSQ==",
"dev": true
},
"v8-compile-cache": { "v8-compile-cache": {
"version": "2.1.0", "version": "2.1.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz", "resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.1.0.tgz",
@ -8841,6 +9187,17 @@
"spdx-expression-parse": "^3.0.0" "spdx-expression-parse": "^3.0.0"
} }
}, },
"verror": {
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/verror/-/verror-1.10.0.tgz",
"integrity": "sha1-OhBcoXBTr1XW4nDB+CiGguGNpAA=",
"dev": true,
"requires": {
"assert-plus": "^1.0.0",
"core-util-is": "1.0.2",
"extsprintf": "^1.2.0"
}
},
"vinyl": { "vinyl": {
"version": "0.5.3", "version": "0.5.3",
"resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-0.5.3.tgz",

@ -13,6 +13,7 @@
"@typescript-eslint/eslint-plugin": "^2.7.0", "@typescript-eslint/eslint-plugin": "^2.7.0",
"benchmark": "^2.1.4", "benchmark": "^2.1.4",
"browserify": "^14.4.0", "browserify": "^14.4.0",
"editorconfig-checker": "^3.0.3",
"eslint": "^6.6.0", "eslint": "^6.6.0",
"eslint-config-standard-with-typescript": "^11.0.1", "eslint-config-standard-with-typescript": "^11.0.1",
"eslint-plugin-import": "^2.18.2", "eslint-plugin-import": "^2.18.2",
@ -39,7 +40,9 @@
"xyz": "2.1.0" "xyz": "2.1.0"
}, },
"scripts": { "scripts": {
"lint": "eslint --ext .js,.ts .", "lint:js": "eslint --ext .js,.ts .",
"lint:editorconfig": "editorconfig-checker",
"lint": "run-s lint:editorconfig lint:js",
"unit": "karma start", "unit": "karma start",
"test": "run-s lint compile unit", "test": "run-s lint compile unit",
"compile": "npm run compile-es && npm run compile-commonjs", "compile": "npm run compile-es && npm run compile-commonjs",

@ -22,9 +22,11 @@ function getTextNodeRect(textNode: Text): ClientRect | undefined {
return rect; return rect;
} }
function calcTransformOrigin(isTextNode: boolean, function calcTransformOrigin(
textRect: ClientRect | undefined, isTextNode: boolean,
boundingRect: ClientRect): string { textRect: ClientRect | undefined,
boundingRect: ClientRect
): string {
if (isTextNode) { if (isTextNode) {
if (textRect) { if (textRect) {
//calculate pixels to center of text from left edge of bounding box //calculate pixels to center of text from left edge of bounding box
@ -36,15 +38,19 @@ function calcTransformOrigin(isTextNode: boolean,
return '0 0'; //top left return '0 0'; //top left
} }
function getTextDx(oldTextRect: ClientRect | undefined, function getTextDx(
newTextRect: ClientRect | undefined): number { oldTextRect: ClientRect | undefined,
newTextRect: ClientRect | undefined
): number {
if (oldTextRect && newTextRect) { if (oldTextRect && newTextRect) {
return ((oldTextRect.left + oldTextRect.width/2) - (newTextRect.left + newTextRect.width/2)); return ((oldTextRect.left + oldTextRect.width/2) - (newTextRect.left + newTextRect.width/2));
} }
return 0; return 0;
} }
function getTextDy(oldTextRect: ClientRect | undefined, function getTextDy(
newTextRect: ClientRect | undefined): number { oldTextRect: ClientRect | undefined,
newTextRect: ClientRect | undefined
): number {
if (oldTextRect && newTextRect) { if (oldTextRect && newTextRect) {
return ((oldTextRect.top + oldTextRect.height/2) - (newTextRect.top + newTextRect.height/2)); return ((oldTextRect.top + oldTextRect.height/2) - (newTextRect.top + newTextRect.height/2));
} }
@ -125,8 +131,9 @@ function post() {
newStyle.transition = origTransition + 'transform 0s'; newStyle.transition = origTransition + 'transform 0s';
newStyle.transformOrigin = calcTransformOrigin(isTextNode, newTextRect, newRect); newStyle.transformOrigin = calcTransformOrigin(isTextNode, newTextRect, newRect);
newStyle.opacity = '0'; newStyle.opacity = '0';
newStyle.transform = origTransform + 'translate('+dx+'px, '+dy+'px) ' + newStyle.transform = origTransform +
'scale('+1/wRatio+', '+1/hRatio+')'; 'translate('+dx+'px, '+dy+'px) ' +
'scale('+1/wRatio+', '+1/hRatio+')';
setNextFrame(newStyle, 'transition', origTransition); setNextFrame(newStyle, 'transition', origTransition);
setNextFrame(newStyle, 'transform', origTransform); setNextFrame(newStyle, 'transform', origTransform);
setNextFrame(newStyle, 'opacity', '1'); setNextFrame(newStyle, 'opacity', '1');
@ -162,4 +169,4 @@ function post() {
} }
export const heroModule = {pre, create, destroy, post} as Module; export const heroModule = {pre, create, destroy, post} as Module;
export default heroModule; export default heroModule;

@ -7,4 +7,4 @@ export interface Module {
destroy: DestroyHook; destroy: DestroyHook;
remove: RemoveHook; remove: RemoveHook;
post: PostHook; post: PostHook;
} }

@ -28,4 +28,4 @@ function updateProps(oldVnode: VNode, vnode: VNode): void {
} }
export const propsModule = {create: updateProps, update: updateProps} as Module; export const propsModule = {create: updateProps, update: updateProps} as Module;
export default propsModule; export default propsModule;

@ -13,4 +13,4 @@ var patch = init([ // Init patch function with choosen modules
eventListenersModule eventListenersModule
]) as (oldVNode: any, vnode: any) => any; ]) as (oldVNode: any, vnode: any) => any;
export const snabbdomBundle = { patch, h: h as any }; export const snabbdomBundle = { patch, h: h as any };
export default snabbdomBundle; export default snabbdomBundle;

@ -96,8 +96,9 @@ export function init(modules: Array<Partial<Module>>, domApi?: DOMAPI) {
const hash = hashIdx > 0 ? hashIdx : sel.length; const hash = hashIdx > 0 ? hashIdx : sel.length;
const dot = dotIdx > 0 ? dotIdx : sel.length; const dot = dotIdx > 0 ? dotIdx : sel.length;
const tag = hashIdx !== -1 || dotIdx !== -1 ? sel.slice(0, Math.min(hash, dot)) : sel; const tag = hashIdx !== -1 || dotIdx !== -1 ? sel.slice(0, Math.min(hash, dot)) : sel;
const elm = vnode.elm = isDef(data) && isDef(i = (data as VNodeData).ns) ? api.createElementNS(i, tag) const elm = vnode.elm = isDef(data) && isDef(i = (data as VNodeData).ns)
: api.createElement(tag); ? api.createElementNS(i, tag)
: api.createElement(tag);
if (hash < dot) elm.setAttribute('id', sel.slice(hash + 1, dot)); if (hash < dot) elm.setAttribute('id', sel.slice(hash + 1, dot));
if (dotIdx > 0) elm.setAttribute('class', sel.slice(dot + 1).replace(/\./g, ' ')); if (dotIdx > 0) elm.setAttribute('class', sel.slice(dot + 1).replace(/\./g, ' '));
for (i = 0; i < cbs.create.length; ++i) cbs.create[i](emptyNode, vnode); for (i = 0; i < cbs.create.length; ++i) cbs.create[i](emptyNode, vnode);
@ -122,12 +123,14 @@ export function init(modules: Array<Partial<Module>>, domApi?: DOMAPI) {
return vnode.elm; return vnode.elm;
} }
function addVnodes(parentElm: Node, function addVnodes(
before: Node | null, parentElm: Node,
vnodes: Array<VNode>, before: Node | null,
startIdx: number, vnodes: Array<VNode>,
endIdx: number, startIdx: number,
insertedVnodeQueue: VNodeQueue) { endIdx: number,
insertedVnodeQueue: VNodeQueue
) {
for (; startIdx <= endIdx; ++startIdx) { for (; startIdx <= endIdx; ++startIdx) {
const ch = vnodes[startIdx]; const ch = vnodes[startIdx];
if (ch != null) { if (ch != null) {

@ -61,4 +61,4 @@ export const thunk = function thunk(sel: string, key?: any, fn?: any, args?: any
}); });
} as ThunkFn; } as ThunkFn;
export default thunk; export default thunk;

@ -36,4 +36,4 @@ export function toVNode(node: Node, domApi?: DOMAPI): VNode {
} }
} }
export default toVNode; export default toVNode;

@ -13,10 +13,10 @@ describe('attachTo', function() {
}); });
it('adds element to target', function() { it('adds element to target', function() {
var vnode1 = h('div', [ var vnode1 = h('div', [
h('div#wrapper', [ h('div#wrapper', [
h('div', 'Some element'), h('div', 'Some element'),
attachTo(elm, h('div#attached', 'Test')), attachTo(elm, h('div#attached', 'Test')),
]), ]),
]); ]);
elm = patch(vnode0, vnode1).elm; elm = patch(vnode0, vnode1).elm;
assert.equal(elm.children.length, 2); assert.equal(elm.children.length, 2);

@ -1,53 +1,53 @@
var assert = require('assert'); var assert = require('assert');
var snabbdom = require('../snabbdom'); var snabbdom = require('../snabbdom');
var h = require('../h').default; var h = require('../h').default;
var patch = snabbdom.init([ var patch = snabbdom.init([
require('../modules/attributes').default require('../modules/attributes').default
]); ]);
describe('svg', function () { describe('svg', function () {
var elm, vnode0; var elm, vnode0;
beforeEach(function() { beforeEach(function() {
elm = document.createElement('svg'); elm = document.createElement('svg');
vnode0 = elm; vnode0 = elm;
}); });
it('removes child svg elements', function(){ it('removes child svg elements', function(){
var a = h('svg', {}, [ var a = h('svg', {}, [
h('g'), h('g'),
h('g') h('g')
]); ]);
var b = h('svg', {}, [ var b = h('svg', {}, [
h('g') h('g')
]); ]);
var result = patch(patch(vnode0, a), b).elm; var result = patch(patch(vnode0, a), b).elm;
assert.equal(result.childNodes.length, 1); assert.equal(result.childNodes.length, 1);
}); });
it('adds correctly xlink namespaced attribute', function(){ it('adds correctly xlink namespaced attribute', function(){
var xlinkNS = 'http://www.w3.org/1999/xlink'; var xlinkNS = 'http://www.w3.org/1999/xlink';
var testUrl = '/test'; var testUrl = '/test';
var a = h('svg', {}, [ var a = h('svg', {}, [
h('use', { h('use', {
attrs: { 'xlink:href': testUrl } attrs: { 'xlink:href': testUrl }
}, []) }, [])
]); ]);
var result = patch(vnode0, a).elm; var result = patch(vnode0, a).elm;
assert.equal(result.childNodes.length, 1); assert.equal(result.childNodes.length, 1);
assert.equal(result.childNodes[0].getAttribute('xlink:href'), testUrl); assert.equal(result.childNodes[0].getAttribute('xlink:href'), testUrl);
assert.equal(result.childNodes[0].getAttributeNS(xlinkNS,'href'), testUrl); assert.equal(result.childNodes[0].getAttributeNS(xlinkNS,'href'), testUrl);
}); });
it('adds correctly xml namespaced attribute', function(){ it('adds correctly xml namespaced attribute', function(){
var xmlNS = 'http://www.w3.org/XML/1998/namespace'; var xmlNS = 'http://www.w3.org/XML/1998/namespace';
var testAttrValue = 'und'; var testAttrValue = 'und';
var a = h('svg', { attrs: { 'xml:lang': testAttrValue } }, []); var a = h('svg', { attrs: { 'xml:lang': testAttrValue } }, []);
var result = patch(vnode0, a).elm; var result = patch(vnode0, a).elm;
assert.equal(result.getAttributeNS(xmlNS, 'lang'), testAttrValue); assert.equal(result.getAttributeNS(xmlNS, 'lang'), testAttrValue);
assert.equal(result.getAttribute('xml:lang'), testAttrValue); assert.equal(result.getAttribute('xml:lang'), testAttrValue);
}); });
}) })

Loading…
Cancel
Save