0.4.5 • Published 12 months ago

micromorph v0.4.5

Weekly downloads
-
License
MIT
Repository
-
Last release
12 months ago

🤏 micromorph

A very tiny library for diffing live DOM nodes.

Extremely handy when used in conjunction with the DOMParser API.


Use Cases

Want to update one node to match another?

Diff them efficiently and only sync changes between the two nodes.

import diff from 'micromorph';

diff(fromNode, toNode);

Want to update the current document to match a new document, maybe from a string?

Micromorph is smart enough to handle full document diffing while avoiding FOUC.

import diff from 'micromorph';
const p = new DOMParser();

const newDoc = p.parseFromString(`<h1>Hello world!</h1>`, 'text/html');

diff(document, newDoc);

Want to turn your MPA into an SPA?

With the /nav entrypoint, Micromorph automatically converts your MPA into a SPA while only re-rendering content that has changed.

import listen from 'micromorph/nav';

listen();

For browsers that don't support the Navigation API, the /spa entrypoint can be used.

import listen from 'micromorph/spa';

listen();
0.4.5

12 months ago

0.4.4

1 year ago

0.4.1

1 year ago

0.4.0

1 year ago

0.4.3

1 year ago

0.4.2

1 year ago

0.3.0

2 years ago

0.3.1

2 years ago

0.2.2

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.1.0

2 years ago

0.1.2

2 years ago

0.0.3

2 years ago

0.1.1

2 years ago

0.0.9

2 years ago

0.0.8

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago

0.0.7

2 years ago

0.0.6

2 years ago

0.0.2

2 years ago

0.0.1

2 years ago