Commit Graph

11 Commits (86488cb8ca0d7e451107e4511cc3da087be69c84)

Author SHA1 Message Date
Shahar Dawn Or 431f95018e
fix: include JSX related module in package ()
Fixes .
Shahar Dawn Or e018fdf79f
chore(tsc): simplify tsconfig.json using tsconfigs ()
Shahar Dawn Or b77cb512f4
refactor(tests): convert to TypeScript ()
Closes .
Fixes .
Noj Vek 7ff8d13b4e snabbdom can be used with jsx/tsx via jsxFactory: jsx
Alexandre Galays fc47e2c9b1 Add package.json/module
Andre Staltz a0033a635d
Introduce toVNode() to reconstruct root element as vnode
This commit addresses issue . 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 . 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  and enabling
client/server-side rendering in an efficient manner
(destruction/recreation client-side is probably too expensive).
Andre Staltz 1b0163cb94
Fix modules/module file to be TypeScript source
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.
Andre Staltz ef8b60993b Fix hooks file to be TypeScript source
In order for other TypeScript code to consume snabbdom's TypeScript
correctly, we must "export" the hooks interfaces just like we export
other types.
José Luis Lafuente ccbf30f0c6
Add support for css variables
Andre Staltz 091dc5f961
Migrate from CommonJS modules to ES2015 modules
Andre Staltz 499cd37b06
Migrate source code to TypeScript v2.0