An open API service indexing awesome lists of open source software.

https://github.com/robleroni/puerro

Keeping the Web as Lean as a Leek
https://github.com/robleroni/puerro

components frontend javascript mvc virtual-dom web

Last synced: 8 days ago
JSON representation

Keeping the Web as Lean as a Leek

Awesome Lists containing this project

README

          





mit
dependnecies
build
npm

# Puerro

Knowledge acquisition about how to build modern frontend web applications as simple as possible by researching different approaches.

## Getting Started

It can be used as a [knowledge base](docs) ([GitBook](https://robin-christen.gitbook.io/puerro/)) or in combination with the provided [abstractions](src).

Also checkout our [examples](examples) or the [research showcase project](huerto).

### Install

Directly copy the desired [abstractions](src) in your project or use NPM to install Puerro fully:

```bash
npm install puerro
```

### Example Usage

```js
import { Observable } from 'puerro'; // bundler specific, or wherever source is located

const Model = ({ text = '' } = {}) => ({ text: Observable(text) });

const View = (model, controller, $input, $output) => {
const render = () => ($output.textContent = model.text.get().length);

// View-Binding
$input.addEventListener('input', event => controller.setName(event.target.value));

// Model-Binding
model.text.onChange(render);
};

const Controller = model => {
const setName = text => model.text.set(text);
return { setName };
};

// Usage
const model = Model();
const controller = Controller(model);
const view = View(model, controller,
document.querySelector('input'),
document.querySelector('output')
);
```

## Developing

To install and work on Puerro locally:

```bash
git clone git@github.com:robleroni/Puerro.git Puerro
cd Puerro
npm install # install the dev dependency 'rollup'
npm start # bundle the scripts and watch for changes
```

## Testing

The test results can be viewed [live](https://robleroni.github.io/Puerro/test/AllTests.html)!

To run and display the tests locally:
```bash
npm test
```