# What is Declarativas?

### tl;dr

[Declarativas](https://github.com/mrozbarry/declarativas) is a zero-dependency javascript library for declarative HTML 5 canvas **context2d** drawing. If you are familiar with how React renders to the DOM, [declarativas](https://github.com/mrozbarry/declarativas) aims to be that for HTML canvas applications.

## Project Goals

#### Provide all context2d properties and draw operations from the canvas API

The [context2d API](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D) has a thorough set of properties and draw functions to make it easy to just draw something on a web page. Wrapping these properties and operations in components gives users familiar with declarative web applications, like [Hyperapp](https://github.com/jorgebucaran/hyperapp), [React](https://reactjs.com), and [Vue](https://vuejs.org/).

#### Components should be easy to build

With a basic set of property and draw operation components, declarativas provides a set of building blocks that can be constructed together to build fantastic looking and functioning components. Components are just functions that return other components, just like in your favourite declarative front-end framework.

#### Make a higher-level API to avoid common pitfalls

One thing that can be hard to track down when using the canvas is the canvas state. It's easy to apply a transform, but forget to reset it for your next render, providing hours or days of canvas debugging. Using some higher level, built-in components, you can easily ensure that the state of the canvas does not bleed into your next render (unless you want it to!).

## What declarativas is not

While declarativas is functional and declarative, it is not **reactive**. All this means is that batteries are not included for state management. While this can seem like an important feature, what this does is make it incredibly easy to integrate into your favourite front-end framework, which probably already includes state management. If you want state management without a separate framework, you could check out [ferp](https://github.com/ferp-js/ferp), a state management library that works similar to [Hyperapp](https://github.com/jorgebucaran/hyperapp) and [Elm](https://elm-lang.org/)'s state management.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://declarativas.mrbarry.com/master.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
