0.10.0 • Published 7 months ago

fandom v0.10.0

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

fandom

MIT license Maintenance status NPM version Downloads per week Code coverage

Attention

Until v1.0.0 is released any breaking changes could be introduced without major version bumping

About

fandom is a lightweight vanilla package that helps build DOM nodes

It has quite limited abilities but it's good enough in simple cases

Motivation

I'm a bit tired that some developers use heavy tools (like React, Vue or Angular) everywhere and all the time even if application is so tiny. Those tools are everywhere around us. It's over-engineering and a bit stupid from my point of view. Let's make something lightweight and nice.

Usage

import { Builder, convert, clear, insert, replace } from "fandom";

const $root = document.querySelector("#root");

const builder = new Builder();
const elements = [3, 14, 15, 9, 26];

builder.div({ class: "list" });

for (let i = 0; i < elements.length; i++) {
    builder.div({ id: elements[i], style: { color: "red" } }).text(`number ${elements[i]}`).close();
}

builder.close();

const model = builder.done();
const domElements = convert(model);

replace($root, domElements);

const $notifications = document.querySelector("#notifications");
clear($notifications);

const changeHandler = (e) = console.log(e.target.value);
builded.input(null, {change: changeHandler});
insert($root, convert(builder.done()));

Tests

Packages

  • mocha is used for unit testing
  • nyc - for coverage

How to run

  • npm test - run unit tests
  • npm run cover - run code coverage
  • npm run test:ui - run e2e tests
0.10.0

7 months ago

0.9.0

7 months ago

0.8.1

7 months ago

0.8.0

7 months ago

0.7.0

8 months ago

0.6.0

9 months ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago