ISSUES CLOSED: #913, #748
BREAKING CHANGE:
The imports of snabbdom functions have changed. Every file in the
project had to be imported on its own, e.g.
```
import { h } from 'snabbdom/h'
import { VNode } from 'snabbdom/vnode'
```
Now, the main snabbdom package exports all of the public API like
```
import { h, VNode } from 'snabbdom'
```
This means consumers of the snabbdom package need to update their
imports. The change makes the use of the `exports` field in
`package.json` unnecessary, which caused issues for TypeScript users
BREAKING CHANGE: CommonJS module are no longer provided.
BREAKING CHANGE: import paths in ES modules include file name
extensions.
BREAKING CHANGE: Compiled to ES2015 (was ES5).
Fixes#516.
Fixes#437.
Fixes#263. Kind of. Because there is no build step.
Thanks to @mreinstein on starting this work.
This commit addresses issue #167. Previously, in snabbdom v0.5.0,
patch(element, vnode) would always create a new element for the root.
This resulted in problems with custom elements (web components), and was
fixed in commit c091c59c59.
However, that commit resulted in bug #167. This meant that snabbdom
would have bugs with server-side rendering, where the root element would
be non-empty (it has many children, rendered on the server-side as
HTML), and the client-side rendering should reuse those existing
children (or clear all the children and recreate them again in patch()).
This commit introduces the function toVNode(elm) that deep-converts an
element (and its tree) to a VNode (and its tree), that is separately
imported and used before calling patch(). toVNode(elm) will look at the
element's attributes and gather those as data for the vnode.
Overall, this commit is important for fixing #167 and enabling
client/server-side rendering in an efficient manner
(destruction/recreation client-side is probably too expensive).
In order for other TypeScript code to consume snabbdom's TypeScript
correctly, we must "export" the modules/module interface just like
we export other types.